}
@Test
public void testReconfigureCreateConnection() {
final String name = Addresses.createUniqueAddress();
final Vertigo vertigo = new Vertigo(this);
vertigo.deployCluster(new Handler<AsyncResult<Cluster>>() {
@Override
public void handle(AsyncResult<Cluster> result) {
assertTrue(result.succeeded());
final Cluster cluster = result.result();
// Deploy a network with two components but no connections. The components
// won't be able to communicate with each other, though the component code
// doesn't need to know that
NetworkConfig network = vertigo.createNetwork(name);
network.addVerticle("sender", TestReconfigureSender.class.getName());
network.addVerticle("receiver", TestReconfigureReceiver.class.getName());
cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
@Override
public void handle(AsyncResult<ActiveNetwork> result) {
if (result.failed()) {
assertTrue(result.cause().getMessage(), result.succeeded());
} else {
// Now that the two components are running, to add a connection between
// the two components we have to create a new network configuration with
// the same name as the original network and add the connection to it.
// When the new configuration is deployed, Vertigo will recognize that
// it has the same name as the running connection and merge the two
// networks.
NetworkConfig network = vertigo.createNetwork(name);
network.createConnection("sender", "out", "receiver", "in");
cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
@Override
public void handle(AsyncResult<ActiveNetwork> result) {
if (result.failed()) {