Пример #1
0
        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);
        }
Пример #2
0
        private void listResultTest()
        {
            initAGCStorageManagement();
            StorageReference reference = mAGCStorageManagement.getStorageReference();

            Task       listTask   = reference.listAll();
            ListResult listResult = HmsUtil.GetHmsBase <ListResult>(Tasks.await(listTask));

            List fileList = listResult.getFileList();

            if (fileList == null)
            {
                Debug.Log("listResultTest fail: fileList is null");
                return;
            }

            List dirList = listResult.getDirList();

            if (dirList == null)
            {
                Debug.Log("listResultTest fail: dirList is null");
                return;
            }

            string pageMaker = listResult.getPageMarker();

            Debug.Log("listResultTest success. pageMaker: " + pageMaker);
        }
Пример #3
0
        private void deleteFileTest()
        {
            initAGCStorageManagement();
            StorageReference reference = mAGCStorageManagement.getStorageReference("addOnCompleteListenerTest.data");

            reference.delete();
            Debug.Log("DeleteFileTest success.");
        }
        public void uploadFile(string path)
        {
            Debug.Log("upload file start.");

            File file = new File(path);

            if (!System.IO.File.Exists(path))
            {
                Debug.Log("upload file does not exists: " + path);
                return;
            }

            StorageReference storageReference = mAGCStorageManagement.getStorageReference(path);
            UploadTask       task             = storageReference.putFile(file);

            task.addOnFailureListener(new MyFailureListener()).addOnSuccessListener(new MySuccessListener());

            Debug.Log("upload file end.");
        }
Пример #5
0
        public void addOnCanceledListenerTest()
        {
            Debug.Log("UploadTask addOnCanceledListenerTest");

            byte[] data     = new byte[100000];
            string filename = "addOnCanceledListenerTest.data";

            StorageReference storageReference = mAGCStorageManagement.getStorageReference(filename);
            UploadTask       task             = storageReference.putBytes(data, new FileMetadata());


            Debug.Log("add addOnCanceledListener");
            //task.addOnCanceledListener(new MyOnCanceledListener("MyOnCanceledListener"));

            MyOnCanceledListener actitvity_listener = new MyOnCanceledListener("ActivityListener");

            task.addOnCanceledListener(new Activity(), actitvity_listener);

            MyOnCanceledListener executor_listener = new MyOnCanceledListener("ExecutorListener");

            task.addOnCanceledListener(new MyExecutor("ExecutorListener"), executor_listener);

            MyOnCanceledListener listener = new MyOnCanceledListener("NormalListener");

            task.addOnCanceledListener(listener);

            Debug.Log("remove addOnCanceledListener");
            MyOnCanceledListener remove = new MyOnCanceledListener("remove");

            task.addOnCanceledListener(new Activity(), remove);
            task.removeOnCanceledListener(remove);

            // UnityEngine.Debug.Log("cancel");
            Debug.Log("task.isCanceled status: " + task.isCanceled());
            if (!task.isCanceled())
            {
                task.pause();
                task.cancel();
            }

            Debug.Log("after cancel: task.isCanceled status: " + task.isCanceled());

            Debug.Log("UploadTask addOnCanceledListenerTest success");
        }
        private void streamDownloadTest()
        {
            initAGCStorageManagement();
            StorageReference   reference  = mAGCStorageManagement.getStorageReference(storageFileName);
            StreamDownloadTask streamTask = reference.getStream();

            if (streamTask == null)
            {
                Debug.Log("downloadStream is null");
            }

            MyStreamHandler    myStreamHandler       = new MyStreamHandler();
            StreamDownloadTask streamTaskWithHandler = reference.getStream(myStreamHandler);

            if (streamTaskWithHandler == null)
            {
                Debug.Log("streamTaskWithHandler is null");
            }

            Debug.Log("streamDownloadTest success");
        }