1
0

调整测试代码的组织,保持主代码整洁

This commit is contained in:
2025-01-03 09:37:22 +08:00
parent 071beee794
commit 07ee530b79
13 changed files with 103 additions and 37 deletions

2
.idea/encodings.xml generated
View File

@@ -5,6 +5,8 @@
<file url="file://$PROJECT_DIR$/adapter/flowable-spring-boot-jpa-starter/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/adapter/flowable-spring-boot-jpa-starter/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/flowable-core/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/flowable-core/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/flowable-core/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/flowable-core/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/flowable-example/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/flowable-example/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component> </component>

View File

@@ -28,6 +28,11 @@
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>flowable-example</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.flowable.core; package com.lanyuanxiaoyao.flowable.jpa;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction; import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;

View File

@@ -1,6 +1,5 @@
package com.lanyuanxiaoyao.flowable.jpa; package com.lanyuanxiaoyao.flowable.jpa;
import com.lanyuanxiaoyao.flowable.core.SimpleAutoAction;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.flowable.jpa; package com.lanyuanxiaoyao.flowable.jpa;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
import com.lanyuanxiaoyao.flowable.core.test.TestFlowableManager; import com.lanyuanxiaoyao.flowable.test.TestFlowableManager;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@@ -18,4 +18,9 @@ public class TestSpringFlowableManager extends TestFlowableManager {
protected FlowableManager flowableManager() { protected FlowableManager flowableManager() {
return flowableManager; return flowableManager;
} }
@Override
protected Class<?> getAutomaticNodeClass() {
return SimpleAutoAction.class;
}
} }

View File

@@ -12,34 +12,9 @@
<artifactId>flowable-core</artifactId> <artifactId>flowable-core</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.11.4</version>
<scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

36
flowable-example/pom.xml Normal file
View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>flowable</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>flowable-example</artifactId>
<dependencies>
<dependency>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>flowable-core</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.flowable.core.test; package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.helper.MapHelper; import com.lanyuanxiaoyao.flowable.core.helper.MapHelper;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
@@ -122,6 +122,8 @@ public abstract class TestFlowableManager {
Assertions.assertThrows(IllegalArgumentException.class, () -> manager.approve(instanceId)); Assertions.assertThrows(IllegalArgumentException.class, () -> manager.approve(instanceId));
} }
protected abstract Class<?> getAutomaticNodeClass();
@Test @Test
public void testAutomaticNode() { public void testAutomaticNode() {
FlowableManager manager = flowableManager(); FlowableManager manager = flowableManager();
@@ -130,7 +132,7 @@ public abstract class TestFlowableManager {
"自动节点", "自动节点",
"自动节点", "自动节点",
FlowableNode.Type.AUTOMATIC, FlowableNode.Type.AUTOMATIC,
"com.lanyuanxiaoyao.flowable.core.SimpleAutoAction", getAutomaticNodeClass().getName(),
null null
); );
manager.create(node); manager.create(node);

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.flowable.core; package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.helper.ListHelper; import com.lanyuanxiaoyao.flowable.core.helper.ListHelper;
import com.lanyuanxiaoyao.flowable.core.helper.StringHelper; import com.lanyuanxiaoyao.flowable.core.helper.StringHelper;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.flowable.core; package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction; import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance; import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.flowable.core; package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
import java.util.UUID; import java.util.UUID;

View File

@@ -1,6 +1,5 @@
package com.lanyuanxiaoyao.flowable.core; package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.test.TestFlowableManager;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager; import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
/** /**
@@ -12,4 +11,9 @@ public class TestSimpleFlowableManager extends TestFlowableManager {
protected FlowableManager flowableManager() { protected FlowableManager flowableManager() {
return new SimpleFlowableManager(); return new SimpleFlowableManager();
} }
@Override
protected Class<?> getAutomaticNodeClass() {
return SimpleAutoAction.class;
}
} }

42
pom.xml
View File

@@ -11,6 +11,7 @@
<modules> <modules>
<module>flowable-core</module> <module>flowable-core</module>
<module>flowable-example</module>
<module>adapter/flowable-spring-boot-jpa-starter</module> <module>adapter/flowable-spring-boot-jpa-starter</module>
</modules> </modules>
@@ -20,14 +21,31 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.6.15</spring-boot.version> <spring-boot.version>2.6.15</spring-boot.version>
<hutool.version>5.8.32</hutool.version>
<junit.version>5.8.2</junit.version>
<slf4j.version>1.7.36</slf4j.version>
</properties> </properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>compile</scope>
</dependency>
</dependencies>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.lanyuanxiaoyao</groupId> <groupId>com.lanyuanxiaoyao</groupId>
<artifactId>flowable-core</artifactId> <artifactId>flowable-core</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>flowable-example</artifactId>
<version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@@ -39,7 +57,27 @@
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId> <artifactId>hutool-core</artifactId>
<version>5.8.32</version> <version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>