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);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testEmptyDN.
@Test(expected = UnsupportedOperationException.class)
public void testEmptyDN() throws Exception {
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
Map<String, Object> body = new HashMap<String, Object>();
body.put(SpringLdapProducer.DN, "");
processBody(exchange, in, body);
}
Aggregations