Search in sources :

Example 1 with OpenRequest

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());
}
Also used : OpenRequest(org.dcache.xrootd.protocol.messages.OpenRequest) File.createTempFile(java.io.File.createTempFile) File(java.io.File) Test(org.junit.Test)

Example 2 with OpenRequest

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);
}
Also used : OpenRequest(org.dcache.xrootd.protocol.messages.OpenRequest) Test(org.junit.Test)

Example 3 with OpenRequest

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);
}
Also used : OpenRequest(org.dcache.xrootd.protocol.messages.OpenRequest) File.createTempFile(java.io.File.createTempFile) File(java.io.File) Test(org.junit.Test)

Example 4 with OpenRequest

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);
}
Also used : OpenRequest(org.dcache.xrootd.protocol.messages.OpenRequest) Test(org.junit.Test)

Example 5 with OpenRequest

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);
}
Also used : OpenRequest(org.dcache.xrootd.protocol.messages.OpenRequest) Test(org.junit.Test)

Aggregations

OpenRequest (org.dcache.xrootd.protocol.messages.OpenRequest)7 Test (org.junit.Test)6 File (java.io.File)2 File.createTempFile (java.io.File.createTempFile)2 NetLoggerBuilder (org.dcache.util.NetLoggerBuilder)1 XrootdProtocol.kXR_chkpoint (org.dcache.xrootd.protocol.XrootdProtocol.kXR_chkpoint)1 CloseRequest (org.dcache.xrootd.protocol.messages.CloseRequest)1 EndSessionRequest (org.dcache.xrootd.protocol.messages.EndSessionRequest)1 ErrorResponse (org.dcache.xrootd.protocol.messages.ErrorResponse)1 LocateRequest (org.dcache.xrootd.protocol.messages.LocateRequest)1 LoginRequest (org.dcache.xrootd.protocol.messages.LoginRequest)1 LoginResponse (org.dcache.xrootd.protocol.messages.LoginResponse)1 MkDirRequest (org.dcache.xrootd.protocol.messages.MkDirRequest)1 MvRequest (org.dcache.xrootd.protocol.messages.MvRequest)1 OpenResponse (org.dcache.xrootd.protocol.messages.OpenResponse)1 PathRequest (org.dcache.xrootd.protocol.messages.PathRequest)1 PrepareRequest (org.dcache.xrootd.protocol.messages.PrepareRequest)1 QueryRequest (org.dcache.xrootd.protocol.messages.QueryRequest)1 ReadRequest (org.dcache.xrootd.protocol.messages.ReadRequest)1 ReadVRequest (org.dcache.xrootd.protocol.messages.ReadVRequest)1