Search in sources :

Example 1 with JaxrsMethodParameterProcessor

use of org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor in project wildfly by wildfly.

the class JaxrsMethodParameterProcessorTestCase method primitiveParameterTest.

/**
 * Check the primitive datatypes are not processed by any converter.
 * @throws Exception
 */
@Test
public void primitiveParameterTest() throws Exception {
    providers.clear();
    resources.clear();
    providers.add(SimpleClassParamConverterProvider.class.getName());
    resources.add(PrimitiveParamResource.class.getName());
    JaxrsMethodParameterProcessor jProcessor = new JaxrsMethodParameterProcessor();
    try {
        jProcessor.testProcessor(Thread.currentThread().getContextClassLoader(), resteasyDeploymentData);
    } catch (Exception e) {
        Assert.fail("Test failed no exception should have been thrown");
    }
}
Also used : PrimitiveParamResource(org.jboss.as.jaxrs.rsources.PrimitiveParamResource) SimpleClassParamConverterProvider(org.jboss.as.jaxrs.rsources.SimpleClassParamConverterProvider) JaxrsMethodParameterProcessor(org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor) Test(org.junit.Test)

Example 2 with JaxrsMethodParameterProcessor

use of org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor in project wildfly by wildfly.

the class JaxrsMethodParameterProcessorTestCase method fromStringTest.

@Test
public void fromStringTest() throws Exception {
    providers.clear();
    resources.clear();
    providers.add(SimpleFromStringProvider.class.getName());
    resources.add(SimpleFromStringResource.class.getName());
    JaxrsMethodParameterProcessor jProcessor = new JaxrsMethodParameterProcessor();
    try {
        jProcessor.testProcessor(Thread.currentThread().getContextClassLoader(), resteasyDeploymentData);
    } catch (Exception e) {
        Assert.fail("Test failed.  It should not have thrown an exception: " + e);
    }
}
Also used : SimpleFromStringProvider(org.jboss.as.jaxrs.rsources.SimpleFromStringProvider) JaxrsMethodParameterProcessor(org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor) SimpleFromStringResource(org.jboss.as.jaxrs.rsources.SimpleFromStringResource) Test(org.junit.Test)

Example 3 with JaxrsMethodParameterProcessor

use of org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor in project wildfly by wildfly.

the class JaxrsSubsystemAdd method performBoottime.

protected void performBoottime(final OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
    final ServiceTarget serviceTarget = context.getServiceTarget();
    JaxrsLogger.JAXRS_LOGGER.resteasyVersion(ResteasyDeployment.class.getPackage().getImplementationVersion());
    context.addStep(new AbstractDeploymentChainStep() {

        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_JAXRS_ANNOTATIONS, new JaxrsAnnotationProcessor());
            processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JAXRS_SPRING, new JaxrsSpringProcessor(serviceTarget));
            processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JAXRS, new JaxrsDependencyProcessor());
            processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_SCANNING, new JaxrsScanningProcessor());
            processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_COMPONENT, new JaxrsComponentDeployer());
            CapabilityServiceSupport capabilities = context.getCapabilityServiceSupport();
            if (capabilities.hasCapability(WELD_CAPABILITY_NAME)) {
                processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_CDI_INTEGRATION, new JaxrsCdiIntegrationProcessor());
            }
            processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_METHOD_PARAMETER, new JaxrsMethodParameterProcessor());
            processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_JAXRS_DEPLOYMENT, new JaxrsIntegrationProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    JaxrsServerConfig serverConfig = createServerConfig(operation, context);
    JaxrsServerConfigService.install(serviceTarget, serverConfig);
}
Also used : JaxrsIntegrationProcessor(org.jboss.as.jaxrs.deployment.JaxrsIntegrationProcessor) JaxrsAnnotationProcessor(org.jboss.as.jaxrs.deployment.JaxrsAnnotationProcessor) JaxrsScanningProcessor(org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor) ServiceTarget(org.jboss.msc.service.ServiceTarget) JaxrsSpringProcessor(org.jboss.as.jaxrs.deployment.JaxrsSpringProcessor) JaxrsComponentDeployer(org.jboss.as.jaxrs.deployment.JaxrsComponentDeployer) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) JaxrsDependencyProcessor(org.jboss.as.jaxrs.deployment.JaxrsDependencyProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) JaxrsCdiIntegrationProcessor(org.jboss.as.jaxrs.deployment.JaxrsCdiIntegrationProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) JaxrsMethodParameterProcessor(org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor)

