Search in sources :

Example 1 with Endpoint

use of org.jboss.jca.core.spi.rar.Endpoint in project wildfly by wildfly.

the class ActivationNameTestCase method testSimpleResourceAdapterAvailability.

@Test
public void testSimpleResourceAdapterAvailability() throws Exception {
    ServiceController<?> controller = serviceContainer.getService(ConnectorServices.RA_REPOSITORY_SERVICE);
    assertNotNull(controller);
    ResourceAdapterRepository repository = (ResourceAdapterRepository) controller.getValue();
    assertNotNull(repository);
    Set<String> ids = repository.getResourceAdapters(SimpleListener.class);
    assertNotNull(ids);
    assertEquals(1, ids.size());
    String piId = ids.iterator().next();
    assertTrue(piId.indexOf("SimpleResourceAdapter") != -1);
    Endpoint endpoint = repository.getEndpoint(piId);
    assertNotNull(endpoint);
}
Also used : Endpoint(org.jboss.jca.core.spi.rar.Endpoint) ResourceAdapterRepository(org.jboss.jca.core.spi.rar.ResourceAdapterRepository) Test(org.junit.Test)

Example 2 with Endpoint

use of org.jboss.jca.core.spi.rar.Endpoint in project wildfly by wildfly.

the class NoRaAnnoTestCase method testActivation.

/**
     * Test activation
     *
     * @param clazz class name
     * @throws Throwable Thrown if case of an error
     */
public void testActivation(Class clazz) throws Throwable {
    ServiceController<?> controller = serviceContainer.getService(ConnectorServices.RA_REPOSITORY_SERVICE);
    assertNotNull(controller);
    ResourceAdapterRepository raRepository = (ResourceAdapterRepository) controller.getValue();
    Set<String> ids = raRepository.getResourceAdapters(clazz);
    assertNotNull(ids);
    assertEquals(1, ids.size());
    String piId = ids.iterator().next();
    assertNotNull(piId);
    Endpoint endpoint = raRepository.getEndpoint(piId);
    assertNotNull(endpoint);
    List<MessageListener> listeners = raRepository.getMessageListeners(piId);
    assertNotNull(listeners);
    assertEquals(2, listeners.size());
    MessageListener listener = listeners.get(0);
    MessageListener listener1 = listeners.get(1);
    ActivationSpec as = listener.getActivation().createInstance();
    ActivationSpec as1 = listener1.getActivation().createInstance();
    assertNotNull(as);
    assertNotNull(as.getResourceAdapter());
    assertNotNull(as1);
    assertNotNull(as1.getResourceAdapter());
    AnnoActivationSpec tas = (AnnoActivationSpec) as;
    log.trace("AS:" + tas + "//1//" + tas.getFirst() + "//2//" + tas.getSecond());
    assertEquals(new Character('C'), tas.getFirst());
    assertEquals(new Double(0.5), tas.getSecond());
    assertTrue(tas.getResourceAdapter() instanceof AnnoResourceAdapter);
    AnnoResourceAdapter tra = (AnnoResourceAdapter) tas.getResourceAdapter();
    log.trace("RA:" + tra + "//1//" + tra.getFirst() + "//2//" + tra.getSecond());
    assertEquals("A", tra.getFirst());
    assertEquals(new Integer(5), tra.getSecond());
}
Also used : AnnoActivationSpec(org.jboss.as.test.integration.jca.annorar.AnnoActivationSpec) AnnoMessageListener(org.jboss.as.test.integration.jca.annorar.AnnoMessageListener) MessageListener(org.jboss.jca.core.spi.rar.MessageListener) Endpoint(org.jboss.jca.core.spi.rar.Endpoint) AnnoResourceAdapter(org.jboss.as.test.integration.jca.annorar.AnnoResourceAdapter) AnnoActivationSpec(org.jboss.as.test.integration.jca.annorar.AnnoActivationSpec) ActivationSpec(javax.resource.spi.ActivationSpec) ResourceAdapterRepository(org.jboss.jca.core.spi.rar.ResourceAdapterRepository)

Example 3 with Endpoint

use of org.jboss.jca.core.spi.rar.Endpoint in project wildfly by wildfly.

the class InflowTestCase method testRegistryConfiguration.

/**
     * Test configuration
     *
     * @throws Throwable Thrown if case of an error
     */
@Test
public void testRegistryConfiguration() throws Throwable {
    ServiceController<?> controller = serviceContainer.getService(ConnectorServices.RA_REPOSITORY_SERVICE);
    assertNotNull(controller);
    ResourceAdapterRepository repository = (ResourceAdapterRepository) controller.getValue();
    assertNotNull(repository);
    Set<String> ids = repository.getResourceAdapters(javax.jms.MessageListener.class);
    assertNotNull(ids);
    int pureInflowListener = 0;
    for (String id : ids) {
        if (id.indexOf("PureInflow") != -1) {
            pureInflowListener++;
        }
    }
    assertEquals(1, pureInflowListener);
    String piId = ids.iterator().next();
    assertNotNull(piId);
    Endpoint endpoint = repository.getEndpoint(piId);
    assertNotNull(endpoint);
    List<MessageListener> listeners = repository.getMessageListeners(piId);
    assertNotNull(listeners);
    assertEquals(1, listeners.size());
    MessageListener listener = listeners.get(0);
    ActivationSpec as = listener.getActivation().createInstance();
    assertNotNull(as);
    assertNotNull(as.getResourceAdapter());
}
Also used : Endpoint(org.jboss.jca.core.spi.rar.Endpoint) ActivationSpec(javax.resource.spi.ActivationSpec) MessageListener(org.jboss.jca.core.spi.rar.MessageListener) ResourceAdapterRepository(org.jboss.jca.core.spi.rar.ResourceAdapterRepository) Endpoint(org.jboss.jca.core.spi.rar.Endpoint) Test(org.junit.Test)

