InstanceZTSProvider implements InstanceProvider { @Override public void initialize(String provider, String providerEndpoint, SSLContext sslContext, KeyStore keyStore) { final String principalList = System.getProperty(ZTS_PRINCIPAL_LIST); if (principalList != null && !principalList.isEmpty()) { principals = new HashSet<>(Arrays.asList(principalList.split(","))); } dnsSuffix = System.getProperty(ZTS_PROVIDER_DNS_SUFFIX, "zts.athenz.cloud"); if (dnsSuffix.isEmpty()) { dnsSuffix = "zts.athenz.cloud"; } this.keyStore = keyStore; }  @Override Scheme getProviderScheme(); @Override void initialize(String provider, String providerEndpoint, SSLContext sslContext,
            KeyStore keyStore); @Override void setHostnameResolver(HostnameResolver hostnameResolver); @Override InstanceConfirmation confirmInstance(InstanceConfirmation confirmation); @Override InstanceConfirmation refreshInstance(InstanceConfirmation confirmation); boolean validatePublicKeys(final String athenzPublicKey, final String csrPublicKey);  }
@Test public void testInitialize() { System.setProperty(InstanceZTSProvider.ZTS_PROVIDER_DNS_SUFFIX, "zts.cloud"); System.setProperty(InstanceZTSProvider.ZTS_PRINCIPAL_LIST, "athenz.api,sports.backend"); InstanceZTSProvider provider = new InstanceZTSProvider(); provider.initialize("provider", "com.yahoo.athenz.instance.provider.impl.InstanceZTSProvider", null, null); assertEquals("zts.cloud", provider.dnsSuffix); assertNull(provider.keyStore); assertEquals(provider.principals.size(), 2); assertTrue(provider.principals.contains("athenz.api")); assertTrue(provider.principals.contains("sports.backend")); provider.close(); System.setProperty(InstanceZTSProvider.ZTS_PROVIDER_DNS_SUFFIX, ""); System.setProperty(InstanceZTSProvider.ZTS_PRINCIPAL_LIST, ""); provider = new InstanceZTSProvider(); provider.initialize("provider", "com.yahoo.athenz.instance.provider.impl.InstanceZTSProvider", null, null); assertEquals("zts.athenz.cloud", provider.dnsSuffix); assertNull(provider.keyStore); assertNull(provider.principals); provider.close(); System.clearProperty(InstanceZTSProvider.ZTS_PROVIDER_DNS_SUFFIX); }