Example 4 with JaxrsMethodParameterProcessor

use of org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor in project wildfly by wildfly.

the class JaxrsMethodParameterProcessorTestCase method valueOfTest.

@Test
public void valueOfTest() throws Exception {
    providers.clear();
    resources.clear();
    providers.add(SimpleValueOfProvider.class.getName());
    resources.add(SimpleValueOfResource.class.getName());
    JaxrsMethodParameterProcessor jProcessor = new JaxrsMethodParameterProcessor();
    try {
        jProcessor.testProcessor(Thread.currentThread().getContextClassLoader(), resteasyDeploymentData);
    } catch (Exception e) {
        Assert.fail("Test failed.  It should not have thrown an exception: " + e);
    }
}
Also used : SimpleValueOfResource(org.jboss.as.jaxrs.rsources.SimpleValueOfResource) JaxrsMethodParameterProcessor(org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor) SimpleValueOfProvider(org.jboss.as.jaxrs.rsources.SimpleValueOfProvider) Test(org.junit.Test)

Example 5 with JaxrsMethodParameterProcessor

use of org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor in project wildfly by wildfly.

the class JaxrsMethodParameterProcessorTestCase method customParameterTest.

/**
 * Check that a custom datatype is process by the ParamConverterProvider.
 * The provider throws an exception by design.
 *
 * @throws Exception
 */
@Test
public void customParameterTest() throws Exception {
    providers.clear();
    resources.clear();
    providers.add(SimpleClassParamConverterProvider.class.getName());
    resources.add(SimpleClassParamConverterResource.class.getName());
    JaxrsMethodParameterProcessor jProcessor = new JaxrsMethodParameterProcessor();
    try {
        jProcessor.testProcessor(Thread.currentThread().getContextClassLoader(), resteasyDeploymentData);
    } catch (Exception e) {
        Assert.fail("Test failed.  It should not have thrown an exception: " + e);
    }
}
Also used : SimpleClassParamConverterProvider(org.jboss.as.jaxrs.rsources.SimpleClassParamConverterProvider) JaxrsMethodParameterProcessor(org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor) SimpleClassParamConverterResource(org.jboss.as.jaxrs.rsources.SimpleClassParamConverterResource) Test(org.junit.Test)

Aggregations

JaxrsMethodParameterProcessor (org.jboss.as.jaxrs.deployment.JaxrsMethodParameterProcessor)8 Test (org.junit.Test)7 SimpleClassParamConverterProvider (org.jboss.as.jaxrs.rsources.SimpleClassParamConverterProvider)3 SimpleClassParamConverterResource (org.jboss.as.jaxrs.rsources.SimpleClassParamConverterResource)2 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 JaxrsAnnotationProcessor (org.jboss.as.jaxrs.deployment.JaxrsAnnotationProcessor)1 JaxrsCdiIntegrationProcessor (org.jboss.as.jaxrs.deployment.JaxrsCdiIntegrationProcessor)1 JaxrsComponentDeployer (org.jboss.as.jaxrs.deployment.JaxrsComponentDeployer)1 JaxrsDependencyProcessor (org.jboss.as.jaxrs.deployment.JaxrsDependencyProcessor)1 JaxrsIntegrationProcessor (org.jboss.as.jaxrs.deployment.JaxrsIntegrationProcessor)1 JaxrsScanningProcessor (org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor)1 JaxrsSpringProcessor (org.jboss.as.jaxrs.deployment.JaxrsSpringProcessor)1 PrimitiveParamResource (org.jboss.as.jaxrs.rsources.PrimitiveParamResource)1 SimpleClassLazyParamConverter (org.jboss.as.jaxrs.rsources.SimpleClassLazyParamConverter)1 SimpleClassParameterizedTypeResource (org.jboss.as.jaxrs.rsources.SimpleClassParameterizedTypeResource)1 SimpleFromStringProvider (org.jboss.as.jaxrs.rsources.SimpleFromStringProvider)1 SimpleFromStringResource (org.jboss.as.jaxrs.rsources.SimpleFromStringResource)1 SimpleFromValueProvider (org.jboss.as.jaxrs.rsources.SimpleFromValueProvider)1 SimpleFromValueResource (org.jboss.as.jaxrs.rsources.SimpleFromValueResource)1 SimpleValueOfProvider (org.jboss.as.jaxrs.rsources.SimpleValueOfProvider)1