try {
noSshContext = createView(setupProperties(), ImmutableSet.<Module> of(new Log4JLoggingModule()));
Set<? extends NodeMetadata> nodes = noSshContext.getComputeService().createNodesInGroup(group, 1, options);
NodeMetadata first = get(nodes, 0);
assert first.getCredentials() != null : first;
assert first.getCredentials().identity != null : first;
// credentials should not be present as the import public key call doesn't have access to
// the related private key
assert first.getCredentials().credential == null : first;
AWSRunningInstance instance = getInstance(instanceClient, first.getProviderId());
assertEquals(instance.getKeyName(), "jclouds#" + group);
Map<? extends NodeMetadata, ExecResponse> responses = view.getComputeService()
.runScriptOnNodesMatching(
runningInGroup(group),
exec("echo hello"),
overrideLoginCredentials(
LoginCredentials.builder().user(first.getCredentials().identity)
.privateKey(keyPair.get("private")).build()).wrapInInitScript(false).runAsRoot(false));
ExecResponse hello = getOnlyElement(responses.values());
assertEquals(hello.getOutput().trim(), "hello");