@Test public void when_no_target_url_set_the_config_has_null_as_target_uri_and_string_and_an_empty_list_of_uris() throws Exception { TestAdapterConfigInterface configToTest = validConfigAnd().build(); assertNull(configToTest.getTargetURI()); assertNull(configToTest.getTargetAsString()); assertNotNull(configToTest.getTargetURIs()); assertTrue(configToTest.getTargetURIs().isEmpty()); }
public final C build() { validate(); ensureTimeSetup(); ensureTraceID(); C config = buildInitialConfig(); if (!( config instanceof AbstractAdapterConfig)) { throw new IllegalStateException(getClass().getName()+" does not return a child of AbstractAdapterConfig!"); } Set<URI> shrinkedRootURIs = uriShrinker.shrinkToRootURIs(targetURIs); AbstractAdapterConfig abstractAdapterConfig = (AbstractAdapterConfig) config; abstractAdapterConfig.productBaseURL = productBaseURL; abstractAdapterConfig.timeToWaitForNextCheckOperationInMilliseconds = timeToWaitForNextCheckOperationInMinutes * 60 * 1000; abstractAdapterConfig.timeOutInMilliseconds = scanResultTimeOutInMinutes * 60 * 1000; abstractAdapterConfig.proxyHostname = proxyHostname; abstractAdapterConfig.proxyPort = proxyPort; abstractAdapterConfig.user = user; abstractAdapterConfig.trustAllCertificatesEnabled=trustAllCertificatesEnabled; abstractAdapterConfig.passwordOrAPIToken = passwordOrApiToken; abstractAdapterConfig.policyId = policyID; abstractAdapterConfig.targetURIs = targetURIs; abstractAdapterConfig.rootTargetUris.addAll(shrinkedRootURIs); abstractAdapterConfig.targetIPs = targetIPs; abstractAdapterConfig.traceID = traceID; abstractAdapterConfig.projectId=projectId; abstractAdapterConfig.getOptions().putAll(options); packageInternalCustomBuild(config); customBuild(config); return config; }
AbstractAdapterConfigBuilder { public final C build() { validate(); ensureTimeSetup(); ensureTraceID(); C config = buildInitialConfig(); if (!( config instanceof AbstractAdapterConfig)) { throw new IllegalStateException(getClass().getName()+" does not return a child of AbstractAdapterConfig!"); } Set<URI> shrinkedRootURIs = uriShrinker.shrinkToRootURIs(targetURIs); AbstractAdapterConfig abstractAdapterConfig = (AbstractAdapterConfig) config; abstractAdapterConfig.productBaseURL = productBaseURL; abstractAdapterConfig.timeToWaitForNextCheckOperationInMilliseconds = timeToWaitForNextCheckOperationInMinutes * 60 * 1000; abstractAdapterConfig.timeOutInMilliseconds = scanResultTimeOutInMinutes * 60 * 1000; abstractAdapterConfig.proxyHostname = proxyHostname; abstractAdapterConfig.proxyPort = proxyPort; abstractAdapterConfig.user = user; abstractAdapterConfig.trustAllCertificatesEnabled=trustAllCertificatesEnabled; abstractAdapterConfig.passwordOrAPIToken = passwordOrApiToken; abstractAdapterConfig.policyId = policyID; abstractAdapterConfig.targetURIs = targetURIs; abstractAdapterConfig.rootTargetUris.addAll(shrinkedRootURIs); abstractAdapterConfig.targetIPs = targetIPs; abstractAdapterConfig.traceID = traceID; abstractAdapterConfig.projectId=projectId; abstractAdapterConfig.getOptions().putAll(options); packageInternalCustomBuild(config); customBuild(config); return config; } }
AbstractAdapterConfigBuilder { public final C build() { validate(); ensureTimeSetup(); ensureTraceID(); C config = buildInitialConfig(); if (!( config instanceof AbstractAdapterConfig)) { throw new IllegalStateException(getClass().getName()+" does not return a child of AbstractAdapterConfig!"); } Set<URI> shrinkedRootURIs = uriShrinker.shrinkToRootURIs(targetURIs); AbstractAdapterConfig abstractAdapterConfig = (AbstractAdapterConfig) config; abstractAdapterConfig.productBaseURL = productBaseURL; abstractAdapterConfig.timeToWaitForNextCheckOperationInMilliseconds = timeToWaitForNextCheckOperationInMinutes * 60 * 1000; abstractAdapterConfig.timeOutInMilliseconds = scanResultTimeOutInMinutes * 60 * 1000; abstractAdapterConfig.proxyHostname = proxyHostname; abstractAdapterConfig.proxyPort = proxyPort; abstractAdapterConfig.user = user; abstractAdapterConfig.trustAllCertificatesEnabled=trustAllCertificatesEnabled; abstractAdapterConfig.passwordOrAPIToken = passwordOrApiToken; abstractAdapterConfig.policyId = policyID; abstractAdapterConfig.targetURIs = targetURIs; abstractAdapterConfig.rootTargetUris.addAll(shrinkedRootURIs); abstractAdapterConfig.targetIPs = targetIPs; abstractAdapterConfig.traceID = traceID; abstractAdapterConfig.projectId=projectId; abstractAdapterConfig.getOptions().putAll(options); packageInternalCustomBuild(config); customBuild(config); return config; } protected  AbstractAdapterConfigBuilder(); }
AbstractAdapterConfigBuilder { public final C build() { validate(); ensureTimeSetup(); ensureTraceID(); C config = buildInitialConfig(); if (!( config instanceof AbstractAdapterConfig)) { throw new IllegalStateException(getClass().getName()+" does not return a child of AbstractAdapterConfig!"); } Set<URI> shrinkedRootURIs = uriShrinker.shrinkToRootURIs(targetURIs); AbstractAdapterConfig abstractAdapterConfig = (AbstractAdapterConfig) config; abstractAdapterConfig.productBaseURL = productBaseURL; abstractAdapterConfig.timeToWaitForNextCheckOperationInMilliseconds = timeToWaitForNextCheckOperationInMinutes * 60 * 1000; abstractAdapterConfig.timeOutInMilliseconds = scanResultTimeOutInMinutes * 60 * 1000; abstractAdapterConfig.proxyHostname = proxyHostname; abstractAdapterConfig.proxyPort = proxyPort; abstractAdapterConfig.user = user; abstractAdapterConfig.trustAllCertificatesEnabled=trustAllCertificatesEnabled; abstractAdapterConfig.passwordOrAPIToken = passwordOrApiToken; abstractAdapterConfig.policyId = policyID; abstractAdapterConfig.targetURIs = targetURIs; abstractAdapterConfig.rootTargetUris.addAll(shrinkedRootURIs); abstractAdapterConfig.targetIPs = targetIPs; abstractAdapterConfig.traceID = traceID; abstractAdapterConfig.projectId=projectId; abstractAdapterConfig.getOptions().putAll(options); packageInternalCustomBuild(config); customBuild(config); return config; } protected  AbstractAdapterConfigBuilder(); @SuppressWarnings("unchecked") final B configure(AdapterConfigurationStrategy strategy); @SuppressWarnings("unchecked") final B setTimeToWaitForNextCheckOperationInMinutes(int minutes); @SuppressWarnings("unchecked") final B setScanResultTimeOutInMinutes(int scanResultTimeOutInMinutes); @SuppressWarnings("unchecked") final B setUser(String userID); @SuppressWarnings("unchecked") final B setPasswordOrAPIToken(String password); @SuppressWarnings("unchecked") final B setTraceID(String traceID); @SuppressWarnings("unchecked") final B setProductBaseUrl(String baseURL); @SuppressWarnings("unchecked") final B setProxyHostname(String hostname); @SuppressWarnings("unchecked") final B setProxyPort(int proxyPort); @SuppressWarnings("unchecked") final B setPolicyID(String policyID); @SuppressWarnings("unchecked") B setTargetURIs(Set<URI> targetURIs); @SuppressWarnings("unchecked") B setTargetURI(URI targetURI); @SuppressWarnings("unchecked") B setTargetIPs(Set<InetAddress> targetIPs); @SuppressWarnings("unchecked") B setProjectId(String projectId); @SuppressWarnings("unchecked") B setTargetIP(InetAddress ipAdress); @SuppressWarnings("unchecked") B setOption(AdapterOptionKey option, String value); @SuppressWarnings("unchecked") B setTrustAllCertificates(boolean trustAllCertificates); final C build(); void assertProjectIdSet(); }
AbstractAdapterConfigBuilder { public final C build() { validate(); ensureTimeSetup(); ensureTraceID(); C config = buildInitialConfig(); if (!( config instanceof AbstractAdapterConfig)) { throw new IllegalStateException(getClass().getName()+" does not return a child of AbstractAdapterConfig!"); } Set<URI> shrinkedRootURIs = uriShrinker.shrinkToRootURIs(targetURIs); AbstractAdapterConfig abstractAdapterConfig = (AbstractAdapterConfig) config; abstractAdapterConfig.productBaseURL = productBaseURL; abstractAdapterConfig.timeToWaitForNextCheckOperationInMilliseconds = timeToWaitForNextCheckOperationInMinutes * 60 * 1000; abstractAdapterConfig.timeOutInMilliseconds = scanResultTimeOutInMinutes * 60 * 1000; abstractAdapterConfig.proxyHostname = proxyHostname; abstractAdapterConfig.proxyPort = proxyPort; abstractAdapterConfig.user = user; abstractAdapterConfig.trustAllCertificatesEnabled=trustAllCertificatesEnabled; abstractAdapterConfig.passwordOrAPIToken = passwordOrApiToken; abstractAdapterConfig.policyId = policyID; abstractAdapterConfig.targetURIs = targetURIs; abstractAdapterConfig.rootTargetUris.addAll(shrinkedRootURIs); abstractAdapterConfig.targetIPs = targetIPs; abstractAdapterConfig.traceID = traceID; abstractAdapterConfig.projectId=projectId; abstractAdapterConfig.getOptions().putAll(options); packageInternalCustomBuild(config); customBuild(config); return config; } protected  AbstractAdapterConfigBuilder(); @SuppressWarnings("unchecked") final B configure(AdapterConfigurationStrategy strategy); @SuppressWarnings("unchecked") final B setTimeToWaitForNextCheckOperationInMinutes(int minutes); @SuppressWarnings("unchecked") final B setScanResultTimeOutInMinutes(int scanResultTimeOutInMinutes); @SuppressWarnings("unchecked") final B setUser(String userID); @SuppressWarnings("unchecked") final B setPasswordOrAPIToken(String password); @SuppressWarnings("unchecked") final B setTraceID(String traceID); @SuppressWarnings("unchecked") final B setProductBaseUrl(String baseURL); @SuppressWarnings("unchecked") final B setProxyHostname(String hostname); @SuppressWarnings("unchecked") final B setProxyPort(int proxyPort); @SuppressWarnings("unchecked") final B setPolicyID(String policyID); @SuppressWarnings("unchecked") B setTargetURIs(Set<URI> targetURIs); @SuppressWarnings("unchecked") B setTargetURI(URI targetURI); @SuppressWarnings("unchecked") B setTargetIPs(Set<InetAddress> targetIPs); @SuppressWarnings("unchecked") B setProjectId(String projectId); @SuppressWarnings("unchecked") B setTargetIP(InetAddress ipAdress); @SuppressWarnings("unchecked") B setOption(AdapterOptionKey option, String value); @SuppressWarnings("unchecked") B setTrustAllCertificates(boolean trustAllCertificates); final C build(); void assertProjectIdSet(); static final String DOCUMENT_INFO_TIMEOUT; static final String DOCUMENT_INFO_CHECK; static final String DOCUMENT_INFO_TRUSTALL; }