CloudStore { boolean parseInstanceInfo(String document) { Struct instStruct = JSON.fromString(document, Struct.class); if (instStruct == null) { LOGGER.error("CloudStore: unable to parse instance identity document: {}", document); return false; } if (awsRegion == null || awsRegion.isEmpty()) { awsRegion = instStruct.getString("region"); if (awsRegion == null || awsRegion.isEmpty()) { LOGGER.error("CloudStore: unable to extract region from instance identity document: {}", document); return false; } } return true; } 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 testParseInstanceInfo() { CloudStore store = new CloudStore(); assertTrue(store.parseInstanceInfo(AWS_INSTANCE_DOCUMENT)); assertEquals(store.awsRegion, "us-west-2"); store.close(); }