@Test public void testHmac() { JsonCredentialsProvider provider = newProvider(); JsonCredentials credentials = (JsonCredentials) provider.getCredentials(); Assert.assertEquals("vaws_access_key_id", credentials.getAWSAccessKeyId()); Assert.assertEquals("vaws_secret_access_key", credentials.getAWSSecretKey()); Assert.assertEquals(null, credentials.getApiKey()); Assert.assertEquals(null, credentials.getServiceInstanceId()); }
@Override public AWSCredentials getCredentials() { if (jsonConfigFile == null) { synchronized (this) { if (jsonConfigFile == null) { jsonConfigFile = new JsonConfigFile(); lastRefreshed = System.nanoTime(); } } } long now = System.nanoTime(); long age = now - lastRefreshed; if (age > refreshForceIntervalNanos) { refresh(); } else if (age > refreshIntervalNanos) { if (refreshSemaphore.tryAcquire()) { try { refresh(); } finally { refreshSemaphore.release(); } } } return jsonConfigFile.getCredentials(); }
JsonCredentialsProvider implements AWSCredentialsProvider { @Override public AWSCredentials getCredentials() { if (jsonConfigFile == null) { synchronized (this) { if (jsonConfigFile == null) { jsonConfigFile = new JsonConfigFile(); lastRefreshed = System.nanoTime(); } } } long now = System.nanoTime(); long age = now - lastRefreshed; if (age > refreshForceIntervalNanos) { refresh(); } else if (age > refreshIntervalNanos) { if (refreshSemaphore.tryAcquire()) { try { refresh(); } finally { refreshSemaphore.release(); } } } return jsonConfigFile.getCredentials(); } }
JsonCredentialsProvider implements AWSCredentialsProvider { @Override public AWSCredentials getCredentials() { if (jsonConfigFile == null) { synchronized (this) { if (jsonConfigFile == null) { jsonConfigFile = new JsonConfigFile(); lastRefreshed = System.nanoTime(); } } } long now = System.nanoTime(); long age = now - lastRefreshed; if (age > refreshForceIntervalNanos) { refresh(); } else if (age > refreshIntervalNanos) { if (refreshSemaphore.tryAcquire()) { try { refresh(); } finally { refreshSemaphore.release(); } } } return jsonConfigFile.getCredentials(); } JsonCredentialsProvider();  JsonCredentialsProvider(String jsonConfigFilePath);  JsonCredentialsProvider(JsonConfigFile jsonConfigFile); }
JsonCredentialsProvider implements AWSCredentialsProvider { @Override public AWSCredentials getCredentials() { if (jsonConfigFile == null) { synchronized (this) { if (jsonConfigFile == null) { jsonConfigFile = new JsonConfigFile(); lastRefreshed = System.nanoTime(); } } } long now = System.nanoTime(); long age = now - lastRefreshed; if (age > refreshForceIntervalNanos) { refresh(); } else if (age > refreshIntervalNanos) { if (refreshSemaphore.tryAcquire()) { try { refresh(); } finally { refreshSemaphore.release(); } } } return jsonConfigFile.getCredentials(); } JsonCredentialsProvider();  JsonCredentialsProvider(String jsonConfigFilePath);  JsonCredentialsProvider(JsonConfigFile jsonConfigFile); @Override AWSCredentials getCredentials(); @Override void refresh(); long getRefreshIntervalNanos(); void setRefreshIntervalNanos(long refreshIntervalNanos); long getRefreshForceIntervalNanos(); void setRefreshForceIntervalNanos(long refreshForceIntervalNanos); @Override String toString(); }
JsonCredentialsProvider implements AWSCredentialsProvider { @Override public AWSCredentials getCredentials() { if (jsonConfigFile == null) { synchronized (this) { if (jsonConfigFile == null) { jsonConfigFile = new JsonConfigFile(); lastRefreshed = System.nanoTime(); } } } long now = System.nanoTime(); long age = now - lastRefreshed; if (age > refreshForceIntervalNanos) { refresh(); } else if (age > refreshIntervalNanos) { if (refreshSemaphore.tryAcquire()) { try { refresh(); } finally { refreshSemaphore.release(); } } } return jsonConfigFile.getCredentials(); } JsonCredentialsProvider();  JsonCredentialsProvider(String jsonConfigFilePath);  JsonCredentialsProvider(JsonConfigFile jsonConfigFile); @Override AWSCredentials getCredentials(); @Override void refresh(); long getRefreshIntervalNanos(); void setRefreshIntervalNanos(long refreshIntervalNanos); long getRefreshForceIntervalNanos(); void setRefreshForceIntervalNanos(long refreshForceIntervalNanos); @Override String toString();  }