You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/01/30 04:45:37 UTC
[incubator-servicecomb-java-chassis] 03/04: SCB-315 add common
AddressResover configuration to foundation-vertx,
and use it in service-registry and config-cc to support dynamic config by
user
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit 3d76998811f81b66182f9bf4a811bb0f784fa217
Author: jeho0815 <je...@email.com>
AuthorDate: Mon Jan 29 14:58:16 2018 +0800
SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user
---
.../foundation/vertx/AddressResolverConfig.java | 17 ++++++++++++++
.../foundation/vertx/TestAddressResoverConfig.java | 26 +++++++++++++++++++---
2 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
index a9bd5fe..698178d 100644
--- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://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.apache.servicecomb.foundation.vertx;
import java.util.Arrays;
diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java
index b9470e3..08d6afa 100644
--- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java
+++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java
@@ -1,5 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://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.apache.servicecomb.foundation.vertx;
+import static org.hamcrest.CoreMatchers.*;
+
+import java.util.Arrays;
+
import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -40,8 +61,7 @@ public class TestAddressResoverConfig {
ArchaiusUtils.setProperty("addressResolver.ndots", 3);
ArchaiusUtils.setProperty("addressResolver.rotateServers", true);
AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test");
- Assert.assertEquals(2, aroc.getServers().size());
- Assert.assertEquals("8.8.8.8", aroc.getServers().get(0));
+ Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4")));
Assert.assertEquals("test.svc.local.cluster", aroc.getSearchDomains().get(0));
AddressResolverOptions aroc1 = AddressResolverConfig.getAddressResover("test1");
Assert.assertEquals("default.svc.local.cluster", aroc1.getSearchDomains().get(0));
@@ -54,7 +74,7 @@ public class TestAddressResoverConfig {
ArchaiusUtils.setProperty("addressResolver.maxQueries", 3);
ArchaiusUtils.setProperty("addressResolver.rdFlag", false);
AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test");
- Assert.assertEquals(2, aroc.getServers().size());
+ Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4")));
Assert.assertEquals(3, aroc.getMaxQueries());
Assert.assertEquals(Integer.MAX_VALUE, aroc.getCacheMaxTimeToLive());
Assert.assertTrue(aroc.isOptResourceEnabled());
--
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.