Add test to override programmatic definition from system properties.
fixes #45
This commit is contained in:
@@ -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<ServiceInfo> 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());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user