CloudStore { String getCacheKey(final String account, final String roleName, final String principal, Integer durationSeconds, final String externalId) { if (cacheTimeout == 0) { return null; } StringBuilder cacheKey = new StringBuilder(256); cacheKey.append(account).append(':').append(roleName).append(':').append(principal); cacheKey.append(':'); if (durationSeconds != null) { cacheKey.append(durationSeconds.intValue()); } cacheKey.append(':'); if (externalId != null) { cacheKey.append(externalId); } return cacheKey.toString(); } 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 testGetCacheKey() { CloudStore cloudStore = new CloudStore(); assertEquals(cloudStore.getCacheKey("account", "role", "user", null, null), "account:role:user::"); assertEquals(cloudStore.getCacheKey("account", "role", "user", 100, null), "account:role:user:100:"); assertEquals(cloudStore.getCacheKey("account", "role", "user", null, "ext"), "account:role:user::ext"); assertEquals(cloudStore.getCacheKey("account", "role", "user", null, "100"), "account:role:user::100"); assertEquals(cloudStore.getCacheKey("account", "role", "user", 100, "ext"), "account:role:user:100:ext"); cloudStore.close(); }