|
|
|
@ -28,10 +28,12 @@ public class UrlResolverTest {
|
|
|
|
|
private String remotePath="/test/img4/CostaRicaine.jpg";
|
|
|
|
|
private String absoluteLocalPath;
|
|
|
|
|
private String newFilePath="src/test/resources";
|
|
|
|
|
private String id=null;
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
|
public void init() throws RemoteBackendException{
|
|
|
|
|
ScopeProvider.instance.set(Costants.DEFAULT_SCOPE_STRING);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
client = new StorageClient(serviceClass, serviceName, owner , AccessType.SHARED, Costants.DEFAULT_MEMORY_TYPE).getClient();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -39,7 +41,7 @@ public class UrlResolverTest {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
setLocalResources();
|
|
|
|
|
String id=client.put(true).LFile(absoluteLocalPath).RFile(remotePath);
|
|
|
|
|
id=client.put(false).LFile(absoluteLocalPath).RFile(remotePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -55,12 +57,26 @@ public class UrlResolverTest {
|
|
|
|
|
System.out.println("HttpUrl generated: "+url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @After
|
|
|
|
|
// public void removeRemoteFile() throws RemoteBackendException{
|
|
|
|
|
// String id=client.remove().RFile(remotePath);
|
|
|
|
|
// List<StorageObject> list=client.showDir().RDir("test/img4");
|
|
|
|
|
// assertTrue(list.isEmpty());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testSerialStorage(){
|
|
|
|
|
long start=System.currentTimeMillis();
|
|
|
|
|
int n=100;
|
|
|
|
|
for(int i = 0; i<n;i++){
|
|
|
|
|
System.out.println("retrieve "+(i+1)+" url");
|
|
|
|
|
//get ID
|
|
|
|
|
System.out.println(client.getHttpsUrl().RFile(id));
|
|
|
|
|
}
|
|
|
|
|
long time=System.currentTimeMillis() - start;
|
|
|
|
|
System.out.println("test serial storage. Total time on "+n+" objects: "+time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@After
|
|
|
|
|
public void removeRemoteFile() throws RemoteBackendException{
|
|
|
|
|
String id=client.remove().RFile(remotePath);
|
|
|
|
|
List<StorageObject> list=client.showDir().RDir("test/img4");
|
|
|
|
|
assertTrue(list.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setLocalResources() {
|
|
|
|
|