mirror of https://github.com/apache/jclouds.git
fixed stub to work with override credential template options
This commit is contained in:
parent
a6da180f61
commit
d86fa45fb6
|
@ -99,7 +99,14 @@ public class StubComputeServiceAdapter implements JCloudsNativeComputeServiceAda
|
|||
builder.state(NodeState.PENDING);
|
||||
builder.publicAddresses(ImmutableSet.<String> of(publicIpPrefix + id));
|
||||
builder.privateAddresses(ImmutableSet.<String> of(privateIpPrefix + id));
|
||||
builder.credentials(new Credentials("root", passwordPrefix + id));
|
||||
Credentials creds = template.getOptions().getOverridingCredentials();
|
||||
if (creds == null)
|
||||
creds = new Credentials(null, null);
|
||||
if (creds.identity == null)
|
||||
creds = creds.toBuilder().identity("root").build();
|
||||
if (creds.credential == null)
|
||||
creds = creds.toBuilder().credential(passwordPrefix + id).build();
|
||||
builder.credentials(creds);
|
||||
NodeMetadata node = builder.build();
|
||||
credentialStore.put("node#" + node.getId(), node.getCredentials());
|
||||
nodes.put(node.getId(), node);
|
||||
|
|
|
@ -137,12 +137,11 @@ list, Alan Dipert and MeikelBrandmeyer."
|
|||
node (create-node service "something" template)]
|
||||
(is (= (-> node bean :credentials f)
|
||||
(f credentials)))
|
||||
(let [credentials (org.jclouds.domain.Credentials. "user" "pwd")
|
||||
(let [identity "fred"
|
||||
f #(.identity %)
|
||||
template (build-template service {:override-login-user-with "fred"})
|
||||
template (build-template service {:override-login-user-with identity})
|
||||
node (create-node service "something" template)]
|
||||
(is (= (-> node bean :credentials f)
|
||||
(f credentials))))
|
||||
(is (= (-> node bean :credentials f) identity)))
|
||||
(let [credential "fred"
|
||||
f #(.credential %)
|
||||
template (build-template
|
||||
|
|
Loading…
Reference in New Issue