[
https://issues.apache.org/jira/browse/SCB-897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610011#comment-16610011
]
ASF GitHub Bot commented on SCB-897:
------------------------------------
liubao68 closed pull request #899: [SCB-897] add bizkeepertestdemo
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/899
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/demo/demo-springmvc/springmvc-client/pom.xml
b/demo/demo-springmvc/springmvc-client/pom.xml
index 21be7b09b..75cb3f01d 100644
--- a/demo/demo-springmvc/springmvc-client/pom.xml
+++ b/demo/demo-springmvc/springmvc-client/pom.xml
@@ -54,6 +54,10 @@
<groupId>org.apache.servicecomb.demo</groupId>
<artifactId>demo-signature</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>foundation-test-scaffolding</artifactId>
+ </dependency>
</dependencies>
<properties>
diff --git
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
index d3760e375..a51588f1b 100644
---
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
+++
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
@@ -76,6 +76,8 @@
private TestContentType testContentType = new TestContentType();
+ private TestBizkeeper testBizkeeper = new TestBizkeeper();
+
@Override
protected void testOnlyRest(RestTemplate template, String cseUrlPrefix) {
testDownload.runRest();
@@ -110,6 +112,7 @@ protected void testAllTransport(String microserviceName,
RestTemplate template,
testObject.runAllTransport();
testGeneric.runAllTransport();
testRestTemplate.runAllTest();
+ testBizkeeper.runAllTest();
testResponseEntity("springmvc", template, cseUrlPrefix);
testCodeFirstTestForm(template, cseUrlPrefix);
diff --git
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestBizkeeper.java
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestBizkeeper.java
new file mode 100644
index 000000000..c074693a7
--- /dev/null
+++
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestBizkeeper.java
@@ -0,0 +1,52 @@
+package org.apache.servicecomb.demo.springmvc.client;
+
+import java.util.concurrent.TimeoutException;
+
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
+import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.springframework.web.client.RestTemplate;
+
+public class TestBizkeeper {
+ private RestTemplate restTemplate = RestTemplateBuilder.create();
+
+ private String prefix = "cse://springmvc/codeFirstBizkeeperTest";
+
+ public void runAllTest() {
+ testTimeout();
+ }
+
+ private void testTimeout() {
+ //config timeout starts with cse.xxx, from yaml
+ try {
+ restTemplate.getForObject(prefix +
"/testTimeout?name={1}&delaytime={2}", String.class, "joker", 1000);
+ TestMgr.check("expect: throw timeout exception", "real: not throw
timeout exception");
+ } catch (Exception e) {
+ TestMgr.check(TimeoutException.class,
e.getCause().getCause().getClass());
+ }
+ //modify config timeout starts with servicecomb.xxx, can change the
timeout effect
+ ArchaiusUtils.setProperty(
+
"servicecomb.isolation.Consumer.springmvc.codeFirstBizkeeperTest.testTimeout.timeout.enabled",
"false");
+ try {
+ String result =
+ restTemplate.getForObject(prefix +
"/testTimeout?name={1}&delaytime={2}", String.class, "joker", 1000);
+ TestMgr.check("joker", result);
+ } catch (Exception e) {
+ TestMgr.check("expect: not throw timeout exception", "real: throw
timeout exception");
+ }
+
+ try {
+ ArchaiusUtils.setProperty(
+
"servicecomb.fallback.Consumer.springmvc.codeFirstBizkeeperTest.testTimeout.enabled",
"false");
+ ArchaiusUtils.setProperty(
+
"servicecomb.isolation.Consumer.springmvc.codeFirstBizkeeperTest.testTimeout.timeout.enabled",
"true");
+ ArchaiusUtils.setProperty(
+
"servicecomb.isolation.Consumer.springmvc.codeFirstBizkeeperTest.testTimeout.timeoutInMilliseconds",
500);
+ restTemplate.getForObject(prefix +
"/testTimeout?name={1}&delaytime={2}", String.class, "joker", 500);
+ TestMgr.check("expect: throw timeout exception", "real: not throw
timeout exception");
+ } catch (InvocationException e) {
+ TestMgr.check(TimeoutException.class,
e.getCause().getCause().getClass());
+ }
+ }
+}
diff --git
a/demo/demo-springmvc/springmvc-client/src/main/resources/microservice.yaml
b/demo/demo-springmvc/springmvc-client/src/main/resources/microservice.yaml
index 03b137c79..9a4b22032 100644
--- a/demo/demo-springmvc/springmvc-client/src/main/resources/microservice.yaml
+++ b/demo/demo-springmvc/springmvc-client/src/main/resources/microservice.yaml
@@ -109,6 +109,20 @@ servicecomb:
duplicate1: newer
cse:
+ fallback:
+ Consumer:
+ springmvc:
+ codeFirstBizkeeperTest:
+ testTimeout:
+ enabled: false
+ isolation:
+ Consumer:
+ springmvc:
+ codeFirstBizkeeperTest:
+ testTimeout:
+ timeout:
+ enabled: true
+ timeoutInMilliseconds: 1000
test:
duplicate2: newer
#########SSL options
diff --git
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/BizkeeperTest.java
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/BizkeeperTest.java
new file mode 100644
index 000000000..8f8e71df7
--- /dev/null
+++
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/BizkeeperTest.java
@@ -0,0 +1,21 @@
+package org.apache.servicecomb.demo.springmvc.server;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "codeFirstBizkeeperTest")
+@RequestMapping(path = "/codeFirstBizkeeperTest", produces =
MediaType.APPLICATION_JSON_VALUE)
+public class BizkeeperTest {
+ @GetMapping(path = "/testTimeout")
+ public String testTimeout(@RequestParam("name") String name,
@RequestParam("delaytime") long delaytime) {
+ try {
+ Thread.sleep(delaytime);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return name;
+ }
+}
diff --git
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
index 6023d1dd9..e19296faa 100644
---
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
+++
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
@@ -59,7 +59,7 @@ public void testSchemaNotChange() {
}
public void testRegisteredBasePath() {
- TestMgr.check(12, RegistryUtils.getMicroservice().getPaths().size());
+ TestMgr.check(13, RegistryUtils.getMicroservice().getPaths().size());
}
private String getSwaggerContent(Swagger swagger) {
diff --git a/demo/pom.xml b/demo/pom.xml
index b1a7bc816..59a2fd027 100644
--- a/demo/pom.xml
+++ b/demo/pom.xml
@@ -117,6 +117,11 @@
<artifactId>crossapp-client</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>foundation-test-scaffolding</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</dependencyManagement>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Support config rest server max initial line length
> --------------------------------------------------
>
> Key: SCB-897
> URL: https://issues.apache.org/jira/browse/SCB-897
> Project: Apache ServiceComb
> Issue Type: Improvement
> Reporter: YaoHaishi
> Assignee: YaoHaishi
> Priority: Major
> Fix For: java-chassis-1.1.0
>
>
> Currently the http request first line length is limited to 4096 on provider
> side.
> We need to provide a config item for user to specify it.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)