You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/06/05 06:23:23 UTC
[servicecomb-java-chassis] branch master updated: [SCB-1987] adjust
test code for filter chain mode
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new f0cc0b5 [SCB-1987] adjust test code for filter chain mode
f0cc0b5 is described below
commit f0cc0b5596fd5a7ce29ee00b0baa5077d7e95ada
Author: wujimin <wu...@huawei.com>
AuthorDate: Thu Jun 4 17:27:18 2020 +0800
[SCB-1987] adjust test code for filter chain mode
---
.../apache/servicecomb/it/testcase/TestAcceptType.java | 18 +++++++++---------
.../springmvc/tests/SpringMvcIntegrationTestBase.java | 5 ++++-
.../tracing-tests/src/test/resources/microservice.yaml | 5 ++++-
metrics/metrics-core/pom.xml | 11 +++++++----
4 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java
index 9b2f2b1..f5d9ca3 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java
@@ -16,6 +16,9 @@
*/
package org.apache.servicecomb.it.testcase;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.catchThrowable;
+
import org.apache.servicecomb.it.Consumers;
import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
import org.junit.Assert;
@@ -45,15 +48,12 @@ public class TestAcceptType {
private void checkTextPlain(Consumers<AcceptTypeIntf> consumers) {
String result = textHeader_rt(consumers, MediaType.TEXT_PLAIN_VALUE);
Assert.assertEquals("cse", result);
- try {
- textHeader_rt(consumers, MediaType.APPLICATION_JSON_VALUE);
- Assert.fail("should throw exception");
- } catch (InvocationException e) {
- Assert.assertEquals(406, e.getStatusCode());
- Assert.assertTrue(e.getMessage().contains("Accept application/json is not supported"));
- } catch (Throwable e) {
- Assert.fail(" should throw InvocationException");
- }
+
+ Throwable throwable = catchThrowable(() -> textHeader_rt(consumers, MediaType.APPLICATION_JSON_VALUE));
+ assertThat(throwable)
+ .isInstanceOf(InvocationException.class)
+ .hasMessageContaining("Accept application/json is not supported");
+ assertThat(((InvocationException) throwable).getStatusCode()).isEqualTo(406);
}
private String textHeader_rt(Consumers<AcceptTypeIntf> consumers, String type) {
diff --git a/integration-tests/springmvc-tests/common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java b/integration-tests/springmvc-tests/common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
index 00dd67c..fb186a3 100644
--- a/integration-tests/springmvc-tests/common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
+++ b/integration-tests/springmvc-tests/common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
@@ -49,6 +49,7 @@ import org.apache.servicecomb.demo.compute.Person;
import org.apache.servicecomb.demo.server.User;
import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
import org.apache.servicecomb.provider.springmvc.reference.async.CseAsyncRestTemplate;
+import org.hamcrest.Matchers;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
@@ -636,7 +637,9 @@ public class SpringMvcIntegrationTestBase {
} catch (HttpServerErrorException e) {
assertThat(e.getRawStatusCode(), is(500));
assertThat(e.getResponseBodyAsString(),
- is("{\"message\":\"Unexpected exception when processing the request.\"}"));
+ Matchers.isOneOf(
+ "{\"message\":\"Unexpected exception when processing the request.\"}",
+ "{\"code\":\"SCB.5000\",\"message\":\"Unexpected exception when processing.\"}"));
}
}
diff --git a/integration-tests/tracing-tests/src/test/resources/microservice.yaml b/integration-tests/tracing-tests/src/test/resources/microservice.yaml
index 41ed717..bd4a59c 100644
--- a/integration-tests/tracing-tests/src/test/resources/microservice.yaml
+++ b/integration-tests/tracing-tests/src/test/resources/microservice.yaml
@@ -33,9 +33,12 @@ servicecomb:
default: tracing-provider,bizkeeper-provider
Consumer:
default: tracing-consumer,loadbalance,bizkeeper-consumer
+ filter-chains:
+ producer:
+ default: default-producer-tranport, schedule, zipkin, validator, producer-operation
tracing:
collector:
address: http://localhost:9411
executor:
default:
- maxThreads-per-group: 10
\ No newline at end of file
+ maxThreads-per-group: 10
diff --git a/metrics/metrics-core/pom.xml b/metrics/metrics-core/pom.xml
index a556217..9caada3 100644
--- a/metrics/metrics-core/pom.xml
+++ b/metrics/metrics-core/pom.xml
@@ -43,6 +43,11 @@
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
+ <artifactId>common-rest</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
<artifactId>registry-service-center</artifactId>
<scope>test</scope>
</dependency>
@@ -51,7 +56,6 @@
<artifactId>vertx-codegen</artifactId>
<scope>provided</scope>
</dependency>
-
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@@ -63,9 +67,8 @@
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>common-rest</artifactId>
+ <artifactId>transport-highway</artifactId>
+ <scope>test</scope>
</dependency>
-
</dependencies>
-
</project>