use of org.dcache.xrootd.protocol.messages.OpenRequest in project dcache-cta by dCache.
the class DataServerHandlerTest method testOpenForStage.
@Test
public void testOpenForStage() throws XrootdException, IOException {
var stageRequest = mockedStageRequest();
var buf = new ByteBufBuilder().withShort(// stream id
1).withShort(XrootdProtocol.kXR_open).withShort(0).withShort(XrootdProtocol.kXR_delete | XrootdProtocol.kXR_new).withZeros(// padding
12).withString("0000C9B4E3768770452E8B1B8E0232584872", UTF_8).build();
OpenRequest msg = new OpenRequest(buf);
handler.doOnOpen(ctx, msg);
assertTrue(new File(stageRequest.getReplicaUri()).exists());
}
use of org.dcache.xrootd.protocol.messages.OpenRequest in project dcache-cta by dCache.
the class DataServerHandlerTest method testOpenForWriteFlushRequest.
@Test(expected = XrootdException.class)
public void testOpenForWriteFlushRequest() throws XrootdException, IOException {
mockedFlushRequest();
var buf = new ByteBufBuilder().withShort(// stream id
1).withShort(XrootdProtocol.kXR_open).withShort(0).withShort(XrootdProtocol.kXR_delete | XrootdProtocol.kXR_new | XrootdProtocol.kXR_writable).withZeros(// padding
12).withString("0000C9B4E3768770452E8B1B8E0232584872", UTF_8).build();
OpenRequest msg = new OpenRequest(buf);
handler.doOnOpen(ctx, msg);
}
use of org.dcache.xrootd.protocol.messages.OpenRequest in project dcache-cta by dCache.
the class DataServerHandlerTest method testOpenForFlushDontExists.
@Test(expected = XrootdException.class)
public void testOpenForFlushDontExists() throws XrootdException, IOException {
var stageRequest = mockedFlushRequest();
var buf = new ByteBufBuilder().withShort(// stream id
1).withShort(XrootdProtocol.kXR_open).withShort(0).withShort(XrootdProtocol.kXR_open_read).withZeros(// padding
12).withString("0000C9B4E3768770452E8B1B8E0232584872", UTF_8).build();
new File(stageRequest.getReplicaUri()).delete();
OpenRequest msg = new OpenRequest(buf);
handler.doOnOpen(ctx, msg);
}
use of org.dcache.xrootd.protocol.messages.OpenRequest in project dcache-cta by dCache.
the class DataServerHandlerTest method testOpenWithoutRequests.
@Test(expected = XrootdException.class)
public void testOpenWithoutRequests() throws XrootdException {
var buf = new ByteBufBuilder().withShort(// stream id
1).withShort(XrootdProtocol.kXR_open).withShort(0).withShort(XrootdProtocol.kXR_open_read | XrootdProtocol.kXR_retstat).withZeros(// padding
12).withString("0000C9B4E3768770452E8B1B8E0232584872", UTF_8).build();
OpenRequest msg = new OpenRequest(buf);
handler.doOnOpen(ctx, msg);
}
use of org.dcache.xrootd.protocol.messages.OpenRequest in project dcache-cta by dCache.
the class DataServerHandlerTest method testOpenForFlush.
@Test
public void testOpenForFlush() throws XrootdException, IOException {
var stageRequest = mockedFlushRequest();
var buf = new ByteBufBuilder().withShort(// stream id
1).withShort(XrootdProtocol.kXR_open).withShort(0).withShort(XrootdProtocol.kXR_open_read).withZeros(// padding
12).withString("0000C9B4E3768770452E8B1B8E0232584872", UTF_8).build();
OpenRequest msg = new OpenRequest(buf);
handler.doOnOpen(ctx, msg);
}
Aggregations