template.getOptions().as(CloudStackTemplateOptions.class).keyPair("mykeypair")
.setupStaticNat(false)
.generateSecurityGroup(true)
.overrideLoginPrivateKey(privKey);
CloudStackComputeServiceAdapter adapter = forKeyPair.getInstance(CloudStackComputeServiceAdapter.class);
CloudStackContext context = forKeyPair.getInstance(CloudStackContext.class);
NodeAndInitialCredentials<VirtualMachine> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
template);
assertNotNull(server);
assertEquals(server.getCredentials().getPrivateKey(), privKey);
}