Skip to content
Permalink
Browse files
Merge remote-tracking branch 'origin/master'
  • Loading branch information
chickenlj committed Oct 22, 2019
2 parents 0f1c741 + c9061bf commit 145b2cf95b1af3124f7d169c1339e0ed764f8efc
Showing 103 changed files with 2,883 additions and 561 deletions.
@@ -0,0 +1,42 @@
name: CI

Check failure on line 1 in .github/workflows/ci.yml

GitHub Actions / build

.github/workflows/ci.yml#L1

Process completed with exit code 1.

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: ./mvnw --settings .mvn/settings.xml clean package

integration:
runs-on: ubuntu-latest
needs: build
env:
DUBBO_VERSION: 2.7.5-SNAPSHOT
strategy:
matrix:
javaVersion: [1.8, 11]
include:
- javaVersion: 1.8
dockerImage: openjdk:8
- javaVersion: 11
dockerImage: openjdk:11

steps:
- uses: actions/checkout@v1
- name: Set up JDK ${{ matrix.javaVersion }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.javaVersion }}
- name: Run integration test
run: |
./mvnw -U --batch-mode --no-transfer-progress --settings .mvn/settings.xml clean install -pl dubbo-maven-address-plugin -Ddubbo.version=$DUBBO_VERSION
./mvnw -U --batch-mode --no-transfer-progress --settings .mvn/settings.xml clean verify -Pdubbo-integration-test -Djava-image.name=${{ matrix.dockerImage }} -Ddubbo.version=$DUBBO_VERSION
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<profiles>
<profile>
<id>apache</id>
<repositories>
<repository>
<id>apache.snapshots.https</id>
<name>Apache Development Snapshot Repository</name>
<url>https://repository.apache.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

<repository>
<id>apache.releases.https</id>
<name>Apache Release Distribution Repository</name>
<url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>

</profiles>

<activeProfiles>
<activeProfile>apache</activeProfile>
</activeProfiles>
</settings>
@@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip
@@ -16,10 +16,8 @@ cache:
install: true

script:
- ./mvnw -B clean install -pl dubbo-maven-address-plugin
- ./mvnw -B clean verify -Pdubbo-integration-test -Djava-image.name=${JAVA_BASE_IMAGE} -Ddubbo.version=2.7.4-SNAPSHOT


- ./mvnw -U --batch-mode --no-transfer-progress --settings .mvn/settings.xml clean install -pl dubbo-maven-address-plugin -Ddubbo.version=2.7.5-SNAPSHOT
- ./mvnw -U --batch-mode --no-transfer-progress --settings .mvn/settings.xml clean verify -Pdubbo-integration-test -Djava-image.name=${JAVA_BASE_IMAGE} -Ddubbo.version=2.7.5-SNAPSHOT

