ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
try {
Set<ContainerProxy> containers = ContainerBuilder.create(fabricProxy, 4).withName("child").withProfiles("default").assertProvisioningResult().build();
try {
LinkedList<Container> containerList = new LinkedList<Container>(containers);
Container eastBroker = containerList.removeLast();
Container westBroker = containerList.removeLast();
Profile eastBrokerProfile = eastBroker.getVersion().getRequiredProfile("mq-broker-us-east.us-east");
eastBroker.setProfiles(new Profile[]{eastBrokerProfile});
Profile westBrokerProfile = eastBroker.getVersion().getRequiredProfile("mq-broker-us-west.us-west");
westBroker.setProfiles(new Profile[]{westBrokerProfile});
Provision.provisioningSuccess(Arrays.asList(westBroker, eastBroker), PROVISION_TIMEOUT);
waitForBroker("us-east");
waitForBroker("us-west");
final BrokerViewMBean brokerEast = (BrokerViewMBean)Provision.getMBean(eastBroker, new ObjectName("org.apache.activemq:type=Broker,brokerName=us-east"), BrokerViewMBean.class, 120000);
final BrokerViewMBean brokerWest = (BrokerViewMBean)Provision.getMBean(westBroker, new ObjectName("org.apache.activemq:type=Broker,brokerName=us-west"), BrokerViewMBean.class, 120000);
Assert.assertNotNull("Cannot get BrokerViewMBean from JMX", brokerEast);
Assert.assertNotNull("Cannot get BrokerViewMBean from JMX", brokerWest);
Container eastProducer = containerList.removeLast();
executeCommand("container-add-profile " + eastProducer.getId()+" example-mq-producer mq-client-us-east");
Container westConsumer = containerList.removeLast();
executeCommand("container-add-profile " + westConsumer.getId() + " example-mq-consumer mq-client-us-west");
Provision.provisioningSuccess(Arrays.asList(eastProducer, westConsumer), PROVISION_TIMEOUT);
System.out.println(executeCommand("fabric:container-list"));