Skip to content
Permalink
Browse files
update dubbo version to 2.7.7 (#605)
  • Loading branch information
htynkn committed Jul 3, 2020
1 parent c67832e commit 20b44cd5e9d0485f4a288e0cec972eb3a2eb5486
Show file tree
Hide file tree
Showing 30 changed files with 13,759 additions and 47 deletions.
@@ -16,7 +16,7 @@ jobs:
with:
java-version: ${{ matrix.java }}
- name: Build with Maven
run: ./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
run: ./mvnw clean install --batch-mode -DskipTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1

@@ -0,0 +1,18 @@
name: Integration

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Copy files
run: cp docker/latest/** ./
- name: Docker build
run: docker build -t apache/dubbo-admin-integration:latest .
- name: Setup xvfb
run: sudo apt-get install xvfb
- name: Run integration test
run: xvfb-run --server-args="-screen 0, 1024x768x24" ./mvnw --batch-mode --projects dubbo-admin-test --activate-profiles dubbo-admin-integration-test -Ddocker.showLogs=true docker:stop docker:remove verify
@@ -40,6 +40,7 @@ service governance follows the version of Dubbo 2.7, and compatible for Dubbo 2.
OR
* `cd dubbo-admin-distribution/target`; `java -jar dubbo-admin-0.1.jar`
5. Visit `http://localhost:8080`
6. Default username and password is `root`
---
### Development Setup
@@ -60,4 +61,4 @@ Once deployed, you can check http://localhost:8080/swagger-ui.html to check all
### License

Apache Dubbo admin is under the Apache 2.0 license, Version 2.0.
See [LICENSE](https://github.com/apache/dubbo-admin/blob/develop/LICENSE) for full license text.
See [LICENSE](https://github.com/apache/dubbo-admin/blob/develop/LICENSE) for full license text.
@@ -0,0 +1,27 @@
# 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.

FROM maven:3-openjdk-8
RUN mkdir -p /source/dubbo-admin-snapshot
ADD . /source/dubbo-admin-snapshot
WORKDIR /source/dubbo-admin-snapshot
RUN mvn --batch-mode clean package -Dmaven.test.skip=true

FROM openjdk:8-jre
LABEL maintainer="dev@dubbo.apache.org"
RUN apt-get update && apt-get install -y tini
COPY --from=0 /source/dubbo-admin-snapshot/dubbo-admin-distribution/target/dubbo-admin-0.2.0-SNAPSHOT.jar /app.jar
ENTRYPOINT ["tini","--","java","-XX:+UnlockExperimentalVMOptions","-XX:+UseCGroupMemoryLimitForHeap","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
EXPOSE 8080
@@ -245,5 +245,20 @@
</plugins>
</build>

<profiles>
<profile>
<id>javax.annotation</id>
<activation>
<jdk>[1.11,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
@@ -32,7 +32,7 @@
import org.apache.dubbo.admin.service.ProviderService;
import org.apache.dubbo.admin.service.impl.MetrcisCollectServiceImpl;
import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -29,7 +29,7 @@
import org.apache.dubbo.admin.service.ConsumerService;
import org.apache.dubbo.admin.service.ProviderService;
import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
@@ -29,7 +29,7 @@
import org.apache.dubbo.admin.service.impl.GenericServiceImpl;
import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
import org.apache.dubbo.metadata.definition.model.MethodDefinition;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,7 +19,7 @@

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.SPI;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;

@SPI("zookeeper")
public interface MetaDataCollector {
@@ -26,7 +26,8 @@
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;

import java.util.Objects;

@@ -67,11 +68,11 @@ public String getConsumerMetaData(MetadataIdentifier key) {

private String doGetMetaData(MetadataIdentifier key) {
try {
Response<GetValue> response = this.client.getKVValue(key.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY));
Response<GetValue> response = this.client.getKVValue(key.getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
return response.getValue().getDecodedValue();
} catch (Exception e) {
LOG.error(String.format("Failed to fetch metadata for %s from consul, cause: %s",
key.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY), e.getMessage()), e);
key.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), e.getMessage()), e);
}
return null;
}
@@ -22,7 +22,8 @@
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
@@ -94,7 +95,7 @@ public String getConsumerMetaData(MetadataIdentifier key) {

private String getMetaData(MetadataIdentifier identifier) {
try {
return configService.getConfig(identifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY),
return configService.getConfig(identifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY),
group, 1000 * 10);
} catch (NacosException e) {
logger.warn("Failed to get " + identifier + " from nacos, cause: " + e.getMessage(), e);
@@ -19,7 +19,7 @@

import org.apache.dubbo.admin.registry.metadata.MetaDataCollector;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;

public class NoOpMetadataCollector implements MetaDataCollector {

@@ -21,7 +21,8 @@
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.apache.dubbo.admin.registry.metadata.MetaDataCollector;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.apache.dubbo.rpc.RpcException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,7 +39,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
import static org.apache.dubbo.metadata.identifier.MetadataIdentifier.META_DATA_STORE_TAG;
import static org.apache.dubbo.metadata.MetadataConstants.META_DATA_STORE_TAG;

public class RedisMetaDataCollector implements MetaDataCollector {

@@ -90,14 +91,14 @@ private String doGetMetaData(MetadataIdentifier identifier) {
String result = null;
if (url.getParameter(CLUSTER_KEY, false)) {
try (JedisCluster jedisCluster = new JedisCluster(jedisClusterNodes, timeout, timeout, 2, password, new GenericObjectPoolConfig())) {
result = jedisCluster.get(identifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY) + META_DATA_STORE_TAG);
result = jedisCluster.get(identifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY) + META_DATA_STORE_TAG);
} catch (Throwable e) {
logger.error("Failed to get " + identifier + " from redis cluster, cause: " + e.getMessage(), e);
throw new RpcException("Failed to get " + identifier + " from redis cluster, cause: " + e.getMessage(), e);
}
} else {
try (Jedis jedis = pool.getResource()) {
result = jedis.get(identifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY) + META_DATA_SOTRE_TAG);
result = jedis.get(identifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY) + META_DATA_SOTRE_TAG);
} catch (Throwable e) {
logger.error("Failed to get " + identifier + " from redis, cause: " + e.getMessage(), e);
throw new RpcException("Failed to get " + identifier + " from redis, cause: " + e.getMessage(), e);
@@ -25,7 +25,8 @@
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;

public class ZookeeperMetaDataCollector implements MetaDataCollector {

@@ -68,7 +69,7 @@ public String getConsumerMetaData(MetadataIdentifier key) {
}

private String getNodePath(MetadataIdentifier metadataIdentifier) {
return toRootDir() + metadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.PATH);
return toRootDir() + metadataIdentifier.getUniqueKey(KeyTypeEnum.PATH);
}

private String toRootDir() {
@@ -17,7 +17,7 @@
package org.apache.dubbo.admin.service;

import org.apache.dubbo.admin.model.domain.Consumer;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;

import java.util.List;

@@ -18,7 +18,7 @@

import org.apache.dubbo.admin.model.domain.Provider;
import org.apache.dubbo.admin.model.dto.ServiceDTO;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;

import java.util.List;
import java.util.Set;
@@ -21,7 +21,7 @@
import org.apache.dubbo.admin.model.domain.Consumer;
import org.apache.dubbo.admin.service.ConsumerService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.springframework.stereotype.Component;

import java.util.HashMap;
@@ -27,7 +27,7 @@
import org.apache.dubbo.admin.service.OverrideService;
import org.apache.dubbo.admin.service.ProviderService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@@ -56,8 +56,8 @@ public class ConditionRoutesControllerTest extends AbstractSpringIntegrationTest

@After
public void tearDown() throws Exception {
if (zkClient.checkExists().forPath("/dubbo") != null) {
zkClient.delete().deletingChildrenIfNeeded().forPath("/dubbo");
if (zkClient.checkExists().forPath("/dubbo/config/dubbo") != null) {
zkClient.delete().deletingChildrenIfNeeded().forPath("/dubbo/config/dubbo");
}
}

@@ -27,7 +27,8 @@
import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
import org.apache.dubbo.metadata.definition.model.MethodDefinition;
import org.apache.dubbo.metadata.definition.util.ClassUtils;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -73,7 +74,7 @@ public void testGetProviderMetaData() {
FullServiceDefinition definition = ServiceDefinitionBuilder.buildFullDefinition(ServiceA.class, params);

String metadata = gson.toJson(definition);
consulMetaDataCollector.getClient().setKVValue(identifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY), metadata);
consulMetaDataCollector.getClient().setKVValue(identifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), metadata);

String providerMetaData = consulMetaDataCollector.getProviderMetaData(identifier);
Assert.assertEquals(metadata, providerMetaData);
@@ -102,7 +103,7 @@ public void testGetConsumerMetaData() {
consumerParams.put("k2", "1");
consumerParams.put("k3", "true");
String metadata = gson.toJson(consumerParams);
consulMetaDataCollector.getClient().setKVValue(identifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY), metadata);
consulMetaDataCollector.getClient().setKVValue(identifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), metadata);

String consumerMetaData = consulMetaDataCollector.getConsumerMetaData(identifier);
Map<String, String> retParams = gson.fromJson(consumerMetaData, new TypeToken<Map<String, String>>() {

0 comments on commit 20b44cd

Please sign in to comment.