use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class SimpleSequenceNumberTest method testDoService_MaximumAndNumberFormattingSetHit.
@Test
public void testDoService_MaximumAndNumberFormattingSetHit() throws Exception {
SimpleSequenceNumberService service = new SimpleSequenceNumberService();
service.setMetadataKey(DEFAULT_METADATA_KEY);
String filename = new File(PROPERTIES.getProperty(KEY_BASEDIR), new GuidGenerator().getUUID()).getCanonicalPath();
createPropertyFile(filename, 12);
service.setSequenceNumberFile(filename);
service.setNumberFormat("000");
service.setMaximumSequenceNumber(12L);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
execute(service, msg);
assertEquals(1, getSequenceNumber(filename));
assertTrue(msg.containsKey(DEFAULT_METADATA_KEY));
assertEquals("012", msg.getMetadataValue(DEFAULT_METADATA_KEY));
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class SimpleSequenceNumberTest method testDoService_MaximumSetHitPropertyExceededMax.
@Test
public void testDoService_MaximumSetHitPropertyExceededMax() throws Exception {
SimpleSequenceNumberService service = new SimpleSequenceNumberService();
service.setMetadataKey(DEFAULT_METADATA_KEY);
String filename = new File(PROPERTIES.getProperty(KEY_BASEDIR), new GuidGenerator().getUUID()).getCanonicalPath();
createPropertyFile(filename, 13);
service.setSequenceNumberFile(filename);
service.setMaximumSequenceNumber(12L);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
execute(service, msg);
assertEquals(2, getSequenceNumber(filename));
assertTrue(msg.containsKey(DEFAULT_METADATA_KEY));
assertEquals("1", msg.getMetadataValue(DEFAULT_METADATA_KEY));
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class SimpleSequenceNumberTest method testDoService_MaximumSetHit.
@Test
public void testDoService_MaximumSetHit() throws Exception {
SimpleSequenceNumberService service = new SimpleSequenceNumberService();
service.setMetadataKey(DEFAULT_METADATA_KEY);
String filename = new File(PROPERTIES.getProperty(KEY_BASEDIR), new GuidGenerator().getUUID()).getCanonicalPath();
createPropertyFile(filename, 13);
service.setSequenceNumberFile(filename);
service.setMaximumSequenceNumber(12L);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
execute(service, msg);
assertEquals(2, getSequenceNumber(filename));
assertTrue(msg.containsKey(DEFAULT_METADATA_KEY));
assertEquals("1", msg.getMetadataValue(DEFAULT_METADATA_KEY));
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class SimpleSequenceNumberTest method testDoService_MaximumAndNumberFormattingSetHitPropertyExceededMax.
@Test
public void testDoService_MaximumAndNumberFormattingSetHitPropertyExceededMax() throws Exception {
SimpleSequenceNumberService service = new SimpleSequenceNumberService();
service.setMetadataKey(DEFAULT_METADATA_KEY);
String filename = new File(PROPERTIES.getProperty(KEY_BASEDIR), new GuidGenerator().getUUID()).getCanonicalPath();
createPropertyFile(filename, 13);
service.setSequenceNumberFile(filename);
service.setNumberFormat("000");
service.setMaximumSequenceNumber(12L);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
execute(service, msg);
assertEquals(2, getSequenceNumber(filename));
assertTrue(msg.containsKey(DEFAULT_METADATA_KEY));
assertEquals("001", msg.getMetadataValue(DEFAULT_METADATA_KEY));
}
use of com.adaptris.util.GuidGenerator in project interlok by adaptris.
the class SimpleSequenceNumberTest method testDoService_MaximumAndNumberFormattingSetNotHit.
@Test
public void testDoService_MaximumAndNumberFormattingSetNotHit() throws Exception {
SimpleSequenceNumberService service = new SimpleSequenceNumberService();
service.setMetadataKey(DEFAULT_METADATA_KEY);
String filename = new File(PROPERTIES.getProperty(KEY_BASEDIR), new GuidGenerator().getUUID()).getCanonicalPath();
createPropertyFile(filename, 10);
service.setSequenceNumberFile(filename);
service.setNumberFormat("000");
service.setMaximumSequenceNumber(12L);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
execute(service, msg);
assertEquals(11, getSequenceNumber(filename));
assertTrue(msg.containsKey(DEFAULT_METADATA_KEY));
assertEquals("010", msg.getMetadataValue(DEFAULT_METADATA_KEY));
}
Aggregations