use of com.yahoo.athenz.instance.provider.InstanceProviderClient in project athenz by yahoo.
the class InstanceHttpProvider method initialize.
@Override
public void initialize(String provider, String providerEndpoint, KeyStore keyStore) {
ProviderHostnameVerifier hostnameVerifier = new ProviderHostnameVerifier(provider);
int readTimeout = Integer.parseInt(System.getProperty(PROP_READ_TIMEOUT, "30000"));
int connectTimeout = Integer.parseInt(System.getProperty(PROP_CONNECT_TIMEOUT, "30000"));
client = new InstanceProviderClient(providerEndpoint, hostnameVerifier, connectTimeout, readTimeout);
}
use of com.yahoo.athenz.instance.provider.InstanceProviderClient in project athenz by yahoo.
the class InstanceHttpProviderTest method testInstanceHttpProviderConfirmInstance.
@Test
public void testInstanceHttpProviderConfirmInstance() {
InstanceHttpProvider provider = new InstanceHttpProvider();
provider.initialize("provider", "https://localhost:4443/instance", null);
InstanceProviderClient client = Mockito.mock(InstanceProviderClient.class);
provider.client = client;
InstanceConfirmation confirmation = new InstanceConfirmation().setAttestationData("data").setDomain("athenz").setProvider("provider").setService("service");
Mockito.when(client.postInstanceConfirmation(confirmation)).thenReturn(confirmation);
InstanceConfirmation result = provider.confirmInstance(confirmation);
assertEquals(result.getAttestationData(), "data");
assertEquals(result.getDomain(), "athenz");
assertEquals(result.getProvider(), "provider");
assertEquals(result.getService(), "service");
provider.close();
}
use of com.yahoo.athenz.instance.provider.InstanceProviderClient in project athenz by yahoo.
the class InstanceHttpProviderTest method testInstanceHttpProviderRefreshInstance.
@Test
public void testInstanceHttpProviderRefreshInstance() {
InstanceHttpProvider provider = new InstanceHttpProvider();
provider.initialize("provider", "https://localhost:4443/instance", null);
InstanceProviderClient client = Mockito.mock(InstanceProviderClient.class);
provider.client = client;
InstanceConfirmation confirmation = new InstanceConfirmation().setAttestationData("data").setDomain("athenz").setProvider("provider").setService("service");
Mockito.when(client.postRefreshConfirmation(confirmation)).thenReturn(confirmation);
InstanceConfirmation result = provider.refreshInstance(confirmation);
assertEquals(result.getAttestationData(), "data");
assertEquals(result.getDomain(), "athenz");
assertEquals(result.getProvider(), "provider");
assertEquals(result.getService(), "service");
provider.close();
}
Aggregations