You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Вальо <no...@github.com> on 2016/04/07 11:00:59 UTC

Re: [jclouds/jclouds-labs-google] Draft implementation of password setting for windows (#170)

> +      GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
> +      InstanceApi instanceApi = createMock(InstanceApi.class);
> +      Operation operation = createMock(Operation.class);
> +      SerialPortOutput serialPortOutput = createMock(SerialPortOutput.class);
> +      Crypto crypto = createMock(Crypto.class);
> +      KeyPairGenerator keyPairGenerator = createMock(KeyPairGenerator.class);
> +      
> +      expect(api.instancesInZone(zone)).andReturn(instanceApi).atLeastOnce();
> +      expect(crypto.rsaKeyPairGenerator()).andReturn(keyPairGenerator);
> +      expect(keyPairGenerator.genKeyPair()).andReturn(keyPair);
> +      // FIXME assert that metadata contained what we expected
> +      expect(instanceApi.setMetadata(eq(instance.name()), isA(Metadata.class))).andReturn(operation).atLeastOnce();
> +      expect(operation.httpErrorStatusCode()).andReturn(null);
> +      expect(instanceApi.getSerialPortOutput(instance.name(), 4)).andReturn(serialPortOutput).atLeastOnce();
> +      expect(serialPortOutput.contents()).andReturn("{\"ready\":true,\"version\":\"Microsoft Windows NT 6.2.9200.0\"}\n" +
> +              "{\"encryptedPassword\":\""+ "encrypted and base64encoded password with keyPair.getPublic()"+ "\",\"exponent\":\"AQAB\",\"passwordFound\":true,\"userName\":\"Administrator\"}");

Need help with the test.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/170/files/172e50d1a163c5ba80ed638cf9c7b25982ca204c#r58839912