public void getStorageReferenceTest() { string result = "success"; mAGCStorageManagement = AGCStorageManagement.getInstance(); StorageReference sr = mAGCStorageManagement.getStorageReference(); if (sr == null) { Debug.Log("mAGCStorageManagement.getStorageReference is null."); result = "fail"; } sr = mAGCStorageManagement.getStorageReference("addOnSuccessListenerTest.data"); if (sr == null) { Debug.Log("mAGCStorageManagement.getStorageReference with argument is null."); result = "fail"; } sr = mAGCStorageManagement.getReferenceFromUrl( "https://ops-dre.agcstorage.link/v0/unity-cloud-test-6ujit/addOnCompleteListenerTest.data?token=62ae812b-1128-47cb-b4fd-54e5a94a8286"); if (sr == null) { Debug.Log("mAGCStorageManagement.getReferenceFromUrl is null."); result = "fail"; } Debug.Log("AGCStorageManagementTest getStorageReferenceTest " + result); }
public void retryTimesTest() { string result = "success"; mAGCStorageManagement = AGCStorageManagement.getInstance(); mAGCStorageManagement.setRetryTimes(4); int retryTimes = mAGCStorageManagement.getRetryTimes(); Debug.Log("AGCStorageManagementTest retryTimesTest " + result + ", retryTimes: " + retryTimes); }
public void timeOutTest() { string result = "success"; mAGCStorageManagement = AGCStorageManagement.getInstance(); mAGCStorageManagement.setMaxDownloadTimeout(11); mAGCStorageManagement.setMaxRequestTimeout(2); mAGCStorageManagement.setMaxUploadTimeout(3); long maxUploadTime = mAGCStorageManagement.getMaxUploadTimeout(); long maxDownloadTimeout = mAGCStorageManagement.getMaxDownloadTimeout(); long maxRequestTimeout = mAGCStorageManagement.getMaxRequestTimeout(); Debug.Log("AGCStorageManagementTest getStorageReferenceTest " + result + ", maxUploadTime: " + maxUploadTime + ", maxDownloadTimeout: " + maxDownloadTimeout + ", maxRequestTimeout: " + maxRequestTimeout); Debug.Log("AGCStorageManagementTest getStorageReferenceTest " + result); }
public void getInstanceTest() { string result = "success"; mAGCStorageManagement = AGCStorageManagement.getInstance(); if (mAGCStorageManagement == null) { Debug.Log("AGCStorageManagement.getInstance() is null"); result = "fail"; } mAGCStorageManagement = AGCStorageManagement.getInstance("https://ops-dre.agcstorage.link"); if (mAGCStorageManagement == null) { Debug.Log("AGCStorageManagement.getInstance(string arg0) is null"); result = "fail"; } MyConnnectionFactroty httpFac = new MyConnnectionFactroty(); mAGCStorageManagement = AGCStorageManagement.getInstance(httpFac); if (mAGCStorageManagement == null) { Debug.Log("AGCStorageManagement.getInstance(HttpURLConnectionFactory arg0) is null"); result = "fail"; } mAGCStorageManagement = AGCStorageManagement.getInstance("https://ops-dre.agcstorage.link", httpFac); if (mAGCStorageManagement == null) { Debug.Log("AGCStorageManagement.getInstance(string arg0, HttpURLConnectionFactory arg1) is null"); result = "fail"; } Debug.Log("AGCStorageManagementTest getInstanceTest " + result); }
private void initAGCStorageManagement() { mAGCStorageManagement = AGCStorageManagement.getInstance(); }
private void storageReferenceTest() { initAGCStorageManagement(); StorageReference reference = mAGCStorageManagement.getStorageReference("storageReferenceTest.data"); AGCStorageManagement storage = reference.getStorage(); if (storage == null) { Debug.Log("storageReferenceTest fail: storage is null"); return; } StorageReference child = reference.child("/"); if (child == null) { Debug.Log("storageReferenceTest fail: child is null"); return; } StorageReference parent = reference.getParent(); if (parent == null) { Debug.Log("storageReferenceTest fail: parent is null"); return; } StorageReference root = reference.getRoot(); if (root == null) { Debug.Log("storageReferenceTest fail: root is null"); return; } Task updateTask = reference.updateFileMetadata(new FileMetadata()); if (updateTask == null) { Debug.Log("storageReferenceTest fail: updateTask is null"); return; } Task task = reference.getFileMetadata(); if (task == null) { Debug.Log("storageReferenceTest fail: task is null"); return; } Task listTask = reference.list(1); if (listTask == null) { Debug.Log("storageReferenceTest fail: listTask is null"); return; } Task listTaskSec = reference.list(1, "1"); if (listTaskSec == null) { Debug.Log("storageReferenceTest fail: listTaskSec is null"); return; } Task listAll = reference.listAll(); if (listAll == null) { Debug.Log("storageReferenceTest fail: listAll is null"); return; } StreamDownloadTask stream = reference.getStream(); if (stream == null) { Debug.Log("storageReferenceTest fail: stream is null"); return; } StreamDownloadTask streamSecond = reference.getStream(new MyStreamHandler()); if (streamSecond == null) { Debug.Log("storageReferenceTest fail: streamSecond is null"); return; } Task getByteTask = reference.getBytes(10); if (getByteTask == null) { Debug.Log("storageReferenceTest fail: getByteTask is null"); return; } Task downloadUrl = reference.getDownloadUrl(); if (downloadUrl == null) { Debug.Log("storageReferenceTest fail: downloadUrl is null"); return; } List activeUploadList = reference.getActiveUploadTasks(); if (activeUploadList == null) { Debug.Log("storageReferenceTest fail: activeUploadList is null"); return; } List activeDownloadList = reference.getActiveDownloadTasks(); if (activeDownloadList == null) { Debug.Log("storageReferenceTest fail: activeDownloadList is null"); return; } StorageReference ref_1 = mAGCStorageManagement.getStorageReference("putFileTest_1.data"); UploadTask uploadFirst = ref_1.putFile(new File("empty_first")); Debug.Log("putFileTest_1 success"); StorageReference ref_2 = mAGCStorageManagement.getStorageReference("putFileTest_2.data"); UploadTask uploadSecond = ref_2.putFile(new File("empty_second"), new FileMetadata(), new Long(0)); Debug.Log("putFileTest_2 success"); StorageReference ref_3 = mAGCStorageManagement.getStorageReference("putFileTest_3.data"); UploadTask uploadThird = ref_3.putFile(new File("empty_third"), new FileMetadata()); Debug.Log("putFileTest_3 success"); StorageReference ref_4 = mAGCStorageManagement.getStorageReference("putFileTest_4.data"); FileMetadata metadata = new FileMetadata(); metadata.setSHA256Hash("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"); UploadTask byteFirst = ref_4.putBytes(new byte[100], metadata, new Long(0)); Debug.Log("putFileTest_4 success"); DownloadTask downloadFirst = reference.getFile(new File("download_first.data")); Debug.Log("download_first success"); Uri myUri = Uri.parse("content://downloads/public_downloads"); if (myUri == null) { Debug.Log("Uri parse fail"); } else { Debug.Log("Uri parse success"); DownloadTask downloadSecond = reference.getFile(myUri); } string bucket = reference.getBucket(); string name = reference.getName(); string path = reference.getPath(); int compareTo = reference.compareTo(ref_3); string toString = reference.toString(); Long myObject = new Long(10); bool equal = reference.equals(myObject.obj); int hashcode = reference.hashCode(); Task deleteTask = reference.delete(); if (deleteTask == null) { Debug.Log("storageReferenceTest fail: deleteTask is null"); return; } Debug.Log("storageReferenceTest success. bucket: " + bucket + ", name: " + name + ", path: " + path + ", compareTo: " + compareTo + ", toString: " + toString + ", equal: " + equal + ", hashcode: " + hashcode); }