Separate and fix tests in SidecarApplicationTests (#3585)

* Separate and fix tests in SidecarApplicationTests.  Fixes #3584

* Renaming classes so they end in Tests
This commit is contained in:
Ryan Baxter
2019-07-03 11:17:27 -04:00
committed by GitHub
parent f29ea94f6e
commit 54bd12c7c2
9 changed files with 458 additions and 185 deletions

View File

@@ -0,0 +1,102 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import java.lang.reflect.Field;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import org.apache.http.config.Registry;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.conn.DefaultHttpClientConnectionOperator;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"sidecar.accept-all-ssl-certificates=false" })
public class AcceptAllSslCertificatesContextTests {
@Autowired
RestTemplate restTemplate;
@Test
public void testUseRestTemplateWhenHttpClientIsNotAvailable() {
HttpComponentsClientHttpRequestFactory requestFactory = (HttpComponentsClientHttpRequestFactory) restTemplate
.getRequestFactory();
CloseableHttpClient client = (CloseableHttpClient) requestFactory.getHttpClient();
PoolingHttpClientConnectionManager poolingHttpClientConnectionManager = getHttpClientConnectionManager(
client);
DefaultHttpClientConnectionOperator httpClientConnectionOperator = getHttpClientConnectionOperator(
poolingHttpClientConnectionManager);
Registry registry = getRegistry(httpClientConnectionOperator);
Map registryMap = getRegistryMap(registry);
SSLConnectionSocketFactory connectionSocketFactory = (SSLConnectionSocketFactory) registryMap
.get("https");
HostnameVerifier hostnameVerifier = getHostnameVerifier(connectionSocketFactory);
assertThat(hostnameVerifier).isInstanceOf(DefaultHostnameVerifier.class);
}
private HostnameVerifier getHostnameVerifier(
SSLConnectionSocketFactory connectionSocketFactory) {
return getField(connectionSocketFactory, "hostnameVerifier");
}
private PoolingHttpClientConnectionManager getHttpClientConnectionManager(
CloseableHttpClient httpClient) {
return getField(httpClient, "connManager");
}
private DefaultHttpClientConnectionOperator getHttpClientConnectionOperator(
PoolingHttpClientConnectionManager connectionManager) {
return getField(connectionManager, "connectionOperator");
}
private Registry getRegistry(
DefaultHttpClientConnectionOperator httpClientConnectionOperator) {
return getField(httpClientConnectionOperator, "socketFactoryRegistry");
}
private Map getRegistryMap(Registry registry) {
return getField(registry, "map");
}
private <T> T getField(Object target, String name) {
Field field = ReflectionUtils.findField(target.getClass(), name);
ReflectionUtils.makeAccessible(field);
Object value = ReflectionUtils.getField(field, target);
return (T) value;
}
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public class BothPropertiesEurekaTestConfigBeanTests {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBeanEurekaInstanceHostnamePropertyShouldBeUsed() {
assertThat(config.getAppname()).isEqualTo("mytest");
assertThat(config.getHostname()).isEqualTo("mhhost1");
assertThat(config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(config.getNonSecurePort()).isEqualTo(7000);
}
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost",
"sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public class EurekaTestConfigBeanTests {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBean() {
assertThat(this.config.getAppname()).isEqualTo("mytest");
assertThat(this.config.getHostname()).isEqualTo("mhhost");
assertThat(this.config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(this.config.getNonSecurePort()).isEqualTo(7000);
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000", "sidecar.ipAddress=127.0.0.1",
"management.server.servlet.context-path=/foo" })
public class ManagementContextPathStatusAndHealthCheckUrlsTests {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testStatusAndHealthCheckUrls() {
assertThat(config.getStatusPageUrl())
.isEqualTo("http://mhhost2:0/foo/actuator/info");
assertThat(config.getHealthCheckUrl())
.isEqualTo("http://mhhost2:0/foo/actuator/health");
}
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "sidecar.hostname=mhhost",
"sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public class NewPropertyEurekaTestConfigBeanTests {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBean() {
assertThat(config.getAppname()).isEqualTo("mytest");
assertThat(config.getHostname()).isEqualTo("mhhost");
assertThat(config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(config.getNonSecurePort()).isEqualTo(7000);
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000", "sidecar.ip-address=10.0.0.1",
"eureka.instance.prefer-ip-address=true" })
public class PreferIpAddressTests {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBeanPreferIpAddress() {
assertThat(config.getAppname()).isEqualTo("mytest");
assertThat(config.getHostname()).isEqualTo("10.0.0.1");
assertThat(config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(config.getNonSecurePort()).isEqualTo(7000);
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"sidecar.port=7000", "sidecar.ip-address=127.0.0.1",
"sidecar.secure-port-enabled=true" })
public class SecurePortEnableds {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testThatSecureEnabledOptionIsSetFromPropertyFile() {
assertThat(this.config.isSecurePortEnabled()).isEqualTo(true);
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author Ryan Baxter
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000", "sidecar.ipAddress=127.0.0.1",
"server.servlet.context-path=/foo" })
public class ServerContextPathStatusAndHealthCheckUrlsTests {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testStatusAndHealthCheckUrls() {
assertThat(config.getStatusPageUrl())
.isEqualTo("http://mhhost2:0/foo/actuator/info");
assertThat(config.getHealthCheckUrl())
.isEqualTo("http://mhhost2:0/foo/actuator/health");
}
}

View File

@@ -1,185 +0,0 @@
/*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.sidecar;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
public class SidecarApplicationTests {
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost",
"sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public static class EurekaTestConfigBeanTest {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBean() {
assertThat(this.config.getAppname()).isEqualTo("mytest");
assertThat(this.config.getHostname()).isEqualTo("mhhost");
assertThat(this.config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(this.config.getNonSecurePort()).isEqualTo(7000);
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "sidecar.hostname=mhhost",
"sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public static class NewPropertyEurekaTestConfigBeanTest {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBean() {
assertThat(config.getAppname()).isEqualTo("mytest");
assertThat(config.getHostname()).isEqualTo("mhhost");
assertThat(config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(config.getNonSecurePort()).isEqualTo(7000);
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000",
"sidecar.ip-address=127.0.0.1" })
public static class BothPropertiesEurekaTestConfigBeanTest {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBeanEurekaInstanceHostnamePropertyShouldBeUsed() {
assertThat(config.getAppname()).isEqualTo("mytest");
assertThat(config.getHostname()).isEqualTo("mhhost1");
assertThat(config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(config.getNonSecurePort()).isEqualTo(7000);
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000",
"sidecar.ip-address=10.0.0.1", "eureka.instance.prefer-ip-address=true" })
public static class PreferIpAddressTest {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testEurekaConfigBeanPreferIpAddress() {
assertThat(config.getAppname()).isEqualTo("mytest");
assertThat(config.getHostname()).isEqualTo("10.0.0.1");
assertThat(config.getInstanceId()).isEqualTo("mhhost:mytest:1");
assertThat(config.getNonSecurePort()).isEqualTo(7000);
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000",
"sidecar.ipAddress=127.0.0.1", "management.context-path=/foo" })
public static class ManagementContextPathStatusAndHealthCheckUrls {
@Autowired
EurekaInstanceConfigBean config;
public void testStatusAndHealthCheckUrls() {
assertThat(config.getStatusPageUrl()).isEqualTo("http://mhhost2:0/foo/info");
assertThat(config.getHealthCheckUrl())
.isEqualTo("http://mhhost2:0/foo/health");
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost",
"spring.application.instance_id=1", "eureka.instance.hostname=mhhost1",
"sidecar.hostname=mhhost2", "sidecar.port=7000",
"sidecar.ipAddress=127.0.0.1", "server.context-path=/foo" })
public static class ServerContextPathStatusAndHealthCheckUrls {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testStatusAndHealthCheckUrls() {
assertThat(config.getStatusPageUrl()).isEqualTo("http://mhhost2:0/foo/info");
assertThat(config.getHealthCheckUrl())
.isEqualTo("http://mhhost2:0/foo/health");
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"sidecar.accept-all-ssl-certificates=false" })
public static class AcceptAllSslCertificatesContext {
@Autowired
RestTemplate restTemplate;
@Test
public void testUseRestTemplateWhenHttpClientIsNotAvailable() {
assertThat(restTemplate.getRequestFactory()).isNull();
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, value = {
"sidecar.port=7000", "sidecar.ip-address=127.0.0.1",
"sidecar.secure-port-enabled=true" })
public static class SecurePortEnabled {
@Autowired
EurekaInstanceConfigBean config;
@Test
public void testThatSecureEnabledOptionIsSetFromPropertyFile() {
assertThat(this.config.isSecurePortEnabled()).isEqualTo(true);
}
}
}