Search in sources :

Example 11 with Connector

use of org.apache.openejb.jee.Connector in project tomee by apache.

the class AnnotationDeployerTest method testResourceAdapter.

@Test
public void testResourceAdapter() throws Exception {
    final ConnectorModule connectorModule = testConnectorModule();
    final AnnotationDeployer.DiscoverAnnotatedBeans discvrAnnBeans = new AnnotationDeployer.DiscoverAnnotatedBeans();
    discvrAnnBeans.deploy(connectorModule);
    final Connector connector = connectorModule.getConnector();
    Assert.assertEquals("displayName", connector.getDisplayName());
    Assert.assertEquals("description", connector.getDescription());
    Assert.assertEquals("eisType", connector.getEisType());
    Assert.assertEquals("vendorName", connector.getVendorName());
    Assert.assertEquals("version", connector.getResourceAdapterVersion());
    Assert.assertEquals("smallIcon", connector.getIcon().getSmallIcon());
    Assert.assertEquals("largeIcon", connector.getIcon().getLargeIcon());
    Assert.assertEquals("licenseDescription", connector.getLicense().getDescription());
    Assert.assertEquals(true, connector.getLicense().isLicenseRequired());
    final List<org.apache.openejb.jee.SecurityPermission> securityPermission = connector.getResourceAdapter().getSecurityPermission();
    Assert.assertEquals("description", securityPermission.get(0).getDescription());
    Assert.assertEquals("permissionSpec", securityPermission.get(0).getSecurityPermissionSpec());
    final List<String> requiredWorkContext = connector.getRequiredWorkContext();
    Assert.assertEquals(TestWorkContext.class.getName(), requiredWorkContext.get(0));
    final List<org.apache.openejb.jee.AuthenticationMechanism> authenticationMechanism = connector.getResourceAdapter().getOutboundResourceAdapter().getAuthenticationMechanism();
    Assert.assertEquals("authMechanism", authenticationMechanism.get(0).getAuthenticationMechanismType());
    Assert.assertEquals(CredentialInterface.GenericCredential.toString(), authenticationMechanism.get(0).getCredentialInterface());
    Assert.assertEquals("description", authenticationMechanism.get(0).getDescription());
    Assert.assertEquals(TransactionSupportType.NO_TRANSACTION, connector.getResourceAdapter().getOutboundResourceAdapter().getTransactionSupport());
    Assert.assertEquals(true, connector.getResourceAdapter().getOutboundResourceAdapter().isReauthenticationSupport());
    Assert.assertEquals(Connection.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionInterface());
    Assert.assertEquals(ConnectionImpl.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionImplClass());
    Assert.assertEquals(ConnectionFactory.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionFactoryInterface());
    Assert.assertEquals(ConnectionFactoryImpl.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionFactoryImplClass());
    Assert.assertEquals(TestActivation.class.getName(), connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener().get(0).getActivationSpec().getActivationSpecClass());
    Assert.assertEquals(TestMessageListener.class.getName(), connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener().get(0).getMessageListenerType());
    Assert.assertEquals(TestAdminObject.class.getName(), connector.getResourceAdapter().getAdminObject().get(0).getAdminObjectClass());
    Assert.assertEquals(TestAdminObjectInterface.class.getName(), connector.getResourceAdapter().getAdminObject().get(0).getAdminObjectInterface());
}
Also used : Connector(org.apache.openejb.jee.Connector) AuthenticationMechanism(javax.resource.spi.AuthenticationMechanism) ManagedConnection(javax.resource.spi.ManagedConnection) ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) SecurityPermission(javax.resource.spi.SecurityPermission) Test(org.junit.Test)

Example 12 with Connector

use of org.apache.openejb.jee.Connector in project tomee by apache.

the class GetterConnectorTest method connector.

@Module
public Connector connector() {
    final ConfigProperty configProperty = new ConfigProperty();
    configProperty.setConfigPropertyName("conf");
    configProperty.setConfigPropertyType(String.class.getName());
    configProperty.setConfigPropertyValue("GetterConnectorTest");
    final ConnectionDefinition connectionDefinition = new ConnectionDefinition();
    connectionDefinition.setConnectionFactoryImplClass(MyMcf.class.getName());
    connectionDefinition.setConnectionInterface(ConnectionFactory.class.getName());
    final OutboundResourceAdapter out = new OutboundResourceAdapter();
    out.getConnectionDefinition().add(connectionDefinition);
    final ResourceAdapter ra = new ResourceAdapter();
    ra.setResourceAdapterClass(MyRa.class.getName());
    ra.getConfigProperty().add(configProperty);
    final Connector connector = new Connector();
    connector.setVersion("1.7");
    connector.setResourceAdapter(ra);
    return connector;
}
Also used : Connector(org.apache.openejb.jee.Connector) ValidatingManagedConnectionFactory(javax.resource.spi.ValidatingManagedConnectionFactory) ConnectionFactory(javax.resource.cci.ConnectionFactory) ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) ConnectionDefinition(org.apache.openejb.jee.ConnectionDefinition) ConfigProperty(org.apache.openejb.jee.ConfigProperty) OutboundResourceAdapter(org.apache.openejb.jee.OutboundResourceAdapter) ResourceAdapter(org.apache.openejb.jee.ResourceAdapter) OutboundResourceAdapter(org.apache.openejb.jee.OutboundResourceAdapter) Module(org.apache.openejb.testing.Module)

Aggregations

Connector (org.apache.openejb.jee.Connector)12 ResourceAdapter (org.apache.openejb.jee.ResourceAdapter)7 File (java.io.File)4 List (java.util.List)4 Properties (java.util.Properties)4 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)4 AppModule (org.apache.openejb.config.AppModule)4 ConnectorModule (org.apache.openejb.config.ConnectorModule)4 EjbModule (org.apache.openejb.config.EjbModule)4 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)4 ConnectionDefinition (org.apache.openejb.jee.ConnectionDefinition)4 EjbJar (org.apache.openejb.jee.EjbJar)4 OutboundResourceAdapter (org.apache.openejb.jee.OutboundResourceAdapter)4 URL (java.net.URL)3 InitialContext (javax.naming.InitialContext)3 ConnectionFactory (javax.resource.cci.ConnectionFactory)3 AppInfo (org.apache.openejb.assembler.classic.AppInfo)3 Assembler (org.apache.openejb.assembler.classic.Assembler)3 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)3 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)3