diff --git a/general/dubbo3/pb/dubbogo-grpc/protobuf/dubbo3/protobuf.mk b/general/dubbo3/pb/dubbogo-grpc/protobuf/dubbo3/protobuf.mk index bd5c19a854..beffc5e012 100644 --- a/general/dubbo3/pb/dubbogo-grpc/protobuf/dubbo3/protobuf.mk +++ b/general/dubbo3/pb/dubbogo-grpc/protobuf/dubbo3/protobuf.mk @@ -16,7 +16,7 @@ ifeq ($(UNAME), Linux) endif $(PROTOC_GEN_GO): - go get -u dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/protoc-gen-dubbo3@3.0 + go get -u github.com/apache/dubbo-go/protocol/dubbo3/protoc-gen-dubbo3@3.0 helloworld.pb.go: helloworld.proto | $(PROTOC_GEN_GO) $(PROTOC) protoc -I . helloworld.proto --dubbo3_out=plugins=grpc+dubbo:. diff --git a/generic/go-server/tests/integration/userprovider_test.go b/generic/go-server/tests/integration/userprovider_test.go index 65316fcfa8..ef741e4171 100644 --- a/generic/go-server/tests/integration/userprovider_test.go +++ b/generic/go-server/tests/integration/userprovider_test.go @@ -21,7 +21,6 @@ package integration import ( "context" - "fmt" "github.com/stretchr/testify/assert" "testing" "time" @@ -39,7 +38,6 @@ func TestGetUser(t *testing.T) { []interface{}{"A003"}, }, ) - fmt.Println("============", o) assert.Nil(t, err) assert.IsType(t, make(map[interface{}]interface{}, 0), o) resp := o.(map[interface{}]interface{}) diff --git a/registry/servicediscovery/consul/README.md b/registry/servicediscovery/consul/README.md deleted file mode 100644 index 105e8f9813..0000000000 --- a/registry/servicediscovery/consul/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Consul Service Discovery Example -### 1. Introduction -[Consul](https://www.consul.io/docs/intro) is a service mesh solution providing a full featured control plane with service discovery, configuration, and segmentation functionality.\ -Dubbogo can use consul as service discovery middleware and metadata reporter. \ -Before using consul, pls make sure consul server is running in your environment and match the config below.\ - -### 2. Important config -```yaml -registries: # registry config - "demoServiceDiscovery": - protocol: "service-discovery" # choose service-discovery as service registry config protocol - params: - service_discovery: "consul_dis" - name_mapping: "in-memory" - metadata: "default" - -service_discovery: - consul_dis: # this key sould match config above - protocol: "consul" # this is real protocol that sd based - remote_ref: "consul1" # this is the remoting network config of target protocol - -remote: - consul1: # this key should match config service_discovery's remote_ref - address: "127.0.0.1:8500" # consul address - timeout: "5s" - -# if you want to report metadata by consul, you can add config below: -metadata_report: - protocol: "consul" - remote_ref: "consul1" -``` -### 3. Import block -To use consul as service discovery, make sure you add import in you server and client: -```go -import( - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -``` - -if you want to use consul to report, make sure you add import: -```go -import( - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" -) -``` \ No newline at end of file diff --git a/registry/servicediscovery/consul/README_zh.md b/registry/servicediscovery/consul/README_zh.md deleted file mode 100644 index 6a4ebd6b89..0000000000 --- a/registry/servicediscovery/consul/README_zh.md +++ /dev/null @@ -1,46 +0,0 @@ -# Consul 服务发现示例 -### 1. 介绍 -[Consul](https://www.consul.io/docs/intro) -是一个服务网格解决方案,它提供了一个具有服务发现、配置和分段功能的全功能控制平面。 -在通过dubbogo使用consul之前,请保证consul已经在您的环境正确运行,并且和下面的ip:port配置一致。 - -### 2. Important config -```yaml -registries: # registry config - "demoServiceDiscovery": - protocol: "service-discovery" # choose service-discovery as service registry config protocol - params: - service_discovery: "consul_dis" - name_mapping: "in-memory" - metadata: "default" - -service_discovery: - consul_dis: # this key sould match config above - protocol: "consul" # this is real protocol that sd based - remote_ref: "consul1" # this is the remoting network config of target protocol - -remote: - consul1: # this key should match config service_discovery's remote_ref - address: "127.0.0.1:8500" # consul 服务地址 - timeout: "5s" - -# if you want to report metadata by consul, you can add config below: -metadata_report: - protocol: "consul" - remote_ref: "consul1" -``` -### 3. Import 引入依赖 -使用consul作为服务注册中心,请将引入以下依赖: -```go -import( - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -``` -如果您希望使用consul来报告数据,请引入以下依赖: -```go -import( - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" -) -``` \ No newline at end of file diff --git a/registry/servicediscovery/consul/go-client/cmd/client.go b/registry/servicediscovery/consul/go-client/cmd/client.go deleted file mode 100644 index f58f8f5ae0..0000000000 --- a/registry/servicediscovery/consul/go-client/cmd/client.go +++ /dev/null @@ -1,105 +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" - "os" - "os/signal" - "syscall" - "time" -) - -import ( - "github.com/apache/dubbo-go-samples/registry/servicediscovery/consul/go-client/pkg/pojo" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - hessian "github.com/apache/dubbo-go-hessian2" - - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" - _ "dubbo.apache.org/dubbo-go/v3/registry/consul" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" - gxlog "github.com/dubbogo/gost/log" -) - -var ( - survivalTimeout int = 10e9 -) - -var userProvider = new(pojo.UserProvider) - -func init() { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&pojo.User{}) -} - -// they are necessary: -// export CONF_CONSUMER_FILE_PATH="xxx" -// export APP_LOG_CONF_FILE="xxx" -func main() { - config.Load() - time.Sleep(3e9) - - gxlog.CInfo("\n\n\nstart to test dubbo\n") - user := &pojo.User{} - for i := 0; i < 5; i++ { - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - if err != nil { - panic(err) - } - gxlog.CInfo("response result: %v\n", user) - } - 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 - } - } -} diff --git a/registry/servicediscovery/consul/go-client/cmd/version.go b/registry/servicediscovery/consul/go-client/cmd/version.go deleted file mode 100644 index ae51f45d95..0000000000 --- a/registry/servicediscovery/consul/go-client/cmd/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/registry/servicediscovery/consul/go-client/conf/client.yml b/registry/servicediscovery/consul/go-client/conf/client.yml deleted file mode 100644 index 88970af573..0000000000 --- a/registry/servicediscovery/consul/go-client/conf/client.yml +++ /dev/null @@ -1,77 +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 : "user-info-client" - module : "dubbogo user-info client" - version : "0.0.1" - owner : "ZX" - environment : "dev" - - -registries: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "consul_dis" - name_mapping: "in-memory" - metadata: "default" - -remote: - consul1: - address: "127.0.0.1:8500" - timeout: "5s" - -metadata_report: - protocol: "consul" - remote_ref: "consul1" - -service_discovery: - consul_dis: - protocol: "consul" - remote_ref: "consul1" - - -references: - "UserProvider": - # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 - registry: "demoServiceDiscovery" - protocol : "dubbo" - provide_by: "UserInfoServer" - 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_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/registry/servicediscovery/consul/go-client/conf/log.yml b/registry/servicediscovery/consul/go-client/conf/log.yml deleted file mode 100644 index 3ed242d290..0000000000 --- a/registry/servicediscovery/consul/go-client/conf/log.yml +++ /dev/null @@ -1,28 +0,0 @@ - -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: diff --git a/registry/servicediscovery/consul/go-client/pkg/pojo/user.go b/registry/servicediscovery/consul/go-client/pkg/pojo/user.go deleted file mode 100644 index d4a119da52..0000000000 --- a/registry/servicediscovery/consul/go-client/pkg/pojo/user.go +++ /dev/null @@ -1,42 +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 pojo - -import ( - "context" - "time" -) - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "com.ikurento.user.User" -} diff --git a/registry/servicediscovery/consul/go-server/cmd/server.go b/registry/servicediscovery/consul/go-server/cmd/server.go deleted file mode 100644 index 503c6764b0..0000000000 --- a/registry/servicediscovery/consul/go-server/cmd/server.go +++ /dev/null @@ -1,89 +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 ( - "fmt" - "os" - "os/signal" - "syscall" - "time" -) - -import ( - "github.com/apache/dubbo-go-samples/registry/servicediscovery/consul/go-server/pkg/pojo" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - hessian "github.com/apache/dubbo-go-hessian2" - - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - - _ "dubbo.apache.org/dubbo-go/v3/registry/consul" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -var ( - survivalTimeout = int(3e9) -) - -// they are necessary: -// export CONF_PROVIDER_FILE_PATH="xxx" -// export APP_LOG_CONF_FILE="xxx" -func main() { - - // ------for hessian2------ - hessian.RegisterPOJO(&pojo.User{}) - config.Load() - - 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("provider app exit now...") - return - } - } -} diff --git a/registry/servicediscovery/consul/go-server/cmd/version.go b/registry/servicediscovery/consul/go-server/cmd/version.go deleted file mode 100644 index ae51f45d95..0000000000 --- a/registry/servicediscovery/consul/go-server/cmd/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/registry/servicediscovery/consul/go-server/conf/client.yml b/registry/servicediscovery/consul/go-server/conf/client.yml deleted file mode 100644 index 75175c81a5..0000000000 --- a/registry/servicediscovery/consul/go-server/conf/client.yml +++ /dev/null @@ -1,77 +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 : "user-info-client" - module : "dubbogo user-info client" - version : "0.0.1" - owner : "ZX" - environment : "dev" - - -registries: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "consul_dis" - name_mapping: "in-memory" - metadata: "default" - -remote: - consul1: - address: "127.0.0.1:8500" - timeout: "5s" - -metadata_report: - protocol: "consul" - remote_ref: "consul1" - -service_discovery: - consul_dis: - protocol: "consul" - remote_ref: "consul1" - - -references: - "UserProvider": - # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 - registry: "demoServiceDiscovery" - protocol : "dubbo" - provide_by: "UserInfoServer" - 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_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/registry/servicediscovery/consul/go-server/conf/log.yml b/registry/servicediscovery/consul/go-server/conf/log.yml deleted file mode 100644 index 3ed242d290..0000000000 --- a/registry/servicediscovery/consul/go-server/conf/log.yml +++ /dev/null @@ -1,28 +0,0 @@ - -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: diff --git a/registry/servicediscovery/consul/go-server/conf/server.yml b/registry/servicediscovery/consul/go-server/conf/server.yml deleted file mode 100644 index 01525a52fd..0000000000 --- a/registry/servicediscovery/consul/go-server/conf/server.yml +++ /dev/null @@ -1,74 +0,0 @@ -# dubbo server yaml configure file - - -# application config -application: - organization: "ikurento.com" - name: "UserInfoServer" - module: "dubbogo user-info server" - version: "0.0.1" - owner: "ZX" - environment: "dev" - - -registries: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "consul-dis" - name_mapping: "in-memory" - metadata: "default" - -remote: - consul1: - address: "127.0.0.1:8500" - timeout: "5s" - -metadata_report: - protocol: "consul" - remote_ref: "consul1" - -service_discovery: - consul-dis: - protocol: "consul" - remote_ref: "consul1" - -services: - "UserProvider": - # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 - registry: "demoServiceDiscovery" - protocol: "dubbo" - # 相当于dubbo.xml中的interface - interface: "com.ikurento.user.UserProvider" - loadbalance: "random" - warmup: "100" - cluster: "failover" - methods: - - name: "GetUser" - retries: 1 - loadbalance: "random" - -protocols: - "dubbo": - name: "dubbo" - port: 20001 - - -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/registry/servicediscovery/consul/go-server/docker/docker-compose.yml b/registry/servicediscovery/consul/go-server/docker/docker-compose.yml deleted file mode 100644 index 5f9a5b1608..0000000000 --- a/registry/servicediscovery/consul/go-server/docker/docker-compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: '3' - -services: - consul: - image: consul:latest - ports: - - 8500:8500 - restart: on-failure - command: agent -server -bind=0.0.0.0 -client=0.0.0.0 -node=consul_Server1 -bootstrap-expect=1 -ui \ No newline at end of file diff --git a/registry/servicediscovery/consul/go-server/pkg/pojo/user.go b/registry/servicediscovery/consul/go-server/pkg/pojo/user.go deleted file mode 100644 index ebc12c3a40..0000000000 --- a/registry/servicediscovery/consul/go-server/pkg/pojo/user.go +++ /dev/null @@ -1,60 +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 pojo - -import ( - "context" - "time" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/config" -) - -import ( - gxlog "github.com/dubbogo/gost/log" -) - -func init() { - config.SetProviderService(new(UserProvider)) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { -} - -func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) { - gxlog.CInfo("req: %v\n", req) - rsp := User{"A001", "Alex Stocks", 18, time.Now()} - gxlog.CInfo("rsp: %v\n", rsp) - return &rsp, nil -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (u User) JavaClassName() string { - return "com.ikurento.user.User" -} diff --git a/registry/servicediscovery/consul/go-server/tests/integration/main_test.go b/registry/servicediscovery/consul/go-server/tests/integration/main_test.go deleted file mode 100644 index 5376a4dc9d..0000000000 --- a/registry/servicediscovery/consul/go-server/tests/integration/main_test.go +++ /dev/null @@ -1,76 +0,0 @@ -// +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" - "os" - "testing" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" - _ "dubbo.apache.org/dubbo-go/v3/metadata/service/inmemory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/remote/impl" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" - _ "dubbo.apache.org/dubbo-go/v3/registry/consul" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -var userProvider = new(UserProvider) - -func TestMain(m *testing.M) { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&User{}) - config.Load() - time.Sleep(3 * time.Second) - - os.Exit(m.Run()) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "com.ikurento.user.User" -} diff --git a/registry/servicediscovery/consul/go-server/tests/integration/userprovider_test.go b/registry/servicediscovery/consul/go-server/tests/integration/userprovider_test.go deleted file mode 100644 index dc29d9a5d3..0000000000 --- a/registry/servicediscovery/consul/go-server/tests/integration/userprovider_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// +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" - "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -func TestGetUser(t *testing.T) { - user := &User{} - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - assert.Nil(t, err) - assert.Equal(t, "A001", user.ID) - assert.Equal(t, "Alex Stocks", user.Name) - assert.Equal(t, int32(18), user.Age) - assert.NotNil(t, user.Time) -} diff --git a/registry/servicediscovery/etcd/go-client/FIXME.md b/registry/servicediscovery/etcd/go-client/FIXME.md deleted file mode 100644 index 600a1f4458..0000000000 --- a/registry/servicediscovery/etcd/go-client/FIXME.md +++ /dev/null @@ -1,36 +0,0 @@ -In order to make the client work, a conf/server.yml shown below is required. Need further investigation: - -```yaml -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "etcd1" - name_mapping: "in-memory" - metadata: "default" - -remote: - etcd: - address: "127.0.0.1:2379" - timeout: "5s" - -metadata_report: - protocol: "etcdv3" - remote_ref: "etcd" - -service_discovery: - etcd1: - protocol: "etcdv3" - remote_ref: "etcd" -``` \ No newline at end of file diff --git a/registry/servicediscovery/etcd/go-client/cmd/client.go b/registry/servicediscovery/etcd/go-client/cmd/client.go deleted file mode 100644 index feaf453a63..0000000000 --- a/registry/servicediscovery/etcd/go-client/cmd/client.go +++ /dev/null @@ -1,70 +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" - "os" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/dubbogo/gost/log" -) - -import ( - "github.com/apache/dubbo-go-samples/registry/servicediscovery/etcd/go-client/pkg" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/etcd" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" - _ "dubbo.apache.org/dubbo-go/v3/registry/etcdv3" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -var userProvider = new(pkg.UserProvider) - -func init() { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&pkg.User{}) -} - -// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run -func main() { - hessian.RegisterPOJO(&pkg.User{}) - config.Load() - time.Sleep(8 * time.Second) - - gxlog.CInfo("\n\n\nstart to test dubbo") - user := &pkg.User{} - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - if err != nil { - gxlog.CError("error: %v\n", err) - os.Exit(1) - return - } - gxlog.CInfo("response result: %v\n", user) -} diff --git a/registry/servicediscovery/etcd/go-client/conf/client.yml b/registry/servicediscovery/etcd/go-client/conf/client.yml deleted file mode 100644 index c4ed3b8c17..0000000000 --- a/registry/servicediscovery/etcd/go-client/conf/client.yml +++ /dev/null @@ -1,74 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "etcd1" - name_mapping: "in-memory" - metadata: "default" - -remote: - etcd: - address: "127.0.0.1:2379" - timeout: "5s" - -metadata_report: - protocol: "etcdv3" - remote_ref: "etcd" - -service_discovery: - etcd1: - protocol: "etcdv3" - remote_ref: "etcd" - -# reference config -references: - "UserProvider": - registry: "demoServiceDiscovery" - protocol: "dubbo" - provide_by: "UserInfoServer" - 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/registry/servicediscovery/etcd/go-client/conf/log.yml b/registry/servicediscovery/etcd/go-client/conf/log.yml deleted file mode 100644 index 2b6e93ad3c..0000000000 --- a/registry/servicediscovery/etcd/go-client/conf/log.yml +++ /dev/null @@ -1,27 +0,0 @@ -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/registry/servicediscovery/etcd/go-client/conf/server.yml b/registry/servicediscovery/etcd/go-client/conf/server.yml deleted file mode 100644 index a1d3052a9c..0000000000 --- a/registry/servicediscovery/etcd/go-client/conf/server.yml +++ /dev/null @@ -1,33 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "etcd1" - name_mapping: "in-memory" - metadata: "default" - -remote: - etcd: - address: "127.0.0.1:2379" - timeout: "5s" - -metadata_report: - protocol: "etcdv3" - remote_ref: "etcd" - -service_discovery: - etcd1: - protocol: "etcdv3" - remote_ref: "etcd" - diff --git a/registry/servicediscovery/etcd/go-client/pkg/user.go b/registry/servicediscovery/etcd/go-client/pkg/user.go deleted file mode 100644 index 7733ea4cb5..0000000000 --- a/registry/servicediscovery/etcd/go-client/pkg/user.go +++ /dev/null @@ -1,42 +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 pkg - -import ( - "context" - "time" -) - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/etcd/go-server/cmd/server.go b/registry/servicediscovery/etcd/go-server/cmd/server.go deleted file mode 100644 index 8319715349..0000000000 --- a/registry/servicediscovery/etcd/go-server/cmd/server.go +++ /dev/null @@ -1,80 +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 ( - "fmt" - "os" - "os/signal" - "syscall" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/apache/dubbo-go-samples/registry/servicediscovery/etcd/go-server/pkg" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - "dubbo.apache.org/dubbo-go/v3/common/logger" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/etcd" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" - _ "dubbo.apache.org/dubbo-go/v3/registry/etcdv3" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -var ( - survivalTimeout = int(3e9) -) - -// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run -func main() { - hessian.RegisterPOJO(&pkg.User{}) - config.Load() - - 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("provider app exit now...") - return - } - } -} diff --git a/registry/servicediscovery/etcd/go-server/conf/client.yml b/registry/servicediscovery/etcd/go-server/conf/client.yml deleted file mode 100644 index c4ed3b8c17..0000000000 --- a/registry/servicediscovery/etcd/go-server/conf/client.yml +++ /dev/null @@ -1,74 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "etcd1" - name_mapping: "in-memory" - metadata: "default" - -remote: - etcd: - address: "127.0.0.1:2379" - timeout: "5s" - -metadata_report: - protocol: "etcdv3" - remote_ref: "etcd" - -service_discovery: - etcd1: - protocol: "etcdv3" - remote_ref: "etcd" - -# reference config -references: - "UserProvider": - registry: "demoServiceDiscovery" - protocol: "dubbo" - provide_by: "UserInfoServer" - 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/registry/servicediscovery/etcd/go-server/conf/log.yml b/registry/servicediscovery/etcd/go-server/conf/log.yml deleted file mode 100644 index 2b6e93ad3c..0000000000 --- a/registry/servicediscovery/etcd/go-server/conf/log.yml +++ /dev/null @@ -1,27 +0,0 @@ -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/registry/servicediscovery/etcd/go-server/conf/server.yml b/registry/servicediscovery/etcd/go-server/conf/server.yml deleted file mode 100644 index 226ca2bb9c..0000000000 --- a/registry/servicediscovery/etcd/go-server/conf/server.yml +++ /dev/null @@ -1,71 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "etcd1" - name_mapping: "in-memory" - metadata: "default" - -remote: - etcd: - address: "127.0.0.1:2379" - timeout: "5s" - -metadata_report: - protocol: "etcdv3" - remote_ref: "etcd" - -service_discovery: - etcd1: - protocol: "etcdv3" - remote_ref: "etcd" - -# service config -services: - "UserProvider": - registry: "demoServiceDiscovery" - 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: 20001 - -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" \ No newline at end of file diff --git a/registry/servicediscovery/etcd/go-server/docker/docker-compose.yml b/registry/servicediscovery/etcd/go-server/docker/docker-compose.yml deleted file mode 100644 index 18c9d27b9c..0000000000 --- a/registry/servicediscovery/etcd/go-server/docker/docker-compose.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: '3' - -services: - etcd: - image: "quay.io/coreos/etcd:latest" - container_name: etcd - environment: - - ETCDCTL_API=3 - command: [ - "etcd", - "--name=etcd0", - "--advertise-client-urls=http://${DOCKER_HOST_IP}:2379", - "--listen-client-urls=http://0.0.0.0:2379", - "--initial-advertise-peer-urls=http://${DOCKER_HOST_IP}:2380", - "--listen-peer-urls=http://0.0.0.0:2380", - "--initial-cluster=etcd0=http://${DOCKER_HOST_IP}:2380", - ] - ports: - - "2379:2379" - - "2380:2380" - restart: always diff --git a/registry/servicediscovery/etcd/go-server/pkg/user.go b/registry/servicediscovery/etcd/go-server/pkg/user.go deleted file mode 100644 index bda734477e..0000000000 --- a/registry/servicediscovery/etcd/go-server/pkg/user.go +++ /dev/null @@ -1,63 +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 pkg - -import ( - "context" - "time" -) - -import ( - "github.com/dubbogo/gost/log" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/config" - hessian "github.com/apache/dubbo-go-hessian2" -) - -func init() { - config.SetProviderService(new(UserProvider)) - // ------for hessian2------ - hessian.RegisterPOJO(&User{}) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { -} - -func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) { - gxlog.CInfo("req:%#v", req) - rsp := User{"A001", "Alex Stocks", 18, time.Now()} - gxlog.CInfo("rsp:%#v", rsp) - return &rsp, nil -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (u User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/etcd/go-server/tests/integration/main_test.go b/registry/servicediscovery/etcd/go-server/tests/integration/main_test.go deleted file mode 100644 index 38906680b3..0000000000 --- a/registry/servicediscovery/etcd/go-server/tests/integration/main_test.go +++ /dev/null @@ -1,75 +0,0 @@ -// +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 ( - hessian "github.com/apache/dubbo-go-hessian2" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/etcd" - _ "dubbo.apache.org/dubbo-go/v3/metadata/remote/impl" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" - _ "dubbo.apache.org/dubbo-go/v3/registry/etcdv3" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -import ( - "context" - "os" - "testing" - "time" -) - -var userProvider = new(UserProvider) - -func TestMain(m *testing.M) { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&User{}) - config.Load() - time.Sleep(3 * time.Second) - - os.Exit(m.Run()) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/etcd/go-server/tests/integration/userprovider_test.go b/registry/servicediscovery/etcd/go-server/tests/integration/userprovider_test.go deleted file mode 100644 index dc29d9a5d3..0000000000 --- a/registry/servicediscovery/etcd/go-server/tests/integration/userprovider_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// +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" - "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -func TestGetUser(t *testing.T) { - user := &User{} - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - assert.Nil(t, err) - assert.Equal(t, "A001", user.ID) - assert.Equal(t, "Alex Stocks", user.Name) - assert.Equal(t, int32(18), user.Age) - assert.NotNil(t, user.Time) -} diff --git a/registry/servicediscovery/file/go-client/FIXME.md b/registry/servicediscovery/file/go-client/FIXME.md deleted file mode 100644 index 211fffbb90..0000000000 --- a/registry/servicediscovery/file/go-client/FIXME.md +++ /dev/null @@ -1,26 +0,0 @@ -In order to make the client work, a conf/server.yml shown below is required. Need further investigation: - -```yaml -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "file1" - name_mapping: "in-memory" - metadata: "default" - -service_discovery: - file1: - protocol: "file" -``` \ No newline at end of file diff --git a/registry/servicediscovery/file/go-client/cmd/client.go b/registry/servicediscovery/file/go-client/cmd/client.go deleted file mode 100644 index 191426f319..0000000000 --- a/registry/servicediscovery/file/go-client/cmd/client.go +++ /dev/null @@ -1,70 +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" - "os" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/dubbogo/gost/log" -) - -import ( - "github.com/apache/dubbo-go-samples/registry/servicediscovery/file/go-client/pkg" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/service/inmemory" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/registry/file" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" - _ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper" -) - -var userProvider = new(pkg.UserProvider) - -func init() { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&pkg.User{}) -} - -// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run -func main() { - hessian.RegisterPOJO(&pkg.User{}) - config.Load() - time.Sleep(8 * time.Second) - - gxlog.CInfo("\n\n\nstart to test dubbo") - user := &pkg.User{} - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - if err != nil { - gxlog.CError("error: %v\n", err) - os.Exit(1) - return - } - gxlog.CInfo("response result: %v\n", user) -} diff --git a/registry/servicediscovery/file/go-client/conf/client.yml b/registry/servicediscovery/file/go-client/conf/client.yml deleted file mode 100644 index a8c97e6bd3..0000000000 --- a/registry/servicediscovery/file/go-client/conf/client.yml +++ /dev/null @@ -1,64 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "file1" - name_mapping: "in-memory" - metadata: "default" - -service_discovery: - file1: - protocol: "file" - -# reference config -references: - "UserProvider": - provide_by: "UserInfoServer" - registry: "demoServiceDiscovery" - 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/registry/servicediscovery/file/go-client/conf/log.yml b/registry/servicediscovery/file/go-client/conf/log.yml deleted file mode 100644 index 2b6e93ad3c..0000000000 --- a/registry/servicediscovery/file/go-client/conf/log.yml +++ /dev/null @@ -1,27 +0,0 @@ -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/registry/servicediscovery/file/go-client/conf/server.yml b/registry/servicediscovery/file/go-client/conf/server.yml deleted file mode 100644 index 9a6ef01665..0000000000 --- a/registry/servicediscovery/file/go-client/conf/server.yml +++ /dev/null @@ -1,23 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "file1" - name_mapping: "in-memory" - metadata: "default" - -service_discovery: - file1: - protocol: "file" - diff --git a/registry/servicediscovery/file/go-client/pkg/user.go b/registry/servicediscovery/file/go-client/pkg/user.go deleted file mode 100644 index 7733ea4cb5..0000000000 --- a/registry/servicediscovery/file/go-client/pkg/user.go +++ /dev/null @@ -1,42 +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 pkg - -import ( - "context" - "time" -) - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/file/go-server/cmd/server.go b/registry/servicediscovery/file/go-server/cmd/server.go deleted file mode 100644 index 50d093db37..0000000000 --- a/registry/servicediscovery/file/go-server/cmd/server.go +++ /dev/null @@ -1,81 +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 ( - "fmt" - "os" - "os/signal" - "syscall" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/apache/dubbo-go-samples/registry/servicediscovery/file/go-server/pkg" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - "dubbo.apache.org/dubbo-go/v3/common/logger" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/config_center/file" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/service/inmemory" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" - _ "dubbo.apache.org/dubbo-go/v3/registry/file" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -var ( - survivalTimeout = int(3e9) -) - -// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run -func main() { - hessian.RegisterPOJO(&pkg.User{}) - config.Load() - - 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("provider app exit now...") - return - } - } -} diff --git a/registry/servicediscovery/file/go-server/conf/client.yml b/registry/servicediscovery/file/go-server/conf/client.yml deleted file mode 100644 index 4841b1bf9e..0000000000 --- a/registry/servicediscovery/file/go-server/conf/client.yml +++ /dev/null @@ -1,63 +0,0 @@ -# dubbo client yaml configure file - -check: true -# client -request_timeout: "3s" -# connect timeout -connect_timeout: "3s" - -# application config -application: - organization: "dubbo.io" - name: "UserInfoServer" - module: "dubbo-go user-info client" - version: "0.0.1" - environment: "dev" - -# registry config -registries: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "file1" - name_mapping: "in-memory" - metadata: "default" - -service_discovery: - file1: - protocol: "file" - -# reference config -references: - "UserProvider": - registry: "demoServiceDiscovery" - 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/registry/servicediscovery/file/go-server/conf/log.yml b/registry/servicediscovery/file/go-server/conf/log.yml deleted file mode 100644 index 2b6e93ad3c..0000000000 --- a/registry/servicediscovery/file/go-server/conf/log.yml +++ /dev/null @@ -1,27 +0,0 @@ -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/registry/servicediscovery/file/go-server/conf/server.yml b/registry/servicediscovery/file/go-server/conf/server.yml deleted file mode 100644 index b5d4265aa0..0000000000 --- a/registry/servicediscovery/file/go-server/conf/server.yml +++ /dev/null @@ -1,61 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "file1" - name_mapping: "in-memory" - metadata: "default" - -service_discovery: - file1: - protocol: "file" - -# service config -services: - "UserProvider": - registry: "demoServiceDiscovery" - 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: 20001 - -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" \ No newline at end of file diff --git a/registry/servicediscovery/file/go-server/pkg/user.go b/registry/servicediscovery/file/go-server/pkg/user.go deleted file mode 100644 index bda734477e..0000000000 --- a/registry/servicediscovery/file/go-server/pkg/user.go +++ /dev/null @@ -1,63 +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 pkg - -import ( - "context" - "time" -) - -import ( - "github.com/dubbogo/gost/log" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/config" - hessian "github.com/apache/dubbo-go-hessian2" -) - -func init() { - config.SetProviderService(new(UserProvider)) - // ------for hessian2------ - hessian.RegisterPOJO(&User{}) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { -} - -func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) { - gxlog.CInfo("req:%#v", req) - rsp := User{"A001", "Alex Stocks", 18, time.Now()} - gxlog.CInfo("rsp:%#v", rsp) - return &rsp, nil -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (u User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/file/go-server/tests/integration/main_test.go b/registry/servicediscovery/file/go-server/tests/integration/main_test.go deleted file mode 100644 index 4cde06ba2c..0000000000 --- a/registry/servicediscovery/file/go-server/tests/integration/main_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// +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 ( - hessian "github.com/apache/dubbo-go-hessian2" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/consul" - _ "dubbo.apache.org/dubbo-go/v3/metadata/service/inmemory" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/registry/consul" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -import ( - "context" - "os" - "testing" - "time" -) - -var userProvider = new(UserProvider) - -func TestMain(m *testing.M) { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&User{}) - config.Load() - time.Sleep(3 * time.Second) - - os.Exit(m.Run()) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/file/go-server/tests/integration/userprovider_test.go b/registry/servicediscovery/file/go-server/tests/integration/userprovider_test.go deleted file mode 100644 index dc29d9a5d3..0000000000 --- a/registry/servicediscovery/file/go-server/tests/integration/userprovider_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// +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" - "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -func TestGetUser(t *testing.T) { - user := &User{} - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - assert.Nil(t, err) - assert.Equal(t, "A001", user.ID) - assert.Equal(t, "Alex Stocks", user.Name) - assert.Equal(t, int32(18), user.Age) - assert.NotNil(t, user.Time) -} diff --git a/registry/servicediscovery/nacos/go-client/FIXME.md b/registry/servicediscovery/nacos/go-client/FIXME.md deleted file mode 100644 index 5870f6cb2c..0000000000 --- a/registry/servicediscovery/nacos/go-client/FIXME.md +++ /dev/null @@ -1,40 +0,0 @@ -In order to make the client work, a conf/server.yml shown below is required. Need further investigation: - -```yaml -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "nacos1" - name_mapping: "dynamic" - metadata: "default" - -remote: - nacos: - address: "127.0.0.1:8848" - timeout: "5s" - -metadata_report: - protocol: "nacos" - remote_ref: "nacos" - -service_discovery: - nacos1: - protocol: "nacos" - remote_ref: "nacos" - -config_center: - protocol: "nacos" - address: "127.0.0.1:8848" -``` \ No newline at end of file diff --git a/registry/servicediscovery/nacos/go-client/cmd/client.go b/registry/servicediscovery/nacos/go-client/cmd/client.go deleted file mode 100644 index 1c033ca07a..0000000000 --- a/registry/servicediscovery/nacos/go-client/cmd/client.go +++ /dev/null @@ -1,71 +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" - "os" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/dubbogo/gost/log" -) - -import ( - "github.com/apache/dubbo-go-samples/registry/servicediscovery/etcd/go-client/pkg" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/config_center/nacos" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/nacos" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/registry/nacos" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" - _ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper" -) - -var userProvider = new(pkg.UserProvider) - -func init() { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&pkg.User{}) -} - -// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run -func main() { - hessian.RegisterPOJO(&pkg.User{}) - config.Load() - time.Sleep(8 * time.Second) - - gxlog.CInfo("\n\n\nstart to test dubbo") - user := &pkg.User{} - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - if err != nil { - gxlog.CError("error: %v\n", err) - os.Exit(1) - return - } - gxlog.CInfo("response result: %v\n", user) -} diff --git a/registry/servicediscovery/nacos/go-client/conf/client.yml b/registry/servicediscovery/nacos/go-client/conf/client.yml deleted file mode 100644 index 73307ba2bf..0000000000 --- a/registry/servicediscovery/nacos/go-client/conf/client.yml +++ /dev/null @@ -1,77 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "nacos1" - name_mapping: "dynamic" - metadata: "default" - -remote: - nacos: - address: "127.0.0.1:8848" - timeout: "5s" - -metadata_report: - protocol: "nacos" - remote_ref: "nacos" - -service_discovery: - nacos1: - protocol: "nacos" - remote_ref: "nacos" - -config_center: - protocol: "nacos" - address: "127.0.0.1:8848" - -# reference config -references: - "UserProvider": - registry: "demoServiceDiscovery" - 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/registry/servicediscovery/nacos/go-client/conf/log.yml b/registry/servicediscovery/nacos/go-client/conf/log.yml deleted file mode 100644 index 2b6e93ad3c..0000000000 --- a/registry/servicediscovery/nacos/go-client/conf/log.yml +++ /dev/null @@ -1,27 +0,0 @@ -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/registry/servicediscovery/nacos/go-client/conf/server.yml b/registry/servicediscovery/nacos/go-client/conf/server.yml deleted file mode 100644 index 398f788312..0000000000 --- a/registry/servicediscovery/nacos/go-client/conf/server.yml +++ /dev/null @@ -1,37 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "nacos1" - name_mapping: "dynamic" - metadata: "default" - -remote: - nacos: - address: "127.0.0.1:8848" - timeout: "5s" - -metadata_report: - protocol: "nacos" - remote_ref: "nacos" - -service_discovery: - nacos1: - protocol: "nacos" - remote_ref: "nacos" - -config_center: - protocol: "nacos" - address: "127.0.0.1:8848" - diff --git a/registry/servicediscovery/nacos/go-client/pkg/user.go b/registry/servicediscovery/nacos/go-client/pkg/user.go deleted file mode 100644 index 7733ea4cb5..0000000000 --- a/registry/servicediscovery/nacos/go-client/pkg/user.go +++ /dev/null @@ -1,42 +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 pkg - -import ( - "context" - "time" -) - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/nacos/go-server/cmd/server.go b/registry/servicediscovery/nacos/go-server/cmd/server.go deleted file mode 100644 index e54f58ca31..0000000000 --- a/registry/servicediscovery/nacos/go-server/cmd/server.go +++ /dev/null @@ -1,81 +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 ( - "fmt" - "os" - "os/signal" - "syscall" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/apache/dubbo-go-samples/registry/servicediscovery/nacos/go-server/pkg" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - "dubbo.apache.org/dubbo-go/v3/common/logger" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/config_center/nacos" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/nacos" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" - _ "dubbo.apache.org/dubbo-go/v3/registry/nacos" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" -) - -var ( - survivalTimeout = int(3e9) -) - -// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run -func main() { - hessian.RegisterPOJO(&pkg.User{}) - config.Load() - - 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("provider app exit now...") - return - } - } -} diff --git a/registry/servicediscovery/nacos/go-server/conf/client.yml b/registry/servicediscovery/nacos/go-server/conf/client.yml deleted file mode 100644 index a7f90a0d72..0000000000 --- a/registry/servicediscovery/nacos/go-server/conf/client.yml +++ /dev/null @@ -1,77 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "nacos1" - name_mapping: "dynamic" - metadata: "default" - -remote: - nacos: - address: "127.0.0.1:8848" - timeout: "5s" - -metadata_report: - protocol: "nacos" - remote_ref: "nacos" - -service_discovery: - nacos1: - protocol: "nacos" - remote_ref: "nacos" - -config_center: - protocol: "nacos" - address: "127.0.0.1:8848" - -# reference config -references: - "UserProvider": - registry: "demoServiceDiscovery" - 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/registry/servicediscovery/nacos/go-server/conf/log.yml b/registry/servicediscovery/nacos/go-server/conf/log.yml deleted file mode 100644 index 2b6e93ad3c..0000000000 --- a/registry/servicediscovery/nacos/go-server/conf/log.yml +++ /dev/null @@ -1,27 +0,0 @@ -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/registry/servicediscovery/nacos/go-server/conf/server.yml b/registry/servicediscovery/nacos/go-server/conf/server.yml deleted file mode 100644 index dbf37ad702..0000000000 --- a/registry/servicediscovery/nacos/go-server/conf/server.yml +++ /dev/null @@ -1,75 +0,0 @@ -# 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: - "demoServiceDiscovery": - protocol: "service-discovery" - params: - service_discovery: "nacos1" - name_mapping: "dynamic" - metadata: "default" - -remote: - nacos: - address: "127.0.0.1:8848" - timeout: "5s" - -metadata_report: - protocol: "nacos" - remote_ref: "nacos" - -service_discovery: - nacos1: - protocol: "nacos" - remote_ref: "nacos" - -config_center: - protocol: "nacos" - address: "127.0.0.1:8848" - -# service config -services: - "UserProvider": - registry: "demoServiceDiscovery" - 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: 20001 - -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/registry/servicediscovery/nacos/go-server/docker/docker-compose.yml b/registry/servicediscovery/nacos/go-server/docker/docker-compose.yml deleted file mode 100644 index 4b1d3d3bf2..0000000000 --- a/registry/servicediscovery/nacos/go-server/docker/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: "3" - -services: - nacos: - image: nacos/nacos-server:latest - container_name: nacos-standalone - environment: - - PREFER_HOST_MODE=hostname - - MODE=standalone - ports: - - "8848:8848" \ No newline at end of file diff --git a/registry/servicediscovery/nacos/go-server/pkg/user.go b/registry/servicediscovery/nacos/go-server/pkg/user.go deleted file mode 100644 index bda734477e..0000000000 --- a/registry/servicediscovery/nacos/go-server/pkg/user.go +++ /dev/null @@ -1,63 +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 pkg - -import ( - "context" - "time" -) - -import ( - "github.com/dubbogo/gost/log" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/config" - hessian "github.com/apache/dubbo-go-hessian2" -) - -func init() { - config.SetProviderService(new(UserProvider)) - // ------for hessian2------ - hessian.RegisterPOJO(&User{}) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { -} - -func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) { - gxlog.CInfo("req:%#v", req) - rsp := User{"A001", "Alex Stocks", 18, time.Now()} - gxlog.CInfo("rsp:%#v", rsp) - return &rsp, nil -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (u User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/nacos/go-server/tests/integration/main_test.go b/registry/servicediscovery/nacos/go-server/tests/integration/main_test.go deleted file mode 100644 index dd1a894a9d..0000000000 --- a/registry/servicediscovery/nacos/go-server/tests/integration/main_test.go +++ /dev/null @@ -1,76 +0,0 @@ -// +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 ( - hessian "github.com/apache/dubbo-go-hessian2" - - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/config_center/nacos" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/nacos" - _ "dubbo.apache.org/dubbo-go/v3/metadata/remote/impl" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/registry/nacos" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" - _ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper" -) - -import ( - "context" - "os" - "testing" - "time" -) - -var userProvider = new(UserProvider) - -func TestMain(m *testing.M) { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&User{}) - config.Load() - time.Sleep(3 * time.Second) - - os.Exit(m.Run()) -} - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/registry/servicediscovery/nacos/go-server/tests/integration/userprovider_test.go b/registry/servicediscovery/nacos/go-server/tests/integration/userprovider_test.go deleted file mode 100644 index dc29d9a5d3..0000000000 --- a/registry/servicediscovery/nacos/go-server/tests/integration/userprovider_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// +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" - "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -func TestGetUser(t *testing.T) { - user := &User{} - err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) - assert.Nil(t, err) - assert.Equal(t, "A001", user.ID) - assert.Equal(t, "Alex Stocks", user.Name) - assert.Equal(t, int32(18), user.Age) - assert.NotNil(t, user.Time) -} diff --git a/start_integrate_test.sh b/start_integrate_test.sh index 97086ff8a8..8de205ec83 100755 --- a/start_integrate_test.sh +++ b/start_integrate_test.sh @@ -46,7 +46,6 @@ array+=("metric/go-server") array+=("registry/zookeeper/go-server") array+=("registry/etcd/go-server") - # registry/servicediscovery/zookeeper array+=("registry/servicediscovery/zookeeper/go-server")