use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testAuthenticate.
@Test
public void testAuthenticate() throws Exception {
String dn = "cn=dn";
String filter = "filter";
String password = "password";
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
Map<String, Object> body = new HashMap<String, Object>();
body.put(SpringLdapProducer.DN, dn);
body.put(SpringLdapProducer.FILTER, filter);
body.put(SpringLdapProducer.PASSWORD, password);
when(ldapEndpoint.getOperation()).thenReturn(LdapOperation.AUTHENTICATE);
processBody(exchange, in, body);
verify(ldapTemplate).authenticate(Matchers.any(LdapQuery.class), eq(password));
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testNullDN.
@Test(expected = UnsupportedOperationException.class)
public void testNullDN() throws Exception {
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
Map<String, Object> body = new HashMap<String, Object>();
body.put(SpringLdapProducer.DN, null);
processBody(exchange, in, body);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testUnbind.
@Test
public void testUnbind() throws Exception {
String dn = "some dn";
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
Map<String, Object> body = new HashMap<String, Object>();
body.put(SpringLdapProducer.DN, dn);
when(ldapEndpoint.getOperation()).thenReturn(LdapOperation.UNBIND);
processBody(exchange, in, body);
verify(ldapTemplate).unbind(eq(dn));
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testModifyAttributes.
@Test
public void testModifyAttributes() throws Exception {
String dn = "cn=dn";
ModificationItem[] modificationItems = new ModificationItem[] { new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute("key", "value")) };
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
Map<String, Object> body = new HashMap<String, Object>();
body.put(SpringLdapProducer.DN, dn);
body.put(SpringLdapProducer.MODIFICATION_ITEMS, modificationItems);
when(ldapEndpoint.getOperation()).thenReturn(LdapOperation.MODIFY_ATTRIBUTES);
processBody(exchange, in, body);
verify(ldapTemplate).modifyAttributes(eq(dn), eq(modificationItems));
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testNoDNForFunctionDrivenOperation.
@Test
public void testNoDNForFunctionDrivenOperation() throws Exception {
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
Map<String, Object> body = new HashMap<String, Object>();
body.put(SpringLdapProducer.FUNCTION, Mockito.mock(BiFunction.class));
when(ldapEndpoint.getOperation()).thenReturn(LdapOperation.FUNCTION_DRIVEN);
processBody(exchange, in, body);
}
Aggregations