@@ -26,22 +26,21 @@ public class BatchMoveTest extends TestCase {
2626 public final String expectedHash = "FmDZwqadA4-ib_15hYfQpb7UXUYR" ;
2727
2828 public String bucketName ;
29- public final String key1 = "BatchMoveTest-key1" ;
30- public final String key2 = "BatchMoveTest-key2" ;
31-
32- public final String srcBucket = "junit_bucket_src" ;
33- public final String destBucket = "junit_bucket_dest" ;
29+ public final String key1 = "java- BatchMoveTest-key1" ;
30+ public final String key2 = "java- BatchMoveTest-key2" ;
31+
32+ public final String srcBucket = System . getenv ( "QINIU_TEST_SRC_BUCKET" ) ;
33+ public final String destBucket = System . getenv ( "QINIU_TEST_BUCKET" ) ;
3434
3535 public Mac mac ;
36-
36+
3737 @ Override
3838 public void setUp () throws Exception {
3939 // get the config
4040 {
4141 Config .ACCESS_KEY = System .getenv ("QINIU_ACCESS_KEY" );
4242 Config .SECRET_KEY = System .getenv ("QINIU_SECRET_KEY" );
4343 Config .RS_HOST = System .getenv ("QINIU_RS_HOST" );
44- bucketName = System .getenv ("QINIU_TEST_BUCKET" );
4544 mac = new Mac (Config .ACCESS_KEY , Config .SECRET_KEY );
4645 }
4746
@@ -50,7 +49,6 @@ public void setUp() throws Exception {
5049 assertNotNull (Config .ACCESS_KEY );
5150 assertNotNull (Config .SECRET_KEY );
5251 assertNotNull (Config .RS_HOST );
53- assertNotNull (bucketName );
5452 }
5553
5654 // upload a file to the bucket with key1, key2
@@ -107,41 +105,41 @@ public void testBatchMove() throws Exception {
107105 {
108106 RSClient rs = new RSClient (mac );
109107 List <EntryPathPair > entries = new ArrayList <EntryPathPair >();
110-
108+
111109 EntryPathPair pair1 = new EntryPathPair ();
112-
110+
113111 EntryPath src = new EntryPath ();
114112 src .bucket = srcBucket ;
115113 src .key = key1 ;
116-
114+
117115 EntryPath dest = new EntryPath ();
118116 dest .bucket = destBucket ;
119117 dest .key = key1 ;
120-
118+
121119 pair1 .src = src ;
122120 pair1 .dest = dest ;
123-
121+
124122 EntryPathPair pair2 = new EntryPathPair ();
125-
123+
126124 EntryPath src2 = new EntryPath ();
127125 src2 .bucket = srcBucket ;
128126 src2 .key = key2 ;
129-
127+
130128 EntryPath dest2 = new EntryPath ();
131129 dest2 .bucket = destBucket ;
132130 dest2 .key = key2 ;
133-
131+
134132 pair2 .src = src2 ;
135133 pair2 .dest = dest2 ;
136-
134+
137135 entries .add (pair1 );
138136 entries .add (pair2 );
139-
137+
140138 BatchCallRet ret = rs .batchMove (entries );
141-
139+
142140 // check batchMove
143141 assertTrue (ret .ok ());
144-
142+
145143 List <CallRet > results = ret .results ;
146144 for (CallRet r : results ) {
147145 assertTrue (r .ok ());
@@ -150,41 +148,41 @@ public void testBatchMove() throws Exception {
150148 // the src keys should not be available in src bucket
151149 {
152150 RSClient rs = new RSClient (mac );
153-
151+
154152 List <EntryPath > entries = new ArrayList <EntryPath >();
155153 EntryPath e1 = new EntryPath ();
156154 e1 .bucket = srcBucket ;
157155 e1 .key = key1 ;
158-
156+
159157 EntryPath e2 = new EntryPath ();
160158 e2 .bucket = srcBucket ;
161159 e2 .key = key2 ;
162-
160+
163161 entries .add (e1 );
164162 entries .add (e2 );
165-
163+
166164 BatchStatRet ret = rs .batchStat (entries );
167165 assertTrue (!ret .ok ());
168166 }
169167 // the dest bucket should have the keys
170168 {
171169 RSClient rs = new RSClient (mac );
172-
170+
173171 List <EntryPath > entries = new ArrayList <EntryPath >();
174172 EntryPath e1 = new EntryPath ();
175173 e1 .bucket = destBucket ;
176174 e1 .key = key1 ;
177-
175+
178176 EntryPath e2 = new EntryPath ();
179177 e2 .bucket = destBucket ;
180178 e2 .key = key2 ;
181-
179+
182180 entries .add (e1 );
183181 entries .add (e2 );
184-
182+
185183 BatchStatRet ret = rs .batchStat (entries );
186184 assertTrue (ret .ok ());
187-
185+
188186 List <Entry > results = ret .results ;
189187 for (Entry r : results ) {
190188 assertTrue (r .ok ());
@@ -221,7 +219,7 @@ public void tearDown() {
221219
222220 // use batchstat checks it again.
223221 {
224-
222+
225223 RSClient rs = new RSClient (mac );
226224 List <EntryPath > entries = new ArrayList <EntryPath >();
227225
0 commit comments