@Override public boolean isAbsent(AlluxioURI path) { MountInfo mountInfo = getMountInfo(path); if (mountInfo == null) { return false; } AlluxioURI mountBaseUri = mountInfo.getAlluxioUri(); while (path != null && !path.equals(mountBaseUri)) { Long cached = mCache.getIfPresent(path.getPath()); if (cached != null && cached == mountInfo.getMountId()) { return true; } path = path.getParent(); } // Reached the root, without finding anything in the cache. return false; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MountInfo)) { return false; } MountInfo that = (MountInfo) o; return mMountId == that.getMountId() && mAlluxioUri.equals(that.getAlluxioUri()) && mUfsUri.equals(that.getUfsUri()) && mOptions.getReadOnly() == (that.getOptions().getReadOnly()) && mOptions.getShared() == (that.getOptions().getShared()); }
AlluxioURI source = new AlluxioURI(config.getSource()); AlluxioURI destination = new AlluxioURI(config.getDestination()); if (source.equals(destination)) { return new HashMap<WorkerInfo, ArrayList<MoveCommand>>();
/** * Tests the {@link AlluxioURI#equals(Object)} method for multi-component schemes. */ @Test public void multiPartSchemeEquals() { assertTrue(new AlluxioURI("scheme:part1://127.0.0.1:3306/a.txt") .equals(new AlluxioURI("scheme:part1://127.0.0.1:3306/a.txt"))); assertFalse(new AlluxioURI("part1://127.0.0.1:3306/a.txt") .equals(new AlluxioURI("scheme:part1://127.0.0.1:3306/a.txt"))); assertFalse(new AlluxioURI("scheme:part1://127.0.0.1:3306/a.txt") .equals(new AlluxioURI("part1://127.0.0.1:3306/a.txt"))); assertTrue(new AlluxioURI("scheme:part1:part2://127.0.0.1:3306/a.txt") .equals(new AlluxioURI("scheme:part1:part2://127.0.0.1:3306/a.txt"))); assertFalse(new AlluxioURI("part2://127.0.0.1:3306/a.txt") .equals(new AlluxioURI("scheme:part1:part2://127.0.0.1:3306/a.txt"))); assertFalse(new AlluxioURI("scheme:part1:part2://127.0.0.1:3306/a.txt") .equals(new AlluxioURI("part2://127.0.0.1:3306/a.txt"))); }
/** * Tests the {@link AlluxioURI#equals(Object)} method with query component. */ @Test public void queryEquals() { Map<String, String> queryMap = new HashMap<>(); queryMap.put("a", "b"); queryMap.put("c", "d"); assertTrue(new AlluxioURI("scheme://host:123/a.txt?a=b&c=d") .equals(new AlluxioURI("scheme://host:123/a.txt?a=b&c=d"))); // There is no guarantee which order the queryMap will create the query string. assertTrue(new AlluxioURI("scheme://host:123/a.txt?c=d&a=b") .equals(new AlluxioURI("scheme", Authority.fromString("host:123"), "/a.txt", queryMap)) || new AlluxioURI("scheme://host:123/a.txt?a=b&c=d") .equals(new AlluxioURI("scheme", Authority.fromString("host:123"), "/a.txt", queryMap))); assertFalse(new AlluxioURI("scheme://host:123/a.txt?a=b&c=d&e=f") .equals(new AlluxioURI("scheme://host:123/a.txt?a=b&c=d"))); assertFalse(new AlluxioURI("scheme://host:123/a.txt?a=b&c=d&e=f") .equals(new AlluxioURI("scheme", Authority.fromString("host:123"), "/a.txt", queryMap))); }
/** * Tests the {@link AlluxioURI#equals(Object)} method. */ @Test public void equalsTests() { assertFalse(new AlluxioURI("alluxio://127.0.0.1:8080/a/b/c.txt").equals(new AlluxioURI( "alluxio://localhost:8080/a/b/c.txt"))); AlluxioURI[] uriFromDifferentConstructor = new AlluxioURI[] {new AlluxioURI("alluxio://127.0.0.1:8080/a/b/c.txt"), new AlluxioURI("alluxio", Authority.fromString("127.0.0.1:8080"), "/a/b/c.txt"), new AlluxioURI( new AlluxioURI("alluxio://127.0.0.1:8080/a"), new AlluxioURI("b/c.txt"))}; for (int i = 0; i < uriFromDifferentConstructor.length - 1; i++) { assertTrue(uriFromDifferentConstructor[i].equals(uriFromDifferentConstructor[i + 1])); } }
if (srcInodePath.getUri().equals(dstInodePath.getUri())) { return;
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MountInfo)) { return false; } MountInfo that = (MountInfo) o; return mMountId == that.getMountId() && mAlluxioUri.equals(that.getAlluxioUri()) && mUfsUri.equals(that.getUfsUri()) && mOptions.equals(that.getOptions()); }
@Override public boolean isAbsent(AlluxioURI path) { MountInfo mountInfo = getMountInfo(path); if (mountInfo == null) { return false; } AlluxioURI mountBaseUri = mountInfo.getAlluxioUri(); while (path != null && !path.equals(mountBaseUri)) { Long cached = mCache.getIfPresent(path.getPath()); if (cached != null && cached == mountInfo.getMountId()) { return true; } path = path.getParent(); } // Reached the root, without finding anything in the cache. return false; }
if (srcInodePath.getUri().equals(dstInodePath.getUri())) { return;