use of java.util.ArrayList in project camel by apache.
the class SimpleTest method testListRemoveByInstance.
public void testListRemoveByInstance() throws Exception {
List<Object> data = new ArrayList<Object>();
data.add("A");
data.add("B");
exchange.getIn().setBody(data);
assertEquals(2, data.size());
Expression expression = SimpleLanguage.simple("${body.remove('A')}");
expression.evaluate(exchange, Object.class);
assertEquals(1, data.size());
assertEquals("B", data.get(0));
}
use of java.util.ArrayList in project camel by apache.
the class RemoveRouteDefinitionTest method testStopRoute.
public void testStopRoute() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
MBeanServer mbeanServer = getMBeanServer();
Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
assertEquals(1, set.size());
ObjectName on = set.iterator().next();
boolean registered = mbeanServer.isRegistered(on);
assertEquals("Should be registered", true, registered);
RouteDefinition definition = context.getRouteDefinition("route1");
List<RouteDefinition> routeDefinitions = new ArrayList<RouteDefinition>();
routeDefinitions.add(definition);
context.stopRoute("route1");
// route is only stopped so its still in JMX
set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
assertEquals(1, set.size());
}
use of java.util.ArrayList in project camel by apache.
the class RemoveRouteDefinitionTest method testShutdownRoute.
@SuppressWarnings("deprecation")
public void testShutdownRoute() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
MBeanServer mbeanServer = getMBeanServer();
Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
assertEquals(1, set.size());
ObjectName on = set.iterator().next();
boolean registered = mbeanServer.isRegistered(on);
assertEquals("Should be registered", true, registered);
RouteDefinition definition = context.getRouteDefinition("route1");
List<RouteDefinition> routeDefinitions = new ArrayList<RouteDefinition>();
routeDefinitions.add(definition);
context.shutdownRoute("route1");
// route is shutdown (= also removed), so its not longer in JMX
set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
assertEquals(0, set.size());
}
use of java.util.ArrayList in project camel by apache.
the class RemoveRouteDefinitionTest method testStopAndRemoveRoute.
public void testStopAndRemoveRoute() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
MBeanServer mbeanServer = getMBeanServer();
Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
assertEquals(1, set.size());
ObjectName on = set.iterator().next();
boolean registered = mbeanServer.isRegistered(on);
assertEquals("Should be registered", true, registered);
RouteDefinition definition = context.getRouteDefinition("route1");
List<RouteDefinition> routeDefinitions = new ArrayList<RouteDefinition>();
routeDefinitions.add(definition);
// must stop before we can remove
context.stopRoute("route1");
context.removeRoute("route1");
// route is removed, so its not longer in JMX
set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
assertEquals(0, set.size());
}
use of java.util.ArrayList in project camel by apache.
the class AhcProducerTwoParametersWithSameKeyTest method testTwoHeadersWithSameKeyHeader.
@Test
public void testTwoHeadersWithSameKeyHeader() throws Exception {
Exchange out = template.request("ahc:http://localhost:{{port}}/myapp", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody(null);
exchange.getIn().setHeader("from", "me");
List<String> list = new ArrayList<String>();
list.add("foo");
list.add("bar");
exchange.getIn().setHeader("to", list);
}
});
assertNotNull(out);
assertFalse("Should not fail", out.isFailed());
assertEquals("OK", out.getOut().getBody(String.class));
assertEquals("yes", out.getOut().getHeader("bar"));
}
Aggregations