Refine search
/** * Tests the {@link AlluxioURI#AlluxioURI(String)} constructor to throw an exception in case an * invalid URI was provided. */ @Test(expected = IllegalArgumentException.class) public void invalidURISyntax() { new AlluxioURI("://localhost:8080/a"); }
/** * Tests the {@link AlluxioURI#AlluxioURI(String, Authority, String)} constructor to throw an * exception in case an empty path was provided. */ @Test(expected = IllegalArgumentException.class) public void constructFromEmptyPathTest2() { new AlluxioURI(null, null, null); }
/** * Tests the {@link AlluxioURI#AlluxioURI(String, Authority, String)} constructor to throw an * exception in case an empty path was provided. */ @Test(expected = IllegalArgumentException.class) public void constructFromEmptyPathTest3() { new AlluxioURI("file", null, ""); }
/** * Tests that the worker will delete the source directory if the directory contains nothing. */ @Test public void deleteEmptySourceDir() throws Exception { when(mMockFileSystem.listStatus(new AlluxioURI(TEST_DIR))) .thenReturn(Lists.<URIStatus>newArrayList()); runTask(TEST_DIR, TEST_SOURCE, TEST_DESTINATION, WriteType.THROUGH); verify(mMockFileSystem).delete(eq(new AlluxioURI(TEST_DIR)), any(DeletePOptions.class)); }
/** * Tests load root metadata. It should not fail. */ @Test public void loadRoot() throws Exception { mFileSystemMaster.loadMetadata(new AlluxioURI("alluxio:/"), LoadMetadataContext.defaults()); }
/** * Tests unmount operation failed when unmounting non-existing dir. */ @Test public void unmountNonExistingPathWithException() throws Exception { mThrown.expect(FileDoesNotExistException.class); mFileSystemMaster.unmount(new AlluxioURI("/FileNotExists")); }
/** * Tests unmount operation failed when unmounting root. */ @Test public void unmountRootWithException() throws Exception { mThrown.expect(InvalidPathException.class); mFileSystemMaster.unmount(new AlluxioURI("/")); }
/** * Tests that the worker will not delete the source directory if the directory still contains * files. */ @Test public void dontDeleteNonEmptySourceTest() throws Exception { when(mMockFileSystem.listStatus(new AlluxioURI(TEST_DIR))) .thenReturn(Lists.newArrayList(new URIStatus(new FileInfo()))); runTask(TEST_DIR, TEST_SOURCE, TEST_DESTINATION, WriteType.THROUGH); verify(mMockFileSystem, times(0)).delete(eq(new AlluxioURI(TEST_DIR)), any(DeletePOptions.class)); }
/** * Tests the {@link AlluxioURI#hasScheme()} method. */ @Test public void hasScheme() { assertFalse(new AlluxioURI("/").hasScheme()); assertTrue(new AlluxioURI("file:/").hasScheme()); assertTrue(new AlluxioURI("file://localhost/").hasScheme()); assertTrue(new AlluxioURI("file://localhost:8080/").hasScheme()); assertFalse(new AlluxioURI("//localhost:8080/").hasScheme()); }
/** * Tests the {@link AlluxioURI#isAbsolute()} method. */ @Test public void isAbsoluteTests() { assertTrue(new AlluxioURI("file:/a").isAbsolute()); assertTrue(new AlluxioURI("file://localhost/a").isAbsolute()); assertFalse(new AlluxioURI("//localhost/a").isAbsolute()); assertFalse(new AlluxioURI("//localhost/").isAbsolute()); assertFalse(new AlluxioURI("/").isAbsolute()); }
@Test public void createCompleteCheck() { List<AlluxioURI> uris = ImmutableList.of(new AlluxioURI("/"), new AlluxioURI("/dir")); StartupConsistencyCheck check = StartupConsistencyCheck.complete(uris); assertEquals(Status.COMPLETE, check.getStatus()); assertEquals(uris, check.getInconsistentUris()); }
/** * Tests for the {@link BaseFileSystem#setAttribute(AlluxioURI, SetAttributePOptions)} method. */ @Test public void setAttribute() throws Exception { AlluxioURI file = new AlluxioURI("/file"); SetAttributePOptions setAttributeOptions = SetAttributePOptions.getDefaultInstance(); mFileSystem.setAttribute(file, setAttributeOptions); verify(mFileSystemMasterClient).setAttribute(file, setAttributeOptions); }
/** * Tests for the {@link BaseFileSystem#unmount(AlluxioURI, UnmountPOptions)} method. */ @Test public void unmount() throws Exception { AlluxioURI path = new AlluxioURI("/"); UnmountPOptions unmountOptions = UnmountPOptions.getDefaultInstance(); doNothing().when(mFileSystemMasterClient).unmount(path); mFileSystem.unmount(path, unmountOptions); verify(mFileSystemMasterClient).unmount(path); }
/** * Tests the {@link AlluxioURI#toString()} method to normalize Windows paths. */ @Test public void normalizeWindowsTests() { assumeTrue(WINDOWS); assertEquals("c:/a/b", new AlluxioURI("c:\\a\\b").toString()); assertEquals("c:/a/c", new AlluxioURI("c:\\a\\b\\..\\c").toString()); }
@Test public void moveEmptyDirectory() throws Exception { createDirectory("/src"); createDirectory("/dst"); setPathToNotExist("/dst/src"); assignMoves("/src", "/dst/src"); verify(mMockFileSystem).createDirectory(eq(new AlluxioURI("/dst/src")), any(CreateDirectoryPOptions.class)); }
/** * Tests the {@link FileSystemMaster#mount(AlluxioURI, AlluxioURI, MountContext)} method. */ @Test public void mount() throws Exception { AlluxioURI alluxioURI = new AlluxioURI("/hello"); AlluxioURI ufsURI = createTempUfsDir("ufs/hello"); mFileSystemMaster.mount(alluxioURI, ufsURI, MountContext.defaults()); }
/** * Tests that an exception is thrown when trying to create the root path twice. */ @Test public void createRootPath() throws Exception { mThrown.expect(FileAlreadyExistsException.class); mThrown.expectMessage("/"); createPath(mTree, new AlluxioURI("/"), sFileContext); }
@Test public void invalidPath() throws Exception { mThrown.expect(InvalidPathException.class); try (LockedInodePath inodePath = sTree .lockInodePath(new AlluxioURI(""), LockPattern.READ)) { mPermissionChecker.checkPermission(Mode.Bits.WRITE, inodePath); } }
/** * Tests that the bytes of the file to move are written to the destination stream. */ @Test public void basicMoveTest() throws Exception { runTask(TEST_SOURCE, TEST_SOURCE, TEST_DESTINATION, WriteType.THROUGH); Assert.assertArrayEquals(TEST_SOURCE_CONTENTS, mMockOutStream.toByteArray()); verify(mMockFileSystem).delete(new AlluxioURI(TEST_SOURCE)); }
@Test public void deleteRecursiveClearsInnerInodesAndEdges() throws Exception { createFileWithSingleBlock(new AlluxioURI("/a/b/c/d/e")); createFileWithSingleBlock(new AlluxioURI("/a/b/x/y/z")); mFileSystemMaster.delete(new AlluxioURI("/a/b"), DeleteContext.defaults(DeletePOptions.newBuilder().setRecursive(true))); assertEquals(1, mInodeStore.allEdges().size()); assertEquals(2, mInodeStore.allInodes().size()); }