Merge pull request #410 from chickenlj/disable-java-IT
Upgrade helloworld java sample
diff --git a/helloworld/java-client/pom.xml b/helloworld/java-client/pom.xml
index da8ae8c..3bc4dcd 100644
--- a/helloworld/java-client/pom.xml
+++ b/helloworld/java-client/pom.xml
@@ -27,7 +27,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2</dubbo.version>
+ <dubbo.version>3.0.11</dubbo.version>
<junit.version>4.12</junit.version>
<spring-test.version>4.3.16.RELEASE</spring-test.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java b/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
index 71e5f2a..07bc37e 100644
--- a/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
+++ b/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
@@ -21,6 +21,7 @@
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.sample.hello.Helloworld;
import java.io.IOException;
@@ -34,8 +35,12 @@
ref.setProtocol(CommonConstants.TRIPLE);
ref.setLazy(true);
ref.setTimeout(100000);
- ref.setApplication(new ApplicationConfig("demo-consumer"));
- ref.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
+
+ DubboBootstrap.getInstance()
+ .application(new ApplicationConfig("demo-consumer"))
+ .registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
+ .reference(ref).start();
+
final IGreeter iGreeter = ref.get();
System.out.println("dubbo ref started");
diff --git a/helloworld/java-server/pom.xml b/helloworld/java-server/pom.xml
index bac62e9..825b7fe 100644
--- a/helloworld/java-server/pom.xml
+++ b/helloworld/java-server/pom.xml
@@ -29,7 +29,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.2</dubbo.version>
+ <dubbo.version>3.0.11</dubbo.version>
<junit.version>4.12</junit.version>
<spring-test.version>4.3.16.RELEASE</spring-test.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
index e052dcb..b50dc25 100644
--- a/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
+++ b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
@@ -30,10 +30,15 @@
service.setInterface(IGreeter.class);
service.setRef(new IGreeter1Impl());
service.setProtocol(new ProtocolConfig(CommonConstants.TRIPLE, 50051));
- service.setApplication(new ApplicationConfig("demo-provider"));
- service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
- service.export();
+ service.setApplication();
+ service.setRegistry();
System.out.println("dubbo service started");
- new CountDownLatch(1).await();
+
+ DubboBootstrap.getInstance()
+ .application(new ApplicationConfig("demo-provider"))
+ .registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
+ .service(service)
+ .start()
+ .await();
}
}