use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class MultipartMessageBuilderTest method testService_WithContentId.
@Test
public void testService_WithContentId() throws Exception {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("Hello World");
msg.addMetadata("customContentId", new GuidGenerator().safeUUID());
MultipartMessageBuilder service = new MultipartMessageBuilder().withMimeParts(new InlineMimePartBuilder()).withContentId("%message{customContentId}");
ExampleServiceCase.execute(service, msg);
String payload = msg.getContent();
assertTrue(payload.contains(msg.getMetadataValue("customContentId")));
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class JndiHelperTest method testUnbindJdbcConnection.
@Test
public void testUnbindJdbcConnection() throws Exception {
JdbcPooledConnection connection = new JdbcPooledConnection();
connection.setConnectUrl("jdbc:derby:memory:" + new GuidGenerator().safeUUID() + ";create=true");
connection.setDriverImp("org.apache.derby.jdbc.EmbeddedDriver");
connection.setMinimumPoolSize(1);
connection.setAcquireIncrement(1);
connection.setMaximumPoolSize(7);
connection.setUniqueId(getName());
InitialContext initialContext = new InitialContext(env);
JndiHelper.bind(initialContext, connection, true);
JndiHelper.unbind(initialContext, connection, true);
JndiHelper.bind(initialContext, connection, false);
JndiHelper.unbind(initialContext, connection, false);
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class StandardWorkerTest method setUp.
@Before
public void setUp() throws Exception {
String subDir = new GuidGenerator().safeUUID();
baseUrl = new URL(PROPERTIES.getProperty(BASE_KEY) + "/" + subDir);
baseDir = FsHelper.createFileReference(baseUrl);
baseDir.mkdirs();
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class StandardWorkerTest method testRenameFile.
@Test
public void testRenameFile() throws Exception {
FsWorker worker = createWorker();
String[] testFiles = createTestFiles();
String newFilename = new GuidGenerator().safeUUID();
worker.rename(new File(baseDir, testFiles[0]), new File(baseDir, newFilename));
File[] files = worker.listFiles(baseDir);
Set set = new HashSet(Arrays.asList(files));
assertTrue(set.contains(new File(FsHelper.createFileReference(baseUrl), newFilename)));
try {
worker.rename(new File(baseDir, testFiles[0]), new File(baseDir, testFiles[1]));
fail("pre-exisitng new name doesn't cause exception");
} catch (FsException e) {
/* ok */
}
try {
worker.rename(baseDir, new File(baseDir, "somename"));
fail("old file name is dir doesn't cause exception");
} catch (FsException e) {
/* ok */
}
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class FtpCase method testRename.
@Test
public void testRename() throws Exception {
Assume.assumeTrue(areTestsEnabled());
String oldName = Thread.currentThread().getName();
try {
Thread.currentThread().setName(getName());
String filename = getRemotePutFilename();
FileTransferClient client = connectClientImpl();
client.chdir(getRemotePutDirectory());
client.put(FILE_TEXT.getBytes(), filename);
String newFilename = new GuidGenerator().safeUUID();
client.rename(filename, newFilename);
client.delete(newFilename);
client.disconnect();
} finally {
Thread.currentThread().setName(oldName);
}
}
Aggregations