@Test public void setup_data_used_from_selected_target_type() { TargetIdentifyingMultiInstallSetup setup = mock(TargetIdentifyingMultiInstallSetup.class); TargetType type = TargetType.INTRANET; when(setup.getBaseURL(type)).thenReturn("http: when(setup.getPassword(type)).thenReturn("mypwd1"); when(setup.getUserId(type)).thenReturn("myuser1"); when(setup.isHavingUntrustedCertificate(type)).thenReturn(true); type = TargetType.INTERNET; when(setup.getBaseURL(type)).thenReturn("http: when(setup.getPassword(type)).thenReturn("mypwd666"); when(setup.getUserId(type)).thenReturn("myuser666"); when(setup.isHavingUntrustedCertificate(type)).thenReturn(false); TargetIdentifyingMultiInstallSetupConfigBuilderStrategy strategyToTest = new TargetIdentifyingMultiInstallSetupConfigBuilderStrategy(setup,TargetType.INTRANET); TestAdapterConfigBuilder configBuilder = new TestAdapterConfigBuilder(); strategyToTest.configure(configBuilder); TestAdapterConfig result = configBuilder.build(); assertEquals("myuser1", result.getUser()); assertEquals("mypwd1", result.getPasswordOrAPIToken()); assertNotNull(result.getPasswordOrAPITokenBase64Encoded()); assertEquals("http: assertTrue(result.isTrustAllCertificatesEnabled()); }
@Override public <B extends AbstractAdapterConfigBuilder<B, C>, C extends AdapterConfig> void configure(B configBuilder) { configBuilder. setTrustAllCertificates(setup.isHavingUntrustedCertificate(targetType)). setUser(setup.getUserId(targetType)). setPasswordOrAPIToken(setup.getPassword(targetType)). setProductBaseUrl(setup.getBaseURL(targetType)); }
TargetIdentifyingMultiInstallSetupConfigBuilderStrategy implements AdapterConfigurationStrategy { @Override public <B extends AbstractAdapterConfigBuilder<B, C>, C extends AdapterConfig> void configure(B configBuilder) { configBuilder. setTrustAllCertificates(setup.isHavingUntrustedCertificate(targetType)). setUser(setup.getUserId(targetType)). setPasswordOrAPIToken(setup.getPassword(targetType)). setProductBaseUrl(setup.getBaseURL(targetType)); } }
TargetIdentifyingMultiInstallSetupConfigBuilderStrategy implements AdapterConfigurationStrategy { @Override public <B extends AbstractAdapterConfigBuilder<B, C>, C extends AdapterConfig> void configure(B configBuilder) { configBuilder. setTrustAllCertificates(setup.isHavingUntrustedCertificate(targetType)). setUser(setup.getUserId(targetType)). setPasswordOrAPIToken(setup.getPassword(targetType)). setProductBaseUrl(setup.getBaseURL(targetType)); } TargetIdentifyingMultiInstallSetupConfigBuilderStrategy(TargetIdentifyingMultiInstallSetup setup, TargetType targetType); }
TargetIdentifyingMultiInstallSetupConfigBuilderStrategy implements AdapterConfigurationStrategy { @Override public <B extends AbstractAdapterConfigBuilder<B, C>, C extends AdapterConfig> void configure(B configBuilder) { configBuilder. setTrustAllCertificates(setup.isHavingUntrustedCertificate(targetType)). setUser(setup.getUserId(targetType)). setPasswordOrAPIToken(setup.getPassword(targetType)). setProductBaseUrl(setup.getBaseURL(targetType)); } TargetIdentifyingMultiInstallSetupConfigBuilderStrategy(TargetIdentifyingMultiInstallSetup setup, TargetType targetType); @Override void configure(B configBuilder); }
TargetIdentifyingMultiInstallSetupConfigBuilderStrategy implements AdapterConfigurationStrategy { @Override public <B extends AbstractAdapterConfigBuilder<B, C>, C extends AdapterConfig> void configure(B configBuilder) { configBuilder. setTrustAllCertificates(setup.isHavingUntrustedCertificate(targetType)). setUser(setup.getUserId(targetType)). setPasswordOrAPIToken(setup.getPassword(targetType)). setProductBaseUrl(setup.getBaseURL(targetType)); } TargetIdentifyingMultiInstallSetupConfigBuilderStrategy(TargetIdentifyingMultiInstallSetup setup, TargetType targetType); @Override void configure(B configBuilder);  }