Skip to content

Commit

Permalink
[Dubbo-808] Support etcd registry (#3605)
Browse files Browse the repository at this point in the history
* Merge https://github.com/dubbo/dubbo-registry-etcd into incubator-dubbo

* Add UT to ConfigurationUtilsTest
  • Loading branch information
ralf0131 authored and zonghaishang committed Mar 11, 2019
1 parent 096d1da commit 1ee4d84
Show file tree
Hide file tree
Showing 28 changed files with 3,258 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dubbo-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
<artifactId>dubbo-remoting-http</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-remoting-etcd3</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-rpc-api</artifactId>
Expand Down Expand Up @@ -218,6 +223,11 @@
<artifactId>dubbo-registry-redis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-etcd3</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-consul</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.Map;

/**
*
*/
Expand All @@ -39,4 +41,29 @@ public void testGetProperty () {
Assertions.assertEquals("10000", ConfigurationUtils.getProperty(Constants.SHUTDOWN_WAIT_KEY));
System.clearProperty(Constants.SHUTDOWN_WAIT_KEY);
}

@Test
public void testParseSingleProperties() throws Exception {
String p1 = "aaa=bbb";
Map<String, String> result = ConfigurationUtils.parseProperties(p1);
Assertions.assertEquals(1, result.size());
Assertions.assertEquals("bbb", result.get("aaa"));
}

@Test
public void testParseMultipleProperties() throws Exception {
String p1 = "aaa=bbb\nccc=ddd";
Map<String, String> result = ConfigurationUtils.parseProperties(p1);
Assertions.assertEquals(2, result.size());
Assertions.assertEquals("bbb", result.get("aaa"));
Assertions.assertEquals("ddd", result.get("ccc"));
}

@Test
public void testEscapedNewLine() throws Exception {
String p1 = "dubbo.registry.address=zookeeper://127.0.0.1:2181\\\\ndubbo.protocol.port=20880";
Map<String, String> result = ConfigurationUtils.parseProperties(p1);
Assertions.assertEquals(1, result.size());
Assertions.assertEquals("zookeeper://127.0.0.1:2181\\ndubbo.protocol.port=20880", result.get("dubbo.registry.address"));
}
}
16 changes: 16 additions & 0 deletions dubbo-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<rs_api_version>2.0</rs_api_version>
<resteasy_version>3.0.19.Final</resteasy_version>
<tomcat_embed_version>8.5.31</tomcat_embed_version>
<jetcd_version>0.3.0</jetcd_version>
<!-- Log libs -->
<slf4j_version>1.7.25</slf4j_version>
<jcl_version>1.2</jcl_version>
Expand Down Expand Up @@ -379,6 +380,21 @@
<artifactId>tomcat-embed-logging-juli</artifactId>
<version>${tomcat_embed_version}</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>${jetcd_version}</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-handler-proxy</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Log libs -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
53 changes: 53 additions & 0 deletions dubbo-registry/dubbo-registry-etcd3/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>dubbo-registry</artifactId>
<groupId>org.apache.dubbo</groupId>
<version>2.7.1-SNAPSHOT</version>
</parent>

<artifactId>dubbo-registry-etcd3</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>The etcd3 registry module of Dubbo project</description>

<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-remoting-etcd3</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>


</project>
Loading

0 comments on commit 1ee4d84

Please sign in to comment.