[
https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16473350#comment-16473350
]
ASF GitHub Bot commented on SCB-548:
------------------------------------
zhengyangyong closed pull request #693: [SCB-548] support gracefully shutdown
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693
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/core/src/main/java/org/apache/servicecomb/core/CseApplicationListener.java
b/core/src/main/java/org/apache/servicecomb/core/CseApplicationListener.java
index 4952f35f3..5d40780cd 100644
--- a/core/src/main/java/org/apache/servicecomb/core/CseApplicationListener.java
+++ b/core/src/main/java/org/apache/servicecomb/core/CseApplicationListener.java
@@ -26,6 +26,7 @@
import org.apache.servicecomb.core.definition.loader.SchemaListenerManager;
import org.apache.servicecomb.core.endpoint.AbstractEndpointsCache;
import org.apache.servicecomb.core.handler.HandlerConfigUtils;
+import org.apache.servicecomb.core.handler.ShutdownHookHandler;
import org.apache.servicecomb.core.provider.consumer.ConsumerProviderManager;
import org.apache.servicecomb.core.provider.consumer.ReferenceConfigUtils;
import org.apache.servicecomb.core.provider.producer.ProducerProviderManager;
@@ -33,6 +34,7 @@
import org.apache.servicecomb.foundation.common.event.EventManager;
import org.apache.servicecomb.foundation.common.utils.BeanUtils;
import org.apache.servicecomb.foundation.common.utils.FortifyUtils;
+import org.apache.servicecomb.foundation.vertx.VertxUtils;
import org.apache.servicecomb.serviceregistry.RegistryUtils;
import
org.apache.servicecomb.serviceregistry.task.MicroserviceInstanceRegisterTask;
import org.slf4j.Logger;
@@ -135,8 +137,6 @@ public void onApplicationEvent(ApplicationEvent event) {
RegistryUtils.run();
// 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效
- // 1. 去注册实例信息
- // TODO 服务优雅退出
if (applicationContext instanceof AbstractApplicationContext) {
((AbstractApplicationContext)
applicationContext).registerShutdownHook();
}
@@ -147,13 +147,36 @@ public void onApplicationEvent(ApplicationEvent event) {
}
} else if (event instanceof ContextClosedEvent) {
LOGGER.warn("cse is closing now...");
- triggerEvent(EventType.BEFORE_CLOSE);
- RegistryUtils.destroy();
- triggerEvent(EventType.AFTER_CLOSE);
+ gracefullyShutdown();
isInit = false;
}
}
+ private void gracefullyShutdown() {
+ //Step 1: notify all component stop invoke via BEFORE_CLOSE Event
+ triggerEvent(EventType.BEFORE_CLOSE);
+
+ //Step 2: Unregister microservice instance from Service Center and close
vertx
+ RegistryUtils.destroy();
+ VertxUtils.closeVertxByName("registry");
+
+ //Step 3: wait all invocation finished
+ try {
+ ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.acquire();
+ LOGGER.warn("all invocation finished");
+ } catch (InterruptedException e) {
+ LOGGER.error("invocation finished semaphore interrupted", e);
+ }
+
+ //Step 4: Stop vertx to prevent blocking exit
+ VertxUtils.closeVertxByName("config-center");
+ VertxUtils.closeVertxByName("transport");
+
+ //Step 5: notify all component do clean works via AFTER_CLOSE Event
+ triggerEvent(EventType.AFTER_CLOSE);
+ }
+
+
/**
* <p>As the process of instance registry is asynchronous, the {@code
AFTER_REGISTRY}
* event should not be sent immediately after {@link RegistryUtils#run()} is
invoked.
diff --git
a/core/src/main/java/org/apache/servicecomb/core/handler/ShutdownHookHandler.java
b/core/src/main/java/org/apache/servicecomb/core/handler/ShutdownHookHandler.java
index 8d1318aa3..4b284a4cb 100644
---
a/core/src/main/java/org/apache/servicecomb/core/handler/ShutdownHookHandler.java
+++
b/core/src/main/java/org/apache/servicecomb/core/handler/ShutdownHookHandler.java
@@ -17,18 +17,19 @@
package org.apache.servicecomb.core.handler;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.servicecomb.core.Handler;
import org.apache.servicecomb.core.Invocation;
+import
org.apache.servicecomb.foundation.common.exceptions.ServiceCombException;
import org.apache.servicecomb.swagger.invocation.AsyncResponse;
import org.apache.servicecomb.swagger.invocation.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * 实现调用链的优雅停止: 当调用链没有返回的时候,等待返回或者超时
+ * 实现调用链的优雅停止: 当调用链没有返回的时候,等待返回(由于Consumer存在超时,所以必定能够返回)
*/
public final class ShutdownHookHandler implements Handler, Runnable {
private static final Logger LOG =
LoggerFactory.getLogger(ShutdownHookHandler.class);
@@ -39,13 +40,16 @@
private final AtomicLong responseCounter = new AtomicLong(0);
- private final int timeout = 600;
-
- private final int period = 10;
-
private volatile boolean shuttingDown = false;
+ public final Semaphore ALL_INVOCATION_FINISHED = new Semaphore(1);
+
private ShutdownHookHandler() {
+ try {
+ ALL_INVOCATION_FINISHED.acquire();
+ } catch (InterruptedException e) {
+ throw new ServiceCombException("init invocation finished semaphore
failed", e);
+ }
Runtime.getRuntime().addShutdownHook(new Thread(this));
}
@@ -62,7 +66,7 @@ public void handle(Invocation invocation, AsyncResponse
asyncResp) throws Except
}
// TODO:统计功能应该独立出来,在链中统计,会有各种bug
- // 下面的两次catch,可能会导致一次请求,对应2次应答
+ // 下面的两次catch,可能会导致一次请求,对应2次应答
requestCounter.incrementAndGet();
try {
invocation.next(resp -> {
@@ -70,28 +74,26 @@ public void handle(Invocation invocation, AsyncResponse
asyncResp) throws Except
asyncResp.handle(resp);
} finally {
responseCounter.incrementAndGet();
+ validAllInvocationFinished();
}
});
} catch (Throwable e) {
responseCounter.incrementAndGet();
+ validAllInvocationFinished();
throw e;
}
}
+ private synchronized void validAllInvocationFinished() {
+ if (shuttingDown && getActiveCount() <= 0) {
+ ALL_INVOCATION_FINISHED.release();
+ }
+ }
+
@Override
public void run() {
shuttingDown = true;
- LOG.warn("handler chain is shutting down");
- int time = 0;
- while (getActiveCount() != 0 && time <= timeout) {
- try {
- TimeUnit.SECONDS.sleep(period);
- } catch (InterruptedException e) {
- LOG.warn(e.getMessage());
- }
- time = time + period;
- LOG.warn("waiting invocation to finish in seconds " + time);
- }
- LOG.warn("handler chain is shut down");
+ LOG.warn("handler chain is shutting down...");
+ validAllInvocationFinished();
}
}
diff --git
a/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java
b/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java
index e5eaec84a..43fd873f3 100644
---
a/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java
+++
b/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java
@@ -35,6 +35,7 @@
import org.apache.servicecomb.core.BootListener.EventType;
import org.apache.servicecomb.core.definition.loader.SchemaListenerManager;
import org.apache.servicecomb.core.endpoint.AbstractEndpointsCache;
+import org.apache.servicecomb.core.handler.ShutdownHookHandler;
import org.apache.servicecomb.core.provider.consumer.ConsumerProviderManager;
import org.apache.servicecomb.core.provider.consumer.ReferenceConfigUtils;
import org.apache.servicecomb.core.provider.producer.ProducerProviderManager;
@@ -167,6 +168,8 @@ void destroy() {
CseApplicationListener cal = new CseApplicationListener();
ContextClosedEvent event = new ContextClosedEvent(context);
+ ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.release();
+
List<EventType> eventTypes = new ArrayList<>();
BootListener bootListener = e -> {
eventTypes.add(e.getEventType());
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java
index 4aba612f2..d5e55f463 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java
@@ -157,6 +157,13 @@ public static Vertx getVertxByName(String name) {
return vertxMap.get(name);
}
+ public static void closeVertxByName(String name) {
+ Vertx vertx = vertxMap.remove(name);
+ if (vertx != null) {
+ vertx.close();
+ }
+ }
+
public static <T> void runInContext(Context context, AsyncResultCallback<T>
callback, T result, Throwable e) {
if (context == Vertx.currentContext()) {
complete(callback, result, e);
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 52c37a267..62152e492 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -37,7 +37,6 @@
<module>test-common</module>
<module>spring-jaxrs-tests</module>
<module>pojo-test</module>
- <module>spring-springmvc-tests</module>
<module>spring-zuul-tracing-tests</module>
<module>spring-pojo-tests</module>
<module>dynamic-config-tests</module>
diff --git
a/integration-tests/spring-zuul-tracing-tests/src/test/java/org/apache/servicecomb/spring/cloud/zuul/tracing/SpringCloudZuulTracingTest.java
b/integration-tests/spring-zuul-tracing-tests/src/test/java/org/apache/servicecomb/spring/cloud/zuul/tracing/SpringCloudZuulTracingTest.java
index 35a82b1de..1402cc237 100644
---
a/integration-tests/spring-zuul-tracing-tests/src/test/java/org/apache/servicecomb/spring/cloud/zuul/tracing/SpringCloudZuulTracingTest.java
+++
b/integration-tests/spring-zuul-tracing-tests/src/test/java/org/apache/servicecomb/spring/cloud/zuul/tracing/SpringCloudZuulTracingTest.java
@@ -17,7 +17,6 @@
package org.apache.servicecomb.spring.cloud.zuul.tracing;
-import static com.seanyinx.github.unit.scaffolding.AssertUtils.expectFailing;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
diff --git a/integration-tests/springmvc-tests/pom.xml
b/integration-tests/springmvc-tests/pom.xml
index ba4f674e3..8b907a256 100644
--- a/integration-tests/springmvc-tests/pom.xml
+++ b/integration-tests/springmvc-tests/pom.xml
@@ -27,7 +27,17 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>springmvc-tests</artifactId>
- <name>Java Chassis::Integration Tests::Raw Spring MVC</name>
+ <packaging>pom</packaging>
+ <name>Java Chassis::Integration Tests::Spring MVC</name>
+
+ <modules>
+ <module>springmvc-tests-common</module>
+ <module>springmvc-tests-general</module>
+ <module>springmvc-tests-simplified-mapping</module>
+ <module>springmvc-tests-general-with-springboot</module>
+ <module>springmvc-tests-simplified-mapping-with-springboot</module>
+ </modules>
+
<dependencies>
<dependency>
<groupId>org.apache.servicecomb.demo</groupId>
diff --git a/integration-tests/springmvc-tests/springmvc-tests-common/pom.xml
b/integration-tests/springmvc-tests/springmvc-tests-common/pom.xml
new file mode 100644
index 000000000..885d5126e
--- /dev/null
+++ b/integration-tests/springmvc-tests/springmvc-tests-common/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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>
+ <artifactId>springmvc-tests</artifactId>
+ <groupId>org.apache.servicecomb.tests</groupId>
+ <version>1.0.0-m2-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Java Chassis::Integration Tests::Spring MVC Common</name>
+ <artifactId>springmvc-tests-common</artifactId>
+
+</project>
\ No newline at end of file
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
similarity index 99%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
index 611916c9a..6d3fdf9d1 100644
---
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
+++
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcIntegrationTestBase.java
@@ -84,7 +84,7 @@
private final String controllerUrl = baseUrl + "springmvc/controller/";
- static void setUpLocalRegistry() {
+ public static void setUpLocalRegistry() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL resource = loader.getResource("registry.yaml");
assert resource != null;
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvc.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvc.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvc.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvc.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcBase.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcBase.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcBase.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcBase.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcSimplifiedMappingAnnotation.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcSimplifiedMappingAnnotation.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcSimplifiedMappingAnnotation.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/CodeFirstSpringmvcSimplifiedMappingAnnotation.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerBase.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerBase.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerBase.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerBase.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerImpl.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerImpl.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerImpl.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerImpl.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerSimplifiedMappingAnnotationImpl.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerSimplifiedMappingAnnotationImpl.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerSimplifiedMappingAnnotationImpl.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/ControllerSimplifiedMappingAnnotationImpl.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpoint.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpoint.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpoint.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpoint.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpointBase.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpointBase.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpointBase.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingRestEndpointBase.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingSimplifiedMappingAnnotationRestEndpoint.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingSimplifiedMappingAnnotationRestEndpoint.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingSimplifiedMappingAnnotationRestEndpoint.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/EnglishGreetingSimplifiedMappingAnnotationRestEndpoint.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpoint.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpoint.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpoint.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpoint.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpointBase.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpointBase.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpointBase.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingRestEndpointBase.java
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingSimplifiedMappingAnnotationRestEndpoint.java
b/integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingSimplifiedMappingAnnotationRestEndpoint.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingSimplifiedMappingAnnotationRestEndpoint.java
rename to
integration-tests/springmvc-tests/springmvc-tests-common/src/test/java/org/apache/servicecomb/demo/springmvc/tests/endpoints/FrenchGreetingSimplifiedMappingAnnotationRestEndpoint.java
diff --git a/integration-tests/spring-springmvc-tests/pom.xml
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/pom.xml
similarity index 74%
rename from integration-tests/spring-springmvc-tests/pom.xml
rename to
integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/pom.xml
index 2840574d5..6832ba807 100644
--- a/integration-tests/spring-springmvc-tests/pom.xml
+++
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/pom.xml
@@ -20,26 +20,21 @@
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>
- <artifactId>integration-tests</artifactId>
+ <artifactId>springmvc-tests</artifactId>
<groupId>org.apache.servicecomb.tests</groupId>
<version>1.0.0-m2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>spring-springmvc-tests</artifactId>
- <name>Java Chassis::Integration Tests::Spring MVC</name>
+ <name>Java Chassis::Integration Tests::Spring MVC General With Spring
Boot</name>
+ <artifactId>springmvc-tests-general-with-springboot</artifactId>
+
<dependencies>
<dependency>
<groupId>org.apache.servicecomb.tests</groupId>
- <artifactId>springmvc-tests</artifactId>
+ <artifactId>springmvc-tests-common</artifactId>
<version>1.0.0-m2-SNAPSHOT</version>
<type>test-jar</type>
- <exclusions>
- <exclusion>
- <groupId>org.apache.servicecomb.demo</groupId>
- <artifactId>demo-signature</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
@@ -59,16 +54,4 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkCount>1</forkCount>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
+</project>
\ No newline at end of file
diff --git
a/integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringIntegrationTest.java
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringIntegrationTest.java
similarity index 87%
rename from
integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringIntegrationTest.java
rename to
integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringIntegrationTest.java
index 75d6693f3..c0caef64c 100644
---
a/integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringIntegrationTest.java
+++
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringIntegrationTest.java
@@ -17,6 +17,7 @@
package org.apache.servicecomb.demo.springmvc.tests;
+import org.apache.servicecomb.core.handler.ShutdownHookHandler;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -29,14 +30,16 @@
private static ConfigurableApplicationContext context;
@BeforeClass
- public static void init() throws Exception {
+ public static void init() {
System.setProperty("cse.uploads.directory", "/tmp");
setUpLocalRegistry();
context = SpringApplication.run(SpringMvcSpringMain.class);
}
@AfterClass
- public static void shutdown() throws Exception {
+ public static void shutdown() {
+ //sim system.exit(0)
+ ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.release();
context.close();
}
}
diff --git
a/integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringMain.java
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringMain.java
similarity index 100%
rename from
integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringMain.java
rename to
integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringMain.java
diff --git
a/integration-tests/spring-springmvc-tests/src/test/resources/log4j.properties
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/resources/log4j.properties
similarity index 100%
rename from
integration-tests/spring-springmvc-tests/src/test/resources/log4j.properties
rename to
integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/resources/log4j.properties
diff --git
a/integration-tests/springmvc-tests/src/test/resources/microservice.yaml
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/resources/microservice.yaml
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/resources/microservice.yaml
rename to
integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/resources/microservice.yaml
diff --git a/integration-tests/springmvc-tests/src/test/resources/registry.yaml
b/integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/resources/registry.yaml
similarity index 100%
rename from integration-tests/springmvc-tests/src/test/resources/registry.yaml
rename to
integration-tests/springmvc-tests/springmvc-tests-general-with-springboot/src/test/resources/registry.yaml
diff --git a/integration-tests/springmvc-tests/springmvc-tests-general/pom.xml
b/integration-tests/springmvc-tests/springmvc-tests-general/pom.xml
new file mode 100644
index 000000000..6b07517e8
--- /dev/null
+++ b/integration-tests/springmvc-tests/springmvc-tests-general/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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>
+ <artifactId>springmvc-tests</artifactId>
+ <groupId>org.apache.servicecomb.tests</groupId>
+ <version>1.0.0-m2-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Java Chassis::Integration Tests::Spring MVC General</name>
+ <artifactId>springmvc-tests-general</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.tests</groupId>
+ <artifactId>springmvc-tests-common</artifactId>
+ <version>1.0.0-m2-SNAPSHOT</version>
+ <type>test-jar</type>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcIntegrationTest.java
b/integration-tests/springmvc-tests/springmvc-tests-general/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcIntegrationTest.java
similarity index 89%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcIntegrationTest.java
rename to
integration-tests/springmvc-tests/springmvc-tests-general/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcIntegrationTest.java
index dd11460e4..c0fc7e3a7 100644
---
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcIntegrationTest.java
+++
b/integration-tests/springmvc-tests/springmvc-tests-general/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcIntegrationTest.java
@@ -18,6 +18,7 @@
package org.apache.servicecomb.demo.springmvc.tests;
import org.apache.servicecomb.core.CseApplicationListener;
+import org.apache.servicecomb.core.handler.ShutdownHookHandler;
import org.apache.servicecomb.foundation.common.utils.BeanUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -33,7 +34,9 @@ public static void init() throws Exception {
}
@AfterClass
- public static void shutdown() throws Exception {
+ public static void shutdown() {
+ //sim system.exit(0)
+ ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.release();
CseApplicationListener cal =
BeanUtils.getBean("org.apache.servicecomb.core.CseApplicationListener");
ContextClosedEvent event = new ContextClosedEvent(BeanUtils.getContext());
cal.onApplicationEvent(event);
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcTestMain.java
b/integration-tests/springmvc-tests/springmvc-tests-general/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcTestMain.java
similarity index 100%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcTestMain.java
rename to
integration-tests/springmvc-tests/springmvc-tests-general/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcTestMain.java
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-general/src/test/resources/microservice.yaml
b/integration-tests/springmvc-tests/springmvc-tests-general/src/test/resources/microservice.yaml
new file mode 100644
index 000000000..a5d81f871
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-general/src/test/resources/microservice.yaml
@@ -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.
+## ---------------------------------------------------------------------------
+
+APPLICATION_ID: springmvctest-it
+service_description:
+ name: springmvc-tests
+ version: 0.0.2
+servicecomb:
+ service:
+ registry:
+ address: http://127.0.0.1:30100
+ rest:
+ address: 0.0.0.0:8080
+ handler:
+ chain:
+ Provider:
+ default: bizkeeper-provider
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-general/src/test/resources/registry.yaml
b/integration-tests/springmvc-tests/springmvc-tests-general/src/test/resources/registry.yaml
new file mode 100644
index 000000000..c1ca1e9b3
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-general/src/test/resources/registry.yaml
@@ -0,0 +1,24 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+springmvc-tests:
+ - id: "001"
+ version: "0.0.2"
+ appid: springmvctest-it
+ instances:
+ - endpoints:
+ - rest://127.0.0.1:8080
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/pom.xml
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/pom.xml
new file mode 100644
index 000000000..a98aea37d
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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>
+ <artifactId>springmvc-tests</artifactId>
+ <groupId>org.apache.servicecomb.tests</groupId>
+ <version>1.0.0-m2-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Java Chassis::Integration Tests::Spring MVC Simplified Mapping With
Spring Boot</name>
+ <artifactId>springmvc-tests-simplified-mapping-with-springboot</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.tests</groupId>
+ <artifactId>springmvc-tests-common</artifactId>
+ <version>1.0.0-m2-SNAPSHOT</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>spring-boot-starter-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringMain.java
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringMain.java
new file mode 100644
index 000000000..e149464af
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringMain.java
@@ -0,0 +1,26 @@
+/*
+ * 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 org.apache.servicecomb.demo.springmvc.tests;
+
+import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableServiceComb
+class SpringMvcSpringMain {
+}
diff --git
a/integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringSimplifiedMappingAnnotationIntegrationTest.java
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringSimplifiedMappingAnnotationIntegrationTest.java
similarity index 87%
rename from
integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringSimplifiedMappingAnnotationIntegrationTest.java
rename to
integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringSimplifiedMappingAnnotationIntegrationTest.java
index 089d3d021..dfc0ca8b7 100644
---
a/integration-tests/spring-springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringSimplifiedMappingAnnotationIntegrationTest.java
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcSpringSimplifiedMappingAnnotationIntegrationTest.java
@@ -17,6 +17,7 @@
package org.apache.servicecomb.demo.springmvc.tests;
+import org.apache.servicecomb.core.handler.ShutdownHookHandler;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -29,7 +30,7 @@
private static ConfigurableApplicationContext context;
@BeforeClass
- public static void init() throws Exception {
+ public static void init() {
System.setProperty("spring.profiles.active", "SimplifiedMapping");
System.setProperty("cse.uploads.directory", "/tmp");
setUpLocalRegistry();
@@ -37,7 +38,9 @@ public static void init() throws Exception {
}
@AfterClass
- public static void shutdown() throws Exception {
+ public static void shutdown() {
+ //sim system.exit(0)
+ ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.release();
context.close();
}
}
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/log4j.properties
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/log4j.properties
new file mode 100644
index 000000000..bc03e25ce
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/log4j.properties
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+log4j.rootLogger=INFO, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1}
- %m%n
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/microservice.yaml
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/microservice.yaml
new file mode 100644
index 000000000..a5d81f871
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/microservice.yaml
@@ -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.
+## ---------------------------------------------------------------------------
+
+APPLICATION_ID: springmvctest-it
+service_description:
+ name: springmvc-tests
+ version: 0.0.2
+servicecomb:
+ service:
+ registry:
+ address: http://127.0.0.1:30100
+ rest:
+ address: 0.0.0.0:8080
+ handler:
+ chain:
+ Provider:
+ default: bizkeeper-provider
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/registry.yaml
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/registry.yaml
new file mode 100644
index 000000000..c1ca1e9b3
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping-with-springboot/src/test/resources/registry.yaml
@@ -0,0 +1,24 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+springmvc-tests:
+ - id: "001"
+ version: "0.0.2"
+ appid: springmvctest-it
+ instances:
+ - endpoints:
+ - rest://127.0.0.1:8080
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/pom.xml
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/pom.xml
new file mode 100644
index 000000000..1940d9813
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<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>
+ <artifactId>springmvc-tests</artifactId>
+ <groupId>org.apache.servicecomb.tests</groupId>
+ <version>1.0.0-m2-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Java Chassis::Integration Tests::Spring MVC Simplified Mapping</name>
+ <artifactId>springmvc-tests-simplified-mapping</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.tests</groupId>
+ <artifactId>springmvc-tests-common</artifactId>
+ <version>1.0.0-m2-SNAPSHOT</version>
+ <type>test-jar</type>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcSimplifiedMappingAnnotationIntegrationTest.java
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcSimplifiedMappingAnnotationIntegrationTest.java
similarity index 89%
rename from
integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcSimplifiedMappingAnnotationIntegrationTest.java
rename to
integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcSimplifiedMappingAnnotationIntegrationTest.java
index a4cd05038..d6d2cfc94 100644
---
a/integration-tests/springmvc-tests/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcSimplifiedMappingAnnotationIntegrationTest.java
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/java/org/apache/servicecomb/demo/springmvc/tests/RawSpringMvcSimplifiedMappingAnnotationIntegrationTest.java
@@ -18,6 +18,7 @@
package org.apache.servicecomb.demo.springmvc.tests;
import org.apache.servicecomb.core.CseApplicationListener;
+import org.apache.servicecomb.core.handler.ShutdownHookHandler;
import org.apache.servicecomb.foundation.common.utils.BeanUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -34,7 +35,9 @@ public static void init() throws Exception {
}
@AfterClass
- public static void shutdown() throws Exception {
+ public static void shutdown() {
+ //sim system.exit(0)
+ ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.release();
CseApplicationListener cal =
BeanUtils.getBean("org.apache.servicecomb.core.CseApplicationListener");
ContextClosedEvent event = new ContextClosedEvent(BeanUtils.getContext());
cal.onApplicationEvent(event);
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcTestMain.java
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcTestMain.java
new file mode 100644
index 000000000..99d937049
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/java/org/apache/servicecomb/demo/springmvc/tests/SpringMvcTestMain.java
@@ -0,0 +1,29 @@
+/*
+ * 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 org.apache.servicecomb.demo.springmvc.tests;
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+public class SpringMvcTestMain {
+
+ public static void main(String[] args) throws Exception {
+ Log4jUtils.init();
+ BeanUtils.init();
+ }
+}
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/resources/microservice.yaml
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/resources/microservice.yaml
new file mode 100644
index 000000000..a5d81f871
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/resources/microservice.yaml
@@ -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.
+## ---------------------------------------------------------------------------
+
+APPLICATION_ID: springmvctest-it
+service_description:
+ name: springmvc-tests
+ version: 0.0.2
+servicecomb:
+ service:
+ registry:
+ address: http://127.0.0.1:30100
+ rest:
+ address: 0.0.0.0:8080
+ handler:
+ chain:
+ Provider:
+ default: bizkeeper-provider
diff --git
a/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/resources/registry.yaml
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/resources/registry.yaml
new file mode 100644
index 000000000..c1ca1e9b3
--- /dev/null
+++
b/integration-tests/springmvc-tests/springmvc-tests-simplified-mapping/src/test/resources/registry.yaml
@@ -0,0 +1,24 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+springmvc-tests:
+ - id: "001"
+ version: "0.0.2"
+ appid: springmvctest-it
+ instances:
+ - endpoints:
+ - rest://127.0.0.1:8080
----------------------------------------------------------------
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 Gracefully Shutdown
> ---------------------------
>
> Key: SCB-548
> URL: https://issues.apache.org/jira/browse/SCB-548
> Project: Apache ServiceComb
> Issue Type: Improvement
> Components: Java-Chassis
> Affects Versions: java-chassis-1.0.0-m2
> Reporter: yangyongzheng
> Assignee: yangyongzheng
> Priority: Major
>
> We did not implement gracefully shutdown yet:
> ```java
> // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效
> // 1. 去注册实例信息
> // TODO 服务优雅退出
> if (applicationContext instanceof AbstractApplicationContext) {
> ((AbstractApplicationContext)
> applicationContext).registerShutdownHook();
> }
> ```
>
> And had got an issue :
> https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from
> user.
> So it's time we must do it and remove this TODO
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)