This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-integration-cases.git


The following commit(s) were added to refs/heads/main by this push:
     new 4aa96817 add integration test case to verify apache/dubbo#13787 (#8)
4aa96817 is described below

commit 4aa9681702ae884ee32a556a748e92ab008f73b3
Author: laywin <[email protected]>
AuthorDate: Mon Mar 11 16:14:24 2024 +0800

    add integration test case to verify apache/dubbo#13787 (#8)
    
    * add integration test case to verify apache/dubbo#13787
    
    * Update 99-integration/dubbo-samples-test-13787/pom.xml
    
    modify dubbo version
    
    Co-authored-by: Albumen Kevin <[email protected]>
    
    ---------
    
    Co-authored-by: Albumen Kevin <[email protected]>
---
 .../case-configuration.yml                         |  47 ++++
 .../dubbo-samples-test-13787/case-versions.conf    |  25 ++
 99-integration/dubbo-samples-test-13787/pom.xml    |  88 ++++++
 .../apache/dubbo/samples/test/DubboProvider.java   |  38 +++
 .../dubbo/samples/test/EmbeddedZooKeeper.java      | 309 +++++++++++++++++++++
 .../apache/dubbo/samples/test/HelloService.java    |  26 ++
 .../dubbo/samples/test/HelloServiceImpl.java       |  33 +++
 .../src/main/resources/application.yml             |  29 ++
 .../org/apache/dubbo/samples/test/ConsumerIT.java  |  41 +++
 99-integration/pom.xml                             |   1 +
 10 files changed, 637 insertions(+)

