target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testWrappedReadForCompressedData() throws IOException { byte[] buf = new byte[2]; InputStream mockStream = Mockito.mock(InputStream.class); Mockito.when(mockStream.read(buf, 0, 1)).thenReturn(1); Mockito.when(mockStream.read(buf, 0, 2)).thenThrow( new java.lang.InternalError()); try { assertEquals("Ch... | public static int wrappedReadForCompressedData(InputStream is, byte[] buf, int off, int len) throws IOException { try { return is.read(buf, off, len); } catch (IOException ie) { throw ie; } catch (Throwable t) { throw new IOException("Error while reading compressed data", t); } } | IOUtils { public static int wrappedReadForCompressedData(InputStream is, byte[] buf, int off, int len) throws IOException { try { return is.read(buf, off, len); } catch (IOException ie) { throw ie; } catch (Throwable t) { throw new IOException("Error while reading compressed data", t); } } } | IOUtils { public static int wrappedReadForCompressedData(InputStream is, byte[] buf, int off, int len) throws IOException { try { return is.read(buf, off, len); } catch (IOException ie) { throw ie; } catch (Throwable t) { throw new IOException("Error while reading compressed data", t); } } } | IOUtils { public static int wrappedReadForCompressedData(InputStream is, byte[] buf, int off, int len) throws IOException { try { return is.read(buf, off, len); } catch (IOException ie) { throw ie; } catch (Throwable t) { throw new IOException("Error while reading compressed data", t); } } static void copyBytes(InputS... | IOUtils { public static int wrappedReadForCompressedData(InputStream is, byte[] buf, int off, int len) throws IOException { try { return is.read(buf, off, len); } catch (IOException ie) { throw ie; } catch (Throwable t) { throw new IOException("Error while reading compressed data", t); } } static void copyBytes(InputS... |
@Test public void testSkipFully() throws IOException { byte inArray[] = new byte[] {0, 1, 2, 3, 4}; ByteArrayInputStream in = new ByteArrayInputStream(inArray); try { in.mark(inArray.length); IOUtils.skipFully(in, 2); IOUtils.skipFully(in, 2); try { IOUtils.skipFully(in, 2); fail("expected to get a PrematureEOFExceptio... | public static void skipFully(InputStream in, long len) throws IOException { long amt = len; while (amt > 0) { long ret = in.skip(amt); if (ret == 0) { int b = in.read(); if (b == -1) { throw new EOFException( "Premature EOF from inputStream after " + "skipping " + (len - amt) + " byte(s)."); } ret = 1; } amt -= ret; } ... | IOUtils { public static void skipFully(InputStream in, long len) throws IOException { long amt = len; while (amt > 0) { long ret = in.skip(amt); if (ret == 0) { int b = in.read(); if (b == -1) { throw new EOFException( "Premature EOF from inputStream after " + "skipping " + (len - amt) + " byte(s)."); } ret = 1; } amt ... | IOUtils { public static void skipFully(InputStream in, long len) throws IOException { long amt = len; while (amt > 0) { long ret = in.skip(amt); if (ret == 0) { int b = in.read(); if (b == -1) { throw new EOFException( "Premature EOF from inputStream after " + "skipping " + (len - amt) + " byte(s)."); } ret = 1; } amt ... | IOUtils { public static void skipFully(InputStream in, long len) throws IOException { long amt = len; while (amt > 0) { long ret = in.skip(amt); if (ret == 0) { int b = in.read(); if (b == -1) { throw new EOFException( "Premature EOF from inputStream after " + "skipping " + (len - amt) + " byte(s)."); } ret = 1; } amt ... | IOUtils { public static void skipFully(InputStream in, long len) throws IOException { long amt = len; while (amt > 0) { long ret = in.skip(amt); if (ret == 0) { int b = in.read(); if (b == -1) { throw new EOFException( "Premature EOF from inputStream after " + "skipping " + (len - amt) + " byte(s)."); } ret = 1; } amt ... |
@Test public void testReadIncorrectlyRestrictedWithSecurity() throws IOException { assumeTrue(NativeIO.isAvailable()); System.out.println("Running test with native libs..."); try { SecureIOUtils .forceSecureOpenForRead(testFilePath, "invalidUser", null).close(); fail("Didn't throw expection for wrong ownership!"); } ca... | static FileInputStream forceSecureOpenForRead(File f, String expectedOwner, String expectedGroup) throws IOException { FileInputStream fis = new FileInputStream(f); boolean success = false; try { Stat stat = NativeIO.getFstat(fis.getFD()); checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner, expectedGroup); su... | SecureIOUtils { static FileInputStream forceSecureOpenForRead(File f, String expectedOwner, String expectedGroup) throws IOException { FileInputStream fis = new FileInputStream(f); boolean success = false; try { Stat stat = NativeIO.getFstat(fis.getFD()); checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner, ex... | SecureIOUtils { static FileInputStream forceSecureOpenForRead(File f, String expectedOwner, String expectedGroup) throws IOException { FileInputStream fis = new FileInputStream(f); boolean success = false; try { Stat stat = NativeIO.getFstat(fis.getFD()); checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner, ex... | SecureIOUtils { static FileInputStream forceSecureOpenForRead(File f, String expectedOwner, String expectedGroup) throws IOException { FileInputStream fis = new FileInputStream(f); boolean success = false; try { Stat stat = NativeIO.getFstat(fis.getFD()); checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner, ex... | SecureIOUtils { static FileInputStream forceSecureOpenForRead(File f, String expectedOwner, String expectedGroup) throws IOException { FileInputStream fis = new FileInputStream(f); boolean success = false; try { Stat stat = NativeIO.getFstat(fis.getFD()); checkStat(f, stat.getOwner(), stat.getGroup(), expectedOwner, ex... |
@Test public void testVisitStoreFiles() throws IOException { final Set<String> regions = new HashSet<String>(); final Set<String> families = new HashSet<String>(); final Set<String> hfiles = new HashSet<String>(); FSVisitor.visitTableStoreFiles(fs, tableDir, new FSVisitor.StoreFileVisitor() { public void storeFile(fina... | public static void visitTableStoreFiles(final FileSystem fs, final Path tableDir, final StoreFileVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + tableDir); return; } for (FileS... | FSVisitor { public static void visitTableStoreFiles(final FileSystem fs, final Path tableDir, final StoreFileVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + tableDir); return; ... | FSVisitor { public static void visitTableStoreFiles(final FileSystem fs, final Path tableDir, final StoreFileVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + tableDir); return; ... | FSVisitor { public static void visitTableStoreFiles(final FileSystem fs, final Path tableDir, final StoreFileVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + tableDir); return; ... | FSVisitor { public static void visitTableStoreFiles(final FileSystem fs, final Path tableDir, final StoreFileVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + tableDir); return; ... |
@Test public void testFstat() throws Exception { FileOutputStream fos = new FileOutputStream( new File(TEST_DIR, "testfstat")); NativeIO.Stat stat = NativeIO.getFstat(fos.getFD()); fos.close(); LOG.info("Stat: " + String.valueOf(stat)); assertEquals(System.getProperty("user.name"), stat.getOwner()); assertNotNull(stat.... | private static native Stat fstat(FileDescriptor fd) throws IOException; | NativeIO { private static native Stat fstat(FileDescriptor fd) throws IOException; } | NativeIO { private static native Stat fstat(FileDescriptor fd) throws IOException; } | NativeIO { private static native Stat fstat(FileDescriptor fd) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int ... | NativeIO { private static native Stat fstat(FileDescriptor fd) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int ... |
@Test public void testMultiThreadedFstat() throws Exception { final FileOutputStream fos = new FileOutputStream( new File(TEST_DIR, "testfstat")); final AtomicReference<Throwable> thrown = new AtomicReference<Throwable>(); List<Thread> statters = new ArrayList<Thread>(); for (int i = 0; i < 10; i++) { Thread statter = ... | public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } } | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } } | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); st... | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); st... |
@Test public void testFstatClosedFd() throws Exception { FileOutputStream fos = new FileOutputStream( new File(TEST_DIR, "testfstat2")); fos.close(); try { NativeIO.Stat stat = NativeIO.getFstat(fos.getFD()); } catch (NativeIOException nioe) { LOG.info("Got expected exception", nioe); assertEquals(Errno.EBADF, nioe.get... | public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } } | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } } | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); st... | NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); st... |
@Test public void testOpenMissingWithoutCreate() throws Exception { LOG.info("Open a missing file without O_CREAT and it should fail"); try { FileDescriptor fd = NativeIO.open( new File(TEST_DIR, "doesntexist").getAbsolutePath(), NativeIO.O_WRONLY, 0700); fail("Able to open a new file without O_CREAT"); } catch (Native... | public static native FileDescriptor open(String path, int flags, int mode) throws IOException; | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; } | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; } | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long... | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long... |
@Test public void testOpenWithCreate() throws Exception { LOG.info("Test creating a file with O_CREAT"); FileDescriptor fd = NativeIO.open( new File(TEST_DIR, "testWorkingOpen").getAbsolutePath(), NativeIO.O_WRONLY | NativeIO.O_CREAT, 0700); assertNotNull(true); assertTrue(fd.valid()); FileOutputStream fos = new FileOu... | public static native FileDescriptor open(String path, int flags, int mode) throws IOException; | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; } | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; } | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long... | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long... |
@Test public void testFDDoesntLeak() throws IOException { for (int i = 0; i < 10000; i++) { FileDescriptor fd = NativeIO.open( new File(TEST_DIR, "testNoFdLeak").getAbsolutePath(), NativeIO.O_WRONLY | NativeIO.O_CREAT, 0700); assertNotNull(true); assertTrue(fd.valid()); FileOutputStream fos = new FileOutputStream(fd); ... | public static native FileDescriptor open(String path, int flags, int mode) throws IOException; | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; } | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; } | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long... | NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long... |
@Test public void testChmod() throws Exception { try { NativeIO.chmod("/this/file/doesnt/exist", 777); fail("Chmod of non-existent file didn't fail"); } catch (NativeIOException nioe) { assertEquals(Errno.ENOENT, nioe.getErrno()); } File toChmod = new File(TEST_DIR, "testChmod"); assertTrue("Create test subject", toChm... | public static native void chmod(String path, int mode) throws IOException; | NativeIO { public static native void chmod(String path, int mode) throws IOException; } | NativeIO { public static native void chmod(String path, int mode) throws IOException; } | NativeIO { public static native void chmod(String path, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, i... | NativeIO { public static native void chmod(String path, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, i... |
@Test public void testVisitRecoveredEdits() throws IOException { final Set<String> regions = new HashSet<String>(); final Set<String> edits = new HashSet<String>(); FSVisitor.visitTableRecoveredEdits(fs, tableDir, new FSVisitor.RecoveredEditsVisitor() { public void recoveredEdits (final String region, final String logf... | public static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir, final FSVisitor.RecoveredEditsVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + tableDir); r... | FSVisitor { public static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir, final FSVisitor.RecoveredEditsVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + ... | FSVisitor { public static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir, final FSVisitor.RecoveredEditsVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + ... | FSVisitor { public static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir, final FSVisitor.RecoveredEditsVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + ... | FSVisitor { public static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir, final FSVisitor.RecoveredEditsVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { LOG.info("No regions under directory:" + ... |
@Test public void testPosixFadvise() throws Exception { FileInputStream fis = new FileInputStream("/dev/zero"); try { NativeIO.posix_fadvise(fis.getFD(), 0, 0, NativeIO.POSIX_FADV_SEQUENTIAL); } catch (UnsupportedOperationException uoe) { assumeTrue(false); } finally { fis.close(); } try { NativeIO.posix_fadvise(fis.ge... | static native void posix_fadvise( FileDescriptor fd, long offset, long len, int flags) throws NativeIOException; | NativeIO { static native void posix_fadvise( FileDescriptor fd, long offset, long len, int flags) throws NativeIOException; } | NativeIO { static native void posix_fadvise( FileDescriptor fd, long offset, long len, int flags) throws NativeIOException; } | NativeIO { static native void posix_fadvise( FileDescriptor fd, long offset, long len, int flags) throws NativeIOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileD... | NativeIO { static native void posix_fadvise( FileDescriptor fd, long offset, long len, int flags) throws NativeIOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileD... |
@Test public void testSyncFileRange() throws Exception { FileOutputStream fos = new FileOutputStream( new File(TEST_DIR, "testSyncFileRange")); try { fos.write("foo".getBytes()); NativeIO.sync_file_range(fos.getFD(), 0, 1024, NativeIO.SYNC_FILE_RANGE_WRITE); } catch (UnsupportedOperationException uoe) { assumeTrue(fals... | static native void sync_file_range( FileDescriptor fd, long offset, long nbytes, int flags) throws NativeIOException; | NativeIO { static native void sync_file_range( FileDescriptor fd, long offset, long nbytes, int flags) throws NativeIOException; } | NativeIO { static native void sync_file_range( FileDescriptor fd, long offset, long nbytes, int flags) throws NativeIOException; } | NativeIO { static native void sync_file_range( FileDescriptor fd, long offset, long nbytes, int flags) throws NativeIOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
... | NativeIO { static native void sync_file_range( FileDescriptor fd, long offset, long nbytes, int flags) throws NativeIOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
... |
@Test public void testGetUserName() throws IOException { assertFalse(NativeIO.getUserName(0).isEmpty()); } | static native String getUserName(int uid) throws IOException; | NativeIO { static native String getUserName(int uid) throws IOException; } | NativeIO { static native String getUserName(int uid) throws IOException; } | NativeIO { static native String getUserName(int uid) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int flags); st... | NativeIO { static native String getUserName(int uid) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int flags); st... |
@Test public void testGetGroupName() throws IOException { assertFalse(NativeIO.getGroupName(0).isEmpty()); } | static native String getGroupName(int uid) throws IOException; | NativeIO { static native String getGroupName(int uid) throws IOException; } | NativeIO { static native String getGroupName(int uid) throws IOException; } | NativeIO { static native String getGroupName(int uid) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int flags); s... | NativeIO { static native String getGroupName(int uid) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, long len, int flags); s... |
@Test public void testRenameTo() throws Exception { final File TEST_DIR = new File(new File( System.getProperty("test.build.data","build/test/data")), "renameTest"); assumeTrue(TEST_DIR.mkdirs()); File nonExistentFile = new File(TEST_DIR, "nonexistent"); File targetFile = new File(TEST_DIR, "target"); try { NativeIO.re... | public static void renameTo(File src, File dst) throws IOException { if (!nativeLoaded) { if (!src.renameTo(dst)) { throw new IOException("renameTo(src=" + src + ", dst=" + dst + ") failed."); } } else { renameTo0(src.getAbsolutePath(), dst.getAbsolutePath()); } } | NativeIO { public static void renameTo(File src, File dst) throws IOException { if (!nativeLoaded) { if (!src.renameTo(dst)) { throw new IOException("renameTo(src=" + src + ", dst=" + dst + ") failed."); } } else { renameTo0(src.getAbsolutePath(), dst.getAbsolutePath()); } } } | NativeIO { public static void renameTo(File src, File dst) throws IOException { if (!nativeLoaded) { if (!src.renameTo(dst)) { throw new IOException("renameTo(src=" + src + ", dst=" + dst + ") failed."); } } else { renameTo0(src.getAbsolutePath(), dst.getAbsolutePath()); } } } | NativeIO { public static void renameTo(File src, File dst) throws IOException { if (!nativeLoaded) { if (!src.renameTo(dst)) { throw new IOException("renameTo(src=" + src + ", dst=" + dst + ") failed."); } } else { renameTo0(src.getAbsolutePath(), dst.getAbsolutePath()); } } static boolean isAvailable(); static native... | NativeIO { public static void renameTo(File src, File dst) throws IOException { if (!nativeLoaded) { if (!src.renameTo(dst)) { throw new IOException("renameTo(src=" + src + ", dst=" + dst + ") failed."); } } else { renameTo0(src.getAbsolutePath(), dst.getAbsolutePath()); } } static boolean isAvailable(); static native... |
@Test public void testClear() throws IOException { for (int i = 0; i < 1000; i++) { estimator.insert(i); } estimator.clear(); assertEquals(estimator.getCount(), 0); assertEquals(estimator.getSampleCount(), 0); try { estimator.snapshot(); fail("Expected IOException for an empty window."); } catch (IOException e) { Gener... | synchronized public void clear() { count = 0; bufferCount = 0; samples.clear(); } | SampleQuantiles { synchronized public void clear() { count = 0; bufferCount = 0; samples.clear(); } } | SampleQuantiles { synchronized public void clear() { count = 0; bufferCount = 0; samples.clear(); } SampleQuantiles(Quantile[] quantiles); } | SampleQuantiles { synchronized public void clear() { count = 0; bufferCount = 0; samples.clear(); } SampleQuantiles(Quantile[] quantiles); synchronized void insert(long v); synchronized Map<Quantile, Long> snapshot(); synchronized long getCount(); @VisibleForTesting synchronized int getSampleCount(); synchronized void ... | SampleQuantiles { synchronized public void clear() { count = 0; bufferCount = 0; samples.clear(); } SampleQuantiles(Quantile[] quantiles); synchronized void insert(long v); synchronized Map<Quantile, Long> snapshot(); synchronized long getCount(); @VisibleForTesting synchronized int getSampleCount(); synchronized void ... |
@Test public void testVisitLogFiles() throws IOException { final Set<String> servers = new HashSet<String>(); final Set<String> logs = new HashSet<String>(); FSVisitor.visitLogFiles(fs, rootDir, new FSVisitor.LogFileVisitor() { public void logFile (final String server, final String logfile) throws IOException { servers... | public static void visitLogFiles(final FileSystem fs, final Path rootDir, final LogFileVisitor visitor) throws IOException { Path logsDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); FileStatus[] logServerDirs = FSUtils.listStatus(fs, logsDir); if (logServerDirs == null) { LOG.info("No logs under directory:" + ... | FSVisitor { public static void visitLogFiles(final FileSystem fs, final Path rootDir, final LogFileVisitor visitor) throws IOException { Path logsDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); FileStatus[] logServerDirs = FSUtils.listStatus(fs, logsDir); if (logServerDirs == null) { LOG.info("No logs under di... | FSVisitor { public static void visitLogFiles(final FileSystem fs, final Path rootDir, final LogFileVisitor visitor) throws IOException { Path logsDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); FileStatus[] logServerDirs = FSUtils.listStatus(fs, logsDir); if (logServerDirs == null) { LOG.info("No logs under di... | FSVisitor { public static void visitLogFiles(final FileSystem fs, final Path rootDir, final LogFileVisitor visitor) throws IOException { Path logsDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); FileStatus[] logServerDirs = FSUtils.listStatus(fs, logsDir); if (logServerDirs == null) { LOG.info("No logs under di... | FSVisitor { public static void visitLogFiles(final FileSystem fs, final Path rootDir, final LogFileVisitor visitor) throws IOException { Path logsDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); FileStatus[] logServerDirs = FSUtils.listStatus(fs, logsDir); if (logServerDirs == null) { LOG.info("No logs under di... |
@Test public void testIsHDFS() throws Exception { HBaseTestingUtility htu = new HBaseTestingUtility(); htu.getConfiguration().setBoolean("dfs.support.append", false); assertFalse(FSUtils.isHDFS(htu.getConfiguration())); htu.getConfiguration().setBoolean("dfs.support.append", true); MiniDFSCluster cluster = null; try { ... | public static boolean isHDFS(final Configuration conf) throws IOException { FileSystem fs = FileSystem.get(conf); String scheme = fs.getUri().getScheme(); return scheme.equalsIgnoreCase("hdfs"); } | FSUtils { public static boolean isHDFS(final Configuration conf) throws IOException { FileSystem fs = FileSystem.get(conf); String scheme = fs.getUri().getScheme(); return scheme.equalsIgnoreCase("hdfs"); } } | FSUtils { public static boolean isHDFS(final Configuration conf) throws IOException { FileSystem fs = FileSystem.get(conf); String scheme = fs.getUri().getScheme(); return scheme.equalsIgnoreCase("hdfs"); } protected FSUtils(); } | FSUtils { public static boolean isHDFS(final Configuration conf) throws IOException { FileSystem fs = FileSystem.get(conf); String scheme = fs.getUri().getScheme(); return scheme.equalsIgnoreCase("hdfs"); } protected FSUtils(); static FSUtils getInstance(FileSystem fs, Configuration conf); static boolean deleteDirecto... | FSUtils { public static boolean isHDFS(final Configuration conf) throws IOException { FileSystem fs = FileSystem.get(conf); String scheme = fs.getUri().getScheme(); return scheme.equalsIgnoreCase("hdfs"); } protected FSUtils(); static FSUtils getInstance(FileSystem fs, Configuration conf); static boolean deleteDirecto... |
@Test public void testUnqualifiedUriContents() throws Exception { String dirString = "d1"; PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString("d1/f1", "d1/f1.1", "d1/f2"), sortedString(items) ); } | public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChildPath(stats[i].getPath()); items[i] = new P... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... |
@Test public void testcomputeHDFSBlocksDistribution() throws Exception { HBaseTestingUtility htu = new HBaseTestingUtility(); final int DEFAULT_BLOCK_SIZE = 1024; htu.getConfiguration().setLong("dfs.block.size", DEFAULT_BLOCK_SIZE); MiniDFSCluster cluster = null; Path testFile = null; try { String hosts[] = new String[... | static public HDFSBlocksDistribution computeHDFSBlocksDistribution( final FileSystem fs, FileStatus status, long start, long length) throws IOException { HDFSBlocksDistribution blocksDistribution = new HDFSBlocksDistribution(); BlockLocation [] blockLocations = fs.getFileBlockLocations(status, start, length); for(Block... | FSUtils { static public HDFSBlocksDistribution computeHDFSBlocksDistribution( final FileSystem fs, FileStatus status, long start, long length) throws IOException { HDFSBlocksDistribution blocksDistribution = new HDFSBlocksDistribution(); BlockLocation [] blockLocations = fs.getFileBlockLocations(status, start, length);... | FSUtils { static public HDFSBlocksDistribution computeHDFSBlocksDistribution( final FileSystem fs, FileStatus status, long start, long length) throws IOException { HDFSBlocksDistribution blocksDistribution = new HDFSBlocksDistribution(); BlockLocation [] blockLocations = fs.getFileBlockLocations(status, start, length);... | FSUtils { static public HDFSBlocksDistribution computeHDFSBlocksDistribution( final FileSystem fs, FileStatus status, long start, long length) throws IOException { HDFSBlocksDistribution blocksDistribution = new HDFSBlocksDistribution(); BlockLocation [] blockLocations = fs.getFileBlockLocations(status, start, length);... | FSUtils { static public HDFSBlocksDistribution computeHDFSBlocksDistribution( final FileSystem fs, FileStatus status, long start, long length) throws IOException { HDFSBlocksDistribution blocksDistribution = new HDFSBlocksDistribution(); BlockLocation [] blockLocations = fs.getFileBlockLocations(status, start, length);... |
@Test public void testCwdContents() throws Exception { String dirString = Path.CUR_DIR; PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString("d1", "d2"), sortedString(items) ); } | public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChildPath(stats[i].getPath()); items[i] = new P... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... | PathData implements Comparable<PathData> { public PathData[] getDirectoryContents() throws IOException { checkIfExists(FileTypeRequirement.SHOULD_BE_DIRECTORY); FileStatus[] stats = fs.listStatus(path); PathData[] items = new PathData[stats.length]; for (int i=0; i < stats.length; i++) { String child = getStringForChil... |
@Test public void testToFile() throws Exception { PathData item = new PathData(".", conf); assertEquals(new File(testDir.toString()), item.toFile()); item = new PathData("d1/f1", conf); assertEquals(new File(testDir + "/d1/f1"), item.toFile()); item = new PathData(testDir + "/d1/f1", conf); assertEquals(new File(testDi... | public File toFile() { if (!(fs instanceof LocalFileSystem)) { throw new IllegalArgumentException("Not a local path: " + path); } return ((LocalFileSystem)fs).pathToFile(path); } | PathData implements Comparable<PathData> { public File toFile() { if (!(fs instanceof LocalFileSystem)) { throw new IllegalArgumentException("Not a local path: " + path); } return ((LocalFileSystem)fs).pathToFile(path); } } | PathData implements Comparable<PathData> { public File toFile() { if (!(fs instanceof LocalFileSystem)) { throw new IllegalArgumentException("Not a local path: " + path); } return ((LocalFileSystem)fs).pathToFile(path); } PathData(String pathString, Configuration conf); PathData(File localPath, Configuration conf); pr... | PathData implements Comparable<PathData> { public File toFile() { if (!(fs instanceof LocalFileSystem)) { throw new IllegalArgumentException("Not a local path: " + path); } return ((LocalFileSystem)fs).pathToFile(path); } PathData(String pathString, Configuration conf); PathData(File localPath, Configuration conf); pr... | PathData implements Comparable<PathData> { public File toFile() { if (!(fs instanceof LocalFileSystem)) { throw new IllegalArgumentException("Not a local path: " + path); } return ((LocalFileSystem)fs).pathToFile(path); } PathData(String pathString, Configuration conf); PathData(File localPath, Configuration conf); pr... |
@Test public void testAbsoluteGlob() throws Exception { PathData[] items = PathData.expandAsGlob(testDir+"/d1/f1*", conf); assertEquals( sortedString(testDir+"/d1/f1", testDir+"/d1/f1.1"), sortedString(items) ); } | public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern = pattern.replaceAll("\\\\(.)", "$1"); items... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... |
@Test public void testRelativeGlob() throws Exception { PathData[] items = PathData.expandAsGlob("d1/f1*", conf); assertEquals( sortedString("d1/f1", "d1/f1.1"), sortedString(items) ); } | public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern = pattern.replaceAll("\\\\(.)", "$1"); items... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... |
@Test public void testRelativeGlobBack() throws Exception { fs.setWorkingDirectory(new Path("d1")); PathData[] items = PathData.expandAsGlob("../d2/*", conf); assertEquals( sortedString("../d2/f3"), sortedString(items) ); } | public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern = pattern.replaceAll("\\\\(.)", "$1"); items... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... | PathData implements Comparable<PathData> { public static PathData[] expandAsGlob(String pattern, Configuration conf) throws IOException { Path globPath = new Path(pattern); FileSystem fs = globPath.getFileSystem(conf); FileStatus[] stats = fs.globStatus(globPath); PathData[] items = null; if (stats == null) { pattern =... |
@Test public void testWithStringAndConfForBuggyPath() throws Exception { String dirString = "file: Path tmpDir = new Path(dirString); PathData item = new PathData(dirString, conf); assertEquals("file:/tmp", tmpDir.toString()); checkPathData(dirString, item); } | public String toString() { String scheme = uri.getScheme(); String decodedRemainder = uri.getSchemeSpecificPart(); if (scheme == null) { return decodedRemainder; } else { StringBuilder buffer = new StringBuilder(); buffer.append(scheme); buffer.append(":"); buffer.append(decodedRemainder); return buffer.toString(); } } | PathData implements Comparable<PathData> { public String toString() { String scheme = uri.getScheme(); String decodedRemainder = uri.getSchemeSpecificPart(); if (scheme == null) { return decodedRemainder; } else { StringBuilder buffer = new StringBuilder(); buffer.append(scheme); buffer.append(":"); buffer.append(decod... | PathData implements Comparable<PathData> { public String toString() { String scheme = uri.getScheme(); String decodedRemainder = uri.getSchemeSpecificPart(); if (scheme == null) { return decodedRemainder; } else { StringBuilder buffer = new StringBuilder(); buffer.append(scheme); buffer.append(":"); buffer.append(decod... | PathData implements Comparable<PathData> { public String toString() { String scheme = uri.getScheme(); String decodedRemainder = uri.getSchemeSpecificPart(); if (scheme == null) { return decodedRemainder; } else { StringBuilder buffer = new StringBuilder(); buffer.append(scheme); buffer.append(":"); buffer.append(decod... | PathData implements Comparable<PathData> { public String toString() { String scheme = uri.getScheme(); String decodedRemainder = uri.getSchemeSpecificPart(); if (scheme == null) { return decodedRemainder; } else { StringBuilder buffer = new StringBuilder(); buffer.append(scheme); buffer.append(":"); buffer.append(decod... |
@Test public void testCreateDelete() throws IOException { FileContextTestHelper.createFileNonRecursive(fc, "/foo"); Assert.assertTrue(isFile(fc, new Path("/foo"))); Assert.assertTrue(isFile(fcTarget, new Path(chrootedTo, "foo"))); FileContextTestHelper.createFile(fc, "/newDir/foo"); Assert.assertTrue(isFile(fc, new Pat... | @Override public boolean delete(final Path f, final boolean recursive) throws IOException, UnresolvedLinkException { return myFs.delete(fullPath(f), recursive); } | ChRootedFs extends AbstractFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException, UnresolvedLinkException { return myFs.delete(fullPath(f), recursive); } } | ChRootedFs extends AbstractFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException, UnresolvedLinkException { return myFs.delete(fullPath(f), recursive); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); } | ChRootedFs extends AbstractFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException, UnresolvedLinkException { return myFs.delete(fullPath(f), recursive); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override URI getUri(); String stripOutRoot(final Path p... | ChRootedFs extends AbstractFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException, UnresolvedLinkException { return myFs.delete(fullPath(f), recursive); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override URI getUri(); String stripOutRoot(final Path p... |
@Test public void testRename() throws IOException { FileContextTestHelper.createFile(fc, "/newDir/foo"); fc.rename(new Path("/newDir/foo"), new Path("/newDir/fooBar")); Assert.assertFalse(exists(fc, new Path("/newDir/foo"))); Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/foo"))); Assert.assertTrue(isF... | @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } } | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); } | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override URI g... | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override URI g... |
@Test public void testRenameAcrossFs() throws IOException { fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true); fc.rename(new Path("/newDir/dirFoo"), new Path("file: FileContextTestHelper.isDir(fc, new Path("/dirFooBar")); } | @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } } | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); } | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override URI g... | ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override URI g... |
@Test public void testURI() { URI uri = fSys.getUri(); Assert.assertEquals(chrootedTo.toUri(), uri); } | @Override public URI getUri() { return myUri; } | ChRootedFileSystem extends FilterFileSystem { @Override public URI getUri() { return myUri; } } | ChRootedFileSystem extends FilterFileSystem { @Override public URI getUri() { return myUri; } ChRootedFileSystem(final URI uri, Configuration conf); } | ChRootedFileSystem extends FilterFileSystem { @Override public URI getUri() { return myUri; } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getResolvedQualifiedPath(final Path f); @Override Path getWorkingDirectory(); @Over... | ChRootedFileSystem extends FilterFileSystem { @Override public URI getUri() { return myUri; } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getResolvedQualifiedPath(final Path f); @Override Path getWorkingDirectory(); @Over... |
@Test public void testHDFSLinkReadDuringDelete() throws Exception { HBaseTestingUtility testUtil = new HBaseTestingUtility(); Configuration conf = testUtil.getConfiguration(); conf.setInt("dfs.blocksize", 1024 * 1024); conf.setInt("dfs.client.read.prefetch.size", 2 * 1024 * 1024); testUtil.startMiniDFSCluster(1); MiniD... | public FSDataInputStream open(final FileSystem fs) throws IOException { return new FSDataInputStream(new FileLinkInputStream(fs, this)); } | FileLink { public FSDataInputStream open(final FileSystem fs) throws IOException { return new FSDataInputStream(new FileLinkInputStream(fs, this)); } } | FileLink { public FSDataInputStream open(final FileSystem fs) throws IOException { return new FSDataInputStream(new FileLinkInputStream(fs, this)); } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLink(final Collection<Path> locations); } | FileLink { public FSDataInputStream open(final FileSystem fs) throws IOException { return new FSDataInputStream(new FileLinkInputStream(fs, this)); } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLink(final Collection<Path> locations); Path[] getLocations(); String toString(); Path g... | FileLink { public FSDataInputStream open(final FileSystem fs) throws IOException { return new FSDataInputStream(new FileLinkInputStream(fs, this)); } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLink(final Collection<Path> locations); Path[] getLocations(); String toString(); Path g... |
@Test public void testCreateDelete() throws IOException { FileSystemTestHelper.createFile(fSys, "/foo"); Assert.assertTrue(fSys.isFile(new Path("/foo"))); Assert.assertTrue(fSysTarget.isFile(new Path(chrootedTo, "foo"))); FileSystemTestHelper.createFile(fSys, "/newDir/foo"); Assert.assertTrue(fSys.isFile(new Path("/new... | @Override public boolean delete(final Path f, final boolean recursive) throws IOException { return super.delete(fullPath(f), recursive); } | ChRootedFileSystem extends FilterFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException { return super.delete(fullPath(f), recursive); } } | ChRootedFileSystem extends FilterFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException { return super.delete(fullPath(f), recursive); } ChRootedFileSystem(final URI uri, Configuration conf); } | ChRootedFileSystem extends FilterFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException { return super.delete(fullPath(f), recursive); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(... | ChRootedFileSystem extends FilterFileSystem { @Override public boolean delete(final Path f, final boolean recursive) throws IOException { return super.delete(fullPath(f), recursive); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(... |
@Test public void testRename() throws IOException { FileSystemTestHelper.createFile(fSys, "/newDir/foo"); fSys.rename(new Path("/newDir/foo"), new Path("/newDir/fooBar")); Assert.assertFalse(fSys.exists(new Path("/newDir/foo"))); Assert.assertFalse(fSysTarget.exists(new Path(chrootedTo,"newDir/foo"))); Assert.assertTru... | @Override public boolean rename(final Path src, final Path dst) throws IOException { return super.rename(fullPath(src), fullPath(dst)); } | ChRootedFileSystem extends FilterFileSystem { @Override public boolean rename(final Path src, final Path dst) throws IOException { return super.rename(fullPath(src), fullPath(dst)); } } | ChRootedFileSystem extends FilterFileSystem { @Override public boolean rename(final Path src, final Path dst) throws IOException { return super.rename(fullPath(src), fullPath(dst)); } ChRootedFileSystem(final URI uri, Configuration conf); } | ChRootedFileSystem extends FilterFileSystem { @Override public boolean rename(final Path src, final Path dst) throws IOException { return super.rename(fullPath(src), fullPath(dst)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri()... | ChRootedFileSystem extends FilterFileSystem { @Override public boolean rename(final Path src, final Path dst) throws IOException { return super.rename(fullPath(src), fullPath(dst)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri()... |
@Test public void testGetContentSummary() throws IOException { fSys.mkdirs(new Path("/newDir/dirFoo")); ContentSummary cs = fSys.getContentSummary(new Path("/newDir/dirFoo")); Assert.assertEquals(-1L, cs.getQuota()); Assert.assertEquals(-1L, cs.getSpaceQuota()); } | @Override public ContentSummary getContentSummary(Path f) throws IOException { return super.getContentSummary(fullPath(f)); } | ChRootedFileSystem extends FilterFileSystem { @Override public ContentSummary getContentSummary(Path f) throws IOException { return super.getContentSummary(fullPath(f)); } } | ChRootedFileSystem extends FilterFileSystem { @Override public ContentSummary getContentSummary(Path f) throws IOException { return super.getContentSummary(fullPath(f)); } ChRootedFileSystem(final URI uri, Configuration conf); } | ChRootedFileSystem extends FilterFileSystem { @Override public ContentSummary getContentSummary(Path f) throws IOException { return super.getContentSummary(fullPath(f)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getRe... | ChRootedFileSystem extends FilterFileSystem { @Override public ContentSummary getContentSummary(Path f) throws IOException { return super.getContentSummary(fullPath(f)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getRe... |
@Test public void testResolvePath() throws IOException { Assert.assertEquals(chrootedTo, fSys.resolvePath(new Path("/"))); FileSystemTestHelper.createFile(fSys, "/foo"); Assert.assertEquals(new Path(chrootedTo, "foo"), fSys.resolvePath(new Path("/foo"))); } | @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } } | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } ChRootedFileSystem(final URI uri, Configuration conf); } | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getResolvedQualifiedP... | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getResolvedQualifiedP... |
@Test(expected=FileNotFoundException.class) public void testResolvePathNonExisting() throws IOException { fSys.resolvePath(new Path("/nonExisting")); } | @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } } | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } ChRootedFileSystem(final URI uri, Configuration conf); } | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getResolvedQualifiedP... | ChRootedFileSystem extends FilterFileSystem { @Override public Path resolvePath(final Path p) throws IOException { return super.resolvePath(fullPath(p)); } ChRootedFileSystem(final URI uri, Configuration conf); void initialize(final URI name, final Configuration conf); @Override URI getUri(); Path getResolvedQualifiedP... |
@Test public void testURIEmptyPath() throws IOException { Configuration conf = new Configuration(); conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class); URI chrootUri = URI.create("mockfs: new ChRootedFileSystem(chrootUri, conf); } | @Override public FSDataOutputStream create(final Path f, final FsPermission permission, final boolean overwrite, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException { return super.create(fullPath(f), permission, overwrite, bufferSize, replication, blockSi... | ChRootedFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(final Path f, final FsPermission permission, final boolean overwrite, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException { return super.create(fullPath(f), permissio... | ChRootedFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(final Path f, final FsPermission permission, final boolean overwrite, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException { return super.create(fullPath(f), permissio... | ChRootedFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(final Path f, final FsPermission permission, final boolean overwrite, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException { return super.create(fullPath(f), permissio... | ChRootedFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(final Path f, final FsPermission permission, final boolean overwrite, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException { return super.create(fullPath(f), permissio... |
@Test public void testFileChecksum() { final Path p = new Path("har: final HarFileSystem harfs = new HarFileSystem(); Assert.assertEquals(null, harfs.getFileChecksum(p)); } | public FileChecksum getFileChecksum(Path f) { return null; } | HarFileSystem extends FilterFileSystem { public FileChecksum getFileChecksum(Path f) { return null; } } | HarFileSystem extends FilterFileSystem { public FileChecksum getFileChecksum(Path f) { return null; } HarFileSystem(); HarFileSystem(FileSystem fs); } | HarFileSystem extends FilterFileSystem { public FileChecksum getFileChecksum(Path f) { return null; } HarFileSystem(); HarFileSystem(FileSystem fs); @Override String getScheme(); void initialize(URI name, Configuration conf); int getHarVersion(); Path getWorkingDirectory(); @Override URI getUri(); @Override Path makeQ... | HarFileSystem extends FilterFileSystem { public FileChecksum getFileChecksum(Path f) { return null; } HarFileSystem(); HarFileSystem(FileSystem fs); @Override String getScheme(); void initialize(URI name, Configuration conf); int getHarVersion(); Path getWorkingDirectory(); @Override URI getUri(); @Override Path makeQ... |
@Test public void testFixBlockLocations() { { BlockLocation[] b = { new BlockLocation(null, null, 10, 10) }; HarFileSystem.fixBlockLocations(b, 0, 20, 5); assertEquals(b[0].getOffset(), 5); assertEquals(b[0].getLength(), 10); } { BlockLocation[] b = { new BlockLocation(null, null, 10, 10) }; HarFileSystem.fixBlockLocat... | static BlockLocation[] fixBlockLocations(BlockLocation[] locations, long start, long len, long fileOffsetInHar) { long end = start + len; for (BlockLocation location : locations) { long harBlockStart = location.getOffset() - fileOffsetInHar; long harBlockEnd = harBlockStart + location.getLength(); if (start > harBlockS... | HarFileSystem extends FilterFileSystem { static BlockLocation[] fixBlockLocations(BlockLocation[] locations, long start, long len, long fileOffsetInHar) { long end = start + len; for (BlockLocation location : locations) { long harBlockStart = location.getOffset() - fileOffsetInHar; long harBlockEnd = harBlockStart + lo... | HarFileSystem extends FilterFileSystem { static BlockLocation[] fixBlockLocations(BlockLocation[] locations, long start, long len, long fileOffsetInHar) { long end = start + len; for (BlockLocation location : locations) { long harBlockStart = location.getOffset() - fileOffsetInHar; long harBlockEnd = harBlockStart + lo... | HarFileSystem extends FilterFileSystem { static BlockLocation[] fixBlockLocations(BlockLocation[] locations, long start, long len, long fileOffsetInHar) { long end = start + len; for (BlockLocation location : locations) { long harBlockStart = location.getOffset() - fileOffsetInHar; long harBlockEnd = harBlockStart + lo... | HarFileSystem extends FilterFileSystem { static BlockLocation[] fixBlockLocations(BlockLocation[] locations, long start, long len, long fileOffsetInHar) { long end = start + len; for (BlockLocation location : locations) { long harBlockStart = location.getOffset() - fileOffsetInHar; long harBlockEnd = harBlockStart + lo... |
@Test public void testFilterFileSystem() throws Exception { for (Method m : FileSystem.class.getDeclaredMethods()) { if (Modifier.isStatic(m.getModifiers())) continue; if (Modifier.isPrivate(m.getModifiers())) continue; try { DontCheck.class.getMethod(m.getName(), m.getParameterTypes()); LOG.info("Skipping " + m); } ca... | public FilterFileSystem() { } | FilterFileSystem extends FileSystem { public FilterFileSystem() { } } | FilterFileSystem extends FileSystem { public FilterFileSystem() { } FilterFileSystem(); FilterFileSystem(FileSystem fs); } | FilterFileSystem extends FileSystem { public FilterFileSystem() { } FilterFileSystem(); FilterFileSystem(FileSystem fs); FileSystem getRawFileSystem(); void initialize(URI name, Configuration conf); URI getUri(); Path makeQualified(Path path); BlockLocation[] getFileBlockLocations(FileStatus file, long start,
long... | FilterFileSystem extends FileSystem { public FilterFileSystem() { } FilterFileSystem(); FilterFileSystem(FileSystem fs); FileSystem getRawFileSystem(); void initialize(URI name, Configuration conf); URI getUri(); Path makeQualified(Path path); BlockLocation[] getFileBlockLocations(FileStatus file, long start,
long... |
@Test public void testEquals() { BlockCacheColumnFamilySummary e1 = new BlockCacheColumnFamilySummary(); e1.setTable("table1"); e1.setColumnFamily("cf1"); BlockCacheColumnFamilySummary e2 = new BlockCacheColumnFamilySummary(); e2.setTable("table1"); e2.setColumnFamily("cf1"); assertEquals("bcse", e1, e2); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BlockCacheColumnFamilySummary other = (BlockCacheColumnFamilySummary) obj; if (columnFamily == null) { if (other.columnFamily != null) return false; } else if (!colu... | BlockCacheColumnFamilySummary implements Writable, Comparable<BlockCacheColumnFamilySummary> { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BlockCacheColumnFamilySummary other = (BlockCacheColumnFamilySummary) ... | BlockCacheColumnFamilySummary implements Writable, Comparable<BlockCacheColumnFamilySummary> { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BlockCacheColumnFamilySummary other = (BlockCacheColumnFamilySummary) ... | BlockCacheColumnFamilySummary implements Writable, Comparable<BlockCacheColumnFamilySummary> { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BlockCacheColumnFamilySummary other = (BlockCacheColumnFamilySummary) ... | BlockCacheColumnFamilySummary implements Writable, Comparable<BlockCacheColumnFamilySummary> { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BlockCacheColumnFamilySummary other = (BlockCacheColumnFamilySummary) ... |
@Test public void testGetFilterLocalFsSetsConfs() throws Exception { FilterFileSystem flfs = (FilterFileSystem) FileSystem.get(URI.create("flfs:/"), conf); checkFsConf(flfs, conf, 3); } | @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return fs.create(f, permission, overwrite, bufferSize, replication, blockSize, progress); } | FilterFileSystem extends FileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return fs.create(f, permission, overwrite, bufferSize, replication, blockSize, progress); } ... | FilterFileSystem extends FileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return fs.create(f, permission, overwrite, bufferSize, replication, blockSize, progress); } ... | FilterFileSystem extends FileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return fs.create(f, permission, overwrite, bufferSize, replication, blockSize, progress); } ... | FilterFileSystem extends FileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return fs.create(f, permission, overwrite, bufferSize, replication, blockSize, progress); } ... |
@Test public void testVerifyChecksumPassthru() { FileSystem mockFs = mock(FileSystem.class); FileSystem fs = new FilterFileSystem(mockFs); fs.setVerifyChecksum(false); verify(mockFs).setVerifyChecksum(eq(false)); reset(mockFs); fs.setVerifyChecksum(true); verify(mockFs).setVerifyChecksum(eq(true)); } | public void setVerifyChecksum(boolean verifyChecksum) { fs.setVerifyChecksum(verifyChecksum); } | FilterFileSystem extends FileSystem { public void setVerifyChecksum(boolean verifyChecksum) { fs.setVerifyChecksum(verifyChecksum); } } | FilterFileSystem extends FileSystem { public void setVerifyChecksum(boolean verifyChecksum) { fs.setVerifyChecksum(verifyChecksum); } FilterFileSystem(); FilterFileSystem(FileSystem fs); } | FilterFileSystem extends FileSystem { public void setVerifyChecksum(boolean verifyChecksum) { fs.setVerifyChecksum(verifyChecksum); } FilterFileSystem(); FilterFileSystem(FileSystem fs); FileSystem getRawFileSystem(); void initialize(URI name, Configuration conf); URI getUri(); Path makeQualified(Path path); BlockLoca... | FilterFileSystem extends FileSystem { public void setVerifyChecksum(boolean verifyChecksum) { fs.setVerifyChecksum(verifyChecksum); } FilterFileSystem(); FilterFileSystem(FileSystem fs); FileSystem getRawFileSystem(); void initialize(URI name, Configuration conf); URI getUri(); Path makeQualified(Path path); BlockLoca... |
@Test public void testWriteChecksumPassthru() { FileSystem mockFs = mock(FileSystem.class); FileSystem fs = new FilterFileSystem(mockFs); fs.setWriteChecksum(false); verify(mockFs).setWriteChecksum(eq(false)); reset(mockFs); fs.setWriteChecksum(true); verify(mockFs).setWriteChecksum(eq(true)); } | @Override public void setWriteChecksum(boolean writeChecksum) { fs.setWriteChecksum(writeChecksum); } | FilterFileSystem extends FileSystem { @Override public void setWriteChecksum(boolean writeChecksum) { fs.setWriteChecksum(writeChecksum); } } | FilterFileSystem extends FileSystem { @Override public void setWriteChecksum(boolean writeChecksum) { fs.setWriteChecksum(writeChecksum); } FilterFileSystem(); FilterFileSystem(FileSystem fs); } | FilterFileSystem extends FileSystem { @Override public void setWriteChecksum(boolean writeChecksum) { fs.setWriteChecksum(writeChecksum); } FilterFileSystem(); FilterFileSystem(FileSystem fs); FileSystem getRawFileSystem(); void initialize(URI name, Configuration conf); URI getUri(); Path makeQualified(Path path); Blo... | FilterFileSystem extends FileSystem { @Override public void setWriteChecksum(boolean writeChecksum) { fs.setWriteChecksum(writeChecksum); } FilterFileSystem(); FilterFileSystem(FileSystem fs); FileSystem getRawFileSystem(); void initialize(URI name, Configuration conf); URI getUri(); Path makeQualified(Path path); Blo... |
@Test public void testStatistics() throws Exception { FileSystem.getLocal(new Configuration()); int fileSchemeCount = 0; for (Statistics stats : FileSystem.getAllStatistics()) { if (stats.getScheme().equals("file")) { fileSchemeCount++; } } assertEquals(1, fileSchemeCount); } | @Override public String getScheme() { return "file"; } | LocalFileSystem extends ChecksumFileSystem { @Override public String getScheme() { return "file"; } } | LocalFileSystem extends ChecksumFileSystem { @Override public String getScheme() { return "file"; } LocalFileSystem(); LocalFileSystem(FileSystem rawLocalFileSystem); } | LocalFileSystem extends ChecksumFileSystem { @Override public String getScheme() { return "file"; } LocalFileSystem(); LocalFileSystem(FileSystem rawLocalFileSystem); @Override void initialize(URI name, Configuration conf); @Override String getScheme(); FileSystem getRaw(); File pathToFile(Path path); @Override void c... | LocalFileSystem extends ChecksumFileSystem { @Override public String getScheme() { return "file"; } LocalFileSystem(); LocalFileSystem(FileSystem rawLocalFileSystem); @Override void initialize(URI name, Configuration conf); @Override String getScheme(); FileSystem getRaw(); File pathToFile(Path path); @Override void c... |
@Test public void testReportChecksumFailure() throws IOException { base.mkdirs(); assertTrue(base.exists() && base.isDirectory()); final File dir1 = new File(base, "dir1"); final File dir2 = new File(dir1, "dir2"); dir2.mkdirs(); assertTrue(dir2.exists() && dir2.canWrite()); final String dataFileName = "corruptedData";... | public boolean reportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) { try { File f = ((RawLocalFileSystem)fs).pathToFile(p).getCanonicalFile(); String device = new DF(f, getConf()).getMount(); File parent = f.getParentFile(); File dir = null; while (parent!=null && paren... | LocalFileSystem extends ChecksumFileSystem { public boolean reportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) { try { File f = ((RawLocalFileSystem)fs).pathToFile(p).getCanonicalFile(); String device = new DF(f, getConf()).getMount(); File parent = f.getParentFile(); ... | LocalFileSystem extends ChecksumFileSystem { public boolean reportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) { try { File f = ((RawLocalFileSystem)fs).pathToFile(p).getCanonicalFile(); String device = new DF(f, getConf()).getMount(); File parent = f.getParentFile(); ... | LocalFileSystem extends ChecksumFileSystem { public boolean reportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) { try { File f = ((RawLocalFileSystem)fs).pathToFile(p).getCanonicalFile(); String device = new DF(f, getConf()).getMount(); File parent = f.getParentFile(); ... | LocalFileSystem extends ChecksumFileSystem { public boolean reportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) { try { File f = ((RawLocalFileSystem)fs).pathToFile(p).getCanonicalFile(); String device = new DF(f, getConf()).getMount(); File parent = f.getParentFile(); ... |
@Test public void testDirsNotExist() throws Exception { if (isWindows) return; String dir2 = buildBufferDir(ROOT, 2); String dir3 = buildBufferDir(ROOT, 3); try { conf.set(CONTEXT, dir2 + "," + dir3); createTempFile(SMALL_FILE_SIZE); int firstDirIdx = (dirAllocator.getCurrentDirectoryIndex() == 0) ? 2 : 3; int secondDi... | int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } } | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } LocalDirAllocator(String contextCfgItemName); } | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration conf); Path getLocalPathForWrite(String pathStr,... | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration conf); Path getLocalPathForWrite(String pathStr,... |
@Test public void testRWBufferDirBecomesRO() throws Exception { if (isWindows) return; String dir3 = buildBufferDir(ROOT, 3); String dir4 = buildBufferDir(ROOT, 4); try { conf.set(CONTEXT, dir3 + "," + dir4); assertTrue(localFs.mkdirs(new Path(dir3))); assertTrue(localFs.mkdirs(new Path(dir4))); createTempFile(SMALL_FI... | int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } } | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } LocalDirAllocator(String contextCfgItemName); } | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration conf); Path getLocalPathForWrite(String pathStr,... | LocalDirAllocator { int getCurrentDirectoryIndex() { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getCurrentDirectoryIndex(); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration conf); Path getLocalPathForWrite(String pathStr,... |
@Test public void testLocalPathForWriteDirCreation() throws IOException { String dir0 = buildBufferDir(ROOT, 0); String dir1 = buildBufferDir(ROOT, 1); try { conf.set(CONTEXT, dir0 + "," + dir1); assertTrue(localFs.mkdirs(new Path(dir1))); BUFFER_ROOT.setReadOnly(); Path p1 = dirAllocator.getLocalPathForWrite("p1/x", S... | public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException { return getLocalPathForWrite(pathStr, SIZE_UNKNOWN, conf); } | LocalDirAllocator { public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException { return getLocalPathForWrite(pathStr, SIZE_UNKNOWN, conf); } } | LocalDirAllocator { public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException { return getLocalPathForWrite(pathStr, SIZE_UNKNOWN, conf); } LocalDirAllocator(String contextCfgItemName); } | LocalDirAllocator { public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException { return getLocalPathForWrite(pathStr, SIZE_UNKNOWN, conf); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration conf); Path getLocalPathForWrite(String p... | LocalDirAllocator { public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException { return getLocalPathForWrite(pathStr, SIZE_UNKNOWN, conf); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration conf); Path getLocalPathForWrite(String p... |
@Test public void testNoSideEffects() throws IOException { if (isWindows) return; String dir = buildBufferDir(ROOT, 0); try { conf.set(CONTEXT, dir); File result = dirAllocator.createTmpFileForWrite(FILENAME, -1, conf); assertTrue(result.delete()); assertTrue(result.getParentFile().delete()); assertFalse(new File(dir).... | public File createTmpFileForWrite(String pathStr, long size, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.createTmpFileForWrite(pathStr, size, conf); } | LocalDirAllocator { public File createTmpFileForWrite(String pathStr, long size, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.createTmpFileForWrite(pathStr, size, conf); } } | LocalDirAllocator { public File createTmpFileForWrite(String pathStr, long size, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.createTmpFileForWrite(pathStr, size, conf); } LocalDirAllocator(String contextCfgItemName); } | LocalDirAllocator { public File createTmpFileForWrite(String pathStr, long size, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.createTmpFileForWrite(pathStr, size, conf); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(... | LocalDirAllocator { public File createTmpFileForWrite(String pathStr, long size, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.createTmpFileForWrite(pathStr, size, conf); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(... |
@Test public void testGetLocalPathToRead() throws IOException { if (isWindows) return; String dir = buildBufferDir(ROOT, 0); try { conf.set(CONTEXT, dir); assertTrue(localFs.mkdirs(new Path(dir))); File f1 = dirAllocator.createTmpFileForWrite(FILENAME, SMALL_FILE_SIZE, conf); Path p1 = dirAllocator.getLocalPathToRead(f... | public Path getLocalPathToRead(String pathStr, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getLocalPathToRead(pathStr, conf); } | LocalDirAllocator { public Path getLocalPathToRead(String pathStr, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getLocalPathToRead(pathStr, conf); } } | LocalDirAllocator { public Path getLocalPathToRead(String pathStr, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getLocalPathToRead(pathStr, conf); } LocalDirAllocator(String contextCfgItemName); } | LocalDirAllocator { public Path getLocalPathToRead(String pathStr, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getLocalPathToRead(pathStr, conf); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
... | LocalDirAllocator { public Path getLocalPathToRead(String pathStr, Configuration conf) throws IOException { AllocatorPerContext context = obtainContext(contextCfgItemName); return context.getLocalPathToRead(pathStr, conf); } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
... |
@Test public void testElementPlacement() { assertEquals(cache.getHigherBlock(BLOCK_SIZE).getKey().intValue(), (BLOCK_SIZE * 11 / 10)); assertEquals(cache.getHigherBlock((BLOCK_SIZE * 2)).getKey() .intValue(), (BLOCK_SIZE * 21 / 10)); } | Entry<Integer, SingleSizeCache> getHigherBlock(int size) { return sizer.higherEntry(size - 1); } | SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize { Entry<Integer, SingleSizeCache> getHigherBlock(int size) { return sizer.higherEntry(size - 1); } } | SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize { Entry<Integer, SingleSizeCache> getHigherBlock(int size) { return sizer.higherEntry(size - 1); } SlabCache(long size, long avgBlockSize); } | SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize { Entry<Integer, SingleSizeCache> getHigherBlock(int size) { return sizer.higherEntry(size - 1); } SlabCache(long size, long avgBlockSize); void addSlabByConf(Configuration conf); void cacheBlock(BlockCacheKey cacheKey, Cacheable cachedItem); void cacheBl... | SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize { Entry<Integer, SingleSizeCache> getHigherBlock(int size) { return sizer.higherEntry(size - 1); } SlabCache(long size, long avgBlockSize); void addSlabByConf(Configuration conf); void cacheBlock(BlockCacheKey cacheKey, Cacheable cachedItem); void cacheBl... |
@Test public void testRemoveContext() throws IOException { String dir = buildBufferDir(ROOT, 0); try { String contextCfgItemName = "application_1340842292563_0004.app.cache.dirs"; conf.set(contextCfgItemName, dir); LocalDirAllocator localDirAllocator = new LocalDirAllocator( contextCfgItemName); localDirAllocator.getLo... | @Deprecated @InterfaceAudience.LimitedPrivate({"MapReduce"}) public static void removeContext(String contextCfgItemName) { synchronized (contexts) { contexts.remove(contextCfgItemName); } } | LocalDirAllocator { @Deprecated @InterfaceAudience.LimitedPrivate({"MapReduce"}) public static void removeContext(String contextCfgItemName) { synchronized (contexts) { contexts.remove(contextCfgItemName); } } } | LocalDirAllocator { @Deprecated @InterfaceAudience.LimitedPrivate({"MapReduce"}) public static void removeContext(String contextCfgItemName) { synchronized (contexts) { contexts.remove(contextCfgItemName); } } LocalDirAllocator(String contextCfgItemName); } | LocalDirAllocator { @Deprecated @InterfaceAudience.LimitedPrivate({"MapReduce"}) public static void removeContext(String contextCfgItemName) { synchronized (contexts) { contexts.remove(contextCfgItemName); } } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration c... | LocalDirAllocator { @Deprecated @InterfaceAudience.LimitedPrivate({"MapReduce"}) public static void removeContext(String contextCfgItemName) { synchronized (contexts) { contexts.remove(contextCfgItemName); } } LocalDirAllocator(String contextCfgItemName); Path getLocalPathForWrite(String pathStr,
Configuration c... |
@Test public void testgetChecksumLength() throws Exception { assertEquals(8, ChecksumFileSystem.getChecksumLength(0L, 512)); assertEquals(12, ChecksumFileSystem.getChecksumLength(1L, 512)); assertEquals(12, ChecksumFileSystem.getChecksumLength(512L, 512)); assertEquals(16, ChecksumFileSystem.getChecksumLength(513L, 512... | public static long getChecksumLength(long size, int bytesPerSum) { return ((size + bytesPerSum - 1) / bytesPerSum) * 4 + CHECKSUM_VERSION.length + 4; } | ChecksumFileSystem extends FilterFileSystem { public static long getChecksumLength(long size, int bytesPerSum) { return ((size + bytesPerSum - 1) / bytesPerSum) * 4 + CHECKSUM_VERSION.length + 4; } } | ChecksumFileSystem extends FilterFileSystem { public static long getChecksumLength(long size, int bytesPerSum) { return ((size + bytesPerSum - 1) / bytesPerSum) * 4 + CHECKSUM_VERSION.length + 4; } ChecksumFileSystem(FileSystem fs); } | ChecksumFileSystem extends FilterFileSystem { public static long getChecksumLength(long size, int bytesPerSum) { return ((size + bytesPerSum - 1) / bytesPerSum) * 4 + CHECKSUM_VERSION.length + 4; } ChecksumFileSystem(FileSystem fs); static double getApproxChkSumLength(long size); void setConf(Configuration conf); void ... | ChecksumFileSystem extends FilterFileSystem { public static long getChecksumLength(long size, int bytesPerSum) { return ((size + bytesPerSum - 1) / bytesPerSum) * 4 + CHECKSUM_VERSION.length + 4; } ChecksumFileSystem(FileSystem fs); static double getApproxChkSumLength(long size); void setConf(Configuration conf); void ... |
@Test public void testMultiChunkFile() throws Exception { Path testPath = new Path(TEST_ROOT_DIR, "testMultiChunk"); FSDataOutputStream fout = localFs.create(testPath); for (int i = 0; i < 1000; i++) { fout.write(("testing" + i).getBytes()); } fout.close(); readFile(localFs, testPath, 128); readFile(localFs, testPath, ... | @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return create(f, permission, overwrite, true, bufferSize, replication, blockSize, progress); } | ChecksumFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return create(f, permission, overwrite, true, bufferSize, replication, blockSize, pr... | ChecksumFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return create(f, permission, overwrite, true, bufferSize, replication, blockSize, pr... | ChecksumFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return create(f, permission, overwrite, true, bufferSize, replication, blockSize, pr... | ChecksumFileSystem extends FilterFileSystem { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { return create(f, permission, overwrite, true, bufferSize, replication, blockSize, pr... |
@Test public void testRenameFileIntoDir() throws Exception { Path srcPath = new Path(TEST_ROOT_DIR, "testRenameSrc"); Path dstPath = new Path(TEST_ROOT_DIR, "testRenameDir"); localFs.mkdirs(dstPath); verifyRename(srcPath, dstPath, true); } | @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } } | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } ChecksumFileSystem(FileSystem fs); } | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } ChecksumFileSystem(FileSystem fs); static double getApproxChkSumLength(long size); void setConf(Configuration conf); void setVerifyChecksum(boolean verifyChecksum); @Override void setWriteCh... | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } ChecksumFileSystem(FileSystem fs); static double getApproxChkSumLength(long size); void setConf(Configuration conf); void setVerifyChecksum(boolean verifyChecksum); @Override void setWriteCh... |
@Test public void testRenameFileIntoDirFile() throws Exception { Path srcPath = new Path(TEST_ROOT_DIR, "testRenameSrc"); Path dstPath = new Path(TEST_ROOT_DIR, "testRenameDir/testRenameDst"); assertTrue(localFs.mkdirs(dstPath)); verifyRename(srcPath, dstPath, false); } | @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } } | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } ChecksumFileSystem(FileSystem fs); } | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } ChecksumFileSystem(FileSystem fs); static double getApproxChkSumLength(long size); void setConf(Configuration conf); void setVerifyChecksum(boolean verifyChecksum); @Override void setWriteCh... | ChecksumFileSystem extends FilterFileSystem { @Override public boolean mkdirs(Path f) throws IOException { return fs.mkdirs(f); } ChecksumFileSystem(FileSystem fs); static double getApproxChkSumLength(long size); void setConf(Configuration conf); void setVerifyChecksum(boolean verifyChecksum); @Override void setWriteCh... |
@Test public void testNoCompression() throws IOException { assertEquals(4000, createTestV2Block(NONE, includesMemstoreTS). getBlockForCaching().getUncompressedSizeWithoutHeader()); } | public int getUncompressedSizeWithoutHeader() { return uncompressedSizeWithoutHeader; } | HFileBlock extends SchemaConfigured implements Cacheable { public int getUncompressedSizeWithoutHeader() { return uncompressedSizeWithoutHeader; } } | HFileBlock extends SchemaConfigured implements Cacheable { public int getUncompressedSizeWithoutHeader() { return uncompressedSizeWithoutHeader; } HFileBlock(BlockType blockType, int onDiskSizeWithoutHeader,
int uncompressedSizeWithoutHeader, long prevBlockOffset, ByteBuffer buf,
boolean fillHeader, long of... | HFileBlock extends SchemaConfigured implements Cacheable { public int getUncompressedSizeWithoutHeader() { return uncompressedSizeWithoutHeader; } HFileBlock(BlockType blockType, int onDiskSizeWithoutHeader,
int uncompressedSizeWithoutHeader, long prevBlockOffset, ByteBuffer buf,
boolean fillHeader, long of... | HFileBlock extends SchemaConfigured implements Cacheable { public int getUncompressedSizeWithoutHeader() { return uncompressedSizeWithoutHeader; } HFileBlock(BlockType blockType, int onDiskSizeWithoutHeader,
int uncompressedSizeWithoutHeader, long prevBlockOffset, ByteBuffer buf,
boolean fillHeader, long of... |
@Test public void testGetDU() throws IOException { setupDirs(); long du = FileUtil.getDU(TEST_DIR); Assert.assertEquals(du, 8); } | public static long getDU(File dir) { long size = 0; if (!dir.exists()) return 0; if (!dir.isDirectory()) { return dir.length(); } else { File[] allFiles = dir.listFiles(); if(allFiles != null) { for (int i = 0; i < allFiles.length; i++) { boolean isSymLink; try { isSymLink = org.apache.commons.io.FileUtils.isSymlink(al... | FileUtil { public static long getDU(File dir) { long size = 0; if (!dir.exists()) return 0; if (!dir.isDirectory()) { return dir.length(); } else { File[] allFiles = dir.listFiles(); if(allFiles != null) { for (int i = 0; i < allFiles.length; i++) { boolean isSymLink; try { isSymLink = org.apache.commons.io.FileUtils.i... | FileUtil { public static long getDU(File dir) { long size = 0; if (!dir.exists()) return 0; if (!dir.isDirectory()) { return dir.length(); } else { File[] allFiles = dir.listFiles(); if(allFiles != null) { for (int i = 0; i < allFiles.length; i++) { boolean isSymLink; try { isSymLink = org.apache.commons.io.FileUtils.i... | FileUtil { public static long getDU(File dir) { long size = 0; if (!dir.exists()) return 0; if (!dir.isDirectory()) { return dir.length(); } else { File[] allFiles = dir.listFiles(); if(allFiles != null) { for (int i = 0; i < allFiles.length; i++) { boolean isSymLink; try { isSymLink = org.apache.commons.io.FileUtils.i... | FileUtil { public static long getDU(File dir) { long size = 0; if (!dir.exists()) return 0; if (!dir.isDirectory()) { return dir.length(); } else { File[] allFiles = dir.listFiles(); if(allFiles != null) { for (int i = 0; i < allFiles.length; i++) { boolean isSymLink; try { isSymLink = org.apache.commons.io.FileUtils.i... |
@Test public void testReaderV1() throws IOException { for (Compression.Algorithm algo : COMPRESSION_ALGORITHMS) { for (boolean pread : new boolean[] { false, true }) { byte[] block = createTestV1Block(algo); Path path = new Path(TEST_UTIL.getDataTestDir(), "blocks_v1_"+ algo); LOG.info("Creating temporary file at " + p... | void sanityCheck() throws IOException { buf.rewind(); { BlockType blockTypeFromBuf = BlockType.read(buf); if (blockTypeFromBuf != blockType) { throw new IOException("Block type stored in the buffer: " + blockTypeFromBuf + ", block type field: " + blockType); } } sanityCheckAssertion(buf.getInt(), onDiskSizeWithoutHeade... | HFileBlock extends SchemaConfigured implements Cacheable { void sanityCheck() throws IOException { buf.rewind(); { BlockType blockTypeFromBuf = BlockType.read(buf); if (blockTypeFromBuf != blockType) { throw new IOException("Block type stored in the buffer: " + blockTypeFromBuf + ", block type field: " + blockType); } ... | HFileBlock extends SchemaConfigured implements Cacheable { void sanityCheck() throws IOException { buf.rewind(); { BlockType blockTypeFromBuf = BlockType.read(buf); if (blockTypeFromBuf != blockType) { throw new IOException("Block type stored in the buffer: " + blockTypeFromBuf + ", block type field: " + blockType); } ... | HFileBlock extends SchemaConfigured implements Cacheable { void sanityCheck() throws IOException { buf.rewind(); { BlockType blockTypeFromBuf = BlockType.read(buf); if (blockTypeFromBuf != blockType) { throw new IOException("Block type stored in the buffer: " + blockTypeFromBuf + ", block type field: " + blockType); } ... | HFileBlock extends SchemaConfigured implements Cacheable { void sanityCheck() throws IOException { buf.rewind(); { BlockType blockTypeFromBuf = BlockType.read(buf); if (blockTypeFromBuf != blockType) { throw new IOException("Block type stored in the buffer: " + blockTypeFromBuf + ", block type field: " + blockType); } ... |
@Test public void testEquals() throws Exception { UserGroupInformation uugi = UserGroupInformation.createUserForTesting(USER_NAME, GROUP_NAMES); assertEquals(uugi, uugi); UserGroupInformation ugi2 = UserGroupInformation.createUserForTesting(USER_NAME, GROUP_NAMES); assertFalse(uugi.equals(ugi2)); assertFalse(uugi.hashC... | @Override public boolean equals(Object o) { if (o == this) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } else { return subject == ((UserGroupInformation) o).subject; } } | UserGroupInformation { @Override public boolean equals(Object o) { if (o == this) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } else { return subject == ((UserGroupInformation) o).subject; } } } | UserGroupInformation { @Override public boolean equals(Object o) { if (o == this) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } else { return subject == ((UserGroupInformation) o).subject; } } UserGroupInformation(Subject subject); } | UserGroupInformation { @Override public boolean equals(Object o) { if (o == this) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } else { return subject == ((UserGroupInformation) o).subject; } } UserGroupInformation(Subject subject); @InterfaceAudience.Public @InterfaceStability.Evo... | UserGroupInformation { @Override public boolean equals(Object o) { if (o == this) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } else { return subject == ((UserGroupInformation) o).subject; } } UserGroupInformation(Subject subject); @InterfaceAudience.Public @InterfaceStability.Evo... |
@SuppressWarnings("unchecked") @Test public <T extends TokenIdentifier> void testAddToken() throws Exception { UserGroupInformation ugi = UserGroupInformation.createRemoteUser("someone"); Token<T> t1 = mock(Token.class); Token<T> t2 = mock(Token.class); Token<T> t3 = mock(Token.class); ugi.addToken(t1); checkTokens(ugi... | public synchronized boolean addToken(Token<? extends TokenIdentifier> token) { return (token != null) ? addToken(token.getService(), token) : false; } | UserGroupInformation { public synchronized boolean addToken(Token<? extends TokenIdentifier> token) { return (token != null) ? addToken(token.getService(), token) : false; } } | UserGroupInformation { public synchronized boolean addToken(Token<? extends TokenIdentifier> token) { return (token != null) ? addToken(token.getService(), token) : false; } UserGroupInformation(Subject subject); } | UserGroupInformation { public synchronized boolean addToken(Token<? extends TokenIdentifier> token) { return (token != null) ? addToken(token.getService(), token) : false; } UserGroupInformation(Subject subject); @InterfaceAudience.Public @InterfaceStability.Evolving static void setConfiguration(Configuration conf); st... | UserGroupInformation { public synchronized boolean addToken(Token<? extends TokenIdentifier> token) { return (token != null) ? addToken(token.getService(), token) : false; } UserGroupInformation(Subject subject); @InterfaceAudience.Public @InterfaceStability.Evolving static void setConfiguration(Configuration conf); st... |
@Test public void testExtractPassword() throws IOException { File testDir = new File(System.getProperty("test.build.data", "target/test-dir")); testDir.mkdirs(); File secretFile = new File(testDir, "secret.txt"); Writer writer = new FileWriter(secretFile); writer.write("hadoop"); writer.close(); LdapGroupsMapping mappi... | String extractPassword(String pwFile) { if (pwFile.isEmpty()) { return ""; } try { StringBuilder password = new StringBuilder(); Reader reader = new FileReader(pwFile); int c = reader.read(); while (c > -1) { password.append((char)c); c = reader.read(); } reader.close(); return password.toString(); } catch (IOException... | LdapGroupsMapping implements GroupMappingServiceProvider, Configurable { String extractPassword(String pwFile) { if (pwFile.isEmpty()) { return ""; } try { StringBuilder password = new StringBuilder(); Reader reader = new FileReader(pwFile); int c = reader.read(); while (c > -1) { password.append((char)c); c = reader.r... | LdapGroupsMapping implements GroupMappingServiceProvider, Configurable { String extractPassword(String pwFile) { if (pwFile.isEmpty()) { return ""; } try { StringBuilder password = new StringBuilder(); Reader reader = new FileReader(pwFile); int c = reader.read(); while (c > -1) { password.append((char)c); c = reader.r... | LdapGroupsMapping implements GroupMappingServiceProvider, Configurable { String extractPassword(String pwFile) { if (pwFile.isEmpty()) { return ""; } try { StringBuilder password = new StringBuilder(); Reader reader = new FileReader(pwFile); int c = reader.read(); while (c > -1) { password.append((char)c); c = reader.r... | LdapGroupsMapping implements GroupMappingServiceProvider, Configurable { String extractPassword(String pwFile) { if (pwFile.isEmpty()) { return ""; } try { StringBuilder password = new StringBuilder(); Reader reader = new FileReader(pwFile); int c = reader.read(); while (c > -1) { password.append((char)c); c = reader.r... |
@Test public void addAll() { Credentials creds = new Credentials(); creds.addToken(service[0], token[0]); creds.addToken(service[1], token[1]); creds.addSecretKey(secret[0], secret[0].getBytes()); creds.addSecretKey(secret[1], secret[1].getBytes()); Credentials credsToAdd = new Credentials(); credsToAdd.addToken(servic... | public void addAll(Credentials other) { addAll(other, true); } | Credentials implements Writable { public void addAll(Credentials other) { addAll(other, true); } } | Credentials implements Writable { public void addAll(Credentials other) { addAll(other, true); } Credentials(); Credentials(Credentials credentials); } | Credentials implements Writable { public void addAll(Credentials other) { addAll(other, true); } Credentials(); Credentials(Credentials credentials); byte[] getSecretKey(Text alias); Token<? extends TokenIdentifier> getToken(Text alias); void addToken(Text alias, Token<? extends TokenIdentifier> t); Collection<Token<?... | Credentials implements Writable { public void addAll(Credentials other) { addAll(other, true); } Credentials(); Credentials(Credentials credentials); byte[] getSecretKey(Text alias); Token<? extends TokenIdentifier> getToken(Text alias); void addToken(Text alias, Token<? extends TokenIdentifier> t); Collection<Token<?... |
@Test public void mergeAll() { Credentials creds = new Credentials(); creds.addToken(service[0], token[0]); creds.addToken(service[1], token[1]); creds.addSecretKey(secret[0], secret[0].getBytes()); creds.addSecretKey(secret[1], secret[1].getBytes()); Credentials credsToAdd = new Credentials(); credsToAdd.addToken(serv... | public void mergeAll(Credentials other) { addAll(other, false); } | Credentials implements Writable { public void mergeAll(Credentials other) { addAll(other, false); } } | Credentials implements Writable { public void mergeAll(Credentials other) { addAll(other, false); } Credentials(); Credentials(Credentials credentials); } | Credentials implements Writable { public void mergeAll(Credentials other) { addAll(other, false); } Credentials(); Credentials(Credentials credentials); byte[] getSecretKey(Text alias); Token<? extends TokenIdentifier> getToken(Text alias); void addToken(Text alias, Token<? extends TokenIdentifier> t); Collection<Toke... | Credentials implements Writable { public void mergeAll(Credentials other) { addAll(other, false); } Credentials(); Credentials(Credentials credentials); byte[] getSecretKey(Text alias); Token<? extends TokenIdentifier> getToken(Text alias); void addToken(Text alias, Token<? extends TokenIdentifier> t); Collection<Toke... |
@Test public void isOriginalTGTReturnsCorrectValues() { assertTrue(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("krbtgt/foo@foo"))); assertTrue(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("krbtgt/foo.bar.bat@foo.bar.bat"))); assertFalse(SecurityUtil.isTGSPrincipal (null)); assertFalse(SecurityUtil.isTGSPri... | static boolean isTGSPrincipal(KerberosPrincipal principal) { if (principal == null) return false; if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; } return false; } | SecurityUtil { static boolean isTGSPrincipal(KerberosPrincipal principal) { if (principal == null) return false; if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; } return false; } } | SecurityUtil { static boolean isTGSPrincipal(KerberosPrincipal principal) { if (principal == null) return false; if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; } return false; } } | SecurityUtil { static boolean isTGSPrincipal(KerberosPrincipal principal) { if (principal == null) return false; if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; } return false; } @InterfaceAudience.Public @InterfaceStability.Evolving static String getServer... | SecurityUtil { static boolean isTGSPrincipal(KerberosPrincipal principal) { if (principal == null) return false; if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; } return false; } @InterfaceAudience.Public @InterfaceStability.Evolving static String getServer... |
@Test public void testGetServerPrincipal() throws IOException { String service = "hdfs/"; String realm = "@REALM"; String hostname = "foohost"; String userPrincipal = "foo@FOOREALM"; String shouldReplace = service + SecurityUtil.HOSTNAME_PATTERN + realm; String replaced = service + hostname + realm; verify(shouldReplac... | @InterfaceAudience.Public @InterfaceStability.Evolving public static String getServerPrincipal(String principalConfig, String hostname) throws IOException { String[] components = getComponents(principalConfig); if (components == null || components.length != 3 || !components[1].equals(HOSTNAME_PATTERN)) { return princip... | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static String getServerPrincipal(String principalConfig, String hostname) throws IOException { String[] components = getComponents(principalConfig); if (components == null || components.length != 3 || !components[1].equals(HOSTNAME_PATTERN)) {... | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static String getServerPrincipal(String principalConfig, String hostname) throws IOException { String[] components = getComponents(principalConfig); if (components == null || components.length != 3 || !components[1].equals(HOSTNAME_PATTERN)) {... | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static String getServerPrincipal(String principalConfig, String hostname) throws IOException { String[] components = getComponents(principalConfig); if (components == null || components.length != 3 || !components[1].equals(HOSTNAME_PATTERN)) {... | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static String getServerPrincipal(String principalConfig, String hostname) throws IOException { String[] components = getComponents(principalConfig); if (components == null || components.length != 3 || !components[1].equals(HOSTNAME_PATTERN)) {... |
@Test public void testStartsWithIncorrectSettings() throws IOException { Configuration conf = new Configuration(); conf.set( org.apache.hadoop.fs.CommonConfigurationKeys.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); String keyTabKey="key"; conf.set(keyTabKey, ""); UserGroupInformation.setConfiguration(conf); boolean got... | @InterfaceAudience.Public @InterfaceStability.Evolving public static void login(final Configuration conf, final String keytabFileKey, final String userNameKey) throws IOException { login(conf, keytabFileKey, userNameKey, getLocalHostName()); } | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static void login(final Configuration conf, final String keytabFileKey, final String userNameKey) throws IOException { login(conf, keytabFileKey, userNameKey, getLocalHostName()); } } | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static void login(final Configuration conf, final String keytabFileKey, final String userNameKey) throws IOException { login(conf, keytabFileKey, userNameKey, getLocalHostName()); } } | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static void login(final Configuration conf, final String keytabFileKey, final String userNameKey) throws IOException { login(conf, keytabFileKey, userNameKey, getLocalHostName()); } @InterfaceAudience.Public @InterfaceStability.Evolving stati... | SecurityUtil { @InterfaceAudience.Public @InterfaceStability.Evolving public static void login(final Configuration conf, final String keytabFileKey, final String userNameKey) throws IOException { login(conf, keytabFileKey, userNameKey, getLocalHostName()); } @InterfaceAudience.Public @InterfaceStability.Evolving stati... |
@Test public void testBlockHeapSize() { if (ClassSize.is32BitJVM()) { assertTrue(HFileBlock.BYTE_BUFFER_HEAP_SIZE == 64); } else { assertTrue(HFileBlock.BYTE_BUFFER_HEAP_SIZE == 80); } for (int size : new int[] { 100, 256, 12345 }) { byte[] byteArr = new byte[HFileBlock.HEADER_SIZE_WITH_CHECKSUMS + size]; ByteBuffer bu... | @Override public long heapSize() { long size = ClassSize.align( SCHEMA_CONFIGURED_UNALIGNED_HEAP_SIZE + 2 * ClassSize.REFERENCE + 6 * Bytes.SIZEOF_INT + 1 * Bytes.SIZEOF_BYTE + 2 * Bytes.SIZEOF_LONG + Bytes.SIZEOF_BOOLEAN ); if (buf != null) { size += ClassSize.align(buf.capacity() + BYTE_BUFFER_HEAP_SIZE); } return Cl... | HFileBlock extends SchemaConfigured implements Cacheable { @Override public long heapSize() { long size = ClassSize.align( SCHEMA_CONFIGURED_UNALIGNED_HEAP_SIZE + 2 * ClassSize.REFERENCE + 6 * Bytes.SIZEOF_INT + 1 * Bytes.SIZEOF_BYTE + 2 * Bytes.SIZEOF_LONG + Bytes.SIZEOF_BOOLEAN ); if (buf != null) { size += ClassSize... | HFileBlock extends SchemaConfigured implements Cacheable { @Override public long heapSize() { long size = ClassSize.align( SCHEMA_CONFIGURED_UNALIGNED_HEAP_SIZE + 2 * ClassSize.REFERENCE + 6 * Bytes.SIZEOF_INT + 1 * Bytes.SIZEOF_BYTE + 2 * Bytes.SIZEOF_LONG + Bytes.SIZEOF_BOOLEAN ); if (buf != null) { size += ClassSize... | HFileBlock extends SchemaConfigured implements Cacheable { @Override public long heapSize() { long size = ClassSize.align( SCHEMA_CONFIGURED_UNALIGNED_HEAP_SIZE + 2 * ClassSize.REFERENCE + 6 * Bytes.SIZEOF_INT + 1 * Bytes.SIZEOF_BYTE + 2 * Bytes.SIZEOF_LONG + Bytes.SIZEOF_BOOLEAN ); if (buf != null) { size += ClassSize... | HFileBlock extends SchemaConfigured implements Cacheable { @Override public long heapSize() { long size = ClassSize.align( SCHEMA_CONFIGURED_UNALIGNED_HEAP_SIZE + 2 * ClassSize.REFERENCE + 6 * Bytes.SIZEOF_INT + 1 * Bytes.SIZEOF_BYTE + 2 * Bytes.SIZEOF_LONG + Bytes.SIZEOF_BOOLEAN ); if (buf != null) { size += ClassSize... |
@Test public void testGetHostFromPrincipal() { assertEquals("host", SecurityUtil.getHostFromPrincipal("service/host@realm")); assertEquals(null, SecurityUtil.getHostFromPrincipal("service@realm")); } | public static String getHostFromPrincipal(String principalName) { return new HadoopKerberosName(principalName).getHostName(); } | SecurityUtil { public static String getHostFromPrincipal(String principalName) { return new HadoopKerberosName(principalName).getHostName(); } } | SecurityUtil { public static String getHostFromPrincipal(String principalName) { return new HadoopKerberosName(principalName).getHostName(); } } | SecurityUtil { public static String getHostFromPrincipal(String principalName) { return new HadoopKerberosName(principalName).getHostName(); } @InterfaceAudience.Public @InterfaceStability.Evolving static String getServerPrincipal(String principalConfig,
String hostname); @InterfaceAudience.Public @InterfaceStab... | SecurityUtil { public static String getHostFromPrincipal(String principalName) { return new HadoopKerberosName(principalName).getHostName(); } @InterfaceAudience.Public @InterfaceStability.Evolving static String getServerPrincipal(String principalConfig,
String hostname); @InterfaceAudience.Public @InterfaceStab... |
@Test public void testBuildDTServiceName() { SecurityUtil.setTokenServiceUseIp(true); assertEquals("127.0.0.1:123", SecurityUtil.buildDTServiceName(URI.create("test: ); assertEquals("127.0.0.1:123", SecurityUtil.buildDTServiceName(URI.create("test: ); assertEquals("127.0.0.1:123", SecurityUtil.buildDTServiceName(URI.cr... | public static String buildDTServiceName(URI uri, int defPort) { String authority = uri.getAuthority(); if (authority == null) { return null; } InetSocketAddress addr = NetUtils.createSocketAddr(authority, defPort); return buildTokenService(addr).toString(); } | SecurityUtil { public static String buildDTServiceName(URI uri, int defPort) { String authority = uri.getAuthority(); if (authority == null) { return null; } InetSocketAddress addr = NetUtils.createSocketAddr(authority, defPort); return buildTokenService(addr).toString(); } } | SecurityUtil { public static String buildDTServiceName(URI uri, int defPort) { String authority = uri.getAuthority(); if (authority == null) { return null; } InetSocketAddress addr = NetUtils.createSocketAddr(authority, defPort); return buildTokenService(addr).toString(); } } | SecurityUtil { public static String buildDTServiceName(URI uri, int defPort) { String authority = uri.getAuthority(); if (authority == null) { return null; } InetSocketAddress addr = NetUtils.createSocketAddr(authority, defPort); return buildTokenService(addr).toString(); } @InterfaceAudience.Public @InterfaceStabilit... | SecurityUtil { public static String buildDTServiceName(URI uri, int defPort) { String authority = uri.getAuthority(); if (authority == null) { return null; } InetSocketAddress addr = NetUtils.createSocketAddr(authority, defPort); return buildTokenService(addr).toString(); } @InterfaceAudience.Public @InterfaceStabilit... |
@Test public void testStandaloneClient() throws IOException { try { TestProtocol proxy = RPC.waitForProxy(TestProtocol.class, TestProtocol.versionID, new InetSocketAddress(ADDRESS, 20), conf, 15000L); proxy.echo(""); fail("We should not have reached here"); } catch (ConnectException ioe) { } } | public static <T> T waitForProxy( Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf ) throws IOException { return waitForProtocolProxy(protocol, clientVersion, addr, conf).getProxy(); } | RPC { public static <T> T waitForProxy( Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf ) throws IOException { return waitForProtocolProxy(protocol, clientVersion, addr, conf).getProxy(); } } | RPC { public static <T> T waitForProxy( Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf ) throws IOException { return waitForProtocolProxy(protocol, clientVersion, addr, conf).getProxy(); } private RPC(); } | RPC { public static <T> T waitForProxy( Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf ) throws IOException { return waitForProtocolProxy(protocol, clientVersion, addr, conf).getProxy(); } private RPC(); static String getProtocolName(Class<?> protocol); static long getProtocolVersion... | RPC { public static <T> T waitForProxy( Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf ) throws IOException { return waitForProtocolProxy(protocol, clientVersion, addr, conf).getProxy(); } private RPC(); static String getProtocolName(Class<?> protocol); static long getProtocolVersion... |
@Test(expected=HadoopIllegalArgumentException.class) public void testStopNonRegisteredProxy() throws Exception { RPC.stopProxy(null); } | public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler instanceo... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... |
@Test public void testStopMockObject() throws Exception { RPC.stopProxy(MockitoUtil.mockProtocol(TestProtocol.class)); } | public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler instanceo... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... |
@Test public void testStopProxy() throws IOException { StoppedProtocol proxy = (StoppedProtocol) RPC.getProxy(StoppedProtocol.class, StoppedProtocol.versionID, null, conf); StoppedInvocationHandler invocationHandler = (StoppedInvocationHandler) Proxy.getInvocationHandler(proxy); assertEquals(invocationHandler.getCloseC... | public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler instanceo... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... | RPC { public static void stopProxy(Object proxy) { if (proxy == null) { throw new HadoopIllegalArgumentException( "Cannot close proxy since it is null"); } try { if (proxy instanceof Closeable) { ((Closeable) proxy).close(); return; } else { InvocationHandler handler = Proxy.getInvocationHandler(proxy); if (handler ins... |
@Test public void testBind() throws Exception { Configuration conf = new Configuration(); ServerSocket socket = new ServerSocket(); InetSocketAddress address = new InetSocketAddress("0.0.0.0",0); socket.bind(address); try { int min = socket.getLocalPort(); int max = min + 100; conf.set("TestRange", min+"-"+max); Server... | public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... |
@Test public void testBindSimple() throws Exception { ServerSocket socket = new ServerSocket(); InetSocketAddress address = new InetSocketAddress("0.0.0.0",0); Server.bind(socket, address, 10); try { assertTrue(socket.isBound()); } finally { socket.close(); } } | public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... |
@Test public void testEmptyConfig() throws Exception { Configuration conf = new Configuration(); conf.set("TestRange", ""); ServerSocket socket = new ServerSocket(); InetSocketAddress address = new InetSocketAddress("0.0.0.0", 0); try { Server.bind(socket, address, 10, conf, "TestRange"); assertTrue(socket.isBound()); ... | public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... |
@Test public void testBindError() throws Exception { Configuration conf = new Configuration(); ServerSocket socket = new ServerSocket(); InetSocketAddress address = new InetSocketAddress("0.0.0.0",0); socket.bind(address); try { int min = socket.getLocalPort(); conf.set("TestRange", min+"-"+min); ServerSocket socket2 =... | public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } } | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... | Server { public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { bind(socket, address, backlog, null, null); } protected Server(String bindAddress, int port,
Class<? extends Writable> paramClass, int handlerCount,
Configuration conf... |
@Test public void testHalfScanAndReseek() throws IOException { HBaseTestingUtility test_util = new HBaseTestingUtility(); String root_dir = test_util.getDataTestDir("TestHalfStoreFile").toString(); Path p = new Path(root_dir, "test"); Configuration conf = test_util.getConfiguration(); FileSystem fs = FileSystem.get(con... | @Override public byte[] midkey() throws IOException { return null; } | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } } | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } HalfStoreFileReader(final FileSystem fs, final Path p,
final CacheConfig cacheConf, final Reference r,
DataBlockEncoding preferredEncodingInCache); HalfStoreFileReader(final FileSystem fs, fi... | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } HalfStoreFileReader(final FileSystem fs, final Path p,
final CacheConfig cacheConf, final Reference r,
DataBlockEncoding preferredEncodingInCache); HalfStoreFileReader(final FileSystem fs, fi... | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } HalfStoreFileReader(final FileSystem fs, final Path p,
final CacheConfig cacheConf, final Reference r,
DataBlockEncoding preferredEncodingInCache); HalfStoreFileReader(final FileSystem fs, fi... |
@Test(timeout=180000) public void testSocketPathSetGet() throws IOException { Assert.assertEquals("/var/run/hdfs/sock.100", DomainSocket.getEffectivePath("/var/run/hdfs/sock._PORT", 100)); } | public static String getEffectivePath(String path, int port) { return path.replace("_PORT", String.valueOf(port)); } | DomainSocket implements Closeable { public static String getEffectivePath(String path, int port) { return path.replace("_PORT", String.valueOf(port)); } } | DomainSocket implements Closeable { public static String getEffectivePath(String path, int port) { return path.replace("_PORT", String.valueOf(port)); } private DomainSocket(String path, int fd); } | DomainSocket implements Closeable { public static String getEffectivePath(String path, int port) { return path.replace("_PORT", String.valueOf(port)); } private DomainSocket(String path, int fd); static String getLoadingFailureReason(); @VisibleForTesting static void disableBindPathValidation(); static String getEffec... | DomainSocket implements Closeable { public static String getEffectivePath(String path, int port) { return path.replace("_PORT", String.valueOf(port)); } private DomainSocket(String path, int fd); static String getLoadingFailureReason(); @VisibleForTesting static void disableBindPathValidation(); static String getEffec... |
@Test(timeout=180000) public void testInvalidOperations() throws IOException { try { DomainSocket.connect( new File(sockDir.getDir(), "test_sock_invalid_operation"). getAbsolutePath()); } catch (IOException e) { GenericTestUtils.assertExceptionContains("connect(2) error: ", e); } } | public static DomainSocket connect(String path) throws IOException { if (loadingFailureReason != null) { throw new UnsupportedOperationException(loadingFailureReason); } int fd = connect0(path); return new DomainSocket(path, fd); } | DomainSocket implements Closeable { public static DomainSocket connect(String path) throws IOException { if (loadingFailureReason != null) { throw new UnsupportedOperationException(loadingFailureReason); } int fd = connect0(path); return new DomainSocket(path, fd); } } | DomainSocket implements Closeable { public static DomainSocket connect(String path) throws IOException { if (loadingFailureReason != null) { throw new UnsupportedOperationException(loadingFailureReason); } int fd = connect0(path); return new DomainSocket(path, fd); } private DomainSocket(String path, int fd); } | DomainSocket implements Closeable { public static DomainSocket connect(String path) throws IOException { if (loadingFailureReason != null) { throw new UnsupportedOperationException(loadingFailureReason); } int fd = connect0(path); return new DomainSocket(path, fd); } private DomainSocket(String path, int fd); static S... | DomainSocket implements Closeable { public static DomainSocket connect(String path) throws IOException { if (loadingFailureReason != null) { throw new UnsupportedOperationException(loadingFailureReason); } int fd = connect0(path); return new DomainSocket(path, fd); } private DomainSocket(String path, int fd); static S... |
@Test public void testSocketIOWithTimeout() throws Exception { Pipe pipe = Pipe.open(); Pipe.SourceChannel source = pipe.source(); Pipe.SinkChannel sink = pipe.sink(); try { final InputStream in = new SocketInputStream(source, TIMEOUT); OutputStream out = new SocketOutputStream(sink, TIMEOUT); byte[] writeBytes = TEST_... | SocketIOWithTimeout(SelectableChannel channel, long timeout) throws IOException { checkChannelValidity(channel); this.channel = channel; this.timeout = timeout; channel.configureBlocking(false); } | SocketIOWithTimeout { SocketIOWithTimeout(SelectableChannel channel, long timeout) throws IOException { checkChannelValidity(channel); this.channel = channel; this.timeout = timeout; channel.configureBlocking(false); } } | SocketIOWithTimeout { SocketIOWithTimeout(SelectableChannel channel, long timeout) throws IOException { checkChannelValidity(channel); this.channel = channel; this.timeout = timeout; channel.configureBlocking(false); } SocketIOWithTimeout(SelectableChannel channel, long timeout); } | SocketIOWithTimeout { SocketIOWithTimeout(SelectableChannel channel, long timeout) throws IOException { checkChannelValidity(channel); this.channel = channel; this.timeout = timeout; channel.configureBlocking(false); } SocketIOWithTimeout(SelectableChannel channel, long timeout); void setTimeout(long timeoutMs); } | SocketIOWithTimeout { SocketIOWithTimeout(SelectableChannel channel, long timeout) throws IOException { checkChannelValidity(channel); this.channel = channel; this.timeout = timeout; channel.configureBlocking(false); } SocketIOWithTimeout(SelectableChannel channel, long timeout); void setTimeout(long timeoutMs); } |
@Test public void testFilenameMeansMultiSwitch() throws Throwable { Configuration conf = new Configuration(); conf.set(ScriptBasedMapping.SCRIPT_FILENAME_KEY, "any-filename"); ScriptBasedMapping mapping = createMapping(conf); assertFalse("Expected to be multi switch", mapping.isSingleSwitch()); mapping.setConf(new Conf... | @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); } | ScriptBasedMapping extends CachedDNSToSwitchMapping { @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); } } | ScriptBasedMapping extends CachedDNSToSwitchMapping { @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); } ScriptBasedMapping(); ScriptBasedMapping(Configuration conf); } | ScriptBasedMapping extends CachedDNSToSwitchMapping { @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); } ScriptBasedMapping(); ScriptBasedMapping(Configuration conf); @Override Configuration getConf(); @Override String toString(); @Override void setConf(Configurat... | ScriptBasedMapping extends CachedDNSToSwitchMapping { @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); } ScriptBasedMapping(); ScriptBasedMapping(Configuration conf); @Override Configuration getConf(); @Override String toString(); @Override void setConf(Configurat... |
@Test public void testGetLocalInetAddress() throws Exception { assertNotNull(NetUtils.getLocalInetAddress("127.0.0.1")); assertNull(NetUtils.getLocalInetAddress("invalid-address-for-test")); assertNull(NetUtils.getLocalInetAddress(null)); } | public static InetAddress getLocalInetAddress(String host) throws SocketException { if (host == null) { return null; } InetAddress addr = null; try { addr = SecurityUtil.getByName(host); if (NetworkInterface.getByInetAddress(addr) == null) { addr = null; } } catch (UnknownHostException ignore) { } return addr; } | NetUtils { public static InetAddress getLocalInetAddress(String host) throws SocketException { if (host == null) { return null; } InetAddress addr = null; try { addr = SecurityUtil.getByName(host); if (NetworkInterface.getByInetAddress(addr) == null) { addr = null; } } catch (UnknownHostException ignore) { } return add... | NetUtils { public static InetAddress getLocalInetAddress(String host) throws SocketException { if (host == null) { return null; } InetAddress addr = null; try { addr = SecurityUtil.getByName(host); if (NetworkInterface.getByInetAddress(addr) == null) { addr = null; } } catch (UnknownHostException ignore) { } return add... | NetUtils { public static InetAddress getLocalInetAddress(String host) throws SocketException { if (host == null) { return null; } InetAddress addr = null; try { addr = SecurityUtil.getByName(host); if (NetworkInterface.getByInetAddress(addr) == null) { addr = null; } } catch (UnknownHostException ignore) { } return add... | NetUtils { public static InetAddress getLocalInetAddress(String host) throws SocketException { if (host == null) { return null; } InetAddress addr = null; try { addr = SecurityUtil.getByName(host); if (NetworkInterface.getByInetAddress(addr) == null) { addr = null; } } catch (UnknownHostException ignore) { } return add... |
@Test(expected=UnknownHostException.class) public void testVerifyHostnamesException() throws UnknownHostException { String[] names = {"valid.host.com", "1.com", "invalid host here"}; NetUtils.verifyHostnames(names); } | public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e) { uri = n... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... |
@Test public void testHalfScanner() throws IOException { HBaseTestingUtility test_util = new HBaseTestingUtility(); String root_dir = test_util.getDataTestDir("TestHalfStoreFileScanBefore").toString(); Path p = new Path(root_dir, "test"); Configuration conf = test_util.getConfiguration(); FileSystem fs = FileSystem.get... | @Override public byte[] midkey() throws IOException { return null; } | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } } | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } HalfStoreFileReader(final FileSystem fs, final Path p,
final CacheConfig cacheConf, final Reference r,
DataBlockEncoding preferredEncodingInCache); HalfStoreFileReader(final FileSystem fs, fi... | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } HalfStoreFileReader(final FileSystem fs, final Path p,
final CacheConfig cacheConf, final Reference r,
DataBlockEncoding preferredEncodingInCache); HalfStoreFileReader(final FileSystem fs, fi... | HalfStoreFileReader extends StoreFile.Reader { @Override public byte[] midkey() throws IOException { return null; } HalfStoreFileReader(final FileSystem fs, final Path p,
final CacheConfig cacheConf, final Reference r,
DataBlockEncoding preferredEncodingInCache); HalfStoreFileReader(final FileSystem fs, fi... |
@Test public void testVerifyHostnamesNoException() { String[] names = {"valid.host.com", "1.com"}; try { NetUtils.verifyHostnames(names); } catch (UnknownHostException e) { fail("NetUtils.verifyHostnames threw unexpected UnknownHostException"); } } | public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e) { uri = n... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... | NetUtils { public static void verifyHostnames(String[] names) throws UnknownHostException { for (String name: names) { if (name == null) { throw new UnknownHostException("null hostname found"); } URI uri = null; try { uri = new URI(name); if (uri.getHost() == null) { uri = new URI("http: } } catch (URISyntaxException e... |
@Test public void testIsLocalAddress() throws Exception { assertTrue(NetUtils.isLocalAddress(InetAddress.getLocalHost())); Enumeration<NetworkInterface> interfaces = NetworkInterface .getNetworkInterfaces(); if (interfaces != null) { while (interfaces.hasMoreElements()) { NetworkInterface i = interfaces.nextElement(); ... | public static boolean isLocalAddress(InetAddress addr) { boolean local = addr.isAnyLocalAddress() || addr.isLoopbackAddress(); if (!local) { try { local = NetworkInterface.getByInetAddress(addr) != null; } catch (SocketException e) { local = false; } } return local; } | NetUtils { public static boolean isLocalAddress(InetAddress addr) { boolean local = addr.isAnyLocalAddress() || addr.isLoopbackAddress(); if (!local) { try { local = NetworkInterface.getByInetAddress(addr) != null; } catch (SocketException e) { local = false; } } return local; } } | NetUtils { public static boolean isLocalAddress(InetAddress addr) { boolean local = addr.isAnyLocalAddress() || addr.isLoopbackAddress(); if (!local) { try { local = NetworkInterface.getByInetAddress(addr) != null; } catch (SocketException e) { local = false; } } return local; } } | NetUtils { public static boolean isLocalAddress(InetAddress addr) { boolean local = addr.isAnyLocalAddress() || addr.isLoopbackAddress(); if (!local) { try { local = NetworkInterface.getByInetAddress(addr) != null; } catch (SocketException e) { local = false; } } return local; } static SocketFactory getSocketFactory(C... | NetUtils { public static boolean isLocalAddress(InetAddress addr) { boolean local = addr.isAnyLocalAddress() || addr.isLoopbackAddress(); if (!local) { try { local = NetworkInterface.getByInetAddress(addr) != null; } catch (SocketException e) { local = false; } } return local; } static SocketFactory getSocketFactory(C... |
@Test public void testGetConnectAddress() throws IOException { NetUtils.addStaticResolution("host", "127.0.0.1"); InetSocketAddress addr = NetUtils.createSocketAddrForHost("host", 1); InetSocketAddress connectAddr = NetUtils.getConnectAddress(addr); assertEquals(addr.getHostName(), connectAddr.getHostName()); addr = ne... | public static InetSocketAddress getConnectAddress(Server server) { return getConnectAddress(server.getListenerAddress()); } | NetUtils { public static InetSocketAddress getConnectAddress(Server server) { return getConnectAddress(server.getListenerAddress()); } } | NetUtils { public static InetSocketAddress getConnectAddress(Server server) { return getConnectAddress(server.getListenerAddress()); } } | NetUtils { public static InetSocketAddress getConnectAddress(Server server) { return getConnectAddress(server.getListenerAddress()); } static SocketFactory getSocketFactory(Configuration conf,
Class<?> clazz); static SocketFactory getDefaultSocketFactory(Configuration conf); static SocketFactory getSocketFactory... | NetUtils { public static InetSocketAddress getConnectAddress(Server server) { return getConnectAddress(server.getListenerAddress()); } static SocketFactory getSocketFactory(Configuration conf,
Class<?> clazz); static SocketFactory getDefaultSocketFactory(Configuration conf); static SocketFactory getSocketFactory... |
@Test public void testCreateSocketAddress() throws Throwable { InetSocketAddress addr = NetUtils.createSocketAddr( "127.0.0.1:12345", 1000, "myconfig"); assertEquals("127.0.0.1", addr.getAddress().getHostAddress()); assertEquals(12345, addr.getPort()); addr = NetUtils.createSocketAddr( "127.0.0.1", 1000, "myconfig"); a... | public static InetSocketAddress createSocketAddr(String target) { return createSocketAddr(target, -1); } | NetUtils { public static InetSocketAddress createSocketAddr(String target) { return createSocketAddr(target, -1); } } | NetUtils { public static InetSocketAddress createSocketAddr(String target) { return createSocketAddr(target, -1); } } | NetUtils { public static InetSocketAddress createSocketAddr(String target) { return createSocketAddr(target, -1); } static SocketFactory getSocketFactory(Configuration conf,
Class<?> clazz); static SocketFactory getDefaultSocketFactory(Configuration conf); static SocketFactory getSocketFactoryFromProperty(
... | NetUtils { public static InetSocketAddress createSocketAddr(String target) { return createSocketAddr(target, -1); } static SocketFactory getSocketFactory(Configuration conf,
Class<?> clazz); static SocketFactory getDefaultSocketFactory(Configuration conf); static SocketFactory getSocketFactoryFromProperty(
... |
@Test public void testCanonicalUriWithPort() { URI uri; uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: uri = NetUtils.getCanonicalUri(URI.create("sc... | public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost, (port == -... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... |
@Test public void testCanonicalUriWithDefaultPort() { URI uri; uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: uri = NetUtils.getCanonicalUri(URI.cre... | public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost, (port == -... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... |
@Test public void testCanonicalUriWithPath() { URI uri; uri = NetUtils.getCanonicalUri(URI.create("path"), 2); assertEquals("path", uri.toString()); uri = NetUtils.getCanonicalUri(URI.create("/path"), 2); assertEquals("/path", uri.toString()); } | public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost, (port == -... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... |
@Test public void testCanonicalUriWithNoAuthority() { URI uri; uri = NetUtils.getCanonicalUri(URI.create("scheme:/"), 2); assertEquals("scheme:/", uri.toString()); uri = NetUtils.getCanonicalUri(URI.create("scheme:/path"), 2); assertEquals("scheme:/path", uri.toString()); uri = NetUtils.getCanonicalUri(URI.create("sche... | public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost, (port == -... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... |
@Test public void testCanonicalUriWithNoHost() { URI uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: } | public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost, (port == -... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... |
@Test public void testCanonicalUriWithNoPortNoDefaultPort() { URI uri = NetUtils.getCanonicalUri(URI.create("scheme: assertEquals("scheme: } | public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost, (port == -... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... | NetUtils { public static URI getCanonicalUri(URI uri, int defaultPort) { String host = uri.getHost(); if (host == null) { return uri; } String fqHost = canonicalizeHost(host); int port = uri.getPort(); if (host.equals(fqHost) && port != -1) { return uri; } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), fqHost,... |
@Test public void testHashCode() { HServerAddress hsa1 = new HServerAddress("localhost", 1234); HServerAddress hsa2 = new HServerAddress("localhost", 1234); assertEquals(hsa1.hashCode(), hsa2.hashCode()); HServerAddress hsa3 = new HServerAddress("localhost", 1235); assertNotSame(hsa1.hashCode(), hsa3.hashCode()); } | @Override public int hashCode() { int result = address == null? 0: address.hashCode(); result ^= toString().hashCode(); return result; } | HServerAddress implements WritableComparable<HServerAddress> { @Override public int hashCode() { int result = address == null? 0: address.hashCode(); result ^= toString().hashCode(); return result; } } | HServerAddress implements WritableComparable<HServerAddress> { @Override public int hashCode() { int result = address == null? 0: address.hashCode(); result ^= toString().hashCode(); return result; } HServerAddress(); HServerAddress(InetSocketAddress address); HServerAddress(final String hostname, final int port); H... | HServerAddress implements WritableComparable<HServerAddress> { @Override public int hashCode() { int result = address == null? 0: address.hashCode(); result ^= toString().hashCode(); return result; } HServerAddress(); HServerAddress(InetSocketAddress address); HServerAddress(final String hostname, final int port); H... | HServerAddress implements WritableComparable<HServerAddress> { @Override public int hashCode() { int result = address == null? 0: address.hashCode(); result ^= toString().hashCode(); return result; } HServerAddress(); HServerAddress(InetSocketAddress address); HServerAddress(final String hostname, final int port); H... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.