protected void doBuild() { nginxController = createChild( BasicEntitySpec.newInstance(NginxController.class) // .configure("domain", "webclusterexample.brooklyn.local") .configure("port", "8000+")); web = createChild( ControlledDynamicWebAppCluster.Spec.newInstance() .displayName("WebApp cluster") .controller(nginxController) .initialSize(1) .memberSpec( BasicEntitySpec.newInstance(JBoss7Server.class) .configure("httpPort", "8080+") .configure("war", WAR_PATH))); web.getCluster() .addPolicy( AutoScalerPolicy.builder() .metric(DynamicWebAppCluster.AVERAGE_REQUESTS_PER_SECOND) .sizeRange(1, 5) .metricRange(10, 100) .build()); }
@Override protected void doTest(Location loc) throws Exception { EntityDriverManager entityDriverManager = ctx.getEntityDriverManager(); entityDriverManager.registerDriver( MySqlDriver.class, SshMachineLocation.class, MySqlChefSoloSshDriver.class); mysql = app.createAndManageChild(BasicEntitySpec.newInstance(MySqlNode.class)); app.start(ImmutableList.of(loc)); EntityTestUtils.assertAttributeEqualsEventually(mysql, SoftwareProcess.SERVICE_UP, true); }
@Override protected void doTest(Location loc) throws Exception { MongoDbServer entity = app.createAndManageChild(BasicEntitySpec.newInstance(MongoDbServer.class)); app.start(ImmutableList.of(loc)); EntityTestUtils.assertAttributeEqualsEventually(entity, MongoDbServer.SERVICE_UP, true); String id = insert(entity, "hello", "world!"); DBObject docOut = getById(entity, id); assertEquals(docOut.get("hello"), "world!"); }