public File kerberosKeytab() { String keytabPath = BuiltInConnectionProperty.KEYTAB.wrap(properties).getString(); if (null == keytabPath) { return null; } File keytab = new File(keytabPath); if (!keytab.exists() || !keytab.isFile()) { throw new RuntimeException("The " + BuiltInConnectionProperty.KEYTAB.name() + " does not " + " reference a normal, existent file: " + keytabPath); } return keytab; }
public File kerberosKeytab() { String keytabPath = BuiltInConnectionProperty.KEYTAB.wrap(properties).getString(); if (null == keytabPath) { return null; } File keytab = new File(keytabPath); if (!keytab.exists() || !keytab.isFile()) { throw new RuntimeException("The " + BuiltInConnectionProperty.KEYTAB.name() + " does not " + " reference a normal, existent file: " + keytabPath); } return keytab; }
@Test public void testTrustStore() { final String trustStore = "/my/truststore.jks"; final String windowsTrustStore = "my\\truststore.jks"; final String pw = "supremelysecret"; Properties props = new Properties(); props.setProperty(BuiltInConnectionProperty.TRUSTSTORE.name(), trustStore); props.setProperty(BuiltInConnectionProperty.TRUSTSTORE_PASSWORD.name(), pw); ConnectionConfigImpl config = new ConnectionConfigImpl(props); assertThat(config.truststore().getAbsolutePath(), File.separatorChar == '/' ? is(trustStore) : is(Paths.get(".").toAbsolutePath().getRoot() + windowsTrustStore)); assertThat(config.truststorePassword(), is(pw)); }
@Test public void testTrustStore() { final String trustStore = "/my/truststore.jks"; final String windowsTrustStore = "my\\truststore.jks"; final String pw = "supremelysecret"; Properties props = new Properties(); props.setProperty(BuiltInConnectionProperty.TRUSTSTORE.name(), trustStore); props.setProperty(BuiltInConnectionProperty.TRUSTSTORE_PASSWORD.name(), pw); ConnectionConfigImpl config = new ConnectionConfigImpl(props); assertThat(config.truststore().getAbsolutePath(), File.separatorChar == '/' ? is(trustStore) : is(Paths.get(".").toAbsolutePath().getRoot() + windowsTrustStore)); assertThat(config.truststorePassword(), is(pw)); }
@Test public void testOverridenHttpClient() throws Exception { Properties props = new Properties(); props.setProperty(BuiltInConnectionProperty.HTTP_CLIENT_IMPL.name(), AvaticaHttpClientImpl.class.getName()); URL url = new URL("http://localhost:8765"); ConnectionConfig config = new ConnectionConfigImpl(props); AvaticaHttpClientFactory httpClientFactory = new AvaticaHttpClientFactoryImpl(); AvaticaHttpClient client = httpClientFactory.getClient(url, config, null); assertTrue("Client was an instance of " + client.getClass(), client instanceof AvaticaHttpClientImpl); } }
@Test public void testOverridenHttpClient() throws Exception { Properties props = new Properties(); props.setProperty(BuiltInConnectionProperty.HTTP_CLIENT_IMPL.name(), AvaticaHttpClientImpl.class.getName()); URL url = new URL("http://localhost:8765"); ConnectionConfig config = new ConnectionConfigImpl(props); AvaticaHttpClientFactory httpClientFactory = new AvaticaHttpClientFactoryImpl(); AvaticaHttpClient client = httpClientFactory.getClient(url, config, null); assertTrue("Client was an instance of " + client.getClass(), client instanceof AvaticaHttpClientImpl); } }