Merge branch 'master' of github.com:jclouds/jclouds

* 'master' of github.com:jclouds/jclouds:
  Issue 455:rename org.jclouds.ssh.ExecResponse -> org.jclouds.compute.domain.ExecResponse
  trmk vcloudexpress regression
This commit is contained in:
Adrian Cole 2011-01-26 11:52:32 -08:00
commit d1b1ca7b8c
27 changed files with 61 additions and 54 deletions

View File

@ -47,6 +47,7 @@ import org.jclouds.cloudservers.domain.ServerStatus;
import org.jclouds.cloudservers.domain.SharedIpGroup;
import org.jclouds.cloudservers.domain.WeeklyBackup;
import org.jclouds.cloudservers.options.RebuildServerOptions;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payload;
@ -55,7 +56,6 @@ import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.jclouds.ssh.jsch.config.JschSshClientModule;

View File

@ -37,6 +37,7 @@ import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
import org.jclouds.ec2.domain.BlockDevice;
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
@ -58,7 +59,6 @@ import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.scriptbuilder.ScriptBuilder;
import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.testng.annotations.AfterTest;

View File

@ -37,6 +37,7 @@ import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
import org.jclouds.ec2.domain.Attachment;
import org.jclouds.ec2.domain.BlockDevice;
@ -70,7 +71,6 @@ import org.jclouds.scriptbuilder.InitBuilder;
import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.scriptbuilder.domain.Statements;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.testng.annotations.AfterTest;

View File

@ -31,6 +31,7 @@ import java.util.logging.Logger;
import org.jclouds.Constants;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
import org.jclouds.elasticstack.domain.ClaimType;
import org.jclouds.elasticstack.domain.CreateDriveRequest;
@ -51,7 +52,6 @@ import org.jclouds.net.IPSocket;
import org.jclouds.predicates.InetSocketAddressConnect;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.util.Strings2;

View File

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

View File

@ -48,8 +48,8 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
@Inject
public OrgNameCatalogNameVAppTemplateNameToEndpoint(
Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> orgCatalogItemMap,
@Org String defaultOrg, @Catalog String defaultCatalog) {
Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> orgCatalogItemMap,
@Org String defaultOrg, @Catalog String defaultCatalog) {
this.orgCatalogItemMap = orgCatalogItemMap;
this.defaultOrg = defaultOrg;
this.defaultCatalog = defaultCatalog;
@ -65,13 +65,23 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
org = defaultOrg;
if (catalog == null)
catalog = defaultCatalog;
try {
Map<String, Map<String, ? extends CatalogItem>> catalogs = checkNotNull(orgCatalogItemMap.get().get(org));
return catalogs.get(catalog).get(catalogItem).getEntity().getHref();
} catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
+ orgCatalogItemMap.get());
}
Map<String, Map<String, Map<String, ? extends CatalogItem>>> orgCatalogItemMap = this.orgCatalogItemMap.get();
if (!orgCatalogItemMap.containsKey(org))
throw new NoSuchElementException("org: " + org + " not found in " + orgCatalogItemMap.keySet());
Map<String, Map<String, ? extends CatalogItem>> catalogs = orgCatalogItemMap.get(org);
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

