trmk vcloudexpress regression

This commit is contained in:
Adrian Cole 2011-01-26 10:24:59 -08:00
parent f1288fed4c
commit 2796048643
3 changed files with 32 additions and 28 deletions

View File

@ -33,7 +33,6 @@ import static org.testng.Assert.assertNotNull;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException;
import java.util.Properties; import java.util.Properties;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket; import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
@ -83,13 +81,6 @@ import com.google.inject.Module;
public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTest { public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTest {
// Terremark service call 695,490
@Override
@Test(expectedExceptions = NoSuchElementException.class)
public void testCatalog() throws Exception {
super.testCatalog();
}
protected String expectedOs = "Ubuntu Linux (64-bit)"; protected String expectedOs = "Ubuntu Linux (64-bit)";
protected String itemName = "Ubuntu JeOS 9.10 (64-bit)"; protected String itemName = "Ubuntu JeOS 9.10 (64-bit)";
@ -149,7 +140,7 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
prepare(); prepare();
StringBuffer name = new StringBuffer(); StringBuffer name = new StringBuffer();
for (int i = 0; i < 15; i++) for (int i = 0; i < 15; i++)
name.append("a"); name.append("c");
String serverName = name.toString();// "adriantest"; String serverName = name.toString();// "adriantest";
long hardDisk = 4194304; long hardDisk = 4194304;
@ -166,6 +157,8 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
TerremarkCatalogItem item = tmClient.findCatalogItemInOrgCatalogNamed(null, null, itemName); TerremarkCatalogItem item = tmClient.findCatalogItemInOrgCatalogNamed(null, null, itemName);
assert item != null;
// if this template supports setting the root password, let's add it to // if this template supports setting the root password, let's add it to
// our options // our options
CustomizationParameters customizationOptions = tmClient.getCustomizationOptions(item.getCustomizationOptions() CustomizationParameters customizationOptions = tmClient.getCustomizationOptions(item.getCustomizationOptions()
@ -175,6 +168,8 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
VCloudExpressVAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getHref()); VCloudExpressVAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getHref());
assert vAppTemplate != null;
// instantiate, noting vApp returned has minimal details // instantiate, noting vApp returned has minimal details
vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getHref(), vAppTemplate.getHref(), serverName, vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getHref(), vAppTemplate.getHref(), serverName,
instantiateOptions); instantiateOptions);
@ -196,8 +191,7 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
try {// per docs, this is not supported try {// per docs, this is not supported
tmClient.cancelTask(deployTask.getHref()); tmClient.cancelTask(deployTask.getHref());
} catch (HttpResponseException e) { } catch (UnsupportedOperationException e) {
assertEquals(e.getResponse().getStatusCode(), 501);
} }
assert successTester.apply(deployTask.getHref()); assert successTester.apply(deployTask.getHref());
@ -302,14 +296,14 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
try {// per docs, this is not supported try {// per docs, this is not supported
tmClient.undeployVApp(vApp.getHref()); tmClient.undeployVApp(vApp.getHref());
} catch (HttpResponseException e) { assert false;
assertEquals(e.getResponse().getStatusCode(), 501); } catch (UnsupportedOperationException e) {
} }
try {// per docs, this is not supported try {// per docs, this is not supported
tmClient.suspendVApp(vApp.getHref()); tmClient.suspendVApp(vApp.getHref());
} catch (HttpResponseException e) { assert false;
assertEquals(e.getResponse().getStatusCode(), 501); } catch (UnsupportedOperationException e) {
} }
assert successTester.apply(tmClient.resetVApp(vApp.getHref()).getHref()); assert successTester.apply(tmClient.resetVApp(vApp.getHref()).getHref());

View File

@ -65,13 +65,23 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
org = defaultOrg; org = defaultOrg;
if (catalog == null) if (catalog == null)
catalog = defaultCatalog; catalog = defaultCatalog;
try { Map<String, Map<String, Map<String, ? extends CatalogItem>>> orgCatalogItemMap = this.orgCatalogItemMap.get();
Map<String, Map<String, ? extends CatalogItem>> catalogs = checkNotNull(orgCatalogItemMap.get().get(org));
return catalogs.get(catalog).get(catalogItem).getEntity().getHref(); if (!orgCatalogItemMap.containsKey(org))
} catch (NullPointerException e) { throw new NoSuchElementException("org: " + org + " not found in " + orgCatalogItemMap.keySet());
throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in " Map<String, Map<String, ? extends CatalogItem>> catalogs = orgCatalogItemMap.get(org);
+ orgCatalogItemMap.get());
} if (!catalogs.containsKey(catalog))
throw new NoSuchElementException("catalog: " + org + "/" + catalog + " not found in " + catalogs.keySet());
Map<String, ? extends CatalogItem> catalogMap = catalogs.get(catalog);
if (!catalogMap.containsKey(catalogItem))
throw new NoSuchElementException("item: " + org + "/" + catalog + "/" + catalogItem + " not found in "
+ catalogMap.keySet());
CatalogItem item = catalogMap.get(catalogItem);
return checkNotNull(item.getEntity(), "item: " + org + "/" + catalog + "/" + catalogItem + " has no entity")
.getHref();
} }
} }

View File

@ -239,8 +239,8 @@ public abstract class BaseComputeServiceLiveTest {
} }
for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching( for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching(
runningWithTag(tag), Statements.exec("echo hello"), overrideCredentialsWith(good).wrapInInitScript(false)) runningWithTag(tag), Statements.exec("echo hello"),
.entrySet()) overrideCredentialsWith(good).wrapInInitScript(false).runAsRoot(false)).entrySet())
assert response.getValue().getOutput().trim().equals("hello") : response.getKey() + ": " assert response.getValue().getOutput().trim().equals("hello") : response.getKey() + ": "
+ response.getValue(); + response.getValue();