use of org.dcache.vehicles.PnfsGetFileAttributes 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.vehicles.PnfsGetFileAttributes 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.vehicles.PnfsGetFileAttributes in project dcache by dCache.
the class PnfsManagerTest method testGetAlAndRpWhenMissing.
@Test
public void testGetAlAndRpWhenMissing() {
PnfsCreateEntryMessage pnfsCreateEntryMessage = new PnfsCreateEntryMessage("/pnfs/testRoot/testGetAlAndRpWhenMissing", FileAttributes.ofFileType(REGULAR));
_pnfsManager.createEntry(pnfsCreateEntryMessage);
assertTrue("failed to create an entry", pnfsCreateEntryMessage.getReturnCode() == 0);
PnfsGetFileAttributes request = new PnfsGetFileAttributes(pnfsCreateEntryMessage.getPnfsId(), EnumSet.of(FileAttribute.ACCESS_LATENCY, FileAttribute.RETENTION_POLICY));
_pnfsManager.getFileAttributes(request);
assertThat(request.getReturnCode(), is(0));
assertThat(request.getFileAttributes().getAccessLatency(), is(AccessLatency.NEARLINE));
assertThat(request.getFileAttributes().getRetentionPolicy(), is(RetentionPolicy.CUSTODIAL));
}
use of org.dcache.vehicles.PnfsGetFileAttributes in project dcache by dCache.
the class PnfsManagerTest method testNoAtimeUpdateOnGetFileAttributesNegativeGap.
@Test
public void testNoAtimeUpdateOnGetFileAttributesNegativeGap() throws ChimeraFsException {
FsInode inode = _fs.createFile("/file1");
Stat stat_before = inode.stat();
_pnfsManager.setAtimeGap(-1);
PnfsGetFileAttributes message = new PnfsGetFileAttributes(new PnfsId(inode.getId()), SOME_ATTRIBUTES);
message.setUpdateAtime(true);
_pnfsManager.getFileAttributes(message);
Stat stat_after = inode.stat();
assertTrue("atime is updated, but shouldn't", stat_after.getATime() == stat_before.getATime());
}
use of org.dcache.vehicles.PnfsGetFileAttributes in project dcache by dCache.
the class PnfsManagerTest method testGetFileAttributesNonExist.
@Test
public void testGetFileAttributesNonExist() {
PnfsGetFileAttributes message = new PnfsGetFileAttributes(new PnfsId(FsInode.generateNewID()), EnumSet.noneOf(FileAttribute.class));
_pnfsManager.getFileAttributes(message);
assertTrue("get storageInfo of non existing file should return FILE_NOT_FOUND", message.getReturnCode() == CacheException.FILE_NOT_FOUND);
}
Aggregations