use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testNoDN.
@Test(expected = UnsupportedOperationException.class)
public void testNoDN() throws Exception {
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
Map<String, Object> body = new HashMap<String, Object>();
processBody(exchange, in, body);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testFunctionDriven.
@Test
public void testFunctionDriven() throws Exception {
String dn = "cn=dn";
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.REQUEST, dn);
body.put(SpringLdapProducer.FUNCTION, (BiFunction<LdapOperations, String, Void>) (l, q) -> {
l.lookup(q);
return null;
});
when(ldapEndpoint.getOperation()).thenReturn(LdapOperation.FUNCTION_DRIVEN);
processBody(exchange, in, body);
verify(ldapTemplate).lookup(eq(dn));
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testNullOperation.
@Test(expected = UnsupportedOperationException.class)
public void testNullOperation() 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);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testBind.
@Test
public void testBind() throws Exception {
String dn = "some dn";
BasicAttributes attributes = new BasicAttributes();
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.ATTRIBUTES, attributes);
when(ldapEndpoint.getOperation()).thenReturn(LdapOperation.BIND);
processBody(exchange, in, body);
verify(ldapTemplate).bind(eq(dn), isNull(), eq(attributes));
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SpringLdapProducerTest method testWrongBodyType.
@Test(expected = NullPointerException.class)
public void testWrongBodyType() throws Exception {
Exchange exchange = new DefaultExchange(context);
Message in = new DefaultMessage();
in.setBody("");
exchange.setIn(in);
ldapProducer.process(exchange);
}
Aggregations