@@ -11,23 +11,30 @@ namespace Qiniu.Storage.Tests
11
11
[ TestFixture ]
12
12
public class OperationManagerTests : TestEnv
13
13
{
14
+ private OperationManager getOperationManager ( )
15
+ {
16
+ Mac mac = new Mac ( AccessKey , SecretKey ) ;
17
+ Config config = new Config ( ) ;
18
+ // config.UseHttps = true;
19
+
20
+ OperationManager manager = new OperationManager ( mac , config ) ;
21
+ return manager ;
22
+ }
14
23
15
24
[ Test ]
16
- public void PfopTest ( )
25
+ public void PfopAndPrefopTest ( )
17
26
{
27
+ string key = "qiniu.mp4" ;
28
+ bool force = true ;
29
+ string pipeline = "sdktest" ;
30
+ string notifyUrl = "http://api.example.com/qiniu/pfop/notify" ;
18
31
string saveMp4Entry = Base64 . UrlSafeBase64Encode ( Bucket + ":avthumb_test_target.mp4" ) ;
19
32
string saveJpgEntry = Base64 . UrlSafeBase64Encode ( Bucket + ":vframe_test_target.jpg" ) ;
20
33
string avthumbMp4Fop = "avthumb/mp4|saveas/" + saveMp4Entry ;
21
34
string vframeJpgFop = "vframe/jpg/offset/1|saveas/" + saveJpgEntry ;
22
35
string fops = string . Join ( ";" , new string [ ] { avthumbMp4Fop , vframeJpgFop } ) ;
23
- Mac mac = new Mac ( AccessKey , SecretKey ) ;
24
- Config config = new Config ( ) ;
25
- config . UseHttps = true ;
26
- OperationManager manager = new OperationManager ( mac , config ) ;
27
- string pipeline = "sdktest" ;
28
- string notifyUrl = "http://api.example.com/qiniu/pfop/notify" ;
29
- string key = "qiniu.mp4" ;
30
- bool force = true ;
36
+
37
+ OperationManager manager = getOperationManager ( ) ;
31
38
PfopResult pfopRet = manager . Pfop ( Bucket , key , fops , pipeline , notifyUrl , force ) ;
32
39
if ( pfopRet . Code != ( int ) HttpCode . OK )
33
40
{
@@ -42,5 +49,32 @@ public void PfopTest()
42
49
}
43
50
Console . WriteLine ( ret . ToString ( ) ) ;
44
51
}
52
+
53
+ [ Test ]
54
+ public void PfopWithIdleTimeTest ( )
55
+ {
56
+ string key = "qiniu.mp4" ;
57
+ bool force = true ;
58
+ int type = 1 ;
59
+ string pipeline = null ;
60
+ string saveJpgEntry = Base64 . UrlSafeBase64Encode ( Bucket + ":vframe_test_target.jpg" ) ;
61
+ string vframeJpgFop = "vframe/jpg/offset/1|saveas/" + saveJpgEntry ;
62
+
63
+ OperationManager manager = getOperationManager ( ) ;
64
+ PfopResult pfopRet = manager . Pfop ( Bucket , key , vframeJpgFop , pipeline , null , force , type ) ;
65
+ if ( pfopRet . Code != ( int ) HttpCode . OK )
66
+ {
67
+ Assert . Fail ( "pfop error: " + pfopRet . ToString ( ) ) ;
68
+ }
69
+
70
+ PrefopResult prefopRet = manager . Prefop ( pfopRet . PersistentId ) ;
71
+ if ( prefopRet . Code != ( int ) HttpCode . OK )
72
+ {
73
+ Assert . Fail ( "prefop error: " + prefopRet . ToString ( ) ) ;
74
+ }
75
+ Assert . AreEqual ( 1 , prefopRet . Result . Type ) ;
76
+ Assert . IsNotNull ( prefopRet . Result . CreationDate ) ;
77
+ Assert . IsNotEmpty ( prefopRet . Result . CreationDate ) ;
78
+ }
45
79
}
46
80
}
0 commit comments