@ -20,7 +20,8 @@
(:require
[clojure.contrib.logging :as logging])
(:import
[org.jclouds.ssh SshClient ExecResponse]
org.jclouds.ssh.SshClient
org.jclouds.compute.domain.ExecResponse
com.google.inject.Module
com.google.common.collect.ImmutableSet
org.jclouds.domain.Credentials

View File

@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Set;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
@ -34,7 +35,6 @@ import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.domain.Location;
import org.jclouds.io.Payload;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.ssh.ExecResponse;
import com.google.common.base.Predicate;
import com.google.inject.ImplementedBy;

View File

@ -26,10 +26,10 @@ import java.util.Map;
import javax.annotation.Nullable;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.ssh.ExecResponse;
/**
*

View File

@ -21,10 +21,10 @@ package org.jclouds.compute.callables;
import java.util.concurrent.Callable;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.ssh.ExecResponse;
import com.google.common.annotations.Beta;

View File

@ -27,6 +27,7 @@ import java.util.Collections;
import javax.annotation.Resource;
import javax.inject.Named;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.compute.reference.ComputeServiceConstants;
@ -34,7 +35,6 @@ import org.jclouds.logging.Logger;
import org.jclouds.scriptbuilder.InitBuilder;
import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import com.google.common.annotations.VisibleForTesting;

View File

@ -24,11 +24,11 @@ import static com.google.common.base.Preconditions.checkNotNull;
import javax.inject.Inject;
import javax.inject.Named;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import com.google.common.base.Function;

View File

@ -25,13 +25,13 @@ import static com.google.common.base.Preconditions.checkState;
import javax.annotation.Resource;
import javax.inject.Named;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger;
import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import com.google.common.annotations.VisibleForTesting;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.ssh;
package org.jclouds.compute.domain;
import org.jclouds.compute.config.CustomizationResponse;

View File

@ -59,6 +59,7 @@ import org.jclouds.compute.RunScriptOnNodesException;
import org.jclouds.compute.callables.RunScriptOnNode;
import org.jclouds.compute.config.CustomizationResponse;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
@ -85,7 +86,6 @@ import org.jclouds.logging.Logger;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.scriptbuilder.domain.Statements;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.util.Strings2;
import com.google.common.base.Function;

View File

@ -22,8 +22,8 @@ package org.jclouds.compute.predicates;
import javax.annotation.Resource;
import javax.inject.Singleton;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.logging.Logger;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import com.google.common.base.Predicate;

View File

@ -34,6 +34,7 @@ import javax.inject.Named;
import org.jclouds.compute.callables.RunScriptOnNode;
import org.jclouds.compute.config.CustomizationResponse;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.predicates.RetryIfSocketNotYetOpen;
@ -41,7 +42,6 @@ import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.logging.Logger;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.ssh.ExecResponse;
import com.google.common.base.Function;
import com.google.common.base.Predicate;

View File

@ -30,10 +30,10 @@ import javax.annotation.Resource;
import javax.inject.Named;
import org.jclouds.compute.callables.RunScriptOnNode;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger;
import org.jclouds.ssh.ExecResponse;
import com.google.common.base.Objects;
import com.google.inject.assistedinject.AssistedInject;

View File

@ -22,6 +22,7 @@ package org.jclouds.ssh;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
import org.jclouds.io.Payload;
import org.jclouds.net.IPSocket;

View File

@ -21,7 +21,8 @@
[clojure.contrib.logging :as logging]
[org.jclouds.modules :as modules])
(:import
[org.jclouds.ssh SshClient ExecResponse]
org.jclouds.ssh.SshClient
org.jclouds.compute.domain.ExecResponse
org.jclouds.io.Payload
org.jclouds.net.IPSocket))

View File

@ -58,6 +58,7 @@ import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ComputeType;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
@ -78,7 +79,6 @@ import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.scriptbuilder.domain.Statements;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.testng.annotations.AfterTest;
@ -239,11 +239,11 @@ public abstract class BaseComputeServiceLiveTest {
}
for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching(
runningWithTag(tag), Statements.exec("echo hello"), overrideCredentialsWith(good).wrapInInitScript(false))
.entrySet())
runningWithTag(tag), Statements.exec("echo hello"),
overrideCredentialsWith(good).wrapInInitScript(false).runAsRoot(false)).entrySet())
assert response.getValue().getOutput().trim().equals("hello") : response.getKey() + ": "
+ response.getValue();
runScriptWithCreds(tag, os, good);
checkNodes(nodes, tag);

View File

@ -36,6 +36,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.easymock.IArgumentMatcher;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.domain.Credentials;
import org.jclouds.io.Payload;
@ -43,7 +44,6 @@ import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.RestContext;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.jclouds.util.Strings2;

View File

@ -40,12 +40,12 @@ import javax.inject.Named;
import org.apache.commons.io.input.ProxyInputStream;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
import org.jclouds.logging.Logger;
import org.jclouds.net.IPSocket;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.jclouds.util.Strings2;

View File

@ -26,11 +26,11 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
import org.jclouds.net.IPSocket;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.util.Strings2;

View File

@ -46,13 +46,13 @@ import org.jclouds.cloudsigma.options.CloneDriveOptions;
import org.jclouds.cloudsigma.predicates.DriveClaimed;
import org.jclouds.cloudsigma.util.Servers;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket;
import org.jclouds.predicates.InetSocketAddressConnect;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.AfterGroups;

View File

@ -32,10 +32,10 @@ import java.util.Map.Entry;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.ComputeTestUtils;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;

View File

@ -46,10 +46,10 @@ import com.google.common.collect.Maps;
public class NodeToNodeMetadataTest {
public static final Location location = new LocationImpl(LocationScope.PROVIDER, "byon", "byon", null);
public static final NodeMetadata TEST1 = new NodeMetadataBuilder().ids("first").tag("hadoop").name("xyz").location(
public static final NodeMetadata TEST1 = new NodeMetadataBuilder().ids("cluster-1").tag("hadoop").name("xyz").location(
location).state(NodeState.RUNNING).operatingSystem(
new OperatingSystemBuilder().name("redhat").family(OsFamily.RHEL).arch("x86").version("5.3").description(
"xyz").build()).publicAddresses(ImmutableSet.of("firsthost")).credentials(
"xyz").build()).publicAddresses(ImmutableSet.of("cluster-1.mydomain.com")).credentials(
new Credentials("myUser", "fancyfoot")).adminPassword("sudo").build();
@Test
@ -60,7 +60,7 @@ public class NodeToNodeMetadataTest {
NodeToNodeMetadata parser = new NodeToNodeMetadata(Suppliers.ofInstance(location), credentialStore);
assertEquals(parser.apply(NodesFromYamlTest.TEST1), TEST1);
assertEquals(credentialStore, ImmutableMap.of("node#first", new Credentials("myUser", "fancyfoot")));
assertEquals(credentialStore, ImmutableMap.of("node#cluster-1", new Credentials("myUser", "fancyfoot")));
}
}