You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by il...@apache.org on 2020/11/03 09:39:19 UTC
[dubbo-go-samples] branch makefile updated: make general/dubbo work
with integration test
This is an automated email from the ASF dual-hosted git repository.
iluo pushed a commit to branch makefile
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/makefile by this push:
new 186bc8d make general/dubbo work with integration test
186bc8d is described below
commit 186bc8d5b3a5ef4bf91aafbff3c6c400007724af
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Tue Nov 3 17:38:54 2020 +0800
make general/dubbo work with integration test
---
general/dubbo/go-client/app/version.go | 22 --
general/dubbo/go-client/assembly/bin/load.sh | 203 ------------------
.../dubbo/go-client/assembly/common/app.properties | 23 ---
general/dubbo/go-client/assembly/common/build.sh | 83 --------
general/dubbo/go-client/assembly/linux/dev.sh | 36 ----
general/dubbo/go-client/assembly/linux/release.sh | 35 ----
general/dubbo/go-client/assembly/linux/test.sh | 35 ----
general/dubbo/go-client/assembly/mac/dev.sh | 36 ----
general/dubbo/go-client/assembly/mac/release.sh | 34 ---
general/dubbo/go-client/assembly/mac/test.sh | 34 ---
general/dubbo/go-client/assembly/windows/dev.sh | 34 ---
.../dubbo/go-client/assembly/windows/release.sh | 34 ---
general/dubbo/go-client/assembly/windows/test.sh | 34 ---
general/dubbo/go-client/{app => cmd}/client.go | 96 ++++-----
general/dubbo/go-client/conf/client.yml | 66 ++++++
.../dubbo/go-client/{profiles/dev => conf}/log.yml | 55 +++--
general/dubbo/go-client/{app => pkg}/user.go | 17 +-
general/dubbo/go-client/profiles/dev/client.yml | 85 --------
.../dubbo/go-client/profiles/release/client.yml | 83 --------
general/dubbo/go-client/profiles/release/log.yml | 28 ---
general/dubbo/go-client/profiles/test/client.yml | 83 --------
general/dubbo/go-client/profiles/test/log.yml | 28 ---
general/dubbo/go-server/app/user_provider1.go | 109 ----------
general/dubbo/go-server/app/user_provider2.go | 118 -----------
general/dubbo/go-server/app/version.go | 22 --
general/dubbo/go-server/assembly/bin/load.sh | 151 --------------
.../dubbo/go-server/assembly/common/app.properties | 23 ---
general/dubbo/go-server/assembly/common/build.sh | 82 --------
general/dubbo/go-server/assembly/linux/dev.sh | 36 ----
general/dubbo/go-server/assembly/linux/release.sh | 36 ----
general/dubbo/go-server/assembly/linux/test.sh | 36 ----
general/dubbo/go-server/assembly/mac/dev.sh | 36 ----
general/dubbo/go-server/assembly/mac/release.sh | 36 ----
general/dubbo/go-server/assembly/mac/test.sh | 36 ----
general/dubbo/go-server/assembly/windows/dev.sh | 36 ----
.../dubbo/go-server/assembly/windows/release.sh | 36 ----
general/dubbo/go-server/assembly/windows/test.sh | 36 ----
general/dubbo/go-server/{app => cmd}/server.go | 22 +-
general/dubbo/go-server/conf/client.yml | 59 ++++++
.../dubbo/go-server/{profiles/dev => conf}/log.yml | 55 +++--
general/dubbo/go-server/conf/server.yml | 55 +++++
general/dubbo/go-server/docker/docker-compose.yml | 9 +
general/dubbo/go-server/{app => pkg}/user.go | 6 +-
.../dubbo/go-server/{app => pkg}/user_provider.go | 6 +-
general/dubbo/go-server/profiles/dev/server.yml | 94 ---------
general/dubbo/go-server/profiles/release/log.yml | 28 ---
.../dubbo/go-server/profiles/release/server.yml | 91 --------
general/dubbo/go-server/profiles/test/log.yml | 28 ---
general/dubbo/go-server/profiles/test/server.yml | 91 --------
.../tests/integration/main_test.go} | 77 +++----
.../tests/integration/userprovider_test.go | 114 ++++++++++
general/dubbo/java-client/build.sh | 21 --
general/dubbo/java-client/pom.xml | 230 ---------------------
.../java-client/src/main/assembly/assembly.xml | 39 ----
.../src/main/assembly/conf/dubbo.properties | 13 --
.../src/main/assembly/conf/log4j.properties | 19 --
.../src/main/java/com/ikurento/user/Consumer.java | 227 --------------------
.../src/main/java/com/ikurento/user/Gender.java | 23 ---
.../src/main/java/com/ikurento/user/User.java | 83 --------
.../main/java/com/ikurento/user/UserProvider.java | 27 ---
.../resources/META-INF/spring/dubbo.consumer.xml | 42 ----
.../src/main/resources/META-INF/spring/service.xml | 38 ----
.../src/main/resources/log4j.properties | 19 --
general/dubbo/java-server/build.sh | 20 --
general/dubbo/java-server/pom.xml | 196 ------------------
general/dubbo/java-server/script/debug.sh | 22 --
.../java-server/src/main/assembly/assembly.xml | 45 ----
.../src/main/assembly/conf/dubbo.properties | 14 --
.../src/main/assembly/conf/log4j.properties | 20 --
.../src/main/java/com/ikurento/user/Gender.java | 23 ---
.../src/main/java/com/ikurento/user/Provider.java | 34 ---
.../src/main/java/com/ikurento/user/Response.java | 92 ---------
.../src/main/java/com/ikurento/user/User.java | 95 ---------
.../main/java/com/ikurento/user/UserProvider.java | 50 -----
.../com/ikurento/user/UserProviderAnotherImpl.java | 143 -------------
.../java/com/ikurento/user/UserProviderImpl.java | 119 -----------
.../resources/META-INF/spring/dubbo.provider.xml | 39 ----
.../src/main/resources/log4j.properties | 20 --
78 files changed, 443 insertions(+), 4018 deletions(-)
diff --git a/general/dubbo/go-client/app/version.go b/general/dubbo/go-client/app/version.go
deleted file mode 100644
index ae51f45..0000000
--- a/general/dubbo/go-client/app/version.go
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 main
-
-var (
- Version = "2.7.5"
-)
diff --git a/general/dubbo/go-client/assembly/bin/load.sh b/general/dubbo/go-client/assembly/bin/load.sh
deleted file mode 100644
index ffa240b..0000000
--- a/general/dubbo/go-client/assembly/bin/load.sh
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-APP_NAME="APPLICATION_NAME"
-APP_ARGS=""
-SLEEP_INTERVAL=5
-MAX_LIFETIME=4000
-
-PROJECT_HOME=""
-OS_NAME=`uname`
-if [[ ${OS_NAME} != "Windows" ]]; then
- PROJECT_HOME=`pwd`
- PROJECT_HOME=${PROJECT_HOME}"/"
-else
- APP_NAME="APPLICATION_NAME.exe"
-fi
-
-export CONF_CONSUMER_FILE_PATH=${PROJECT_HOME}"TARGET_CONF_FILE"
-export APP_LOG_CONF_FILE=${PROJECT_HOME}"TARGET_LOG_CONF_FILE"
-# export GOTRACEBACK=system
-# export GODEBUG=gctrace=1
-
-usage() {
- echo "Usage: $0 start [conf suffix]"
- echo " $0 stop"
- echo " $0 term"
- echo " $0 restart"
- echo " $0 list"
- echo " $0 monitor"
- echo " $0 crontab"
- exit
-}
-
-start() {
- arg=$1
- if [ "$arg" = "" ];then
- echo "No registry type! Default client.yml!"
- else
- export CONF_CONSUMER_FILE_PATH=${CONF_CONSUMER_FILE_PATH//\.yml/\_$arg\.yml}
- fi
- if [ ! -f "${CONF_CONSUMER_FILE_PATH}" ];then
- echo $CONF_CONSUMER_FILE_PATH" is not existing!"
- return
- fi
- APP_LOG_PATH=${PROJECT_HOME}"logs/"
- mkdir -p ${APP_LOG_PATH}
- APP_BIN=${PROJECT_HOME}sbin/${APP_NAME}
- chmod u+x ${APP_BIN}
- # CMD="nohup ${APP_BIN} ${APP_ARGS} >>${APP_NAME}.nohup.out 2>&1 &"
- CMD="${APP_BIN}"
- eval ${CMD}
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- CUR=`date +%FT%T`
- if [ "${PID}" != "" ]; then
- for p in ${PID}
- do
- echo "start ${APP_NAME} ( pid =" ${p} ") at " ${CUR}
- done
- fi
-}
-
-stop() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -SIGINT ${APP_NAME} ( pid =" ${ps} ")"
- kill -2 ${ps}
- done
- fi
-}
-
-
-term() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -9 ${APP_NAME} ( pid =" ${ps} ")"
- kill -9 ${ps}
- done
- fi
-}
-
-list() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s\n", $1, $2, $9, $10)}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s,%s\n", $1, $4, $6, $7, $8)}'`
- fi
-
- if [ "${PID}" != "" ]; then
- echo "list ${APP_NAME}"
-
- if [[ ${OS_NAME} == "Linux" || ${OS_NAME} == "Darwin" ]]; then
- echo "index: user, pid, start, duration"
- else
- echo "index: PID, WINPID, UID, STIME, COMMAND"
- fi
- idx=0
- for ps in ${PID}
- do
- echo "${idx}: ${ps}"
- ((idx ++))
- done
- fi
-}
-
-monitor() {
- idx=0
- while true; do
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [[ "${PID}" == "" ]]; then
- start
- idx=0
- fi
-
- ((LIFE=idx*${SLEEP_INTERVAL}))
- echo "${APP_NAME} ( pid = " ${PID} ") has been working in normal state for " $LIFE " seconds."
- ((idx ++))
- sleep ${SLEEP_INTERVAL}
- done
-}
-
-crontab() {
- idx=0
- while true; do
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [[ "${PID}" == "" ]]; then
- start
- idx=0
- fi
-
- ((LIFE=idx*${SLEEP_INTERVAL}))
- echo "${APP_NAME} ( pid = " ${PID} ") has been working in normal state for " $LIFE " seconds."
- ((idx ++))
- sleep ${SLEEP_INTERVAL}
- if [[ ${LIFE} -gt ${MAX_LIFETIME} ]]; then
- kill -9 ${PID}
- fi
- done
-}
-
-opt=$1
-case C"$opt" in
- Cstart)
- start $2
- ;;
- Cstop)
- stop
- ;;
- Cterm)
- term
- ;;
- Crestart)
- term
- start $2
- ;;
- Clist)
- list
- ;;
- Cmonitor)
- monitor
- ;;
- Ccrontab)
- crontab
- ;;
- C*)
- usage
- ;;
-esac
-
diff --git a/general/dubbo/go-client/assembly/common/app.properties b/general/dubbo/go-client/assembly/common/app.properties
deleted file mode 100644
index e10868f..0000000
--- a/general/dubbo/go-client/assembly/common/app.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# 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.
-
-
-export TARGET_EXEC_NAME="user_info_client"
-# BUILD_PACKAGE="dubbogo-examples/user-info/client/app"
-export BUILD_PACKAGE="app"
-
-export TARGET_CONF_FILE="conf/client.yml"
-export TARGET_LOG_CONF_FILE="conf/log.yml"
diff --git a/general/dubbo/go-client/assembly/common/build.sh b/general/dubbo/go-client/assembly/common/build.sh
deleted file mode 100644
index d38f889..0000000
--- a/general/dubbo/go-client/assembly/common/build.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-rm -rf target/
-
-PROJECT_HOME=`pwd`
-TARGET_FOLDER=${PROJECT_HOME}/target/${GOOS}
-
-TARGET_SBIN_NAME=${TARGET_EXEC_NAME}
-version=`cat app/version.go | grep Version | grep -v "Apache" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}'`
-if [[ ${GOOS} == "windows" ]]; then
- TARGET_SBIN_NAME=${TARGET_SBIN_NAME}.exe
-fi
-TARGET_NAME=${TARGET_FOLDER}/${TARGET_SBIN_NAME}
-if [[ $PROFILE == "dev" || $PROFILE == "test" ]]; then
- # GFLAGS=-gcflags "-N -l" -race -x -v # -x会把go build的详细过程输出
- # GFLAGS=-gcflags "-N -l" -race -v
- # GFLAGS="-gcflags \"-N -l\" -v"
- cd ${BUILD_PACKAGE} && GOOS=$GOOS GOARCH=$GOARCH GO111MODULE=on go build -gcflags "-N -l" -x -v -i -o ${TARGET_NAME} && cd -
-else
- # -s去掉符号表(然后panic时候的stack trace就没有任何文件名/行号信息了,这个等价于普通C/C++程序被strip的效果),
- # -w去掉DWARF调试信息,得到的程序就不能用gdb调试了。-s和-w也可以分开使用,一般来说如果不打算用gdb调试,
- # -w基本没啥损失。-s的损失就有点大了。
- cd ${BUILD_PACKAGE} && GOOS=$GOOS GOARCH=$GOARCH GO111MODULE=on go build -ldflags "-w" -x -v -i -o ${TARGET_NAME} && cd -
-fi
-
-TAR_NAME=${TARGET_EXEC_NAME}-${version}-`date "+%Y%m%d-%H%M"`-${PROFILE}
-
-mkdir -p ${TARGET_FOLDER}/${TAR_NAME}
-
-SBIN_DIR=${TARGET_FOLDER}/${TAR_NAME}/sbin
-BIN_DIR=${TARGET_FOLDER}/${TAR_NAME}
-CONF_DIR=${TARGET_FOLDER}/${TAR_NAME}/conf
-
-mkdir -p ${SBIN_DIR}
-mkdir -p ${CONF_DIR}
-
-mv ${TARGET_NAME} ${SBIN_DIR}
-cp -r assembly/bin ${BIN_DIR}
-cd ${BIN_DIR}/bin/ && mv load.sh load_${TARGET_EXEC_NAME}.sh && cd -
-
-platform=$(uname)
-# modify APPLICATION_NAME
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-fi
-
-# modify TARGET_CONF_FILE
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-# modify TARGET_LOG_CONF_FILE
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-cp -r profiles/${PROFILE}/* ${CONF_DIR}
-
-cd ${TARGET_FOLDER}
-
-tar czf ${TAR_NAME}.tar.gz ${TAR_NAME}/*
-
diff --git a/general/dubbo/go-client/assembly/linux/dev.sh b/general/dubbo/go-client/assembly/linux/dev.sh
deleted file mode 100644
index eada737..0000000
--- a/general/dubbo/go-client/assembly/linux/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="dev"
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/linux/release.sh b/general/dubbo/go-client/assembly/linux/release.sh
deleted file mode 100644
index 10eb3d7..0000000
--- a/general/dubbo/go-client/assembly/linux/release.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/linux/test.sh b/general/dubbo/go-client/assembly/linux/test.sh
deleted file mode 100644
index 78b650c..0000000
--- a/general/dubbo/go-client/assembly/linux/test.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/mac/dev.sh b/general/dubbo/go-client/assembly/mac/dev.sh
deleted file mode 100644
index c828476..0000000
--- a/general/dubbo/go-client/assembly/mac/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="dev"
-
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/mac/release.sh b/general/dubbo/go-client/assembly/mac/release.sh
deleted file mode 100644
index 91c2dfe..0000000
--- a/general/dubbo/go-client/assembly/mac/release.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/mac/test.sh b/general/dubbo/go-client/assembly/mac/test.sh
deleted file mode 100644
index a7853f5..0000000
--- a/general/dubbo/go-client/assembly/mac/test.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/windows/dev.sh b/general/dubbo/go-client/assembly/windows/dev.sh
deleted file mode 100644
index 10a3866..0000000
--- a/general/dubbo/go-client/assembly/windows/dev.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="dev"
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/windows/release.sh b/general/dubbo/go-client/assembly/windows/release.sh
deleted file mode 100644
index 21af573..0000000
--- a/general/dubbo/go-client/assembly/windows/release.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/assembly/windows/test.sh b/general/dubbo/go-client/assembly/windows/test.sh
deleted file mode 100644
index 2104da8..0000000
--- a/general/dubbo/go-client/assembly/windows/test.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-client/app/client.go b/general/dubbo/go-client/cmd/client.go
similarity index 85%
rename from general/dubbo/go-client/app/client.go
rename to general/dubbo/go-client/cmd/client.go
index 838887d..9c632fe 100644
--- a/general/dubbo/go-client/app/client.go
+++ b/general/dubbo/go-client/cmd/client.go
@@ -19,80 +19,58 @@ package main
import (
"context"
- "fmt"
- "os"
- "os/signal"
- "syscall"
+ "github.com/apache/dubbo-go/config"
"time"
)
import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-samples/golang/general/dubbo/go-client/pkg"
"github.com/dubbogo/gost/log"
)
import (
- hessian "github.com/apache/dubbo-go-hessian2"
- "github.com/apache/dubbo-go/common/logger"
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
- "github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/filter/filter_impl"
_ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/registry/protocol"
-
- _ "github.com/apache/dubbo-go/cluster/cluster_impl"
- _ "github.com/apache/dubbo-go/cluster/loadbalance"
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
var (
survivalTimeout int = 10e9
+ userProvider = new(pkg.UserProvider)
+ userProvider1 = new(pkg.UserProvider1)
+ userProvider2 = new(pkg.UserProvider2)
)
-// they are necessary:
-// export CONF_CONSUMER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
+// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run
func main() {
+ hessian.RegisterJavaEnum(pkg.Gender(pkg.MAN))
+ hessian.RegisterJavaEnum(pkg.Gender(pkg.WOMAN))
+ hessian.RegisterPOJO(&pkg.User{})
- hessian.RegisterJavaEnum(Gender(MAN))
- hessian.RegisterJavaEnum(Gender(WOMAN))
- hessian.RegisterPOJO(&User{})
+ config.SetConsumerService(userProvider)
+ // FIXME: cannot make multi-references work
+ //config.SetConsumerService(userProvider1)
+ //config.SetConsumerService(userProvider2)
config.Load()
+ time.Sleep(6 * time.Second)
+
gxlog.CInfo("\n\ntest")
test()
- gxlog.CInfo("\n\ntest1")
- test1()
- gxlog.CInfo("\n\ntest2")
- test2()
- initSignal()
-}
-
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP,
- syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- time.AfterFunc(time.Duration(survivalTimeout), func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
-
- // The program exits normally or timeout forcibly exits.
- fmt.Println("app exit now...")
- return
- }
- }
+ //gxlog.CInfo("\n\ntest1")
+ //test1()
+ //gxlog.CInfo("\n\ntest2")
+ //test2()
}
func test() {
+
gxlog.CInfo("\n\n\necho")
res, err := userProvider.Echo(context.TODO(), "OK")
if err != nil {
@@ -100,10 +78,8 @@ func test() {
}
gxlog.CInfo("res: %v\n", res)
- time.Sleep(3e9)
-
gxlog.CInfo("\n\n\nstart to test dubbo")
- user := &User{}
+ user := &pkg.User{}
err = userProvider.GetUser(context.TODO(), []interface{}{"A003"}, user)
if err != nil {
panic(err)
@@ -133,7 +109,7 @@ func test() {
gxlog.CInfo("response result: %v", ret1)
gxlog.CInfo("\n\n\nstart to test dubbo - getUser")
- user = &User{}
+ user = &pkg.User{}
var i int32 = 1
err = userProvider.GetUser2(context.TODO(), []interface{}{i}, user)
if err != nil {
@@ -142,7 +118,7 @@ func test() {
gxlog.CInfo("response result: %v", user)
gxlog.CInfo("\n\n\nstart to test dubbo - getUser - overload")
- user = &User{}
+ user = &pkg.User{}
err = userProvider.GetUser2(context.TODO(), []interface{}{i, "overload"}, user)
if err != nil {
panic(err)
@@ -157,7 +133,7 @@ func test() {
gxlog.CInfo("succ!")
gxlog.CInfo("\n\n\nstart to test dubbo - getErr")
- user = &User{}
+ user = &pkg.User{}
err = userProvider.GetErr(context.TODO(), []interface{}{"A003"}, user)
if err == nil {
panic("err is nil")
@@ -180,10 +156,8 @@ func test1() {
}
gxlog.CInfo("res: %v\n", res)
- time.Sleep(3e9)
-
gxlog.CInfo("\n\n\nstart to test dubbo")
- user := &User{}
+ user := &pkg.User{}
err = userProvider1.GetUser(context.TODO(), []interface{}{"A003"}, user)
if err != nil {
panic(err)
@@ -205,7 +179,7 @@ func test1() {
gxlog.CInfo("response result: %v", ret1)
gxlog.CInfo("\n\n\nstart to test dubbo - getUser")
- user = &User{}
+ user = &pkg.User{}
var i int32 = 1
err = userProvider1.GetUser2(context.TODO(), []interface{}{i}, user)
if err != nil {
@@ -214,7 +188,7 @@ func test1() {
gxlog.CInfo("response result: %v", user)
gxlog.CInfo("\n\n\nstart to test dubbo - getUser - overload")
- user = &User{}
+ user = &pkg.User{}
err = userProvider1.GetUser2(context.TODO(), []interface{}{i, "overload"}, user)
if err != nil {
panic(err)
@@ -229,7 +203,7 @@ func test1() {
gxlog.CInfo("succ!")
gxlog.CInfo("\n\n\nstart to test dubbo - getErr")
- user = &User{}
+ user = &pkg.User{}
err = userProvider1.GetErr(context.TODO(), []interface{}{"A003"}, user)
if err == nil {
panic("err is nil")
@@ -255,7 +229,7 @@ func test2() {
time.Sleep(3e9)
gxlog.CInfo("\n\n\nstart to test dubbo")
- user := &User{}
+ user := &pkg.User{}
err = userProvider2.GetUser(context.TODO(), []interface{}{"A003"}, user)
if err != nil {
panic(err)
@@ -277,7 +251,7 @@ func test2() {
gxlog.CInfo("response result: %v", ret1)
gxlog.CInfo("\n\n\nstart to test dubbo - getUser")
- user = &User{}
+ user = &pkg.User{}
var i int32 = 1
err = userProvider2.GetUser2(context.TODO(), []interface{}{i}, user)
if err != nil {
@@ -286,7 +260,7 @@ func test2() {
gxlog.CInfo("response result: %v", user)
gxlog.CInfo("\n\n\nstart to test dubbo - getUser - overload")
- user = &User{}
+ user = &pkg.User{}
err = userProvider2.GetUser2(context.TODO(), []interface{}{i, "overload"}, user)
if err != nil {
panic(err)
@@ -301,7 +275,7 @@ func test2() {
gxlog.CInfo("succ!")
gxlog.CInfo("\n\n\nstart to test dubbo - getErr")
- user = &User{}
+ user = &pkg.User{}
err = userProvider2.GetErr(context.TODO(), []interface{}{"A003"}, user)
if err == nil {
panic("err is nil")
diff --git a/general/dubbo/go-client/conf/client.yml b/general/dubbo/go-client/conf/client.yml
new file mode 100644
index 0000000..61e7b64
--- /dev/null
+++ b/general/dubbo/go-client/conf/client.yml
@@ -0,0 +1,66 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout: "3s"
+# connect timeout
+connect_timeout: "3s"
+
+# application config
+application:
+ organization: "dubbo.io"
+ name: "UserInfoConsumer"
+ module: "dubbo-go user-info client"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+# reference config
+references:
+ "UserProvider":
+ registry: "demoZk"
+ protocol: "dubbo"
+ interface: "org.apache.dubbo.UserProvider"
+ cluster: "failover"
+# "UserProvider1":
+# registry: "demoZk"
+# protocol: "dubbo"
+# interface: "org.apache.dubbo.UserProvider"
+# cluster: "failover"
+# "UserProvider2":
+# registry: "demoZk"
+# protocol: "dubbo"
+# interface: "org.apache.dubbo.UserProvider"
+# cluster: "failover"
+
+# protocol config
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ pool_size: 64
+ pool_ttl: 600
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "120s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ pkg_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/general/dubbo/go-client/profiles/dev/log.yml b/general/dubbo/go-client/conf/log.yml
similarity index 88%
rename from general/dubbo/go-client/profiles/dev/log.yml
rename to general/dubbo/go-client/conf/log.yml
index 59fa427..2b6e93a 100644
--- a/general/dubbo/go-client/profiles/dev/log.yml
+++ b/general/dubbo/go-client/conf/log.yml
@@ -1,28 +1,27 @@
-
-level: "debug"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
+level: "debug"
+development: true
+disableCaller: false
+disableStacktrace: false
+sampling:
+encoding: "console"
+
+# encoder
+encoderConfig:
+ messageKey: "message"
+ levelKey: "level"
+ timeKey: "time"
+ nameKey: "logger"
+ callerKey: "caller"
+ stacktraceKey: "stacktrace"
+ lineEnding: ""
+ levelEncoder: "capital"
+ timeEncoder: "iso8601"
+ durationEncoder: "seconds"
+ callerEncoder: "short"
+ nameEncoder: ""
+
+outputPaths:
+ - "stderr"
+errorOutputPaths:
+ - "stderr"
+initialFields:
diff --git a/general/dubbo/go-client/app/user.go b/general/dubbo/go-client/pkg/user.go
similarity index 91%
copy from general/dubbo/go-client/app/user.go
copy to general/dubbo/go-client/pkg/user.go
index 8e241fc..a3908b4 100644
--- a/general/dubbo/go-client/app/user.go
+++ b/general/dubbo/go-client/pkg/user.go
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package main
+package pkg
import (
"context"
@@ -26,22 +26,11 @@ import (
import (
hessian "github.com/apache/dubbo-go-hessian2"
- "github.com/apache/dubbo-go/config"
)
type Gender hessian.JavaEnum
-var (
- userProvider = new(UserProvider)
- userProvider1 = new(UserProvider1)
- userProvider2 = new(UserProvider2)
-)
-func init() {
- config.SetConsumerService(userProvider)
- config.SetConsumerService(userProvider1)
- config.SetConsumerService(userProvider2)
-}
const (
MAN hessian.JavaEnum = iota
@@ -59,7 +48,7 @@ var genderValue = map[string]hessian.JavaEnum{
}
func (g Gender) JavaClassName() string {
- return "com.ikurento.user.Gender"
+ return "org.apache.dubbo.Gender"
}
func (g Gender) String() string {
@@ -97,7 +86,7 @@ func (u User) String() string {
}
func (User) JavaClassName() string {
- return "com.ikurento.user.User"
+ return "org.apache.dubbo.User"
}
type UserProvider struct {
diff --git a/general/dubbo/go-client/profiles/dev/client.yml b/general/dubbo/go-client/profiles/dev/client.yml
deleted file mode 100644
index f571913..0000000
--- a/general/dubbo/go-client/profiles/dev/client.yml
+++ /dev/null
@@ -1,85 +0,0 @@
-# dubbo client yaml configure file
-
-
-check: true
-# client
-request_timeout : "3s"
-# connect timeout
-connect_timeout : "3s"
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info client"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-references:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "dubbo"
- interface : "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods :
- - name: "GetUser"
- retries: 3
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-
-protocol_conf:
- dubbo:
- reconnect_interval: 0
- connection_number: 1
- heartbeat_period: "5s"
- session_timeout: "180s"
- pool_size: 64
- pool_ttl: 600
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "client"
-
-filter: "tracing"
diff --git a/general/dubbo/go-client/profiles/release/client.yml b/general/dubbo/go-client/profiles/release/client.yml
deleted file mode 100644
index cb2ce35..0000000
--- a/general/dubbo/go-client/profiles/release/client.yml
+++ /dev/null
@@ -1,83 +0,0 @@
-# dubbo client yaml configure file
-
-
-check: true
-# client
-request_timeout : "3s"
-# connect timeout
-connect_timeout : "3s"
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info client"
- version : "0.0.1"
- owner : "ZX"
- environment : "release"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-references:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "dubbo"
- interface : "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods :
- - name: "GetUser"
- retries: 3
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-
-protocol_conf:
- dubbo:
- reconnect_interval: 0
- connection_number: 1
- heartbeat_period: "5s"
- session_timeout: "180s"
- pool_size: 64
- pool_ttl: 600
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "client"
diff --git a/general/dubbo/go-client/profiles/release/log.yml b/general/dubbo/go-client/profiles/release/log.yml
deleted file mode 100644
index e0514be..0000000
--- a/general/dubbo/go-client/profiles/release/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "warn"
-development: true
-disableCaller: true
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/dubbo/go-client/profiles/test/client.yml b/general/dubbo/go-client/profiles/test/client.yml
deleted file mode 100644
index 8d9f0d5..0000000
--- a/general/dubbo/go-client/profiles/test/client.yml
+++ /dev/null
@@ -1,83 +0,0 @@
-# dubbo client yaml configure file
-
-
-check: true
-# client
-request_timeout : "3s"
-# connect timeout
-connect_timeout : "3s"
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info client"
- version : "0.0.1"
- owner : "ZX"
- environment : "test"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-references:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "dubbo"
- interface : "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods :
- - name: "GetUser"
- retries: 3
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-
-protocol_conf:
- dubbo:
- reconnect_interval: 0
- connection_number: 1
- heartbeat_period: "5s"
- session_timeout: "180s"
- pool_size: 64
- pool_ttl: 600
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "client"
diff --git a/general/dubbo/go-client/profiles/test/log.yml b/general/dubbo/go-client/profiles/test/log.yml
deleted file mode 100644
index baee0b7..0000000
--- a/general/dubbo/go-client/profiles/test/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "info"
-development: false
-disableCaller: false
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/dubbo/go-server/app/user_provider1.go b/general/dubbo/go-server/app/user_provider1.go
deleted file mode 100644
index 7dfc141..0000000
--- a/general/dubbo/go-server/app/user_provider1.go
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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 main
-
-import (
- "context"
- "fmt"
- "strconv"
-)
-
-import (
- "github.com/dubbogo/gost/log"
-)
-
-import (
- "github.com/apache/dubbo-go-hessian2/java_exception"
- "github.com/apache/dubbo-go/config"
- perrors "github.com/pkg/errors"
-)
-
-func init() {
- config.SetProviderService(new(UserProvider1))
-}
-
-type UserProvider1 struct {
-}
-
-func (u *UserProvider1) getUser(userId string) (*User, error) {
- if user, ok := userMap[userId]; ok {
- return &user, nil
- }
-
- return nil, fmt.Errorf("invalid user id:%s", userId)
-}
-
-func (u *UserProvider1) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
- var (
- err error
- user *User
- )
-
- gxlog.CInfo("req:%#v", req)
- user, err = u.getUser(req[0].(string))
- if err == nil {
- *rsp = *user
- gxlog.CInfo("rsp:%#v", rsp)
- }
- return err
-}
-
-func (u *UserProvider1) GetUser0(id string, name string) (User, error) {
- var err error
-
- gxlog.CInfo("id:%s, name:%s", id, name)
- user, err := u.getUser(id)
- if err != nil {
- return User{}, err
- }
- if user.Name != name {
- return User{}, perrors.New("name is not " + user.Name)
- }
- return *user, err
-}
-
-func (u *UserProvider1) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
- var err error
-
- gxlog.CInfo("req:%#v", req)
- rsp.Id = strconv.Itoa(int(req[0].(int32)))
- return err
-}
-
-func (u *UserProvider1) GetUser3() error {
- return nil
-}
-
-func (u *UserProvider1) GetErr(ctx context.Context, req []interface{}, rsp *User) error {
- return java_exception.NewThrowable("exception")
-}
-
-func (u *UserProvider1) GetUsers(req []interface{}) ([]interface{}, error) {
-
- return []interface{}{}, nil
-}
-
-func (s *UserProvider1) MethodMapper() map[string]string {
- return map[string]string{
- "GetUser2": "getUser",
- }
-}
-
-func (u *UserProvider1) Reference() string {
- return "UserProvider1"
-}
diff --git a/general/dubbo/go-server/app/user_provider2.go b/general/dubbo/go-server/app/user_provider2.go
deleted file mode 100644
index 4472242..0000000
--- a/general/dubbo/go-server/app/user_provider2.go
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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 main
-
-import (
- "context"
- "fmt"
- "strconv"
-)
-
-import (
- "github.com/dubbogo/gost/log"
-)
-
-import (
- "github.com/apache/dubbo-go-hessian2/java_exception"
- "github.com/apache/dubbo-go/config"
- perrors "github.com/pkg/errors"
-)
-
-func init() {
- config.SetProviderService(new(UserProvider2))
-}
-
-type UserProvider2 struct {
-}
-
-func (u *UserProvider2) getUser(userId string) (*User, error) {
- if user, ok := userMap[userId]; ok {
- return &user, nil
- }
-
- return nil, fmt.Errorf("invalid user id:%s", userId)
-}
-
-func (u *UserProvider2) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
- var (
- err error
- user *User
- )
-
- gxlog.CInfo("req:%#v", req)
- user, err = u.getUser(req[0].(string))
- if err == nil {
- *rsp = *user
- gxlog.CInfo("rsp:%#v", rsp)
- }
- return err
-}
-
-func (u *UserProvider2) GetUser0(id string, name string) (User, error) {
- var err error
-
- gxlog.CInfo("id:%s, name:%s", id, name)
- user, err := u.getUser(id)
- if err != nil {
- return User{}, err
- }
- if user.Name != name {
- return User{}, perrors.New("name is not " + user.Name)
- }
- return *user, err
-}
-
-func (u *UserProvider2) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
- var err error
-
- gxlog.CInfo("req:%#v", req)
- rsp.Id = strconv.Itoa(int(req[0].(int32)))
- return err
-}
-
-func (u *UserProvider2) GetUser3() error {
- return nil
-}
-
-func (u *UserProvider2) GetErr(ctx context.Context, req []interface{}, rsp *User) error {
- return java_exception.NewThrowable("exception")
-}
-
-func (u *UserProvider2) GetUsers(req []interface{}) ([]interface{}, error) {
- var err error
-
- gxlog.CInfo("req:%s", req)
- t := req[0].([]interface{})
- user, err := u.getUser(t[0].(string))
- if err != nil {
- return nil, err
- }
- gxlog.CInfo("user:%v", user)
-
- return []interface{}{user}, err
-}
-
-func (s *UserProvider2) MethodMapper() map[string]string {
- return map[string]string{
- "GetUser2": "getUser",
- }
-}
-
-func (u *UserProvider2) Reference() string {
- return "UserProvider2"
-}
diff --git a/general/dubbo/go-server/app/version.go b/general/dubbo/go-server/app/version.go
deleted file mode 100644
index ae51f45..0000000
--- a/general/dubbo/go-server/app/version.go
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 main
-
-var (
- Version = "2.7.5"
-)
diff --git a/general/dubbo/go-server/assembly/bin/load.sh b/general/dubbo/go-server/assembly/bin/load.sh
deleted file mode 100644
index 90077c2..0000000
--- a/general/dubbo/go-server/assembly/bin/load.sh
+++ /dev/null
@@ -1,151 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-APP_NAME="APPLICATION_NAME"
-APP_ARGS=""
-
-
-PROJECT_HOME=""
-OS_NAME=`uname`
-if [[ ${OS_NAME} != "Windows" ]]; then
- PROJECT_HOME=`pwd`
- PROJECT_HOME=${PROJECT_HOME}"/"
-fi
-
-export CONF_PROVIDER_FILE_PATH=${PROJECT_HOME}"TARGET_CONF_FILE"
-export APP_LOG_CONF_FILE=${PROJECT_HOME}"TARGET_LOG_CONF_FILE"
-
-usage() {
- echo "Usage: $0 start [conf suffix]"
- echo " $0 stop"
- echo " $0 term"
- echo " $0 restart"
- echo " $0 list"
- echo " $0 monitor"
- echo " $0 crontab"
- exit
-}
-
-start() {
- arg=$1
- if [ "$arg" = "" ];then
- echo "No registry type! Default server.yml!"
- else
- export CONF_PROVIDER_FILE_PATH=${CONF_PROVIDER_FILE_PATH//\.yml/\_$arg\.yml}
- fi
- if [ ! -f "${CONF_PROVIDER_FILE_PATH}" ];then
- echo $CONF_PROVIDER_FILE_PATH" is not existing!"
- return
- fi
- APP_LOG_PATH="${PROJECT_HOME}logs/"
- mkdir -p ${APP_LOG_PATH}
- APP_BIN=${PROJECT_HOME}sbin/${APP_NAME}
- chmod u+x ${APP_BIN}
- # CMD="nohup ${APP_BIN} ${APP_ARGS} >>${APP_NAME}.nohup.out 2>&1 &"
- CMD="${APP_BIN}"
- eval ${CMD}
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- CUR=`date +%FT%T`
- if [ "${PID}" != "" ]; then
- for p in ${PID}
- do
- echo "start ${APP_NAME} ( pid =" ${p} ") at " ${CUR}
- done
- fi
-}
-
-stop() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -SIGINT ${APP_NAME} ( pid =" ${ps} ")"
- kill -2 ${ps}
- done
- fi
-}
-
-
-term() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -9 ${APP_NAME} ( pid =" ${ps} ")"
- kill -9 ${ps}
- done
- fi
-}
-
-list() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s\n", $1, $2, $9, $10)}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s,%s\n", $1, $4, $6, $7, $8)}'`
- fi
-
- if [ "${PID}" != "" ]; then
- echo "list ${APP_NAME}"
-
- if [[ ${OS_NAME} == "Linux" || ${OS_NAME} == "Darwin" ]]; then
- echo "index: user, pid, start, duration"
- else
- echo "index: PID, WINPID, UID, STIME, COMMAND"
- fi
- idx=0
- for ps in ${PID}
- do
- echo "${idx}: ${ps}"
- ((idx ++))
- done
- fi
-}
-
-opt=$1
-case C"$opt" in
- Cstart)
- start $2
- ;;
- Cstop)
- stop
- ;;
- Cterm)
- term
- ;;
- Crestart)
- term
- start $2
- ;;
- Clist)
- list
- ;;
- C*)
- usage
- ;;
-esac
-
diff --git a/general/dubbo/go-server/assembly/common/app.properties b/general/dubbo/go-server/assembly/common/app.properties
deleted file mode 100644
index 1f0827e..0000000
--- a/general/dubbo/go-server/assembly/common/app.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# 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.
-
-
-TARGET_EXEC_NAME="user_info_server"
-# BUILD_PACKAGE="dubbogo-examples/user-info/server/app"
-BUILD_PACKAGE="app"
-
-TARGET_CONF_FILE="conf/server.yml"
-TARGET_LOG_CONF_FILE="conf/log.yml"
diff --git a/general/dubbo/go-server/assembly/common/build.sh b/general/dubbo/go-server/assembly/common/build.sh
deleted file mode 100644
index aff46f9..0000000
--- a/general/dubbo/go-server/assembly/common/build.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-rm -rf target/
-
-PROJECT_HOME=`pwd`
-TARGET_FOLDER=${PROJECT_HOME}/target/${GOOS}
-
-TARGET_SBIN_NAME=${TARGET_EXEC_NAME}
-version=`cat app/version.go | grep Version | grep -v "Apache" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}'`
-if [[ ${GOOS} == "windows" ]]; then
- TARGET_SBIN_NAME=${TARGET_SBIN_NAME}.exe
-fi
-TARGET_NAME=${TARGET_FOLDER}/${TARGET_SBIN_NAME}
-if [[ $PROFILE = "test" ]]; then
- # GFLAGS=-gcflags "-N -l" -race -x -v # -x会把go build的详细过程输出
- # GFLAGS=-gcflags "-N -l" -race -v
- # GFLAGS="-gcflags \"-N -l\" -v"
- cd ${BUILD_PACKAGE} && GO111MODULE=on go build -gcflags "-N -l" -x -v -i -o ${TARGET_NAME} && cd -
- #cd ${BUILD_PACKAGE} && go build -gcflags "-N -l" -x -v -i -o ${TARGET_NAME} && cd -
-else
- # -s去掉符号表(然后panic时候的stack trace就没有任何文件名/行号信息了,这个等价于普通C/C++程序被strip的效果),
- # -w去掉DWARF调试信息,得到的程序就不能用gdb调试了。-s和-w也可以分开使用,一般来说如果不打算用gdb调试,
- # -w基本没啥损失。-s的损失就有点大了。
- cd ${BUILD_PACKAGE} && GO111MODULE=on go build -ldflags "-w" -x -v -i -o ${TARGET_NAME} && cd -
- #cd ${BUILD_PACKAGE} && go build -ldflags "-w" -x -v -i -o ${TARGET_NAME} && cd -
-fi
-
-TAR_NAME=${TARGET_EXEC_NAME}-${version}-`date "+%Y%m%d-%H%M"`-${PROFILE}
-
-mkdir -p ${TARGET_FOLDER}/${TAR_NAME}
-
-SBIN_DIR=${TARGET_FOLDER}/${TAR_NAME}/sbin
-BIN_DIR=${TARGET_FOLDER}/${TAR_NAME}
-CONF_DIR=${TARGET_FOLDER}/${TAR_NAME}/conf
-
-mkdir -p ${SBIN_DIR}
-mkdir -p ${CONF_DIR}
-
-mv ${TARGET_NAME} ${SBIN_DIR}
-cp -r assembly/bin ${BIN_DIR}
-# modify APPLICATION_NAME
-# OS=`uname`
-# if [[ $OS=="Darwin" ]]; then
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-fi
-# modify TARGET_CONF_FILE
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-# modify TARGET_LOG_CONF_FILE
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-cp -r profiles/${PROFILE}/* ${CONF_DIR}
-
-cd ${TARGET_FOLDER}
-
-tar czf ${TAR_NAME}.tar.gz ${TAR_NAME}/*
-
diff --git a/general/dubbo/go-server/assembly/linux/dev.sh b/general/dubbo/go-server/assembly/linux/dev.sh
deleted file mode 100644
index d830ac9..0000000
--- a/general/dubbo/go-server/assembly/linux/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/assembly/linux/release.sh b/general/dubbo/go-server/assembly/linux/release.sh
deleted file mode 100644
index 9930380..0000000
--- a/general/dubbo/go-server/assembly/linux/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/assembly/linux/test.sh b/general/dubbo/go-server/assembly/linux/test.sh
deleted file mode 100644
index 87144bb..0000000
--- a/general/dubbo/go-server/assembly/linux/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/assembly/mac/dev.sh b/general/dubbo/go-server/assembly/mac/dev.sh
deleted file mode 100644
index 3a7659b..0000000
--- a/general/dubbo/go-server/assembly/mac/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/assembly/mac/release.sh b/general/dubbo/go-server/assembly/mac/release.sh
deleted file mode 100644
index 1c4bce4..0000000
--- a/general/dubbo/go-server/assembly/mac/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/assembly/mac/test.sh b/general/dubbo/go-server/assembly/mac/test.sh
deleted file mode 100644
index 69206e3..0000000
--- a/general/dubbo/go-server/assembly/mac/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
-
diff --git a/general/dubbo/go-server/assembly/windows/dev.sh b/general/dubbo/go-server/assembly/windows/dev.sh
deleted file mode 100644
index 011fb41..0000000
--- a/general/dubbo/go-server/assembly/windows/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/assembly/windows/release.sh b/general/dubbo/go-server/assembly/windows/release.sh
deleted file mode 100644
index 679a26a..0000000
--- a/general/dubbo/go-server/assembly/windows/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/assembly/windows/test.sh b/general/dubbo/go-server/assembly/windows/test.sh
deleted file mode 100644
index 4a36de0..0000000
--- a/general/dubbo/go-server/assembly/windows/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/dubbo/go-server/app/server.go b/general/dubbo/go-server/cmd/server.go
similarity index 87%
rename from general/dubbo/go-server/app/server.go
rename to general/dubbo/go-server/cmd/server.go
index c777151..8c12a69 100644
--- a/general/dubbo/go-server/app/server.go
+++ b/general/dubbo/go-server/cmd/server.go
@@ -27,16 +27,16 @@ import (
import (
hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-samples/golang/general/dubbo/go-server/pkg"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
"github.com/apache/dubbo-go/common/logger"
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
_ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/registry/protocol"
-
- _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
- _ "github.com/apache/dubbo-go/filter/filter_impl"
-
- _ "github.com/apache/dubbo-go/cluster/cluster_impl"
- _ "github.com/apache/dubbo-go/cluster/loadbalance"
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
@@ -44,15 +44,13 @@ var (
survivalTimeout = int(3e9)
)
-// they are necessary:
-// export CONF_PROVIDER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
+// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
func main() {
// ------for hessian2------
- hessian.RegisterJavaEnum(Gender(MAN))
- hessian.RegisterJavaEnum(Gender(WOMAN))
- hessian.RegisterPOJO(&User{})
+ hessian.RegisterJavaEnum(pkg.Gender(pkg.MAN))
+ hessian.RegisterJavaEnum(pkg.Gender(pkg.WOMAN))
+ hessian.RegisterPOJO(&pkg.User{})
// ------------
config.Load()
diff --git a/general/dubbo/go-server/conf/client.yml b/general/dubbo/go-server/conf/client.yml
new file mode 100644
index 0000000..11ae382
--- /dev/null
+++ b/general/dubbo/go-server/conf/client.yml
@@ -0,0 +1,59 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout: "3s"
+# connect timeout
+connect_timeout: "3s"
+
+# application config
+application:
+ organization: "dubbo.io"
+ name: "UserInfoTest"
+ module: "dubbo-go user-info client"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+# reference config
+references:
+ "UserProvider":
+ registry: "demoZk"
+ protocol: "dubbo"
+ interface: "org.apache.dubbo.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
+
+# protocol config
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ pool_size: 64
+ pool_ttl: 600
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "120s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ pkg_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/general/dubbo/go-server/profiles/dev/log.yml b/general/dubbo/go-server/conf/log.yml
similarity index 88%
rename from general/dubbo/go-server/profiles/dev/log.yml
rename to general/dubbo/go-server/conf/log.yml
index 59fa427..2b6e93a 100644
--- a/general/dubbo/go-server/profiles/dev/log.yml
+++ b/general/dubbo/go-server/conf/log.yml
@@ -1,28 +1,27 @@
-
-level: "debug"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
+level: "debug"
+development: true
+disableCaller: false
+disableStacktrace: false
+sampling:
+encoding: "console"
+
+# encoder
+encoderConfig:
+ messageKey: "message"
+ levelKey: "level"
+ timeKey: "time"
+ nameKey: "logger"
+ callerKey: "caller"
+ stacktraceKey: "stacktrace"
+ lineEnding: ""
+ levelEncoder: "capital"
+ timeEncoder: "iso8601"
+ durationEncoder: "seconds"
+ callerEncoder: "short"
+ nameEncoder: ""
+
+outputPaths:
+ - "stderr"
+errorOutputPaths:
+ - "stderr"
+initialFields:
diff --git a/general/dubbo/go-server/conf/server.yml b/general/dubbo/go-server/conf/server.yml
new file mode 100644
index 0000000..af90434
--- /dev/null
+++ b/general/dubbo/go-server/conf/server.yml
@@ -0,0 +1,55 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization: "dubbo.io"
+ name: "UserInfoServer"
+ module: "dubbo-go user-info server"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+
+# service config
+services:
+ "UserProvider":
+ registry: "demoZk"
+ protocol: "dubbo"
+ interface: "org.apache.dubbo.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+# protocol config
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "120s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ pkg_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "server"
diff --git a/general/dubbo/go-server/docker/docker-compose.yml b/general/dubbo/go-server/docker/docker-compose.yml
new file mode 100644
index 0000000..8724179
--- /dev/null
+++ b/general/dubbo/go-server/docker/docker-compose.yml
@@ -0,0 +1,9 @@
+version: '3'
+
+services:
+ zookeeper:
+ image: zookeeper
+ ports:
+ - 2181:2181
+ restart: on-failure
+
diff --git a/general/dubbo/go-server/app/user.go b/general/dubbo/go-server/pkg/user.go
similarity index 96%
rename from general/dubbo/go-server/app/user.go
rename to general/dubbo/go-server/pkg/user.go
index 21fbe9a..176eb0b 100644
--- a/general/dubbo/go-server/app/user.go
+++ b/general/dubbo/go-server/pkg/user.go
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package main
+package pkg
import (
"fmt"
@@ -45,7 +45,7 @@ var genderValue = map[string]hessian.JavaEnum{
}
func (g Gender) JavaClassName() string {
- return "com.ikurento.user.Gender"
+ return "org.apache.dubbo.Gender"
}
func (g Gender) String() string {
@@ -105,5 +105,5 @@ func (u User) String() string {
}
func (u User) JavaClassName() string {
- return "com.ikurento.user.User"
+ return "org.apache.dubbo.User"
}
diff --git a/general/dubbo/go-server/app/user_provider.go b/general/dubbo/go-server/pkg/user_provider.go
similarity index 99%
rename from general/dubbo/go-server/app/user_provider.go
rename to general/dubbo/go-server/pkg/user_provider.go
index 9e13932..2f8e4c6 100644
--- a/general/dubbo/go-server/app/user_provider.go
+++ b/general/dubbo/go-server/pkg/user_provider.go
@@ -15,23 +15,23 @@
* limitations under the License.
*/
-package main
+package pkg
import (
"context"
"fmt"
- hessian "github.com/apache/dubbo-go-hessian2"
"strconv"
)
import (
+ hessian "github.com/apache/dubbo-go-hessian2"
"github.com/dubbogo/gost/log"
+ perrors "github.com/pkg/errors"
)
import (
"github.com/apache/dubbo-go-hessian2/java_exception"
"github.com/apache/dubbo-go/config"
- perrors "github.com/pkg/errors"
)
func init() {
diff --git a/general/dubbo/go-server/profiles/dev/server.yml b/general/dubbo/go-server/profiles/dev/server.yml
deleted file mode 100644
index 4a542e2..0000000
--- a/general/dubbo/go-server/profiles/dev/server.yml
+++ /dev/null
@@ -1,94 +0,0 @@
-# dubbo server yaml configure file
-
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info server"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
- "hangzhouzk":
- # 对应java配置中address属性的zookeeper <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-
-services:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "dubbo"
- # 相当于dubbo.xml中的interface
- interface : "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
-
-protocols:
- "dubbo":
- name: "dubbo"
- # ip : "127.0.0.1"
- port: 20000
-
-
-protocol_conf:
- dubbo:
- session_number: 700
- session_timeout: "180s"
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "server"
-
-filter: "tracing"
\ No newline at end of file
diff --git a/general/dubbo/go-server/profiles/release/log.yml b/general/dubbo/go-server/profiles/release/log.yml
deleted file mode 100644
index e0514be..0000000
--- a/general/dubbo/go-server/profiles/release/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "warn"
-development: true
-disableCaller: true
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/dubbo/go-server/profiles/release/server.yml b/general/dubbo/go-server/profiles/release/server.yml
deleted file mode 100644
index 38b786e..0000000
--- a/general/dubbo/go-server/profiles/release/server.yml
+++ /dev/null
@@ -1,91 +0,0 @@
-# dubbo server yaml configure file
-
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info server"
- version : "0.0.1"
- owner : "ZX"
- environment : "release"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-
-services:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "dubbo"
- # 相当于dubbo.xml中的interface
- interface : "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
-
-protocols:
- "dubbo":
- name: "dubbo"
- # ip : "127.0.0.1"
- port: 20000
-
-
-protocol_conf:
- dubbo:
- session_number: 700
- session_timeout: "180s"
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "server"
diff --git a/general/dubbo/go-server/profiles/test/log.yml b/general/dubbo/go-server/profiles/test/log.yml
deleted file mode 100644
index baee0b7..0000000
--- a/general/dubbo/go-server/profiles/test/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "info"
-development: false
-disableCaller: false
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/dubbo/go-server/profiles/test/server.yml b/general/dubbo/go-server/profiles/test/server.yml
deleted file mode 100644
index 32f62e1..0000000
--- a/general/dubbo/go-server/profiles/test/server.yml
+++ /dev/null
@@ -1,91 +0,0 @@
-# dubbo server yaml configure file
-
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info server"
- version : "0.0.1"
- owner : "ZX"
- environment : "test"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-
-services:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "dubbo"
- # 相当于dubbo.xml中的interface
- interface : "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "dubbo"
- version: "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
-
-protocols:
- "dubbo":
- name: "dubbo"
- # ip : "127.0.0.1"
- port: 20000
-
-
-protocol_conf:
- dubbo:
- session_number: 700
- session_timeout: "180s"
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "server"
diff --git a/general/dubbo/go-client/app/user.go b/general/dubbo/go-server/tests/integration/main_test.go
similarity index 62%
rename from general/dubbo/go-client/app/user.go
rename to general/dubbo/go-server/tests/integration/main_test.go
index 8e241fc..c4795d6 100644
--- a/general/dubbo/go-client/app/user.go
+++ b/general/dubbo/go-server/tests/integration/main_test.go
@@ -1,3 +1,5 @@
+// +build integration
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,32 +17,47 @@
* limitations under the License.
*/
-package main
+package integration
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
import (
"context"
"fmt"
+ "os"
"strconv"
+ "testing"
"time"
)
-import (
- hessian "github.com/apache/dubbo-go-hessian2"
- "github.com/apache/dubbo-go/config"
-)
+var userProvider = new(UserProvider)
-type Gender hessian.JavaEnum
+func TestMain(m *testing.M) {
+ config.SetConsumerService(userProvider)
+ hessian.RegisterJavaEnum(Gender(MAN))
+ hessian.RegisterJavaEnum(Gender(WOMAN))
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+ time.Sleep(3 * time.Second)
-var (
- userProvider = new(UserProvider)
- userProvider1 = new(UserProvider1)
- userProvider2 = new(UserProvider2)
-)
+ os.Exit(m.Run())
+}
+
+type Gender hessian.JavaEnum
func init() {
config.SetConsumerService(userProvider)
- config.SetConsumerService(userProvider1)
- config.SetConsumerService(userProvider2)
}
const (
@@ -59,7 +76,7 @@ var genderValue = map[string]hessian.JavaEnum{
}
func (g Gender) JavaClassName() string {
- return "com.ikurento.user.Gender"
+ return "org.apache.dubbo.Gender"
}
func (g Gender) String() string {
@@ -97,7 +114,7 @@ func (u User) String() string {
}
func (User) JavaClassName() string {
- return "com.ikurento.user.User"
+ return "org.apache.dubbo.User"
}
type UserProvider struct {
@@ -115,33 +132,3 @@ type UserProvider struct {
func (u *UserProvider) Reference() string {
return "UserProvider"
}
-
-type UserProvider1 struct {
- GetUsers func(req []interface{}) ([]interface{}, error)
- GetErr func(ctx context.Context, req []interface{}, rsp *User) error
- GetUser func(ctx context.Context, req []interface{}, rsp *User) error
- GetUser0 func(id string, name string) (User, error)
- GetUser1 func(ctx context.Context, req []interface{}, rsp *User) error
- GetUser2 func(ctx context.Context, req []interface{}, rsp *User) error `dubbo:"getUser"`
- GetUser3 func() error
- Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
-}
-
-func (u *UserProvider1) Reference() string {
- return "UserProvider1"
-}
-
-type UserProvider2 struct {
- GetUsers func(req []interface{}) ([]interface{}, error)
- GetErr func(ctx context.Context, req []interface{}, rsp *User) error
- GetUser func(ctx context.Context, req []interface{}, rsp *User) error
- GetUser0 func(id string, name string) (User, error)
- GetUser1 func(ctx context.Context, req []interface{}, rsp *User) error
- GetUser2 func(ctx context.Context, req []interface{}, rsp *User) error `dubbo:"getUser"`
- GetUser3 func() error
- Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
-}
-
-func (u *UserProvider2) Reference() string {
- return "UserProvider2"
-}
diff --git a/general/dubbo/go-server/tests/integration/userprovider_test.go b/general/dubbo/go-server/tests/integration/userprovider_test.go
new file mode 100644
index 0000000..6fdb024
--- /dev/null
+++ b/general/dubbo/go-server/tests/integration/userprovider_test.go
@@ -0,0 +1,114 @@
+// +build integration
+
+/*
+ * 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 integration
+
+import (
+ "context"
+ "github.com/apache/dubbo-go-hessian2/java_exception"
+ "github.com/apache/dubbo-samples/golang/general/dubbo/go-server/pkg"
+ "testing"
+)
+import (
+ "github.com/stretchr/testify/assert"
+)
+
+func TestGetUserA000(t *testing.T) {
+ user := &User{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A000"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "0", user.Id)
+ assert.Equal(t, "Alex Stocks", user.Name)
+ assert.Equal(t, int32(31), user.Age)
+ assert.Equal(t, Gender(pkg.MAN), user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUserA001(t *testing.T) {
+ user := &User{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "001", user.Id)
+ assert.Equal(t, "ZhangSheng", user.Name)
+ assert.Equal(t, int32(18), user.Age)
+ assert.Equal(t, Gender(pkg.MAN), user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUserA002(t *testing.T) {
+ user := &User{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A002"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "002", user.Id)
+ assert.Equal(t, "Lily", user.Name)
+ assert.Equal(t, int32(20), user.Age)
+ assert.Equal(t, Gender(pkg.WOMAN), user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUserA003(t *testing.T) {
+ user := &User{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A003"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "113", user.Id)
+ assert.Equal(t, "Moorse", user.Name)
+ assert.Equal(t, int32(30), user.Age)
+ assert.Equal(t, Gender(pkg.WOMAN), user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUser0(t *testing.T) {
+ user, err := userProvider.GetUser0("A003", "Moorse")
+ assert.Nil(t, err)
+ assert.NotNil(t, user)
+
+ user, err = userProvider.GetUser0("A003", "MOORSE")
+ assert.NotNil(t, err)
+}
+
+func TestGetUser2(t *testing.T) {
+ user := &User{}
+ err := userProvider.GetUser2(context.TODO(), []interface{}{int32(64)}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "64", user.Id)
+}
+
+func TestGetUser3(t *testing.T) {
+ err := userProvider.GetUser3()
+ assert.Nil(t, err)
+}
+
+func TestGetErr(t *testing.T) {
+ user := &User{}
+ err := userProvider.GetErr(context.TODO(), []interface{}{"A003"}, user)
+ assert.IsType(t, &java_exception.Throwable{}, err)
+}
+
+func TestGetUsers(t *testing.T) {
+ users, err := userProvider.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
+ assert.Nil(t, err)
+ assert.Equal(t, "Lily", users[0].(*User).Name)
+ assert.Equal(t, "Moorse", users[1].(*User).Name)
+}
+
+func TestGetGender(t *testing.T) {
+ gender, err := userProvider.GetGender(1)
+ assert.Nil(t, err)
+ assert.Equal(t, Gender(pkg.WOMAN), gender)
+}
diff --git a/general/dubbo/java-client/build.sh b/general/dubbo/java-client/build.sh
deleted file mode 100644
index c869acf..0000000
--- a/general/dubbo/java-client/build.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-# rm src/main/resources/META-INF/spring/dubbo.consumer.xml
-# cp src/main/resources/META-INF/spring/dubbo-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml
-# cp src/main/resources/META-INF/spring/jsonrpc-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml
-mvn clean package -Dmaven.test.skip
diff --git a/general/dubbo/java-client/pom.xml b/general/dubbo/java-client/pom.xml
deleted file mode 100644
index 4065414..0000000
--- a/general/dubbo/java-client/pom.xml
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>com.ikurento</groupId>
- <artifactId>user-info-client</artifactId>
- <packaging>jar</packaging>
- <version>0.2.0</version>
- <description>The demo consumer module of dubbo project</description>
-
- <properties>
- <skip_maven_deploy>false</skip_maven_deploy>
-
- <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
- <dubbo-version>2.6.5</dubbo-version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo-dependencies-bom</artifactId>
- <version>${dubbo-version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>com.qianmi</groupId>
- <artifactId>dubbo-rpc-jsonrpc</artifactId>
- <version>${dubbo-jsonrpc-version}</version>
- </dependency>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>2.12.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.20.0-GA</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.2.5.Final</version>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>1.1.7</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.grizzly</groupId>
- <artifactId>grizzly-core</artifactId>
- <version>2.1.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.7</version>
- </dependency>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.56</version>
- </dependency>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.4.7</version>
- </dependency>
- <dependency>
- <groupId>org.apache.bsf</groupId>
- <artifactId>bsf-api</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.14</version>
- </dependency>
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- </dependency>
- <dependency>
- <groupId>com.netflix.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>1.1.16</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.xmemcached</groupId>
- <artifactId>xmemcached</artifactId>
- <version>1.3.6</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-simple</artifactId>
- <version>2.6.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>2.6.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <version>0.12.0</version>
- </dependency>
- <dependency>
- <groupId>com.caucho</groupId>
- <artifactId>hessian</artifactId>
- <version>4.0.7</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.26</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.2</version>
- </dependency>
- <dependency>
- <groupId>redis.clients</groupId>
- <artifactId>jedis</artifactId>
- <version>2.1.0</version>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>1.0.0.GA</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.2.0.Final</version>
- </dependency>
- <dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>0.4</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>package</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <outputDirectory>${project.build.directory}/dubbo</outputDirectory>
- <includes>META-INF/assembly/**</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/general/dubbo/java-client/src/main/assembly/assembly.xml b/general/dubbo/java-client/src/main/assembly/assembly.xml
deleted file mode 100644
index 47757d1..0000000
--- a/general/dubbo/java-client/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<assembly>
- <id>assembly</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0755</fileMode>
- </fileSet>
- <fileSet>
- <directory>src/main/assembly/conf</directory>
- <outputDirectory>conf</outputDirectory>
- <fileMode>0644</fileMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- </dependencySet>
- </dependencySets>
-</assembly>
\ No newline at end of file
diff --git a/general/dubbo/java-client/src/main/assembly/conf/dubbo.properties b/general/dubbo/java-client/src/main/assembly/conf/dubbo.properties
deleted file mode 100644
index e561efc..0000000
--- a/general/dubbo/java-client/src/main/assembly/conf/dubbo.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-### dubboע���������� ###
-dubbo.container = log4j,spring
-dubbo.application.name = user-info-client
-dubbo.application.owner = AlexStocks
-dubbo.application.environment = product
-dubbo.registry.address = zookeeper://127.0.0.1:2181
-dubbo.monitor.protocol = zookeeper
-dubbo.consumer.timeout = 10000
-dubbo.provider.timeout = 10000
-dubbo.protocol.name = dubbo
-
-dubbo.log4j.file = logs/client.log
-dubbo.log4j.level = WARN
diff --git a/general/dubbo/java-client/src/main/assembly/conf/log4j.properties b/general/dubbo/java-client/src/main/assembly/conf/log4j.properties
deleted file mode 100644
index 06bcb34..0000000
--- a/general/dubbo/java-client/src/main/assembly/conf/log4j.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
diff --git a/general/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java b/general/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java
deleted file mode 100644
index a2c4296..0000000
--- a/general/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import com.alibaba.dubbo.rpc.service.EchoService;
-import java.util.List;
-
-public class Consumer {
- // Define a private variable (Required in Spring)
- private UserProvider userProvider;
- private UserProvider userProvider1;
- private UserProvider userProvider2;
-
- // Spring DI (Required in Spring)
- public void setUserProvider(UserProvider u) {
- this.userProvider = u;
- }
- public void setUserProvider1(UserProvider u) {
- this.userProvider1 = u;
- }
- public void setUserProvider2(UserProvider u) {
- this.userProvider2 = u;
- }
-
- // Start the entry function for consumer (Specified in the configuration file)
- public void start() throws Exception {
- System.out.println("\n\ntest");
- testGetUser();
- testGetUsers();
- System.out.println("\n\ntest1");
- testGetUser1();
- testGetUsers1();
- System.out.println("\n\ntest2");
- testGetUser2();
- testGetUsers2();
- Thread.sleep(2000);
- }
-
- private void testGetUser() throws Exception {
- try {
- EchoService echoService = (EchoService)userProvider;
- Object status = echoService.$echo("OK");
- System.out.println("echo: "+status);
- User user1 = userProvider.GetUser("A003");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName() + ", sex:" + user1.getSex().toString()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
- User user2 = userProvider.GetUser0("A003","Moorse");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user2.getId() + ", name:" + user2.getName() + ", sex:" + user2.getSex().toString()
- + ", age:" + user2.getAge() + ", time:" + user2.getTime().toString());
- User user3 = userProvider.getUser(1);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user3.getId() + ", name:" + user3.getName() + ", sex:" + user3.getSex().toString()
- + ", age:" + user3.getAge() + ", time:" + user3.getTime());
- User user4 = userProvider.getUser(1, "name");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user4.getId() + ", name:" + user4.getName() + ", sex:" + user4.getSex().toString()
- + ", age:" + user4.getAge() + ", time:" + user4.getTime());
- userProvider.GetUser3();
- System.out.println("GetUser3 succ");
-
- User user9 = userProvider.GetUser1("A003");
- } catch (Throwable e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- try {
- userProvider.GetErr("A003");
- } catch (Throwable t) {
- System.out.println("*************exception***********");
- t.printStackTrace();
- }
- }
-
- private void testGetUsers() throws Exception {
- try {
- List<String> userIDList = new ArrayList<String>();
- userIDList.add("A001");
- userIDList.add("A002");
- userIDList.add("A003");
-
- List<User> userList = userProvider.GetUsers(userIDList);
-
- for (int i = 0; i < userList.size(); i++) {
- User user = userList.get(i);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void testGetUser1() throws Exception {
- try {
- EchoService echoService = (EchoService)userProvider1;
- Object status = echoService.$echo("OK");
- System.out.println("echo: "+status);
- User user1 = userProvider1.GetUser("A003");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName() + ", sex:" + user1.getSex().toString()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
- User user2 = userProvider1.GetUser0("A003","Moorse");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user2.getId() + ", name:" + user2.getName() + ", sex:" + user2.getSex().toString()
- + ", age:" + user2.getAge() + ", time:" + user2.getTime().toString());
- User user3 = userProvider1.getUser(1);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user3.getId() + ", name:" + user3.getName() + ", sex:" + user3.getSex().toString()
- + ", age:" + user3.getAge() + ", time:" + user3.getTime());
- User user4 = userProvider1.getUser(1, "name");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user4.getId() + ", name:" + user4.getName() + ", sex:" + user4.getSex().toString()
- + ", age:" + user4.getAge() + ", time:" + user4.getTime());
- userProvider1.GetUser3();
- System.out.println("GetUser3 succ");
-
- User user9 = userProvider1.GetUser1("A003");
- } catch (Throwable e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- try {
- userProvider1.GetErr("A003");
- } catch (Throwable t) {
- System.out.println("*************exception***********");
- t.printStackTrace();
- }
- }
-
- private void testGetUsers1() throws Exception {
- try {
- List<String> userIDList = new ArrayList<String>();
- userIDList.add("A001");
- userIDList.add("A002");
- userIDList.add("A003");
-
- List<User> userList = userProvider1.GetUsers(userIDList);
-
- for (int i = 0; i < userList.size(); i++) {
- User user = userList.get(i);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void testGetUser2() throws Exception {
- try {
- EchoService echoService = (EchoService)userProvider2;
- Object status = echoService.$echo("OK");
- System.out.println("echo: "+status);
- User user1 = userProvider2.GetUser("A003");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName() + ", sex:" + user1.getSex().toString()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
- User user2 = userProvider2.GetUser0("A003","Moorse");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user2.getId() + ", name:" + user2.getName() + ", sex:" + user2.getSex().toString()
- + ", age:" + user2.getAge() + ", time:" + user2.getTime().toString());
- User user3 = userProvider2.getUser(1);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user3.getId() + ", name:" + user3.getName() + ", sex:" + user3.getSex().toString()
- + ", age:" + user3.getAge() + ", time:" + user3.getTime());
- User user4 = userProvider2.getUser(1, "name");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user4.getId() + ", name:" + user4.getName() + ", sex:" + user4.getSex().toString()
- + ", age:" + user4.getAge() + ", time:" + user4.getTime());
- userProvider2.GetUser3();
- System.out.println("GetUser3 succ");
-
- User user9 = userProvider2.GetUser1("A003");
- } catch (Throwable e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- try {
- userProvider2.GetErr("A003");
- } catch (Throwable t) {
- System.out.println("*************exception***********");
- t.printStackTrace();
- }
- }
-
- private void testGetUsers2() throws Exception {
- try {
- List<String> userIDList = new ArrayList<String>();
- userIDList.add("A001");
- userIDList.add("A002");
- userIDList.add("A003");
-
- List<User> userList = userProvider2.GetUsers(userIDList);
-
- for (int i = 0; i < userList.size(); i++) {
- User user = userList.get(i);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/general/dubbo/java-client/src/main/java/com/ikurento/user/Gender.java b/general/dubbo/java-client/src/main/java/com/ikurento/user/Gender.java
deleted file mode 100644
index e606be7..0000000
--- a/general/dubbo/java-client/src/main/java/com/ikurento/user/Gender.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-public enum Gender {
- MAN,
- WOMAN
-}
diff --git a/general/dubbo/java-client/src/main/java/com/ikurento/user/User.java b/general/dubbo/java-client/src/main/java/com/ikurento/user/User.java
deleted file mode 100644
index 7f228b3..0000000
--- a/general/dubbo/java-client/src/main/java/com/ikurento/user/User.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import java.util.Date;
-
-public class User {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
- private Gender sex = Gender.MAN;
-
- public User() {
- }
-
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public Gender getSex() {
- return sex;
- }
-
- public void setSex(Gender sex) {
- this.sex = sex;
- }
-}
diff --git a/general/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java b/general/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java
deleted file mode 100644
index 0e75a97..0000000
--- a/general/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import java.util.List;
-
-public interface UserProvider {
- User GetUser(String userId);
- User GetErr(String userId) throws Exception;
- User GetUser1(String userId) throws Exception;
- User getUser(int usercode);
- User getUser(int usercode, String name);
- void GetUser3();
- List<User> GetUsers(List<String> userIdList);
- User GetUser0(String userId, String name);
-}
diff --git a/general/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/general/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
deleted file mode 100644
index 9dfd685..0000000
--- a/general/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
-
- <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
- <dubbo:application name="user-info-client" />
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="ikurento" address="zookeeper://127.0.0.1:2181" />
- <!-- dubbo.registry.address from dubbo.properties -->
- <!-- dubbo:registry address="${dubbo.registry.address}" / -->
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol id="dubbo" name="dubbo" />
- <dubbo:protocol id="jsonrpc" name="jsonrpc" />
-
- <!-- 声明需要使用的服务接口 -->
- <dubbo:reference registry="ikurento" check="false" id="userProvider" protocol="dubbo" interface="com.ikurento.user.UserProvider">
- <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
- </dubbo:reference>
-
- <dubbo:reference registry="ikurento" check="false" id="userProvider1" protocol="dubbo" version="2.0" interface="com.ikurento.user.UserProvider">
- </dubbo:reference>
- <dubbo:reference registry="ikurento" check="false" id="userProvider2" protocol="dubbo" version="2.0" group="as" interface="com.ikurento.user.UserProvider">
- </dubbo:reference>
-</beans>
diff --git a/general/dubbo/java-client/src/main/resources/META-INF/spring/service.xml b/general/dubbo/java-client/src/main/resources/META-INF/spring/service.xml
deleted file mode 100644
index 854d513..0000000
--- a/general/dubbo/java-client/src/main/resources/META-INF/spring/service.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- <bean class="com.ikurento.user.Consumer" init-method="start">
- <!-- 声明这个类 要使用的服务名-->
- <property name="userProvider" ref="userProvider" />
- <property name="userProvider1" ref="userProvider1" />
- <property name="userProvider2" ref="userProvider2" />
- </bean>
-
- <!-- App config -->
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <value>classpath:dubbo.properties</value>
- </list>
- </property>
- </bean>
-
-</beans>
diff --git a/general/dubbo/java-client/src/main/resources/log4j.properties b/general/dubbo/java-client/src/main/resources/log4j.properties
deleted file mode 100644
index 06bcb34..0000000
--- a/general/dubbo/java-client/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
diff --git a/general/dubbo/java-server/build.sh b/general/dubbo/java-server/build.sh
deleted file mode 100644
index 7b5755b..0000000
--- a/general/dubbo/java-server/build.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-# mvn dependency:sources
-mvn clean package -Dmaven.test.skip
-# mvn -X clean compile package -DskipTests=true
diff --git a/general/dubbo/java-server/pom.xml b/general/dubbo/java-server/pom.xml
deleted file mode 100644
index 6333c23..0000000
--- a/general/dubbo/java-server/pom.xml
+++ /dev/null
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-
-<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>
-
- <groupId>com.ikurento</groupId>
- <artifactId>user-info-server</artifactId>
- <packaging>jar</packaging>
- <version>0.2.0</version>
- <description>The demo provider module of dubbo project</description>
- <properties>
- <skip_maven_deploy>false</skip_maven_deploy>
-
- <dubbo-version>2.6.5</dubbo-version>
- <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo-dependencies-bom</artifactId>
- <version>${dubbo-version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
-
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <exclusions>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>2.12.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.qianmi</groupId>
- <artifactId>dubbo-rpc-jsonrpc</artifactId>
- <version>${dubbo-jsonrpc-version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.26</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.10.0</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.10.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- <exclusions>
- <exclusion>
- <artifactId>org.apache.zookeeper</artifactId>
- <groupId>zookeeper</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.14</version>
- </dependency>
-
- </dependencies>
-
- <repositories>
- <repository>
- <id>nexus-aliyu</id>
- <url>https://maven.aliyun.com/nexus/content/groups/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>nexus-aliyu</id>
- <url>https://maven.aliyun.com/nexus/content/groups/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
-
-
- <build>
-
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>package</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <outputDirectory>${project.build.directory}/dubbo</outputDirectory>
- <includes>META-INF/assembly/**</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
-
-
diff --git a/general/dubbo/java-server/script/debug.sh b/general/dubbo/java-server/script/debug.sh
deleted file mode 100644
index 1038cd7..0000000
--- a/general/dubbo/java-server/script/debug.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-# jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/*:/Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/ com.alibaba.dubbo.container.Main
-jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/* -sourcepath /Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/:/Users/alex/tmp/java-server/src/main/java com.alibaba.dubbo.container.Main
-# jdb stop at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec:76
-# run
-
diff --git a/general/dubbo/java-server/src/main/assembly/assembly.xml b/general/dubbo/java-server/src/main/assembly/assembly.xml
deleted file mode 100644
index 98a2e10..0000000
--- a/general/dubbo/java-server/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<assembly>
- <id>assembly</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0755</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- <fileSet>
- <directory>src/main/assembly/conf</directory>
- <includes>
- <include>dubbo.properties</include>
- <include>log4j.*</include>
- </includes>
- <outputDirectory>conf</outputDirectory>
- <fileMode>0644</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- </dependencySet>
- </dependencySets>
-</assembly>
\ No newline at end of file
diff --git a/general/dubbo/java-server/src/main/assembly/conf/dubbo.properties b/general/dubbo/java-server/src/main/assembly/conf/dubbo.properties
deleted file mode 100644
index 2826f31..0000000
--- a/general/dubbo/java-server/src/main/assembly/conf/dubbo.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-### dubbo注册中心配置 ##
-dubbo.container = log4j,spring
-dubbo.application.name = user-info-server
-dubbo.application.environment = product
-dubbo.application.owner = AlexStocks
-dubbo.registry.address = 127.0.0.1:2181
-dubbo.registry.protocol = zookeeper
-dubbo.consumer.timeout = 10000
-dubbo.provider.timeout = 10000
-dubbo.protocol.name = dubbo
-dubbo.protocol.port = 10000
-
-dubbo.log4j.file = logs/dubbo.log
-dubbo.log4j.level = INFO
diff --git a/general/dubbo/java-server/src/main/assembly/conf/log4j.properties b/general/dubbo/java-server/src/main/assembly/conf/log4j.properties
deleted file mode 100644
index 13c8049..0000000
--- a/general/dubbo/java-server/src/main/assembly/conf/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
diff --git a/general/dubbo/java-server/src/main/java/com/ikurento/user/Gender.java b/general/dubbo/java-server/src/main/java/com/ikurento/user/Gender.java
deleted file mode 100644
index e606be7..0000000
--- a/general/dubbo/java-server/src/main/java/com/ikurento/user/Gender.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-public enum Gender {
- MAN,
- WOMAN
-}
diff --git a/general/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java b/general/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java
deleted file mode 100644
index dea1c34..0000000
--- a/general/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class Provider {
-
- /**
- * To get ipv6 address to work, add
- * System.setProperty("java.net.preferIPv6Addresses", "true");
- * before running your application.
- */
- public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo.provider.xml"});
- context.start();
- System.in.read(); // press any key to exit
- }
-}
diff --git a/general/dubbo/java-server/src/main/java/com/ikurento/user/Response.java b/general/dubbo/java-server/src/main/java/com/ikurento/user/Response.java
deleted file mode 100644
index 83b423d..0000000
--- a/general/dubbo/java-server/src/main/java/com/ikurento/user/Response.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import java.io.*;
-
-public final class Response<T> implements Serializable {
- private static final long serialVersionUID = 3727205004706510648L;
- public static final Integer OK = 200;
- public static final Integer ERR = 500;
- private Integer Status;
- private String Err;
- private T Data;
-
- public Response() {
- }
-
- public static <T> Response<T> ok() {
- Response r = new Response();
- r.Status = OK;
- return r;
- }
-
- public static <T> Response<T> ok(Object Data) {
- Response r = new Response();
- r.Status = OK;
- r.Data = Data;
- return r;
- }
-
- public static <T> Response<T> notOk(String Err) {
- Response r = new Response();
- r.Status = ERR;
- r.Err = Err;
- return r;
- }
-
- public static <T> Response<T> notOk(Integer Status, String Err) {
- Response r = new Response();
- r.Status = Status;
- r.Err = Err;
- return r;
- }
-
-// public Boolean isSuccess() {
-// return Objects.equals(this.Status, OK);
-// }
-
- public Integer getStatus() {
- return this.Status;
- }
-
- public void setStatus(Integer Status) {
- this.Status = Status;
- }
-
- public String getErr() {
- return this.Err;
- }
-
- public void setErr(String Err) {
- this.Err = Err;
- }
-
- public T getData() {
- return this.Data;
- }
-
- public void setData(T Data) {
- this.Status = OK;
- this.Data = Data;
- }
-
- public String toString() {
- return "Response{Status=" + this.Status + ", Err='" + this.Err + '\'' + ", Data=" + this.Data + '}';
- }
-}
\ No newline at end of file
diff --git a/general/dubbo/java-server/src/main/java/com/ikurento/user/User.java b/general/dubbo/java-server/src/main/java/com/ikurento/user/User.java
deleted file mode 100644
index a6e76cf..0000000
--- a/general/dubbo/java-server/src/main/java/com/ikurento/user/User.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import java.util.Date;
-import java.io.Serializable;
-
-public class User implements Serializable {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
- private Gender sex = Gender.MAN;
-
- public User() {
- }
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public User(String id, String name, int age, Date time, Gender sex) {
- this.id = id;
- this.name = name;
- this.age = age;
- this.time = time;
- this.sex = sex;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public Gender getSex() {
- return sex;
- }
-
- public void setSex(Gender sex) {
- this.sex = sex;
- }
-
- public String toString() {
- return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time + ", gender:" + sex + "}";
- }
-}
diff --git a/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java b/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java
deleted file mode 100644
index e750834..0000000
--- a/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import java.util.List;
-import java.util.Map;
-
-public interface UserProvider {
-
- boolean isLimit(Gender gender, String name);
-
- User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
-
- List<User> GetUsers(List<String> userIdList);
-
- void GetUser3();
-
- User GetUser0(String userId, String name);
-
- User GetErr(String userId) throws Exception;
-
- Map<String, User> GetUserMap(List<String> userIdList);
-
- User getUser(int usercode);
-
- User getUser(int usercode, String name);
-
- User queryUser(User user);
-
- Map<String, User> queryAll();
-
- int Calc(int a,int b);
-
- Response<Integer> Sum(int a, int b);
-}
diff --git a/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderAnotherImpl.java b/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderAnotherImpl.java
deleted file mode 100644
index 717e6b3..0000000
--- a/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderAnotherImpl.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-public class UserProviderAnotherImpl implements UserProvider {
- // private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
- private static final Logger logger = LoggerFactory.getLogger("userLogger"); // Output to user-server.log
-
- private Map<String, User> userMap = new HashMap<String, User>();
-
- public UserProviderAnotherImpl() {
- // userMap.put("001", new User("001", "other-zhangsan", 18, new Date(1998-1900, 1, 2, 3, 4, 5), Gender.MAN));
- userMap.put("001", new User("001", "other-zhangsan", 18, new Date(0x12345678), Gender.MAN));
- userMap.put("002", new User("002", "other-lisi", 20, new Date(1996-1900, 1, 2, 3, 4, 5), Gender.MAN));
- userMap.put("003", new User("003", "other-lily", 23, new Date(1993-1900, 1, 2, 3, 4, 5), Gender.WOMAN));
- userMap.put("004", new User("004", "other-lisa", 32, new Date(1985-1900, 1, 2, 3, 4, 5), Gender.WOMAN));
- }
-
- public boolean isLimit(Gender gender, String name) {
- logger.info(String.format("input gender=%sand name=%s", gender, name));
- return Gender.MAN == gender;
- }
-
- public User GetUser(String userId) {
- logger.info("input userId = " + userId);
- return new User(userId, "Joe", 48);
- }
-
- public User GetUser0(String userId, String name) {
- return new User(userId, name, 48);
- }
-
- public void GetUser3() {
- logger.info("this is GetUser3 of another");
- }
-
- public User GetErr(String userId) throws Exception {
- throw new Exception("exception");
- }
-
- public List<User> GetUsers(ArrayList<String> userIdList) {
- Iterator it = userIdList.iterator();
- List<User> userList = new ArrayList<User>();
- logger.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- logger.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- userList.add(userMap.get(id));
- logger.info("id:" + id + ", user:" + userMap.get(id));
- }
- }
-
- return userList;
- }
-
- public Map<String, User> GetUserMap(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- Map<String, User> map = new HashMap<String, User>();
- logger.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- logger.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- map.put(id, userMap.get(id));
- logger.info("id:" + id + ", user:" + userMap.get(id));
- }
- }
-
- return map;
- }
-
- public List<User> GetUsers(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- List<User> userList = new ArrayList<User>();
- logger.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- logger.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- userList.add(userMap.get(id));
- logger.info("id:" + id + ", user:" + userMap.get(id));
- }
- }
-
- return userList;
- }
-
- // @Override
- public User getUser(int userCode) {
- logger.info("input userCode = " + userCode);
- return new User(String.valueOf(userCode), "userCode get", 48);
- }
-
- public User getUser(int usercode, String name) {
- return new User(String.valueOf(usercode), name, 18);
- }
-
- public User queryUser(User user) {
- logger.info("input user = " + user);
- return new User(user.getId(), "get:" + user.getName(), user.getAge() + 18);
- }
-
- public Map<String, User> queryAll() {
- logger.info("input");
- Map<String, User> map = new HashMap<String, User>();
- map.put("001", new User("001", "Joe", 18));
- map.put("002", new User("002", "Wen", 20));
-
- return map;
- }
-
- public int Calc(int a,int b) {
- return a + b + 100;
- }
-
- public Response<Integer> Sum(int a,int b) {
- return Response.ok(a+b);
- }
-}
diff --git a/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java b/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
deleted file mode 100644
index c6d0c17..0000000
--- a/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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 com.ikurento.user;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Iterator;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProviderImpl implements UserProvider {
- // private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
- private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); // Output to user-server.log
- Map<String, User> userMap = new HashMap<String, User>();
-
- public UserProviderImpl() {
- userMap.put("A001", new User("A001", "demo-zhangsan", 18));
- userMap.put("A002", new User("A002", "demo-lisi", 20));
- userMap.put("A003", new User("A003", "demo-lily", 23));
- userMap.put("A004", new User("A004", "demo-lisa", 32));
- }
-
- public boolean isLimit(Gender gender, String name) {
- return Gender.WOMAN == gender;
- }
-
- public User GetUser(String userId) {
- return new User(userId, "zhangsan", 18);
- }
-
- public User GetErr(String userId) throws Exception {
- throw new Exception("exception");
- }
-
- public User GetUser0(String userId, String name) {
- return new User(userId, name, 18);
- }
-
- public List<User> GetUsers(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- List<User> userList = new ArrayList<User>();
- LOG.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- LOG.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- userList.add(userMap.get(id));
- LOG.info("id:" + id + ", user:" + userMap.get(id));
- }
- }
-
- return userList;
- }
-
- public void GetUser3() {
- LOG.info("this is GetUser3 of impl");
- }
-
- public Map<String, User> GetUserMap(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- Map<String, User> map = new HashMap<String, User>();
- LOG.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- LOG.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- map.put(id, userMap.get(id));
- LOG.info("id:" + id + ", user:" + userMap.get(id));
- }
- }
-
- return map;
- }
-
- public User queryUser(User user) {
- return new User(user.getId(), "hello:" +user.getName(), user.getAge() + 18);
- }
-
- public Map<String, User> queryAll() {
- return userMap;
- }
-
-
- public User getUser(int userCode) {
- return new User(String.valueOf(userCode), "userCode get", 48);
- }
-
- public User getUser(int usercode, String name) {
- return new User(String.valueOf(usercode), name, 38);
- }
-
- public int Calc(int a,int b) {
- return a + b;
- }
-
- public Response<Integer> Sum(int a,int b) {
- return Response.ok(a+b);
- }
-}
diff --git a/general/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/general/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
deleted file mode 100644
index 4ebe64b..0000000
--- a/general/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- <!-- 应用名 -->
- <dubbo:application name="user-info-server"/>
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="ikurento" address="zookeeper://127.0.0.1:2181" />
- <dubbo:registry id="ikurento2" address="zookeeper://127.0.0.1:2182" />
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <!-- dubbo:protocol host="127.0.0.1" / -->
- <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010" />
- <dubbo:protocol id="jsonrpc" name="jsonrpc" host="127.0.0.1" port="10010" />
- <!-- 声明需要暴露的服务接口 -->
- <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="demoService"/>
- <dubbo:service id="bbb" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="otherService" version="2.0"/>
- <dubbo:service id="ccc" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="otherService" group="as" version="2.0"/>
-
- <bean id="demoService" class="com.ikurento.user.UserProviderImpl" />
- <bean id="otherService" class="com.ikurento.user.UserProviderAnotherImpl"/>
-
-</beans>
diff --git a/general/dubbo/java-server/src/main/resources/log4j.properties b/general/dubbo/java-server/src/main/resources/log4j.properties
deleted file mode 100644
index 13c8049..0000000
--- a/general/dubbo/java-server/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-