Search in sources :

Example 1 with RegisterResultType

use of org.apache.cxf.xkms.model.xkms.RegisterResultType in project cxf by apache.

the class XKMSServiceTest method testEmptyRegister.

@Test
public void testEmptyRegister() throws URISyntaxException, Exception {
    RegisterRequestType request = new RegisterRequestType();
    setGenericRequestParams(request);
    RegisterResultType result = xkmsService.register(request);
    Assert.assertEquals(ResultMajorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_SENDER.value(), result.getResultMajor());
    Assert.assertEquals(ResultMinorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_FAILURE.value(), result.getResultMinor());
}
Also used : RegisterResultType(org.apache.cxf.xkms.model.xkms.RegisterResultType) RegisterRequestType(org.apache.cxf.xkms.model.xkms.RegisterRequestType) BasicIntegrationTest(org.apache.cxf.xkms.itests.BasicIntegrationTest) Test(org.junit.Test)

Example 2 with RegisterResultType

use of org.apache.cxf.xkms.model.xkms.RegisterResultType in project cxf by apache.

the class XKRSSDisableTest method testRegisterShouldBeDisabled.

@Test
public void testRegisterShouldBeDisabled() {
    RegisterRequestType request = new RegisterRequestType();
    request.setService(XKMSConstants.XKMS_ENDPOINT_NAME);
    request.setId(UUID.randomUUID().toString());
    RegisterResultType result = xkmsService.register(request);
    Assert.assertEquals(ResultMajorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_SENDER.value(), result.getResultMajor());
    Assert.assertEquals(ResultMinorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_MESSAGE_NOT_SUPPORTED.value(), result.getResultMinor());
    ResultDetails message = (ResultDetails) result.getMessageExtension().get(0);
    Assert.assertEquals("XKRSS Operations are disabled", message.getDetails());
}
Also used : ResultDetails(org.apache.cxf.xkms.model.extensions.ResultDetails) RegisterResultType(org.apache.cxf.xkms.model.xkms.RegisterResultType) RegisterRequestType(org.apache.cxf.xkms.model.xkms.RegisterRequestType) BasicIntegrationTest(org.apache.cxf.xkms.itests.BasicIntegrationTest) Test(org.junit.Test)

Example 3 with RegisterResultType

use of org.apache.cxf.xkms.model.xkms.RegisterResultType in project cxf by apache.

the class XKMSService method register.

@Override
public RegisterResultType register(RegisterRequestType request) {
    RegisterResultType response = XKMSResponseFactory.createResponse(request, new RegisterResultType());
    try {
        assertXKRSSAllowed();
        validateRequest(request);
        for (Register handler : keyRegisterHandlers) {
            if (handler.canProcess(request)) {
                return handler.register(request, response);
            }
        }
        throw new UnsupportedOperationException("Service was unable to handle your request");
    } catch (Exception e) {
        return handleException("register", e, response);
    }
}
Also used : RegisterResultType(org.apache.cxf.xkms.model.xkms.RegisterResultType) Register(org.apache.cxf.xkms.handlers.Register)

Example 4 with RegisterResultType

use of org.apache.cxf.xkms.model.xkms.RegisterResultType in project cxf by apache.

the class CheckXKRSS method checkRegisterWithoutXKRSS.

@Test
public void checkRegisterWithoutXKRSS() {
    RegisterRequestType request = new RegisterRequestType();
    request.setId("1");
    request.setService(XKMSConstants.XKMS_ENDPOINT_NAME);
    createXKMSService(false).register(request);
    RegisterResultType result = createXKMSService(false).register(request);
    assertNotSupported(result);
}
Also used : RegisterResultType(org.apache.cxf.xkms.model.xkms.RegisterResultType) RegisterRequestType(org.apache.cxf.xkms.model.xkms.RegisterRequestType) Test(org.junit.Test)

Example 5 with RegisterResultType

use of org.apache.cxf.xkms.model.xkms.RegisterResultType in project cxf by apache.

the class XKMSServiceTest method testRegisterWithoutKey.

@Test
public void testRegisterWithoutKey() throws URISyntaxException, Exception {
    RegisterRequestType request = new RegisterRequestType();
    setGenericRequestParams(request);
    PrototypeKeyBindingType binding = new PrototypeKeyBindingType();
    KeyInfoType keyInfo = new KeyInfoType();
    binding.setKeyInfo(keyInfo);
    request.setPrototypeKeyBinding(binding);
    RegisterResultType result = xkmsService.register(request);
    Assert.assertEquals(ResultMajorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_SENDER.value(), result.getResultMajor());
    Assert.assertEquals(ResultMinorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_FAILURE.value(), result.getResultMinor());
}
Also used : RegisterResultType(org.apache.cxf.xkms.model.xkms.RegisterResultType) PrototypeKeyBindingType(org.apache.cxf.xkms.model.xkms.PrototypeKeyBindingType) RegisterRequestType(org.apache.cxf.xkms.model.xkms.RegisterRequestType) KeyInfoType(org.apache.cxf.xkms.model.xmldsig.KeyInfoType) BasicIntegrationTest(org.apache.cxf.xkms.itests.BasicIntegrationTest) Test(org.junit.Test)

Aggregations

RegisterResultType (org.apache.cxf.xkms.model.xkms.RegisterResultType)7 RegisterRequestType (org.apache.cxf.xkms.model.xkms.RegisterRequestType)6 Test (org.junit.Test)5 BasicIntegrationTest (org.apache.cxf.xkms.itests.BasicIntegrationTest)3 Register (org.apache.cxf.xkms.handlers.Register)2 ArrayList (java.util.ArrayList)1 ResultDetails (org.apache.cxf.xkms.model.extensions.ResultDetails)1 PrototypeKeyBindingType (org.apache.cxf.xkms.model.xkms.PrototypeKeyBindingType)1 RecoverRequestType (org.apache.cxf.xkms.model.xkms.RecoverRequestType)1 RecoverResultType (org.apache.cxf.xkms.model.xkms.RecoverResultType)1 ReissueRequestType (org.apache.cxf.xkms.model.xkms.ReissueRequestType)1 ReissueResultType (org.apache.cxf.xkms.model.xkms.ReissueResultType)1 RequestAbstractType (org.apache.cxf.xkms.model.xkms.RequestAbstractType)1 RevokeRequestType (org.apache.cxf.xkms.model.xkms.RevokeRequestType)1 RevokeResultType (org.apache.cxf.xkms.model.xkms.RevokeResultType)1 KeyInfoType (org.apache.cxf.xkms.model.xmldsig.KeyInfoType)1