@Before public void fileShareTestMethodSetUp() throws StorageException, URISyntaxException { this.share = FileTestHelper.getRandomShareReference(); }
@Before public void fileTestMethodSetUp() throws URISyntaxException, StorageException { this.share = FileTestHelper.getRandomShareReference(); this.share.create(); }
@Before public void cloudFileDirectorySetUp() throws URISyntaxException, StorageException { this.share = FileTestHelper.getRandomShareReference(); this.share.create(); }
@Before public void fileSASTestMethodSetUp() throws URISyntaxException, StorageException, IOException { if (fileClient == null) { fileClient = TestHelper.createCloudFileClient(); } this.share = FileTestHelper.getRandomShareReference(); this.share.create(); this.file = (CloudFile) FileTestHelper.uploadNewFile(this.share, 100, null); }
@Test @Category({ SlowTests.class }) public void testShareSASCombinations() throws StorageException, URISyntaxException, IOException, InvalidKeyException, InterruptedException { EnumSet<SharedAccessFilePermissions> permissionSet = null; Map<Integer, CloudFileShare> shares = new HashMap<Integer, CloudFileShare>(); try { for (int bits = 0x1; bits < 0x40; bits++) { shares.put(bits, FileTestHelper.getRandomShareReference()); shares.get(bits).createIfNotExists(); permissionSet = getPermissions(bits); FileSharePermissions perms = new FileSharePermissions(); perms.getSharedAccessPolicies().put("readwrite" + bits, createSharedAccessPolicy(permissionSet, 300)); shares.get(bits).uploadPermissions(perms); } Thread.sleep(30000); for (int bits = 0x1; bits < 0x20; bits++) { permissionSet = getPermissions(bits); String sasToken = shares.get(bits).generateSharedAccessSignature(null, "readwrite" + bits); CloudFile testFile = FileTestHelper.uploadNewFile(shares.get(bits), 64, null); testAccess(sasToken, permissionSet, shares.get(bits), testFile); } } finally { for (int bits = 0x1; bits < shares.size(); bits++) { shares.get(bits).deleteIfExists(); } } }
@Test @Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) public void testFileProtocolAccountSas() throws InvalidKeyException, StorageException, URISyntaxException, IOException { // Ensure attempt from http fails against HTTPS_ONLY try { testFileAccountSas(this.fileShare, false, generatePolicy( AccountSasTests.FULL_PERMS_CODE, SharedAccessAccountService.FILE, null, SharedAccessProtocols.HTTPS_ONLY)); fail(); } catch (IllegalArgumentException ex) { assertEquals(SR.CANNOT_TRANSFORM_NON_HTTPS_URI_WITH_HTTPS_ONLY_CREDENTIALS, ex.getMessage()); } finally { this.fileShare.deleteIfExists(); } // Ensure attempt from https succeeds against HTTPS_ONLY this.fileShare = FileTestHelper.getRandomShareReference(); testFileAccountSas(this.fileShare, true, generatePolicy( AccountSasTests.FULL_PERMS_CODE, SharedAccessAccountService.FILE, null, SharedAccessProtocols.HTTPS_ONLY)); // Ensure attempts from both https and http succeed against HTTPS_HTTP this.fileShare = FileTestHelper.getRandomShareReference(); testFileAccountSas(this.fileShare, true, generatePolicy( AccountSasTests.FULL_PERMS_CODE, SharedAccessAccountService.FILE, null, SharedAccessProtocols.HTTPS_HTTP)); this.fileShare = FileTestHelper.getRandomShareReference(); testFileAccountSas(this.fileShare, false, generatePolicy( AccountSasTests.FULL_PERMS_CODE, SharedAccessAccountService.FILE, null, SharedAccessProtocols.HTTPS_HTTP)); }
@Before public void accountSasTestMethodSetUp() throws URISyntaxException, StorageException, IOException { this.blobClient = TestHelper.createCloudBlobClient(); this.blobContainer = BlobTestHelper.getRandomContainerReference(); this.fileClient = TestHelper.createCloudFileClient(); this.fileShare = FileTestHelper.getRandomShareReference(); this.queueClient = TestHelper.createCloudQueueClient(); this.queueQueue = QueueTestHelper.getRandomQueueReference(); this.tableClient = TestHelper.createCloudTableClient(); this.tableTable = TableTestHelper.getRandomTableReference(); }
@Before public void fileEncryptionTestMethodSetup() throws URISyntaxException, StorageException, IOException { this.share = FileTestHelper.getRandomShareReference(); this.share.create(); this.dir = this.share.getRootDirectoryReference().getDirectoryReference("dir"); this.dir.create(); this.file = this.share.getRootDirectoryReference().getFileReference("file"); this.file.uploadText("text"); }
this.fileShare = FileTestHelper.getRandomShareReference(); testFileAccountSas(this.fileShare, false, generatePolicy(AccountSasTests.FULL_PERMS_CODE, SharedAccessAccountService.FILE, sourceIP, null)); this.fileShare = FileTestHelper.getRandomShareReference(); testFileAccountSas(this.fileShare, false, generatePolicy(AccountSasTests.FULL_PERMS_CODE, SharedAccessAccountService.FILE, allIP, null));
throws StorageException, URISyntaxException, IOException, InvalidKeyException, InterruptedException { final int length = 128; final CloudFileShare share = FileTestHelper.getRandomShareReference(); share.create(); final CloudFile source = FileTestHelper.uploadNewFile(share, length, null);
String data = "String data"; final CloudFileShare share = FileTestHelper.getRandomShareReference(); try { share.create();
this.share = FileTestHelper.getRandomShareReference(); this.share.getProperties().setShareQuota(shareQuota); this.share.create();
throws InvalidKeyException, URISyntaxException, StorageException, IOException, InterruptedException { final CloudFileShare share = FileTestHelper.getRandomShareReference(); try { share.create();