Search in sources :

Example 11 with InstanceProviderManager

use of com.yahoo.athenz.zts.InstanceProviderManager in project athenz by yahoo.

the class InstanceProviderManagerTest method testVerifyProviderEndpoint.

@Test
public void testVerifyProviderEndpoint() {
    InstanceProviderManager providerManager = new InstanceProviderManager(null, null);
    assertTrue(providerManager.verifyProviderEndpoint("test1.athenz.com"));
    assertTrue(providerManager.verifyProviderEndpoint("test1.athenz2.com"));
    assertFalse(providerManager.verifyProviderEndpoint("test1.athenz3.com"));
    // now let's remove our config in which case all is true
    providerManager.providerEndpoints = Collections.emptyList();
    assertTrue(providerManager.verifyProviderEndpoint("test1.athenz.com"));
    assertTrue(providerManager.verifyProviderEndpoint("test1.athenz2.com"));
    assertTrue(providerManager.verifyProviderEndpoint("test1.athenz3.com"));
}
Also used : InstanceProviderManager(com.yahoo.athenz.zts.InstanceProviderManager) Test(org.testng.annotations.Test)

Example 12 with InstanceProviderManager

use of com.yahoo.athenz.zts.InstanceProviderManager in project athenz by yahoo.

the class InstanceProviderManagerTest method testGetProviderClientInvalidEndpoint.

@Test
public void testGetProviderClientInvalidEndpoint() {
    SignedDomain signedDomain = createSignedDomain("coretech", "weather", true, true, "http://invalid");
    store.processDomain(signedDomain, false);
    InstanceProviderManager provider = new InstanceProviderManager(store, null);
    InstanceProvider client = provider.getProvider("coretech.weather");
    assertNull(client);
}
Also used : SignedDomain(com.yahoo.athenz.zms.SignedDomain) InstanceProviderManager(com.yahoo.athenz.zts.InstanceProviderManager) InstanceProvider(com.yahoo.athenz.instance.provider.InstanceProvider) Test(org.testng.annotations.Test)

Example 13 with InstanceProviderManager

use of com.yahoo.athenz.zts.InstanceProviderManager in project athenz by yahoo.

the class InstanceProviderManagerTest method testGetProviderClientNoServices.

@Test
public void testGetProviderClientNoServices() {
    SignedDomain signedDomain = createSignedDomainHttpsEndpoint("coretech", "weather", false, true);
    store.processDomain(signedDomain, false);
    InstanceProviderManager provider = new InstanceProviderManager(store, null);
    InstanceProvider client = provider.getProvider("coretech.weather");
    assertNull(client);
}
Also used : SignedDomain(com.yahoo.athenz.zms.SignedDomain) InstanceProviderManager(com.yahoo.athenz.zts.InstanceProviderManager) InstanceProvider(com.yahoo.athenz.instance.provider.InstanceProvider) Test(org.testng.annotations.Test)

Example 14 with InstanceProviderManager

use of com.yahoo.athenz.zts.InstanceProviderManager in project athenz by yahoo.

the class InstanceProviderManagerTest method testGetProviderEndpointScheme.

@Test
public void testGetProviderEndpointScheme() throws URISyntaxException {
    InstanceProviderManager provider = new InstanceProviderManager(null, null);
    URI uri = new URI("https://test.athenz2.com/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.HTTPS);
    uri = new URI("https://test.athenz2.com:4443/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.HTTPS);
    uri = new URI("https://test.athenz2.com:4443/test1");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.HTTPS);
    uri = new URI("class://com.yahoo.athenz.AWSProvider");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.CLASS);
    uri = new URI("http://test.athenz.com/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("https://test.athenz4.com/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("http://test.athenz.com:4443/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("http://test.athenz.com:4443/test1");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("http://:4443?key=value");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("http://test.athenz3.com/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("http://test.athenz3.com:4443/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("http://test.athenz3.com:4443/test1");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("test.athenz.com/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("file://test.athenz.com/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("//test.athenz.com/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("test://test.athenz.com:4443/");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
    uri = new URI("uri://test.athenz.com:4443/test1");
    assertEquals(provider.getProviderEndpointScheme(uri), ProviderScheme.UNKNOWN);
}
Also used : InstanceProviderManager(com.yahoo.athenz.zts.InstanceProviderManager) URI(java.net.URI) Test(org.testng.annotations.Test)

Aggregations

InstanceProviderManager (com.yahoo.athenz.zts.InstanceProviderManager)14 Test (org.testng.annotations.Test)14 InstanceProvider (com.yahoo.athenz.instance.provider.InstanceProvider)11 SignedDomain (com.yahoo.athenz.zms.SignedDomain)10 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)1