use of java.util.ArrayList in project camel by apache.
the class EC2ComponentSpringTest method startInstances.
@Test
public void startInstances() {
Exchange exchange = template.request("direct:start", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Collection l = new ArrayList();
l.add("test-1");
exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
}
});
StartInstancesResult resultGet = (StartInstancesResult) exchange.getOut().getBody();
assertEquals(resultGet.getStartingInstances().get(0).getInstanceId(), "test-1");
assertEquals(resultGet.getStartingInstances().get(0).getPreviousState().getName(), InstanceStateName.Stopped.toString());
assertEquals(resultGet.getStartingInstances().get(0).getCurrentState().getName(), InstanceStateName.Running.toString());
}
use of java.util.ArrayList in project camel by apache.
the class EC2ComponentSpringTest method ec2DescribeSpecificInstancesTest.
@Test
public void ec2DescribeSpecificInstancesTest() throws Exception {
Exchange exchange = template.request("direct:describe", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Collection l = new ArrayList();
l.add("instance-1");
exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
}
});
DescribeInstancesResult resultGet = (DescribeInstancesResult) exchange.getOut().getBody();
assertEquals(resultGet.getReservations().size(), 1);
assertEquals(resultGet.getReservations().get(0).getInstances().size(), 1);
}
use of java.util.ArrayList in project camel by apache.
the class EC2ProducerTest method ec2TerminateTest.
@Test
public void ec2TerminateTest() throws Exception {
mock.expectedMessageCount(1);
Exchange exchange = template.request("direct:terminate", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Collection l = new ArrayList();
l.add("test-1");
exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
}
});
assertMockEndpointsSatisfied();
TerminateInstancesResult resultGet = (TerminateInstancesResult) exchange.getIn().getBody();
assertEquals(resultGet.getTerminatingInstances().get(0).getInstanceId(), "test-1");
assertEquals(resultGet.getTerminatingInstances().get(0).getPreviousState().getName(), InstanceStateName.Running.toString());
assertEquals(resultGet.getTerminatingInstances().get(0).getCurrentState().getName(), InstanceStateName.Terminated.toString());
}
use of java.util.ArrayList in project camel by apache.
the class EC2ProducerTest method ec2RebootInstancesTest.
@Test
public void ec2RebootInstancesTest() throws Exception {
mock.expectedMessageCount(1);
Exchange exchange = template.request("direct:reboot", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Collection l = new ArrayList();
l.add("test-1");
exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
}
});
assertMockEndpointsSatisfied();
}
use of java.util.ArrayList in project camel by apache.
the class EC2ProducerTest method ec2MonitorInstancesTest.
@Test
public void ec2MonitorInstancesTest() throws Exception {
mock.expectedMessageCount(1);
Exchange exchange = template.request("direct:monitor", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Collection l = new ArrayList();
l.add("test-1");
exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
}
});
assertMockEndpointsSatisfied();
MonitorInstancesResult resultGet = (MonitorInstancesResult) exchange.getIn().getBody();
assertEquals(resultGet.getInstanceMonitorings().size(), 1);
assertEquals(resultGet.getInstanceMonitorings().get(0).getInstanceId(), "test-1");
assertEquals(resultGet.getInstanceMonitorings().get(0).getMonitoring().getState(), MonitoringState.Enabled.toString());
}
Aggregations