Example 4 with Endpoint

use of org.jboss.jca.core.spi.rar.Endpoint in project wildfly by wildfly.

the class InflowJarTestCase method testRegistryConfiguration.

/**
     * Test configuration
     *
     * @throws Throwable Thrown if case of an error
     */
@Test
public void testRegistryConfiguration() throws Throwable {
    assertNotNull(serviceContainer);
    ServiceController<?> controller = serviceContainer.getService(ConnectorServices.RA_REPOSITORY_SERVICE);
    assertNotNull(controller);
    ResourceAdapterRepository repository = (ResourceAdapterRepository) controller.getValue();
    assertNotNull(repository);
    Set<String> ids = repository.getResourceAdapters();
    assertNotNull(ids);
    String piId = getElementContaining(ids, "MultipleResourceAdapter");
    assertNotNull(piId);
    Endpoint endpoint = repository.getEndpoint(piId);
    assertNotNull(endpoint);
    List<MessageListener> listeners = repository.getMessageListeners(piId);
    assertNotNull(listeners);
    assertEquals(1, listeners.size());
    MessageListener listener = listeners.get(0);
    ActivationSpec as = listener.getActivation().createInstance();
    assertNotNull(as);
    assertNotNull(as.getResourceAdapter());
}
Also used : Endpoint(org.jboss.jca.core.spi.rar.Endpoint) ActivationSpec(javax.resource.spi.ActivationSpec) MessageListener(org.jboss.jca.core.spi.rar.MessageListener) ResourceAdapterRepository(org.jboss.jca.core.spi.rar.ResourceAdapterRepository) Test(org.junit.Test)

Example 5 with Endpoint

use of org.jboss.jca.core.spi.rar.Endpoint in project wildfly by wildfly.

the class InflowFlatTestCase method testRegistryConfiguration.

/**
     * Test configuration
     *
     * @throws Throwable Thrown if case of an error
     */
@Test
public void testRegistryConfiguration() throws Throwable {
    assertNotNull(serviceContainer);
    ServiceController<?> controller = serviceContainer.getService(ConnectorServices.RA_REPOSITORY_SERVICE);
    assertNotNull(controller);
    ResourceAdapterRepository repository = (ResourceAdapterRepository) controller.getValue();
    assertNotNull(repository);
    Set<String> ids = repository.getResourceAdapters();
    assertNotNull(ids);
    String piId = getElementContaining(ids, "MultipleResourceAdapter");
    assertNotNull(piId);
    Endpoint endpoint = repository.getEndpoint(piId);
    assertNotNull(endpoint);
    List<MessageListener> listeners = repository.getMessageListeners(piId);
    assertNotNull(listeners);
    assertEquals(1, listeners.size());
    MessageListener listener = listeners.get(0);
    ActivationSpec as = listener.getActivation().createInstance();
    assertNotNull(as);
    assertNotNull(as.getResourceAdapter());
}
Also used : Endpoint(org.jboss.jca.core.spi.rar.Endpoint) ActivationSpec(javax.resource.spi.ActivationSpec) MessageListener(org.jboss.jca.core.spi.rar.MessageListener) ResourceAdapterRepository(org.jboss.jca.core.spi.rar.ResourceAdapterRepository) Test(org.junit.Test)

Aggregations

Endpoint (org.jboss.jca.core.spi.rar.Endpoint)9 ActivationSpec (javax.resource.spi.ActivationSpec)8 ResourceAdapterRepository (org.jboss.jca.core.spi.rar.ResourceAdapterRepository)8 MessageListener (org.jboss.jca.core.spi.rar.MessageListener)7 Test (org.junit.Test)6 AnnoActivationSpec (org.jboss.as.test.integration.jca.annorar.AnnoActivationSpec)2 AnnoMessageListener (org.jboss.as.test.integration.jca.annorar.AnnoMessageListener)2 AnnoResourceAdapter (org.jboss.as.test.integration.jca.annorar.AnnoResourceAdapter)2 ValidActivationSpec (org.jboss.as.test.integration.jca.beanvalidation.ra.ValidActivationSpec)2 ValidMessageEndpoint (org.jboss.as.test.integration.jca.beanvalidation.ra.ValidMessageEndpoint)2 ValidMessageEndpointFactory (org.jboss.as.test.integration.jca.beanvalidation.ra.ValidMessageEndpointFactory)2 EJBUtilities (org.jboss.as.ejb3.component.EJBUtilities)1