Search in sources :

Example 6 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class ActiveMqPasPollingConsumerTest method testInitNoClientIdOrSubscriptionId.

@Test
public void testInitNoClientIdOrSubscriptionId() throws Exception {
    PasPollingConsumer consumer = create();
    try {
        consumer.init();
        fail("Should fail due to missing subscription Id, client Id");
    } catch (CoreException e) {
    // expected
    }
}
Also used : PasPollingConsumer(com.adaptris.core.jms.PasPollingConsumer) CoreException(com.adaptris.core.CoreException) Test(org.junit.Test)

Example 7 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class ActiveMqPasPollingConsumerTest method testInitClientAndSubscriptionSet.

@Test
public void testInitClientAndSubscriptionSet() throws Exception {
    PasPollingConsumer consumer = create();
    consumer.setClientId("xxxx");
    consumer.setSubscriptionId("xxxx");
    try {
        consumer.init();
    } catch (CoreException e) {
        fail(e.getMessage());
    }
}
Also used : PasPollingConsumer(com.adaptris.core.jms.PasPollingConsumer) CoreException(com.adaptris.core.CoreException) Test(org.junit.Test)

Example 8 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class WorkflowRetryAndFailTest method testFailedStart_ExceedsMax.

@Override
@Test
public void testFailedStart_ExceedsMax() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndFail strategy = new WorkflowRetryAndFail(2, new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailStart workflow = new FailStart(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    c.requestInit();
    try {
        c.requestStart();
    } catch (CoreException expected) {
    }
    // That's right 1 + 2 retries.
    assertEquals(3, workflow.getAttempts());
    assertEquals(InitialisedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) CoreException(com.adaptris.core.CoreException) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 9 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class WorkflowRetryAndFailTest method testFailedInitialise_ExceedsMax.

@Override
@Test
public void testFailedInitialise_ExceedsMax() throws Exception {
    WorkflowList wfl = new WorkflowList();
    WorkflowRetryAndFail strategy = new WorkflowRetryAndFail(2, new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    FailInit workflow = new FailInit(3);
    wfl.add(workflow);
    wfl.setLifecycleStrategy(strategy);
    Channel c = createChannel(wfl);
    try {
        c.requestInit();
    } catch (CoreException expected) {
    }
    // That's right 1 + 2 retries.
    assertEquals(3, workflow.getAttempts());
    assertEquals(ClosedState.getInstance(), workflow.retrieveComponentState());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) CoreException(com.adaptris.core.CoreException) WorkflowList(com.adaptris.core.WorkflowList) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Example 10 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class AdapterRegistryTest method testReloadFromVersionControl_NoVCS.

@Test
public void testReloadFromVersionControl_NoVCS() throws Exception {
    AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
    try {
        myAdapterRegistry.reloadFromVersionControl();
        fail();
    } catch (CoreException expected) {
        assertEquals("No Runtime Version Control", expected.getMessage());
    }
}
Also used : CoreException(com.adaptris.core.CoreException) JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) BootstrapProperties(com.adaptris.core.management.BootstrapProperties) JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

CoreException (com.adaptris.core.CoreException)186 Test (org.junit.Test)110 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)44 Adapter (com.adaptris.core.Adapter)32 ObjectName (javax.management.ObjectName)29 Channel (com.adaptris.core.Channel)27 ArrayList (java.util.ArrayList)24 IOException (java.io.IOException)20 File (java.io.File)19 ServiceException (com.adaptris.core.ServiceException)14 TimeInterval (com.adaptris.util.TimeInterval)13 Document (org.w3c.dom.Document)12 MalformedObjectNameException (javax.management.MalformedObjectNameException)11 AdaptrisMarshaller (com.adaptris.core.AdaptrisMarshaller)10 StandardWorkflow (com.adaptris.core.StandardWorkflow)9 URLString (com.adaptris.util.URLString)9 TimeoutException (java.util.concurrent.TimeoutException)9 PoolingWorkflow (com.adaptris.core.PoolingWorkflow)8 Workflow (com.adaptris.core.Workflow)8 XPath (com.adaptris.util.text.xml.XPath)8