@Test public void testDefaults() throws CommandLineParseException, IOException { tlsCertificateAuthorityServiceCommandLine.parse("-t", testToken); assertEquals(BaseCertificateAuthorityCommandLine.DEFAULT_CONFIG_JSON, tlsCertificateAuthorityServiceCommandLine.getConfigJsonOut()); assertNull(tlsCertificateAuthorityServiceCommandLine.getConfigJsonIn()); TlsConfig tlsConfig = tlsCertificateAuthorityServiceCommandLine.createConfig(); assertEquals(TlsConfig.DEFAULT_HOSTNAME, tlsConfig.getCaHostname()); assertEquals(testToken, tlsConfig.getToken()); assertEquals(TlsConfig.DEFAULT_PORT, tlsConfig.getPort()); assertEquals(TlsConfig.DEFAULT_KEY_STORE_TYPE, tlsConfig.getKeyStoreType()); assertEquals(TlsCertificateAuthorityServiceCommandLine.NIFI_CA_KEYSTORE + tlsConfig.getKeyStoreType().toLowerCase(), tlsConfig.getKeyStore()); assertNull(tlsConfig.getKeyStorePassword()); assertNull(tlsConfig.getKeyPassword()); assertEquals(TlsConfig.DEFAULT_KEY_SIZE, tlsConfig.getKeySize()); assertEquals(TlsConfig.DEFAULT_KEY_PAIR_ALGORITHM, tlsConfig.getKeyPairAlgorithm()); assertEquals(TlsConfig.DEFAULT_SIGNING_ALGORITHM, tlsConfig.getSigningAlgorithm()); assertEquals(TlsConfig.DEFAULT_DAYS, tlsConfig.getDays()); }
public TlsConfig createConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsConfig tlsConfig = new ObjectMapper().readValue(inputStream, TlsConfig.class); tlsConfig.initDefaults(); return tlsConfig; } } else { TlsConfig tlsConfig = new TlsConfig(); tlsConfig.setCaHostname(getCertificateAuthorityHostname()); tlsConfig.setDn(getDn()); tlsConfig.setToken(getToken()); tlsConfig.setPort(getPort()); tlsConfig.setKeyStore(NIFI_CA_KEYSTORE + getKeyStoreType().toLowerCase()); tlsConfig.setKeyStoreType(getKeyStoreType()); tlsConfig.setKeySize(getKeySize()); tlsConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsConfig.setSigningAlgorithm(getSigningAlgorithm()); tlsConfig.setDays(getDays()); return tlsConfig; } }
TlsCertificateAuthorityServiceCommandLine extends BaseCertificateAuthorityCommandLine { public TlsConfig createConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsConfig tlsConfig = new ObjectMapper().readValue(inputStream, TlsConfig.class); tlsConfig.initDefaults(); return tlsConfig; } } else { TlsConfig tlsConfig = new TlsConfig(); tlsConfig.setCaHostname(getCertificateAuthorityHostname()); tlsConfig.setDn(getDn()); tlsConfig.setToken(getToken()); tlsConfig.setPort(getPort()); tlsConfig.setKeyStore(NIFI_CA_KEYSTORE + getKeyStoreType().toLowerCase()); tlsConfig.setKeyStoreType(getKeyStoreType()); tlsConfig.setKeySize(getKeySize()); tlsConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsConfig.setSigningAlgorithm(getSigningAlgorithm()); tlsConfig.setDays(getDays()); return tlsConfig; } } }
TlsCertificateAuthorityServiceCommandLine extends BaseCertificateAuthorityCommandLine { public TlsConfig createConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsConfig tlsConfig = new ObjectMapper().readValue(inputStream, TlsConfig.class); tlsConfig.initDefaults(); return tlsConfig; } } else { TlsConfig tlsConfig = new TlsConfig(); tlsConfig.setCaHostname(getCertificateAuthorityHostname()); tlsConfig.setDn(getDn()); tlsConfig.setToken(getToken()); tlsConfig.setPort(getPort()); tlsConfig.setKeyStore(NIFI_CA_KEYSTORE + getKeyStoreType().toLowerCase()); tlsConfig.setKeyStoreType(getKeyStoreType()); tlsConfig.setKeySize(getKeySize()); tlsConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsConfig.setSigningAlgorithm(getSigningAlgorithm()); tlsConfig.setDays(getDays()); return tlsConfig; } } TlsCertificateAuthorityServiceCommandLine();  TlsCertificateAuthorityServiceCommandLine(InputStreamFactory inputStreamFactory); }
TlsCertificateAuthorityServiceCommandLine extends BaseCertificateAuthorityCommandLine { public TlsConfig createConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsConfig tlsConfig = new ObjectMapper().readValue(inputStream, TlsConfig.class); tlsConfig.initDefaults(); return tlsConfig; } } else { TlsConfig tlsConfig = new TlsConfig(); tlsConfig.setCaHostname(getCertificateAuthorityHostname()); tlsConfig.setDn(getDn()); tlsConfig.setToken(getToken()); tlsConfig.setPort(getPort()); tlsConfig.setKeyStore(NIFI_CA_KEYSTORE + getKeyStoreType().toLowerCase()); tlsConfig.setKeyStoreType(getKeyStoreType()); tlsConfig.setKeySize(getKeySize()); tlsConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsConfig.setSigningAlgorithm(getSigningAlgorithm()); tlsConfig.setDays(getDays()); return tlsConfig; } } TlsCertificateAuthorityServiceCommandLine();  TlsCertificateAuthorityServiceCommandLine(InputStreamFactory inputStreamFactory); static void main(String[] args); TlsConfig createConfig(); }
TlsCertificateAuthorityServiceCommandLine extends BaseCertificateAuthorityCommandLine { public TlsConfig createConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsConfig tlsConfig = new ObjectMapper().readValue(inputStream, TlsConfig.class); tlsConfig.initDefaults(); return tlsConfig; } } else { TlsConfig tlsConfig = new TlsConfig(); tlsConfig.setCaHostname(getCertificateAuthorityHostname()); tlsConfig.setDn(getDn()); tlsConfig.setToken(getToken()); tlsConfig.setPort(getPort()); tlsConfig.setKeyStore(NIFI_CA_KEYSTORE + getKeyStoreType().toLowerCase()); tlsConfig.setKeyStoreType(getKeyStoreType()); tlsConfig.setKeySize(getKeySize()); tlsConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsConfig.setSigningAlgorithm(getSigningAlgorithm()); tlsConfig.setDays(getDays()); return tlsConfig; } } TlsCertificateAuthorityServiceCommandLine();  TlsCertificateAuthorityServiceCommandLine(InputStreamFactory inputStreamFactory); static void main(String[] args); TlsConfig createConfig(); static final String DESCRIPTION; static final String NIFI_CA_KEYSTORE; }