CloudStore { String getSshKeyReqType(String sshKeyReq) { Struct keyReq = JSON.fromString(sshKeyReq, Struct.class); if (keyReq == null) { LOGGER.error("getSshKeyReqType: Unable to parse ssh key req: {}", sshKeyReq); return null; } String sshType = keyReq.getString(ZTSConsts.ZTS_SSH_TYPE); if (sshType == null) { LOGGER.error("getSshKeyReqType: SSH Key request does not have certtype: {}", sshKeyReq); } return sshType; } CloudStore(); void close(); void setHttpClient(HttpClient client); boolean isAwsEnabled(); AmazonS3 getS3Client(); AWSTemporaryCredentials assumeAWSRole(String account, String roleName, String principal,
                                                 Integer durationSeconds, String externalId); String getCloudAccount(String domainName);  }
@Test public void testGetSshKeyReqType() { CloudStore cloudStore = new CloudStore(); final String req = "{\"principals\":[\"localhost\"],\"pubkey\":\"ssh-rsa AAAs\"" + ",\"reqip\":\"10.10.10.10\",\"requser\":\"user\",\"certtype\":\"host\",\"transid\":\"0\"}"; assertEquals(cloudStore.getSshKeyReqType(req), "host"); final String req2 = "{\"principals\":[\"localhost\"],\"pubkey\":\"ssh-rsa AAAs\"" + ",\"reqip\":\"10.10.10.10\",\"requser\":\"user\",\"certtype2\":\"host\",\"transid\":\"0\"}"; assertNull(cloudStore.getSshKeyReqType(req2)); final String req3 = "{invalid-json"; assertNull(cloudStore.getSshKeyReqType(req3)); cloudStore.close(); }