use of org.dcache.auth.Subjects.ROOT in project dcache by dCache.
the class RemoteNameSpaceProviderTests method shouldSucceedForPathToPnfsidWithKnownPathAndResolvingSymlinks.
@Test
public void shouldSucceedForPathToPnfsidWithKnownPathAndResolvingSymlinks() throws Exception {
givenSuccessfulResponse((Modifier<PnfsGetFileAttributes>) (m) -> m.setFileAttributes(FileAttributes.ofPnfsId(A_PNFSID)));
PnfsId id = _namespace.pathToPnfsid(ROOT, "/path/to/entry", true);
PnfsGetFileAttributes sent = getSingleSendAndWaitMessage(PnfsGetFileAttributes.class);
assertThat(sent.getReplyRequired(), is(true));
assertThat(sent.getSubject(), is(ROOT));
assertThat(sent.getPnfsPath(), is("/path/to/entry"));
assertThat(sent.getPnfsId(), nullValue());
assertThat(sent.isFollowSymlink(), is(true));
assertThat(id, is(A_PNFSID));
}
use of org.dcache.auth.Subjects.ROOT in project dcache by dCache.
the class RemoteNameSpaceProviderTests method shouldSucceedWhenGetCacheLocationForFileWithTwoLocations.
@Test
public void shouldSucceedWhenGetCacheLocationForFileWithTwoLocations() throws Exception {
givenSuccessfulResponse((Modifier<PnfsGetCacheLocationsMessage>) (r) -> r.setCacheLocations(Lists.newArrayList("pool-1", "pool-2")));
List<String> locations = _namespace.getCacheLocation(ROOT, A_PNFSID);
PnfsGetCacheLocationsMessage sent = getSingleSendAndWaitMessage(PnfsGetCacheLocationsMessage.class);
assertThat(sent.getReplyRequired(), is(true));
assertThat(sent.getSubject(), is(ROOT));
assertThat(sent.getPnfsId(), is(A_PNFSID));
assertThat(locations, hasSize(2));
assertThat(locations, hasItem("pool-1"));
assertThat(locations, hasItem("pool-2"));
}
use of org.dcache.auth.Subjects.ROOT in project dcache by dCache.
the class RemoteNameSpaceProviderTests method shouldSucceedForPathToPnfsidWithKnownPathAndNotResolvingSymlinks.
@Test
public void shouldSucceedForPathToPnfsidWithKnownPathAndNotResolvingSymlinks() throws Exception {
givenSuccessfulResponse((Modifier<PnfsGetFileAttributes>) (m) -> m.setFileAttributes(FileAttributes.ofPnfsId(A_PNFSID)));
PnfsId id = _namespace.pathToPnfsid(ROOT, "/path/to/entry", false);
PnfsGetFileAttributes sent = getSingleSendAndWaitMessage(PnfsGetFileAttributes.class);
assertThat(sent.getReplyRequired(), is(true));
assertThat(sent.getSubject(), is(ROOT));
assertThat(sent.getPnfsPath(), is("/path/to/entry"));
assertThat(sent.getPnfsId(), nullValue());
assertThat(sent.isFollowSymlink(), is(false));
assertThat(id, is(A_PNFSID));
}
use of org.dcache.auth.Subjects.ROOT in project dcache by dCache.
the class RemoteNameSpaceProviderTests method shouldSucceedForFindExistingEntry.
@Test
public void shouldSucceedForFindExistingEntry() throws Exception {
givenSuccessfulResponse((Modifier<PnfsGetParentMessage>) (r) -> r.addLocation(ANOTHER_PNFSID, "file"));
Collection<Link> locations = _namespace.find(ROOT, A_PNFSID);
PnfsGetParentMessage sent = getSingleSendAndWaitMessage(PnfsGetParentMessage.class);
assertThat(sent.getReplyRequired(), is(true));
assertThat(sent.getSubject(), is(ROOT));
assertThat(sent.getPnfsId(), is(A_PNFSID));
assertThat(locations.size(), is(1));
Link location = locations.iterator().next();
assertThat(location.getParent(), is(ANOTHER_PNFSID));
assertThat(location.getName(), is("file"));
}
use of org.dcache.auth.Subjects.ROOT in project dcache by dCache.
the class RemoteNameSpaceProviderTests method shouldSucceedWhenGetCacheLocationForFileWithOneLocation.
@Test
public void shouldSucceedWhenGetCacheLocationForFileWithOneLocation() throws Exception {
givenSuccessfulResponse((Modifier<PnfsGetCacheLocationsMessage>) (r) -> r.setCacheLocations(Collections.singletonList("pool-1")));
List<String> locations = _namespace.getCacheLocation(ROOT, A_PNFSID);
PnfsGetCacheLocationsMessage sent = getSingleSendAndWaitMessage(PnfsGetCacheLocationsMessage.class);
assertThat(sent.getReplyRequired(), is(true));
assertThat(sent.getSubject(), is(ROOT));
assertThat(sent.getPnfsId(), is(A_PNFSID));
assertThat(locations, hasSize(1));
assertThat(locations, hasItem("pool-1"));
}
Aggregations