protected void checkHttpGet(NodeMetadata node) { ComputeTestUtils.checkHttpGet(view.utils().http(), node, 8080); }
protected void checkHttpGet(NodeMetadata node) { ComputeTestUtils.checkHttpGet(view.utils().http(), node, 8080); }
@Test(enabled = true, dependsOnMethods = "testRegisterTemplate") public void testExtractTemplate() throws Exception { // Initiate the extraction and wait for it to complete AsyncCreateResponse response = client.getTemplateClient().extractTemplate(registeredTemplate.getId(), ExtractMode.HTTP_DOWNLOAD, registeredTemplate.getZoneId()); assertTrue(jobComplete.apply(response.getJobId()), registeredTemplate.toString()); // Get the result AsyncJob<TemplateExtraction> asyncJob = client.getAsyncJobClient().getAsyncJob(response.getJobId()); TemplateExtraction extract = asyncJob.getResult(); assertNotNull(extract); // Check that the URL can be retrieved String extractUrl = extract.getUrl(); assertNotNull(extractUrl); URI uri = new URI(URLDecoder.decode(extractUrl, "utf-8")); assertTrue(cloudStackContext.utils().http().exists(uri), "does not exist: " + uri); }
@Test(dependsOnMethods = "testCanUpdateRunList") public void testRunNodesWithBootstrap() throws IOException { Statement bootstrap = view.getChefService().createBootstrapScriptForGroup(group); try { nodes = computeContext.getComputeService().createNodesInGroup(group, 1, runScript(bootstrap)); } catch (RunNodesException e) { nodes = concat(e.getSuccessfulNodes(), e.getNodeErrors().keySet()); } for (NodeMetadata node : nodes) { URI uri = URI.create("http://" + getLast(node.getPublicAddresses())); InputStream content = computeContext.utils().http().get(uri); String string = Strings2.toStringAndClose(content); assert string.indexOf("It works!") >= 0 : string; } }
@Test(enabled = true, dependsOnMethods = "testRegisterTemplate") public void testExtractTemplate() throws Exception { // Initiate the extraction and wait for it to complete AsyncCreateResponse response = client.getTemplateApi().extractTemplate(registeredTemplate.getId(), ExtractMode.HTTP_DOWNLOAD, registeredTemplate.getZoneId()); assertTrue(jobComplete.apply(response.getJobId()), registeredTemplate.toString()); // Get the result AsyncJob<TemplateExtraction> asyncJob = client.getAsyncJobApi().getAsyncJob(response.getJobId()); TemplateExtraction extract = asyncJob.getResult(); assertNotNull(extract); // Check that the URL can be retrieved String extractUrl = extract.getUrl(); assertNotNull(extractUrl); URI uri = new URI(URLDecoder.decode(extractUrl, "utf-8")); assertTrue(cloudStackContext.utils().http().exists(uri), "does not exist: " + uri); }