forked from huaweicloud/dubbo-servicecomb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…认值不生效的问题和初始化顺序问题
- Loading branch information
Showing
14 changed files
with
376 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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,13 @@ | ||
运行测试的步骤: | ||
|
||
1. 安装本地微服务引擎并启动 | ||
2. 运行 PriceApplication | ||
3. 运行 OrderApplication | ||
4. 配置中心下发配置项: | ||
|
||
[全局配置] dubbo.servicecomb.test.configuration: peizhi | ||
[服务配置:price-provider] dubbo.servicecomb.test.configurationService: peizhi_service | ||
[全局配置] dubbo.servicecomb.governance: {"providerInfos":[{"serviceName":"price-provider","schemaInfos":[{"schemaId":"com.huaweicloud.it.price.PriceService","parameters":{"timeout":5000}}]}]} | ||
|
||
5. 运行 PortalApplication 查看测试结果, 如果成功,输出 `running all test cases successfully` | ||
|
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
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
57 changes: 57 additions & 0 deletions
57
...sts/discovery-tests-client/src/main/java/com/huaweicloud/it/portal/PortalApplication.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,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.it.portal; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@SpringBootApplication | ||
@Component | ||
public class PortalApplication { | ||
private static PortalController portalController; | ||
|
||
@LoadBalanced | ||
@Bean | ||
public RestTemplate restTemplate() { | ||
RestTemplate restTemplate = new RestTemplate(); | ||
return restTemplate; | ||
} | ||
|
||
@Autowired | ||
void setPortalController(PortalController portalController) { | ||
PortalApplication.portalController = portalController; | ||
} | ||
|
||
|
||
public static void main(String[] args) throws Exception { | ||
try { | ||
SpringApplication.run(PortalApplication.class); | ||
} catch (Throwable e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
System.out.println("running all test cases"); | ||
portalController.testAll(); | ||
System.out.println("running all test cases successfully"); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...ests/discovery-tests-client/src/main/java/com/huaweicloud/it/portal/PortalController.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,48 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.it.portal; | ||
|
||
import org.junit.Assert; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@RestController | ||
@RequestMapping(path = "/portal") | ||
public class PortalController { | ||
@Autowired | ||
private RestTemplate restTemplate; | ||
|
||
@GetMapping(path = "testAll") | ||
public void testAll() { | ||
|
||
String result = restTemplate.getForObject("http://order-consumer/price/sayHello?name={name}", String.class, "hello world"); | ||
Assert.assertEquals(result, "hello world"); | ||
|
||
result = restTemplate.getForObject("http://order-consumer/price/sayHello?name={name}", String.class, "timeout"); | ||
Assert.assertEquals(result, "timeout"); | ||
|
||
result = restTemplate.getForObject("http://order-consumer/price/testConfiguration", String.class); | ||
Assert.assertEquals(result, "peizhi"); | ||
|
||
result = restTemplate.getForObject("http://order-consumer/price/testConfigurationService", String.class); | ||
Assert.assertEquals(result, "peizhi_service"); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
integration-tests/discovery-tests/discovery-tests-client/src/main/resources/application.yml
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,31 @@ | ||
## --------------------------------------------------------------------------- | ||
## 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. | ||
## --------------------------------------------------------------------------- | ||
|
||
server: | ||
port: 8088 | ||
|
||
spring: | ||
application: | ||
name: portal-consumer | ||
cloud: | ||
servicecomb: | ||
discovery: | ||
enabled: true | ||
address: http://127.0.0.1:30100 | ||
appName: discovery | ||
serviceName: portal-consumer | ||
version: 0.0.1 |
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
Oops, something went wrong.