diff --git a/99-integration/dubbo-samples-test-13787/case-configuration.yml 
b/99-integration/dubbo-samples-test-13787/case-configuration.yml
new file mode 100644
index 00000000..fe4eb75d
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13787/case-configuration.yml
@@ -0,0 +1,47 @@
+# 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.
+
+services:
+    zookeeper:
+        image: zookeeper:latest
+
+    dubbo-samples-test-13787-provider:
+        type: app
+        basedir: .
+        mainClass: org.apache.dubbo.samples.test.DubboProvider
+        systemProps:
+            - zookeeper.address=zookeeper
+        waitPortsBeforeRun:
+            - zookeeper:2181
+        checkPorts:
+            - 20880
+        checkLog: "dubbo service started"
+        depends_on:
+            - zookeeper
+
+    dubbo-samples-test-13787-consumer:
+        type: test
+        basedir: .
+        tests:
+            - "ConsumerIT.class"
+        systemProps:
+            - zookeeper.address=zookeeper
+        waitPortsBeforeRun:
+            - zookeeper:2181
+            - dubbo-samples-test-13787-provider:20880
+        depends_on:
+            - zookeeper
+            - dubbo-samples-test-13787-provider
diff --git a/99-integration/dubbo-samples-test-13787/case-versions.conf 
b/99-integration/dubbo-samples-test-13787/case-versions.conf
new file mode 100644
index 00000000..c09345d7
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13787/case-versions.conf
@@ -0,0 +1,25 @@
+#
+#
+#   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.
+#
+
+
+# Supported component versions of the test case
+
+# SpringBoot app
+dubbo.version=3.2.12-SNAPSHOT
+spring-boot.version=2.*
+java.version= [>= 8]
diff --git a/99-integration/dubbo-samples-test-13787/pom.xml 
b/99-integration/dubbo-samples-test-13787/pom.xml
new file mode 100644
index 00000000..e6881b80
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13787/pom.xml
@@ -0,0 +1,88 @@
+<?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";>
+
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>23</version>
+        <relativePath/>
+    </parent>
+
+    <groupId>org.apache.dubbo</groupId>
+    <version>1.0-SNAPSHOT</version>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-samples-test-13787</artifactId>
+
+    <properties>
+        <dubbo.version>3.2.12</dubbo.version>
+        <junit.version>4.13.1</junit.version>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <springboot.version>2.7.8</springboot.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <version>${springboot.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo</artifactId>
+            <version>${dubbo.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+            <exclusions>
+                <exclusion>
+                    <artifactId>logback-classic</artifactId>
+                    <groupId>ch.qos.logback</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>logback-core</artifactId>
+                    <groupId>ch.qos.logback</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>log4j</artifactId>
+                    <groupId>log4j</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>slf4j-log4j12</artifactId>
+                    <groupId>org.slf4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+</project>
diff --git 
a/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/DubboProvider.java
 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/DubboProvider.java
new file mode 100644
index 00000000..c375889d
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/DubboProvider.java
@@ -0,0 +1,38 @@
+/*
+ *
+ *   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.test;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+
+@SpringBootApplication
+@EnableDubbo
+public class DubboProvider {
+
+    public static void main(String[] args) {
+        new EmbeddedZooKeeper(2181, false).start();
+
+        SpringApplication.run(DubboProvider.class, args);
+
+        System.out.println("dubbo service started");
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/EmbeddedZooKeeper.java
 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/EmbeddedZooKeeper.java
new file mode 100644
index 00000000..f75a052e
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/EmbeddedZooKeeper.java
@@ -0,0 +1,309 @@
+
+/*
+ * Copyright 2014 the original author or authors.
+ *
+ * Licensed 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.test;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.util.ErrorHandler;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.ServerSocket;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+/**
+ * from: 
https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
+ * <p>
+ * Helper class to start an embedded instance of standalone (non clustered) 
ZooKeeper.
+ * <p>
+ * NOTE: at least an external standalone server (if not an ensemble) are 
recommended, even for
+ * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
+ *
+ * @author Patrick Peralta
+ * @author Mark Fisher
+ * @author David Turanski
+ */
+public class EmbeddedZooKeeper implements SmartLifecycle {
+
+    private static final Random RANDOM = new Random();
+
+    /**
+     * Logger.
+     */
+    private static final Logger logger = 
LoggerFactory.getLogger(EmbeddedZooKeeper.class);
+
+    /**
+     * ZooKeeper client port. This will be determined dynamically upon startup.
+     */
+    private final int clientPort;
+
+    /**
+     * Whether to auto-start. Default is true.
+     */
+    private boolean autoStartup = true;
+
+    /**
+     * Lifecycle phase. Default is 0.
+     */
+    private int phase = 0;
+
+    /**
+     * Thread for running the ZooKeeper server.
+     */
+    private volatile Thread zkServerThread;
+
+    /**
+     * ZooKeeper server.
+     */
+    private volatile ZooKeeperServerMain zkServer;
+
+    /**
+     * {@link ErrorHandler} to be invoked if an Exception is thrown from the 
ZooKeeper server thread.
+     */
+    private ErrorHandler errorHandler;
+
+    private boolean daemon = true;
+
+    /**
+     * Construct an EmbeddedZooKeeper with a random port.
+     */
+    public EmbeddedZooKeeper() {
+        clientPort = findRandomPort(30000, 65535);
+    }
+
+    /**
+     * Construct an EmbeddedZooKeeper with the provided port.
+     *
+     * @param clientPort port for ZooKeeper server to bind to
+     */
+    public EmbeddedZooKeeper(int clientPort, boolean daemon) {
+        this.clientPort = clientPort;
+        this.daemon = daemon;
+    }
+
+    /**
+     * Returns the port that clients should use to connect to this embedded 
server.
+     *
+     * @return dynamically determined client port
+     */
+    public int getClientPort() {
+        return this.clientPort;
+    }
+
+    /**
+     * Specify whether to start automatically. Default is true.
+     *
+     * @param autoStartup whether to start automatically
+     */
+    public void setAutoStartup(boolean autoStartup) {
+        this.autoStartup = autoStartup;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isAutoStartup() {
+        return this.autoStartup;
+    }
+
+    /**
+     * Specify the lifecycle phase for the embedded server.
+     *
+     * @param phase the lifecycle phase
+     */
+    public void setPhase(int phase) {
+        this.phase = phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getPhase() {
+        return this.phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isRunning() {
+        return (zkServerThread != null);
+    }
+
+    /**
+     * Start the ZooKeeper server in a background thread.
+     * <p>
+     * Register an error handler via {@link #setErrorHandler} in order to 
handle
+     * any exceptions thrown during startup or execution.
+     */
+    @Override
+    public synchronized void start() {
+        if (zkServerThread == null) {
+            zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper 
Server Starter");
+            zkServerThread.setDaemon(daemon);
+            zkServerThread.start();
+        }
+    }
+
+    /**
+     * Shutdown the ZooKeeper server.
+     */
+    @Override
+    public synchronized void stop() {
+        if (zkServerThread != null) {
+            // The shutdown method is protected...thus this hack to invoke it.
+            // This will log an exception on shutdown; see
+            // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for 
details.
+            try {
+                Method shutdown = 
ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
+                shutdown.setAccessible(true);
+                shutdown.invoke(zkServer);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            // It is expected that the thread will exit after
+            // the server is shutdown; this will block until
+            // the shutdown is complete.
+            try {
+                zkServerThread.join(5000);
+                zkServerThread = null;
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                logger.warn("Interrupted while waiting for embedded ZooKeeper 
to exit");
+                // abandoning zk thread
+                zkServerThread = null;
+            }
+        }
+    }
+
+    /**
+     * Stop the server if running and invoke the callback when complete.
+     */
+    @Override
+    public void stop(Runnable callback) {
+        stop();
+        callback.run();
+    }
+
+    /**
+     * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown 
from the ZooKeeper server thread. If none
+     * is provided, only error-level logging will occur.
+     *
+     * @param errorHandler the {@link ErrorHandler} to be invoked
+     */
+    public void setErrorHandler(ErrorHandler errorHandler) {
+        this.errorHandler = errorHandler;
+    }
+
+    /**
+     * Runnable implementation that starts the ZooKeeper server.
+     */
+    private class ServerRunnable implements Runnable {
+
+        @Override
+        public void run() {
+            try {
+                Properties properties = new Properties();
+                File file = new File(System.getProperty("java.io.tmpdir")
+                        + File.separator + UUID.randomUUID());
+                file.deleteOnExit();
+                properties.setProperty("dataDir", file.getAbsolutePath());
+                properties.setProperty("clientPort", 
String.valueOf(clientPort));
+
+                QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
+                quorumPeerConfig.parseProperties(properties);
+
+                zkServer = new ZooKeeperServerMain();
+                ServerConfig configuration = new ServerConfig();
+                configuration.readFrom(quorumPeerConfig);
+
+                System.setProperty("zookeeper.admin.enableServer", "false");
+
+                zkServer.runFromConfig(configuration);
+            } catch (Exception e) {
+                if (errorHandler != null) {
+                    errorHandler.handleError(e);
+                } else {
+                    logger.error("Exception running embedded ZooKeeper", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Workaround for SocketUtils.findRandomPort() deprecation.
+     *
+     * @param min min port
+     * @param max max port
+     * @return a random generated available port
+     */
+    private static int findRandomPort(int min, int max) {
+        if (min < 1024) {
+            throw new IllegalArgumentException("Max port shouldn't be less 
than 1024.");
+        }
+
+        if (max > 65535) {
+            throw new IllegalArgumentException("Max port shouldn't be greater 
than 65535.");
+        }
+
+        if (min > max) {
+            throw new IllegalArgumentException("Min port shouldn't be greater 
than max port.");
+        }
+
+        int port = 0;
+        int counter = 0;
+
+        // Workaround for legacy JDK doesn't support Random.nextInt(min, max).
+        List<Integer> randomInts = RANDOM.ints(min, max + 1)
+                .limit(max - min)
+                .mapToObj(Integer::valueOf)
+                .collect(Collectors.toList());
+
+        do {
+            if (counter > max - min) {
+                throw new IllegalStateException("Unable to find a port between 
" + min + "-" + max);
+            }
+
+            port = randomInts.get(counter);
+            counter++;
+        } while (isPortInUse(port));
+
+        return port;
+    }
+
+    private static boolean isPortInUse(int port) {
+        try (ServerSocket ignored = new ServerSocket(port)) {
+            return false;
+        } catch (IOException e) {
+            // continue
+        }
+        return true;
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/HelloService.java
 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/HelloService.java
new file mode 100644
index 00000000..b245a5a8
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/HelloService.java
@@ -0,0 +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.dubbo.samples.test;
+
+
+public interface HelloService {
+
+       String hello();
+}
diff --git 
a/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/HelloServiceImpl.java
 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/HelloServiceImpl.java
new file mode 100644
index 00000000..05acaca0
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-13787/src/main/java/org/apache/dubbo/samples/test/HelloServiceImpl.java
@@ -0,0 +1,33 @@
+/*
+ *
+ *   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.test;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.context.annotation.Lazy;
+
+
+@DubboService
+@Lazy(value = false)
+public class HelloServiceImpl implements HelloService{
+
+       @Override
+       public String hello() {
+               return "hello";
+       }
+}
diff --git 
a/99-integration/dubbo-samples-test-13787/src/main/resources/application.yml 
b/99-integration/dubbo-samples-test-13787/src/main/resources/application.yml
new file mode 100644
index 00000000..ebee8c3c
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13787/src/main/resources/application.yml
@@ -0,0 +1,29 @@
+# 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.
+
+spring:
+  application:
+    name: provider
+  main:
+    lazy-initialization: true
+
+dubbo:
+  application:
+    name: provider
+
+  registry:
+    address: zookeeper://${zookeeper.address:127.0.0.1}:2181
+
diff --git 
a/99-integration/dubbo-samples-test-13787/src/test/java/org/apache/dubbo/samples/test/ConsumerIT.java
 
b/99-integration/dubbo-samples-test-13787/src/test/java/org/apache/dubbo/samples/test/ConsumerIT.java
new file mode 100644
index 00000000..5c031ea1
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-13787/src/test/java/org/apache/dubbo/samples/test/ConsumerIT.java
@@ -0,0 +1,41 @@
+/*
+ *
+ *   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.test;
+
+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.junit.Assert;
+import org.junit.Test;
+
+public class ConsumerIT {
+
+    @Test
+    public void test() {
+        ReferenceConfig<HelloService> reference = new ReferenceConfig<>();
+        reference.setInterface(HelloService.class);
+
+        DubboBootstrap.getInstance().registry(new 
RegistryConfig("zookeeper://" + System.getProperty("zookeeper.address", 
"127.0.0.1") + ":2181"))
+                .application(new 
ApplicationConfig("consumer")).reference(reference).start();
+
+        HelloService helloService = reference.get();
+        Assert.assertEquals(helloService.hello(), "hello");
+    }
+}
diff --git a/99-integration/pom.xml b/99-integration/pom.xml
index 643658d1..55e2f240 100644
--- a/99-integration/pom.xml
+++ b/99-integration/pom.xml
@@ -92,5 +92,6 @@
         <module>dubbo-samples-transaction</module>
         <module>dubbo-samples-rest-withtoken</module>
         <module>dubbo-samples-serialize-check</module>
+        <module>dubbo-samples-test-13787</module>
     </modules>
 </project>

Reply via email to