use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class SerializableAdaptrisMessageTest method testSetMetadata.
@Test
public void testSetMetadata() throws Exception {
SerializableAdaptrisMessage message = new SerializableAdaptrisMessage();
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.addKeyValuePair(new KeyValuePair(KEY1, VALUE1));
kvps.addKeyValuePair(new KeyValuePair(KEY2, VALUE2));
kvps.addKeyValuePair(new KeyValuePair(KEY3, VALUE3));
message.setMetadata(kvps);
assertEquals(3, message.getMetadata().size());
assertTrue(message.getMessageHeaders().containsKey(KEY1));
assertTrue(message.getMessageHeaders().containsKey(KEY2));
assertTrue(message.getMessageHeaders().containsKey(KEY3));
assertFalse(message.getMessageHeaders().containsKey(KEY4));
message.setMetadata((KeyValuePairSet) null);
assertEquals(0, message.getMetadata().size());
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class InsertNodeTest method testSetNamespaceContext.
@Test
public void testSetNamespaceContext() {
InsertNode obj = new InsertNode();
assertNull(obj.getNamespaceContext());
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("hello", "world"));
obj.setNamespaceContext(kvps);
assertEquals(kvps, obj.getNamespaceContext());
obj.setNamespaceContext(null);
assertNull(obj.getNamespaceContext());
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class FtpRecursiveConsumerTest method create.
private FtpConnection create(FakeFtpServer server) {
FtpConnection consumeConnection = new FtpConnection();
consumeConnection.setDefaultControlPort(server.getServerControlPort());
consumeConnection.setDefaultPassword(DEFAULT_PASSWORD);
consumeConnection.setDefaultUserName(DEFAULT_USERNAME);
consumeConnection.setCacheConnection(true);
consumeConnection.setAdditionalDebug(true);
KeyValuePairSet settings = new KeyValuePairSet();
settings.add(new KeyValuePair(ClientSettings.FTP.RemoteVerificationEnabled.name(), "false"));
consumeConnection.setAdditionalSettings(settings);
return consumeConnection;
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class VerifyIdentityServiceTest method testMetadataVerification_Fails.
@Test
public void testMetadataVerification_Fails() throws Exception {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
msg.addMetadata(USER, "user");
msg.addMetadata(PASSWORD, "password");
msg.addMetadata("dbUser", "user");
msg.addMetadata("dbPassword", "NotThePassword");
MetadataIdentityVerifier verifier = new MetadataIdentityVerifier(new KeyValuePairSet(Arrays.asList(new KeyValuePair[] { new KeyValuePair(USER, "dbUser"), new KeyValuePair(PASSWORD, "dbPassword") })));
MetadataIdentityBuilder builder = new MetadataIdentityBuilder(MetadataSource.Standard, new ArrayList<String>(Arrays.asList(USER, PASSWORD)));
VerifyIdentityService service = new VerifyIdentityService(builder, verifier);
try {
execute(service, msg);
fail();
} catch (ServiceException expected) {
}
}
use of com.adaptris.util.KeyValuePairSet in project interlok by adaptris.
the class JndiImplementationCase method testSetJndiParams.
@Test
public void testSetJndiParams() throws Exception {
BaseJndiImplementation jv = createVendorImplementation();
KeyValuePairSet set = new KeyValuePairSet();
jv.setJndiParams(set);
assertEquals(set, jv.getJndiParams());
try {
jv.setJndiParams(null);
fail();
} catch (IllegalArgumentException expected) {
}
assertEquals(set, jv.getJndiParams());
}
Aggregations