Search in sources :

Example 1 with EJBComponentType

use of org.jboss.as.ejb3.subsystem.deployment.EJBComponentType in project wildfly by wildfly.

the class EjbJarRuntimeResourceTestBase method testComponent.

/*
    TODO implement a test of entity beans
    @Test
    public void testEntityBean() throws Exception {
        testComponent(EJBComponentType.ENTITY, ???.class.getSimpleName());
    }
    */
private void testComponent(EJBComponentType type, String name, boolean expectTimer) throws Exception {
    ModelNode address = getComponentAddress(type, name).toModelNode();
    address.protect();
    ModelNode resourceDescription = executeOperation(managementClient, ModelDescriptionConstants.READ_RESOURCE_DESCRIPTION_OPERATION, address);
    ModelNode resource = executeOperation(managementClient, ModelDescriptionConstants.READ_RESOURCE_OPERATION, address);
    assertTrue(resourceDescription.get(ATTRIBUTES, COMPONENT_CLASS_NAME.getName()).isDefined());
    assertEquals(ModelType.STRING, resourceDescription.get(ATTRIBUTES, COMPONENT_CLASS_NAME.getName(), DESCRIPTION).getType());
    assertEquals(ModelType.STRING, resourceDescription.get(ATTRIBUTES, COMPONENT_CLASS_NAME.getName(), TYPE).asType());
    assertTrue(resource.get(COMPONENT_CLASS_NAME.getName()).isDefined());
    validateSecurity(address, resourceDescription, resource);
    if (type.hasPool()) {
        validatePool(address, resourceDescription, resource);
    } else {
        for (AttributeDefinition attr : POOL_ATTRIBUTES) {
            assertFalse(resourceDescription.get(ModelDescriptionConstants.ATTRIBUTES).has(attr.getName()));
            assertFalse(resource.has(attr.getName()));
        }
    }
    if (type.hasTimer()) {
        validateTimer(address, resourceDescription, resource, expectTimer);
    } else {
        assertFalse(resourceDescription.get(ModelDescriptionConstants.ATTRIBUTES).has(TimerAttributeDefinition.INSTANCE.getName()));
        assertFalse(resource.has(TimerAttributeDefinition.INSTANCE.getName()));
    }
}
Also used : AttributeDefinition(org.jboss.as.controller.AttributeDefinition) TimerAttributeDefinition(org.jboss.as.ejb3.subsystem.deployment.TimerAttributeDefinition) ModelNode(org.jboss.dmr.ModelNode)

Example 2 with EJBComponentType

use of org.jboss.as.ejb3.subsystem.deployment.EJBComponentType in project wildfly by wildfly.

the class EjbManagementDeploymentUnitProcessor method installManagementResource.

private void installManagementResource(ComponentConfiguration configuration, DeploymentUnit deploymentUnit) {
    final EJBComponentType type = EJBComponentType.getComponentType(configuration);
    PathAddress addr = getComponentAddress(type, configuration, deploymentUnit);
    final AbstractEJBComponentRuntimeHandler<?> handler = type.getRuntimeHandler();
    handler.registerComponent(addr, configuration.getComponentDescription().getStartServiceName());
    deploymentUnit.addToAttachmentList(EjbDeploymentAttachmentKeys.MANAGED_COMPONENTS, new InstalledComponent(type, addr));
    final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
    deploymentResourceSupport.getDeploymentSubModel(EJB3Extension.SUBSYSTEM_NAME, addr.getLastElement());
    final EJBComponentDescription description = (EJBComponentDescription) configuration.getComponentDescription();
    if (description.isTimerServiceRequired()) {
        final PathAddress timerServiceAddress = PathAddress.pathAddress(addr.getLastElement(), EJB3SubsystemModel.TIMER_SERVICE_PATH);
        final TimerServiceResource timerServiceResource = ((TimerServiceImpl) description.getTimerService()).getResource();
        deploymentResourceSupport.registerDeploymentSubResource(EJB3Extension.SUBSYSTEM_NAME, timerServiceAddress, timerServiceResource);
    }
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) TimerServiceResource(org.jboss.as.ejb3.subsystem.deployment.TimerServiceResource) InstalledComponent(org.jboss.as.ejb3.subsystem.deployment.InstalledComponent) PathAddress(org.jboss.as.controller.PathAddress) EJBComponentType(org.jboss.as.ejb3.subsystem.deployment.EJBComponentType) TimerServiceImpl(org.jboss.as.ejb3.timerservice.TimerServiceImpl) EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription)

Aggregations

AttributeDefinition (org.jboss.as.controller.AttributeDefinition)1 PathAddress (org.jboss.as.controller.PathAddress)1 EJBComponentDescription (org.jboss.as.ejb3.component.EJBComponentDescription)1 EJBComponentType (org.jboss.as.ejb3.subsystem.deployment.EJBComponentType)1 InstalledComponent (org.jboss.as.ejb3.subsystem.deployment.InstalledComponent)1 TimerAttributeDefinition (org.jboss.as.ejb3.subsystem.deployment.TimerAttributeDefinition)1 TimerServiceResource (org.jboss.as.ejb3.subsystem.deployment.TimerServiceResource)1 TimerServiceImpl (org.jboss.as.ejb3.timerservice.TimerServiceImpl)1 DeploymentResourceSupport (org.jboss.as.server.deployment.DeploymentResourceSupport)1 ModelNode (org.jboss.dmr.ModelNode)1