after_success:
- bash <(curl -s https://codecov.io/bash)
@@ -19,13 +19,10 @@

package org.apache.dubbo.samples.annotation;

import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.samples.annotation.action.AnnotationAction;

import org.apache.dubbo.samples.annotation.config.ConsumerConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

public class AnnotationConsumerBootstrap {

@@ -34,19 +31,11 @@ public static void main(String[] args) {
context.start();
final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction");

System.out.println("hello :" + annotationAction.doSayHello("world"));
System.out.println("goodbye :" + annotationAction.doSayGoodbye("world"));
System.out.println("greeting :" + annotationAction.doGreeting("world"));
System.out.println("reply :" + annotationAction.replyGreeting("world"));
System.out.println("hello : " + annotationAction.doSayHello("world"));
System.out.println("goodbye : " + annotationAction.doSayGoodbye("world"));
System.out.println("greeting : " + annotationAction.doGreeting("world"));
System.out.println("reply : " + annotationAction.replyGreeting("world"));
}


@Configuration
@EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.annotation.action")
@PropertySource("classpath:/spring/dubbo-consumer.properties")
@ComponentScan(value = {"org.apache.dubbo.samples.annotation.action"})
static public class ConsumerConfiguration {

}

}
@@ -20,13 +20,8 @@
package org.apache.dubbo.samples.annotation;


import org.apache.dubbo.config.ProviderConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;

import org.apache.dubbo.samples.annotation.config.ProviderConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.util.concurrent.CountDownLatch;

@@ -42,16 +37,4 @@ public static void main(String[] args) throws Exception {
new CountDownLatch(1).await();
}

@Configuration
@EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.annotation.impl")
@PropertySource("classpath:/spring/dubbo-provider.properties")
static public class ProviderConfiguration {
@Bean
public ProviderConfig providerConfig() {
ProviderConfig providerConfig = new ProviderConfig();
providerConfig.setTimeout(1000);
return providerConfig;
}
}

}
@@ -30,12 +30,22 @@
@Component("annotationAction")
public class AnnotationAction {

@Reference(interfaceClass = HelloService.class, version = AnnotationConstants.VERSION)
@Reference(interfaceClass = HelloService.class, version = AnnotationConstants.VERSION /*,
methods = {
@Method(
name = "sayHello",
oninvoke = "notify.oninvoke",
onreturn = "notify.onreturn",
onthrow = "notify.onthrow")
}
*/
)
private HelloService helloService;

@Reference(interfaceClass = GreetingService.class,
version = AnnotationConstants.VERSION,
methods = {@Method(name = "greeting", timeout = 250, retries = 1)})
timeout = 1000,
methods = {@Method(name = "greeting", timeout = 3000, retries = 1)})
private GreetingService greetingService;

public String doSayHello(String name) {
@@ -0,0 +1,35 @@
/*
* 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.dubbo.samples.annotation.api;

import java.util.List;
import java.util.Map;

public interface Notify {
void oninvoke(String request);

void onreturn(String response, String request);

void onthrow(Throwable ex, String request);

List<String> getInvokes();

Map<String, String> getReturns();

Map<String, Throwable> getExceptions();
}
@@ -0,0 +1,31 @@
/*
* 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.dubbo.samples.annotation.config;

import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.annotation.action")
@PropertySource("classpath:/spring/dubbo-consumer.properties")
@ComponentScan(value = {"org.apache.dubbo.samples.annotation.action"})
public class ConsumerConfiguration {

}
@@ -0,0 +1,36 @@
/*
* 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.dubbo.samples.annotation.config;

import org.apache.dubbo.config.ProviderConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.annotation.impl")
@PropertySource("classpath:/spring/dubbo-provider.properties")
public class ProviderConfiguration {
@Bean
public ProviderConfig providerConfig() {
ProviderConfig providerConfig = new ProviderConfig();
providerConfig.setTimeout(1000);
return providerConfig;
}
}
@@ -38,7 +38,7 @@ public String replyGreeting(String name) {

private void sleepWhile() {
try {
Thread.sleep(3000);
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -0,0 +1,68 @@
/*
* 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.dubbo.samples.annotation.impl;


import org.apache.dubbo.samples.annotation.api.Notify;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component("notify")
public class NotifyImpl implements Notify {
private List<String> invokes = new ArrayList<>();
private Map<String, String> returns = new HashMap<>();
private Map<String, Throwable> exceptions = new HashMap<>();

@Override
public void oninvoke(String request) {
System.out.println("oninvoke - request: " + request);
invokes.add(request);
}

@Override
public void onreturn(String response, String request) {
System.out.println("onreturn - req: " + request + ", res: " + response);
returns.put(request, response);
}

@Override
public void onthrow(Throwable ex, String request) {
System.out.println("onthrow - request: " + request + ", exception: " + ex);
exceptions.put(request, ex);
}

@Override
public List<String> getInvokes() {
return invokes;
}

@Override
public Map<String, String> getReturns() {
return returns;
}

@Override
public Map<String, Throwable> getExceptions() {
return exceptions;
}
}

0 comments on commit 145b2cf

Please sign in to comment.