diff --git a/spring-cloud-localconfig-connector/src/test/java/org/springframework/cloud/localconfig/LocalConfigServiceOverrideTest.java b/spring-cloud-localconfig-connector/src/test/java/org/springframework/cloud/localconfig/LocalConfigServiceOverrideTest.java new file mode 100644 index 0000000..980067a --- /dev/null +++ b/spring-cloud-localconfig-connector/src/test/java/org/springframework/cloud/localconfig/LocalConfigServiceOverrideTest.java @@ -0,0 +1,34 @@ +package org.springframework.cloud.localconfig; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.ProvideSystemProperty; +import org.springframework.cloud.service.ServiceInfo; +import org.springframework.cloud.service.common.MongoServiceInfo; + +public class LocalConfigServiceOverrideTest extends AbstractLocalConfigConnectorTest { + + @Rule + public final ProvideSystemProperty OVERRIDE_MYSQL = + new ProvideSystemProperty( + "spring.cloud.candygram", + "mongodb://youruser:yourpass@40.30.20.10:4321/dbname"); + + @Test + public void serviceOverride() { + List services = connector.getServiceInfos(); + ServiceInfo service = getServiceInfo(services, "candygram"); + assertNotNull(service); + assertTrue(service instanceof MongoServiceInfo); + MongoServiceInfo mongo = (MongoServiceInfo) service; + assertEquals("youruser", mongo.getUserName()); + assertEquals(4321, mongo.getPort()); + } + +}