Search in sources :

Example 61 with AdaptrisMessage

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

the class FilesystemRetryStoreTest method testWrite_PayloadMetadataException.

@Test
public void testWrite_PayloadMetadataException() throws Exception {
    FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(BaseCase.getConfiguration(TEST_BASE_URL));
    try {
        LifecycleHelper.initAndStart(store);
        AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
        msg.addObjectHeader(CoreConstants.OBJ_METADATA_EXCEPTION, new Exception());
        store.write(msg);
        File retryDir = FsHelper.toFile(BaseCase.getConfiguration(TEST_BASE_URL));
        File msgDir = new File(retryDir, msg.getUniqueId());
        assertTrue(retryDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY).length >= 1);
        assertTrue(msgDir.exists());
        assertEquals(3, msgDir.listFiles().length);
    } finally {
        LifecycleHelper.stopAndClose(store);
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) DirectoryFileFilter(org.apache.commons.io.filefilter.DirectoryFileFilter) FileFilter(java.io.FileFilter) File(java.io.File) InterlokException(com.adaptris.interlok.InterlokException) Test(org.junit.Test)

Example 62 with AdaptrisMessage

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

the class FilesystemRetryStoreTest method testReport.

@Test
public void testReport() throws Exception {
    FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(BaseCase.getConfiguration(TEST_BASE_URL));
    try {
        LifecycleHelper.initAndStart(store);
        AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
        store.write(msg);
        assertTrue(store.report().iterator().hasNext());
    } finally {
        LifecycleHelper.stopAndClose(store);
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 63 with AdaptrisMessage

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

the class FilesystemRetryStoreTest method testGetMetadata.

@Test
public void testGetMetadata() throws Exception {
    FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(BaseCase.getConfiguration(TEST_BASE_URL));
    try {
        LifecycleHelper.initAndStart(store);
        AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
        store.write(msg);
        Map<String, String> metadata = store.getMetadata(msg.getUniqueId());
        assertEquals(msg.getMessageHeaders(), metadata);
    } finally {
        LifecycleHelper.stopAndClose(store);
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 64 with AdaptrisMessage

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

the class FilesystemRetryStoreTest method testWrite_FileBacked.

@Test
public void testWrite_FileBacked() throws Exception {
    FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(BaseCase.getConfiguration(TEST_BASE_URL));
    try {
        LifecycleHelper.initAndStart(store);
        AdaptrisMessage msg = new FileBackedMessageFactory().newMessage("hello");
        store.write(msg);
        File dir = FsHelper.toFile(BaseCase.getConfiguration(TEST_BASE_URL));
        assertTrue(dir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY).length >= 1);
    } finally {
        LifecycleHelper.stopAndClose(store);
    }
}
Also used : FileBackedMessageFactory(com.adaptris.core.lms.FileBackedMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) DirectoryFileFilter(org.apache.commons.io.filefilter.DirectoryFileFilter) FileFilter(java.io.FileFilter) File(java.io.File) Test(org.junit.Test)

Example 65 with AdaptrisMessage

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

the class FilesystemRetryStoreTest method testReport_Exception.

@Test(expected = InterlokException.class)
public void testReport_Exception() throws Exception {
    FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(INVALID_URL);
    try {
        LifecycleHelper.initAndStart(store);
        AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
        store.report();
    } finally {
        LifecycleHelper.stopAndClose(store);
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Aggregations

AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1495 Test (org.junit.Test)1362 ServiceException (com.adaptris.core.ServiceException)171 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)158 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)156 StandaloneProducer (com.adaptris.core.StandaloneProducer)125 Channel (com.adaptris.core.Channel)122 MetadataElement (com.adaptris.core.MetadataElement)94 File (java.io.File)89 TimeInterval (com.adaptris.util.TimeInterval)77 CoreException (com.adaptris.core.CoreException)67 Session (javax.jms.Session)62 StandardWorkflow (com.adaptris.core.StandardWorkflow)57 GuidGenerator (com.adaptris.util.GuidGenerator)56 JettyHelper.createChannel (com.adaptris.core.http.jetty.JettyHelper.createChannel)50 StandaloneRequestor (com.adaptris.core.StandaloneRequestor)49 Message (javax.jms.Message)47 XPath (com.adaptris.util.text.xml.XPath)45 ServiceList (com.adaptris.core.ServiceList)43 Document (org.w3c.dom.Document)40