-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1334 from daizhenyu/tag-transmission-demo
流量标签透传插件集成测试demo:dubbo demo、rpc-api demo、公共httpserver demo
- Loading branch information
Showing
29 changed files
with
1,061 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
sermant-integration-tests/tag-transmission-test/alibaba-dubbo-consumer-demo/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>com.huaweicloud.sermant.tagtransmission</groupId> | ||
<artifactId>tag-transmission-test</artifactId> | ||
<version>1.0.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>alibaba-dubbo-consumer-demo</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<zkclient.version>0.10</zkclient.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-recipes</artifactId> | ||
<version>${curator.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-framework</artifactId> | ||
<version>${curator.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-x-discovery</artifactId> | ||
<version>${curator.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>${alibaba.dubbo.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.101tec</groupId> | ||
<artifactId>zkclient</artifactId> | ||
<version>${zkclient.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.huaweicloud.sermant.tagtransmission</groupId> | ||
<artifactId>rpc-api-demo</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
41 changes: 41 additions & 0 deletions
41
...aweicloud/demo/tagtransmission/alibabadubbo/consumer/AlibabaDubboConsumerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.demo.tagtransmission.alibabadubbo.consumer; | ||
|
||
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* springboot 启动类 | ||
* | ||
* @author daizhenyu | ||
* @since 2023-09-07 | ||
**/ | ||
@EnableDubbo | ||
@SpringBootApplication | ||
public class AlibabaDubboConsumerApplication { | ||
/** | ||
* 启动类 | ||
* | ||
* @param args 进程启动入参 | ||
*/ | ||
public static void main(String[] args) { | ||
SpringApplication.run(AlibabaDubboConsumerApplication.class, args); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...eicloud/demo/tagtransmission/alibabadubbo/consumer/controller/AlibabaDubboController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.demo.tagtransmission.alibabadubbo.consumer.controller; | ||
|
||
import com.huaweicloud.demo.tagtransmission.rpc.api.alibabadubbo.AlibabaTagTransmissionService; | ||
|
||
import com.alibaba.dubbo.config.annotation.Reference; | ||
|
||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* alibaba dubbo消费端 | ||
* | ||
* @author daizhenyu | ||
* @since 2023-09-08 | ||
**/ | ||
@RestController | ||
@RequestMapping("alibabaDubbo") | ||
public class AlibabaDubboController { | ||
@Reference(loadbalance = "random") | ||
private AlibabaTagTransmissionService tagTransmissionService; | ||
|
||
/** | ||
* 验证alibaba dubbo透传流量标签 | ||
* | ||
* @return 流量标签值 | ||
*/ | ||
@RequestMapping(value = "testAlibabaDubbo", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) | ||
@ResponseBody | ||
public String testAlibabaDubbo() { | ||
return tagTransmissionService.transmitTag(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...sts/tag-transmission-test/alibaba-dubbo-consumer-demo/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Spring Boot应用程序配置 | ||
spring: | ||
application: | ||
name: alibaba-dubbo-consumer | ||
main: | ||
allow-bean-definition-overriding: true | ||
server: | ||
port: 9041 | ||
|
||
# Dubbo配置 | ||
dubbo: | ||
application: | ||
name: alibaba-dubbo-consumer | ||
qos-port: 33335 | ||
registry: | ||
address: zookeeper://127.0.0.1:2181 | ||
protocol: | ||
name: dubbo | ||
port: -1 |
71 changes: 71 additions & 0 deletions
71
sermant-integration-tests/tag-transmission-test/alibaba-dubbo-provider-demo/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>com.huaweicloud.sermant.tagtransmission</groupId> | ||
<artifactId>tag-transmission-test</artifactId> | ||
<version>1.0.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>alibaba-dubbo-provider-demo</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<tag-transmission.version>1.0.0</tag-transmission.version> | ||
<zkclient.version>0.10</zkclient.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-recipes</artifactId> | ||
<version>${curator.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-framework</artifactId> | ||
<version>${curator.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-x-discovery</artifactId> | ||
<version>${curator.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>${alibaba.dubbo.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.101tec</groupId> | ||
<artifactId>zkclient</artifactId> | ||
<version>${zkclient.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.huaweicloud.sermant.tagtransmission</groupId> | ||
<artifactId>rpc-api-demo</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.huaweicloud.sermant.tagtransmission</groupId> | ||
<artifactId>tag-transmission-util-demo</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
41 changes: 41 additions & 0 deletions
41
...aweicloud/demo/tagtransmission/alibabadubbo/provider/AlibabaDubboProviderApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.demo.tagtransmission.alibabadubbo.provider; | ||
|
||
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* springboot 启动类 | ||
* | ||
* @author daizhenyu | ||
* @since 2023-09-07 | ||
**/ | ||
@SpringBootApplication | ||
@EnableDubbo | ||
public class AlibabaDubboProviderApplication { | ||
/** | ||
* 启动类 | ||
* | ||
* @param args 进程启动入参 | ||
*/ | ||
public static void main(String[] args) { | ||
SpringApplication.run(AlibabaDubboProviderApplication.class, args); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
.../tagtransmission/alibabadubbo/provider/serviceimpl/AlibabaTagTransmissionServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.demo.tagtransmission.alibabadubbo.provider.serviceimpl; | ||
|
||
import com.huaweicloud.demo.tagtransmission.rpc.api.alibabadubbo.AlibabaTagTransmissionService; | ||
import com.huaweicloud.demo.tagtransmission.util.HttpClientUtils; | ||
|
||
import com.alibaba.dubbo.config.annotation.Service; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
|
||
/** | ||
* alibaba dubbo服务实现类 | ||
* | ||
* @author daizhenyu | ||
* @since 2023-09-08 | ||
**/ | ||
@Service | ||
public class AlibabaTagTransmissionServiceImpl implements AlibabaTagTransmissionService { | ||
@Value("${common.server.url}") | ||
private String commonServerUrl; | ||
|
||
@Override | ||
public String transmitTag() { | ||
return HttpClientUtils.doHttpUrlConnectionGet(commonServerUrl); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...g-transmission-test/alibaba-dubbo-provider-demo/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
common.server.url=http://127.0.0.1:9040/common/httpServer |
19 changes: 19 additions & 0 deletions
19
...sts/tag-transmission-test/alibaba-dubbo-provider-demo/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Spring Boot应用程序配置 | ||
spring: | ||
application: | ||
name: alibaba-dubbo-provider | ||
main: | ||
allow-bean-definition-overriding: true | ||
server: | ||
port: 9042 | ||
|
||
# Dubbo配置 | ||
dubbo: | ||
application: | ||
name: alibaba-dubbo-provider | ||
qos-port: 33336 | ||
registry: | ||
address: zookeeper://127.0.0.1:2181 | ||
protocol: | ||
name: dubbo | ||
port: -1 |
Oops, something went wrong.