Search in sources :

Example 1 with MockAllowsRetriesConnection

use of com.adaptris.core.stubs.MockAllowsRetriesConnection in project interlok by adaptris.

the class AdapterComponentCheckerTest method testCheckInitialised_RetriesConnection.

@Test
public void testCheckInitialised_RetriesConnection() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName, 2, 2);
    List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
    ObjectName objectName = createComponentCheckerObjectName(adapterName);
    register(mBeans);
    AdapterComponentCheckerMBean manager = JMX.newMBeanProxy(mBeanServer, objectName, AdapterComponentCheckerMBean.class);
    manager.checkInitialise(DefaultMarshaller.getDefaultMarshaller().marshal(new MockAllowsRetriesConnection()));
    manager.checkInitialise(DefaultMarshaller.getDefaultMarshaller().marshal(new MockAllowsRetriesConnection(1)));
}
Also used : Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) MockAllowsRetriesConnection(com.adaptris.core.stubs.MockAllowsRetriesConnection) Test(org.junit.Test)

Example 2 with MockAllowsRetriesConnection

use of com.adaptris.core.stubs.MockAllowsRetriesConnection in project interlok by adaptris.

the class AdapterComponentCheckerTest method createConnectedServices.

private String createConnectedServices(String sharedName) throws Exception {
    ServiceList nestedList = new ServiceList();
    nestedList.add(new StandaloneProducer(new MockAllowsRetriesConnection(6), new NullMessageProducer()));
    if (!StringUtils.isEmpty(sharedName)) {
        nestedList.add(new StatelessServiceWrapper(new StandaloneProducer(new SharedConnection(sharedName), new NullMessageProducer())));
    } else {
        nestedList.add(new StatelessServiceWrapper(new StandaloneProducer()));
    }
    nestedList.add(new AddMetadataService(new ArrayList(Arrays.asList(new MetadataElement[] { new MetadataElement("key", "value") }))));
    ServiceList list = new ServiceList();
    list.add(nestedList);
    list.add(new JdbcServiceList());
    return DefaultMarshaller.getDefaultMarshaller().marshal(list);
}
Also used : SharedConnection(com.adaptris.core.SharedConnection) ServiceList(com.adaptris.core.ServiceList) JdbcServiceList(com.adaptris.core.services.jdbc.JdbcServiceList) ArrayList(java.util.ArrayList) JdbcServiceList(com.adaptris.core.services.jdbc.JdbcServiceList) MetadataElement(com.adaptris.core.MetadataElement) AddMetadataService(com.adaptris.core.services.metadata.AddMetadataService) StandaloneProducer(com.adaptris.core.StandaloneProducer) NullMessageProducer(com.adaptris.core.NullMessageProducer) StatelessServiceWrapper(com.adaptris.core.services.StatelessServiceWrapper) MockAllowsRetriesConnection(com.adaptris.core.stubs.MockAllowsRetriesConnection)

Example 3 with MockAllowsRetriesConnection

use of com.adaptris.core.stubs.MockAllowsRetriesConnection in project interlok by adaptris.

the class ServiceUtilTest method testRewriteForTesting_RetriesConnection.

@Test
public void testRewriteForTesting_RetriesConnection() throws Exception {
    MockAllowsRetriesConnection conn = new MockAllowsRetriesConnection(55);
    StandaloneProducer service = new StandaloneProducer(conn, new NullMessageProducer());
    StandaloneProducer rewritten = ((StandaloneProducer) rewriteConnectionsForTesting(service));
    assertNotSame(conn, rewritten.getConnection());
    assertNotSame(55, ((AllowsRetriesConnection) rewritten.getConnection()).getConnectionAttempts());
}
Also used : StandaloneProducer(com.adaptris.core.StandaloneProducer) NullMessageProducer(com.adaptris.core.NullMessageProducer) MockAllowsRetriesConnection(com.adaptris.core.stubs.MockAllowsRetriesConnection) Test(org.junit.Test)

Example 4 with MockAllowsRetriesConnection

use of com.adaptris.core.stubs.MockAllowsRetriesConnection in project interlok by adaptris.

the class ServiceUtilTest method createConnectedServices.

private String createConnectedServices() throws Exception {
    ServiceList nestedList = new ServiceList();
    nestedList.add(new StandaloneProducer(new MockAllowsRetriesConnection(6), new NullMessageProducer()));
    nestedList.add(new StatelessServiceWrapper(new StandaloneProducer()));
    nestedList.add(new AddMetadataService(new ArrayList(Arrays.asList(new MetadataElement[] { new MetadataElement("key", "value") }))));
    ServiceList list = new ServiceList();
    list.add(nestedList);
    list.add(new JdbcServiceList());
    return DefaultMarshaller.getDefaultMarshaller().marshal(list);
}
Also used : ServiceList(com.adaptris.core.ServiceList) JdbcServiceList(com.adaptris.core.services.jdbc.JdbcServiceList) ArrayList(java.util.ArrayList) JdbcServiceList(com.adaptris.core.services.jdbc.JdbcServiceList) MetadataElement(com.adaptris.core.MetadataElement) AddMetadataService(com.adaptris.core.services.metadata.AddMetadataService) StandaloneProducer(com.adaptris.core.StandaloneProducer) NullMessageProducer(com.adaptris.core.NullMessageProducer) StatelessServiceWrapper(com.adaptris.core.services.StatelessServiceWrapper) MockAllowsRetriesConnection(com.adaptris.core.stubs.MockAllowsRetriesConnection)

Aggregations

MockAllowsRetriesConnection (com.adaptris.core.stubs.MockAllowsRetriesConnection)4 NullMessageProducer (com.adaptris.core.NullMessageProducer)3 StandaloneProducer (com.adaptris.core.StandaloneProducer)3 MetadataElement (com.adaptris.core.MetadataElement)2 ServiceList (com.adaptris.core.ServiceList)2 StatelessServiceWrapper (com.adaptris.core.services.StatelessServiceWrapper)2 JdbcServiceList (com.adaptris.core.services.jdbc.JdbcServiceList)2 AddMetadataService (com.adaptris.core.services.metadata.AddMetadataService)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Adapter (com.adaptris.core.Adapter)1 SharedConnection (com.adaptris.core.SharedConnection)1 ObjectName (javax.management.ObjectName)1