Explorar o código

bug #I576ZY 修复processor异常后 ICmpAroundAspect里面的aferProcess不能正常执行的问题

bryan31 %!s(int64=3) %!d(string=hai) anos
pai
achega
fd72b0b611

+ 1 - 1
liteflow-core/pom.xml

@@ -9,7 +9,7 @@
     <parent>
 		<groupId>com.yomahub</groupId>
 		<artifactId>liteflow</artifactId>
-		<version>2.6.13</version>
+		<version>2.6.14</version>
 	</parent>
 
 	<dependencies>

+ 5 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java

@@ -82,8 +82,11 @@ public abstract class NodeComponent{
 		//全局切面只在spring体系下生效,这里用了spi机制取到相应环境下的实现类
 		//非spring环境下,全局切面为空实现
 		CmpAroundAspectHolder.loadCmpAroundAspect().beforeProcess(this.getNodeId(), slot);
-		self.process();
-		CmpAroundAspectHolder.loadCmpAroundAspect().afterProcess(this.getNodeId(), slot);
+		try{
+			self.process();
+		} finally {
+			CmpAroundAspectHolder.loadCmpAroundAspect().afterProcess(this.getNodeId(), slot);
+		}
 
 		stopWatch.stop();
 		

+ 1 - 1
liteflow-script-common/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
liteflow-script-groovy/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
liteflow-script-qlexpress/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
liteflow-spring-boot-starter/pom.xml

@@ -10,7 +10,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
 
     <dependencies>

+ 1 - 1
liteflow-spring/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
liteflow-testcase-nospring/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
liteflow-testcase-script-groovy/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
liteflow-testcase-script-qlexpress/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
liteflow-testcase-springboot/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 10 - 0
liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/aop/GlobalAOPSpringbootTest.java

@@ -58,6 +58,16 @@ public class GlobalAOPSpringbootTest extends BaseTest {
         Assert.assertEquals("before_after", response.getSlot().getData("e"));
     }
 
+    @Test
+    public void testGlobalAopException() {
+        LiteflowResponse<DefaultSlot> response= flowExecutor.execute2Resp("chain3", "it's a request");
+        Assert.assertFalse(response.isSuccess());
+        Assert.assertEquals("before_after", response.getSlot().getData("a"));
+        Assert.assertEquals("before_after", response.getSlot().getData("b"));
+        Assert.assertEquals("before_after", response.getSlot().getData("c"));
+        Assert.assertEquals("before_after", response.getSlot().getData("f"));
+    }
+
     @AfterClass
     public static void cleanScanCache(){
         BaseTest.cleanScanCache();

+ 21 - 0
liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/aop/cmp2/FCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.aop.cmp2;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("f")
+public class FCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		throw new RuntimeException("test error");
+	}
+
+}

+ 4 - 0
liteflow-testcase-springboot/src/test/resources/aop/flow.xml

@@ -8,4 +8,8 @@
         <then value="a,b,c"/>
         <when value="d,e"/>
     </chain>
+
+    <chain name="chain3">
+        <then value="a,b,c,f"/>
+    </chain>
 </flow>

+ 1 - 1
liteflow-testcase-springnative/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.6.13</version>
+        <version>2.6.14</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 10 - 0
liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/aop/GlobalAOPSpringTest.java

@@ -50,6 +50,16 @@ public class GlobalAOPSpringTest extends BaseTest {
         Assert.assertEquals("before_after", response.getSlot().getData("e"));
     }
 
+    @Test
+    public void testGlobalAopException() {
+        LiteflowResponse<DefaultSlot> response= flowExecutor.execute2Resp("chain3", "it's a request");
+        Assert.assertFalse(response.isSuccess());
+        Assert.assertEquals("before_after", response.getSlot().getData("a"));
+        Assert.assertEquals("before_after", response.getSlot().getData("b"));
+        Assert.assertEquals("before_after", response.getSlot().getData("c"));
+        Assert.assertEquals("before_after", response.getSlot().getData("f"));
+    }
+
     @AfterClass
     public static void cleanScanCache(){
         BaseTest.cleanScanCache();

+ 21 - 0
liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/aop/cmp2/FCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.aop.cmp2;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("f")
+public class FCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		throw new RuntimeException("test error");
+	}
+
+}

+ 4 - 0
liteflow-testcase-springnative/src/test/resources/aop/flow.xml

@@ -8,4 +8,8 @@
         <then value="a,b,c"/>
         <when value="d,e"/>
     </chain>
+
+    <chain name="chain3">
+        <then value="a,b,c,f"/>
+    </chain>
 </flow>

+ 1 - 1
pom.xml

@@ -5,7 +5,7 @@
 	<groupId>com.yomahub</groupId>
     <artifactId>liteflow</artifactId>
     <packaging>pom</packaging>
-    <version>2.6.13</version>
+    <version>2.6.14</version>
 	<name>liteflow</name>
 	<description>a lightweight and practical micro-process framework</description>
 	<url>https://github.com/bryan31/liteflow</url>