Search in sources :

Example 1 with FormattedFilenameCreator

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

the class ReadMetadataFromFilesystemTest method testService_InputXml.

@Test
public void testService_InputXml() throws Exception {
    String subDir = new GuidGenerator().getUUID().replaceAll(":", "").replaceAll("-", "");
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
    ReadMetadataFromFilesystem service = createService(subDir);
    service.setInputStyle(InputStyle.XML);
    service.setFilenameCreator(new FormattedFilenameCreator());
    File parentDir = FsHelper.createFileReference(FsHelper.createUrlFromString(PROPERTIES.getProperty(BASE_DIR), true));
    String propsFilename = parentDir.getCanonicalPath() + "/" + subDir + "/" + msg.getUniqueId();
    Properties p = createProperties();
    writeProperties(p, new File(propsFilename), true);
    execute(service, msg);
    assertTrue(msg.headersContainsKey("key5"));
    assertEquals("v5", msg.getMetadataValue("key5"));
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) FormattedFilenameCreator(com.adaptris.core.FormattedFilenameCreator) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) GuidGenerator(com.adaptris.util.GuidGenerator) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 2 with FormattedFilenameCreator

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

the class SftpProducerTest method createProducerExample.

private StandaloneProducer createProducerExample(FileTransferConnection con) {
    FtpProducer producer = createProducerExample();
    producer.setFilenameCreator(new FormattedFilenameCreator());
    producer.setFtpEndpoint("sftp://sftpuser@hostname:port/path/to/directory");
    return new StandaloneProducer(con, producer);
}
Also used : FormattedFilenameCreator(com.adaptris.core.FormattedFilenameCreator) StandaloneProducer(com.adaptris.core.StandaloneProducer)

Aggregations

FormattedFilenameCreator (com.adaptris.core.FormattedFilenameCreator)2 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)1 StandaloneProducer (com.adaptris.core.StandaloneProducer)1 GuidGenerator (com.adaptris.util.GuidGenerator)1 File (java.io.File)1 Properties (java.util.Properties)1 Test (org.junit.Test)1