@Override public void run() { assertContentContainsText(url, phrase, additionalPhrases); } });
@Override public void run() { for (int i = 0; i < 2; i++) { HttpTestUtils.assertContentContainsText("http://localhost:"+port+"/atC0", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost:"+port+"/atC0/", "Hello"); } for (int i = 0; i < 2; i++) { HttpTestUtils.assertContentContainsText("http://localhost:"+port+"/atC1", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost:"+port+"/atC1/", "Hello"); } }}); }
@Override public void run() { for (int i = 0; i < 2; i++) { HttpTestUtils.assertContentContainsText("http://localhost:"+port+"/atC0/", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost:"+port+"/atC0", "Hello"); } }});
@Override public void run() { // health check HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/hello/frank", "http://localhost1:"+port+"/hello/frank"); // goodbye rewritten to hello HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/goodbye/frank", "http://localhost1:"+port+"/hello/frank"); // hello al rewritten to hello Big Al HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/hello/aled", "http://localhost1:"+port+"/hello/Big%20Aled"); // hello andrew rewritten to hello Sir Andrew HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/hello/andrew", "http://localhost1:"+port+"/hello/Sir%20Andrew"); // goodbye alex rewritten to hello Big Alex (two rewrites) HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/goodbye/alex", "http://localhost1:"+port+"/hello/Big%20Alex"); // but goodbye andrew rewritten only to hello Andrew -- test the "break" logic above (won't continue rewriting) HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/goodbye/andrew", "http://localhost1:"+port+"/hello/andrew"); // al rewrite can be anywhere HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/hello/hello/alex", "http://localhost1:"+port+"/hello/hello/Big%20Alex"); // but an rewrite must be at beginning HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/hello/hello/andrew", "http://localhost1:"+port+"/hello/hello/andrew"); }}); }
@Override public void run() { //cluster 0 for (int i = 0; i < 2; i++) { HttpTestUtils.assertContentContainsText("http://localhost1:"+port, "Hello"); HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/hello/frank", "http://localhost1:"+port+"/hello/frank"); } //cluster 1 for (int i = 0; i < 2; i++) { HttpTestUtils.assertContentContainsText("http://localhost2:"+port+"/hello-world", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost2:"+port+"/hello-world/", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost2:"+port+"/hello-world/hello/bob", "http://localhost2:"+port+"/hello-world/hello/bob"); } //cluster 2 for (int i = 0; i < 2; i++) { HttpTestUtils.assertContentContainsText("http://localhost3:"+port+"/c2", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost3:"+port+"/c2/", "Hello"); HttpTestUtils.assertContentContainsText("http://localhost3:"+port+"/c2/hello/joe", "http://localhost3:"+port+"/c2/hello/new%20joe"); } }});
@Override public void run() { HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"/hello-world", "Hello"); HttpTestUtils.assertHttpStatusCodeEquals("http://localhost1:"+port+"", 404); HttpTestUtils.assertContentContainsText("http://localhost:"+port+"", "Hello"); HttpTestUtils.assertHttpStatusCodeEquals("http://localhost:"+port+"/hello-world", 404); }}); }
@Test(groups = "Integration") public void testHttp() throws Exception { final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class) .configure("war", getTestWar())); app.start(ImmutableList.of(localhostProvisioningLocation)); // Don't rely on hostname; differs from URL when tests run on AWS VM String httpUrl = server.getAttribute(JBoss7Server.ROOT_URL); assertEquals(httpUrl.toLowerCase(), ("http://"+URI.create(httpUrl).getHost()+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/").toLowerCase()); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200); HttpTestUtils.assertContentContainsText(httpUrl, "Hello"); String httpsUrl = "https://"+URI.create(httpUrl).getHost()+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/"; HttpTestUtils.assertUrlUnreachable(httpsUrl); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT)); }}); }
HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
@Override protected void doTest(Location loc) throws Exception { final NodeJsWebAppService server = app.createAndManageChild(EntitySpec.create(NodeJsWebAppService.class) .configure("gitRepoUrl", GIT_REPO_URL) .configure("appFileName", APP_FILE) .configure("appName", APP_NAME)); app.start(ImmutableList.of(loc)); String url = server.getAttribute(NodeJsWebAppService.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); }
@Override protected void doTest(Location loc) throws Exception { final Tomcat8Server server = app.createAndManageChild(EntitySpec.create(Tomcat8Server.class) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(Tomcat8Server.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(Tomcat8Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(Tomcat8Server.ERROR_COUNT)); assertNotNull(server.getAttribute(Tomcat8Server.TOTAL_PROCESSING_TIME)); }}); }
@Override protected void doTest(Location loc) throws Exception { final Tomcat8Server server = app.createAndManageChild(EntitySpec.create(Tomcat8Server.class) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(Tomcat8Server.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(Tomcat8Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(Tomcat8Server.ERROR_COUNT)); assertNotNull(server.getAttribute(Tomcat8Server.TOTAL_PROCESSING_TIME)); // TODO These appear not to be set in TomcatServerImpl.connectSensors // See TomcatServerEc2LiveTest, where these are also not included. // assertNotNull(server.getAttribute(TomcatServer.MAX_PROCESSING_TIME)); // assertNotNull(server.getAttribute(TomcatServer.BYTES_RECEIVED)); // assertNotNull(server.getAttribute(TomcatServer.BYTES_SENT)); }}); }
@Override protected void doTest(Location loc) throws Exception { final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(JBoss7Server.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT)); }}); }
@Override protected void doTest(Location loc) throws Exception { final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(JBoss6Server.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT)); assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss6Server.MAX_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss6Server.BYTES_RECEIVED)); assertNotNull(server.getAttribute(JBoss6Server.BYTES_SENT)); }}); }
@Override protected void doTest(Location loc) throws Exception { final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(JBoss7Server.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT)); }}); }
@Override protected void doTest(Location loc) throws Exception { final TomcatServer server = app.createAndManageChild(EntitySpec.create(TomcatServer.class) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(TomcatServer.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(TomcatServer.REQUEST_COUNT)); assertNotNull(server.getAttribute(TomcatServer.ERROR_COUNT)); assertNotNull(server.getAttribute(TomcatServer.TOTAL_PROCESSING_TIME)); // TODO These appear not to be set in TomcatServerImpl.connectSensors // See TomcatServerEc2LiveTest, where these are also not included. // assertNotNull(server.getAttribute(TomcatServer.MAX_PROCESSING_TIME)); // assertNotNull(server.getAttribute(TomcatServer.BYTES_RECEIVED)); // assertNotNull(server.getAttribute(TomcatServer.BYTES_SENT)); }}); }
@Override protected void doTest(Location loc) throws Exception { final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(JBoss7Server.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT)); assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED)); assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT)); } }); }
@Override protected void doTest(Location loc) throws Exception { final TomcatServer server = app.createAndManageChild(EntitySpec.create(TomcatServer.class) .configure(TomcatServer.OPEN_IPTABLES, true) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); String url = server.getAttribute(TomcatServer.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { assertNotNull(server.getAttribute(TomcatServer.REQUEST_COUNT)); assertNotNull(server.getAttribute(TomcatServer.ERROR_COUNT)); assertNotNull(server.getAttribute(TomcatServer.TOTAL_PROCESSING_TIME)); }}); }
protected void runTest(UsesJmx.JmxAgentModes jmxAgentMode) throws Exception { final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class) .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT) .configure(UsesJmx.JMX_AGENT_MODE, jmxAgentMode) .configure("war", getTestWarWithNoMapping())); app.start(ImmutableList.of(localhostProvisioningLocation)); String httpUrl = server.getAttribute(JBoss6Server.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200); HttpTestUtils.assertContentContainsText(httpUrl, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { // TODO Could test other attributes as well; see jboss7 test assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT)); assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT)); assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME)); }}); } }
HttpTestUtils.assertContentContainsText("http://localhost1:"+port+"", "Hello");