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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations