move files into modules
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -22,7 +22,7 @@ bin/
|
|||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
out/
|
golden/
|
||||||
!**/src/main/**/out/
|
!**/src/main/**/out/
|
||||||
!**/src/test/**/out/
|
!**/src/test/**/out/
|
||||||
|
|
||||||
@@ -42,4 +42,4 @@ out/
|
|||||||
*.png
|
*.png
|
||||||
*.dot
|
*.dot
|
||||||
*.scxml.xml
|
*.scxml.xml
|
||||||
Combined.java
|
Combined.java
|
||||||
|
|||||||
38
file_combine/build.gradle
Normal file
38
file_combine/build.gradle
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil.file_combine'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// deps for parsing java AST
|
||||||
|
implementation 'org.eclipse.jdt:org.eclipse.jdt.core:3.36.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok:1.18.46'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok:1.18.46'
|
||||||
|
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:6.1.0'
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-engine:6.1.0'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.1.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package click.kamil.filecombine;
|
package click.kamil.file_combine;
|
||||||
|
|
||||||
import click.kamil.springstatemachineexporter.ast.common.FileUtils;
|
import click.kamil.file_combine.common.FileUtils;
|
||||||
import org.eclipse.jdt.core.dom.*;
|
import org.eclipse.jdt.core.dom.*;
|
||||||
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
|
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
|
||||||
import org.eclipse.jface.text.Document;
|
import org.eclipse.jface.text.Document;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package click.kamil.file_combine.common;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class FileUtils {
|
||||||
|
public static List<Path> findFilesWithExtension(Set<Path> startDirs, String extension) throws RuntimeException {
|
||||||
|
try (Stream<Path> paths = startDirs.stream()
|
||||||
|
.flatMap(startDir -> {
|
||||||
|
try {
|
||||||
|
return Files.walk(startDir);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
})) {
|
||||||
|
return paths
|
||||||
|
.filter(p -> Files.isRegularFile(p) && p.toString().endsWith(extension))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
file_combine/src/test/java/click/kamil/MyTest.java
Normal file
11
file_combine/src/test/java/click/kamil/MyTest.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
5
gradlew
vendored
5
gradlew
vendored
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015-2021 the original authors.
|
# Copyright © 2015 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
|||||||
NONSTOP* ) nonstop=true ;;
|
NONSTOP* ) nonstop=true ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH="\\\"\\\""
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@@ -172,7 +171,6 @@ fi
|
|||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if "$cygwin" || "$msys" ; then
|
if "$cygwin" || "$msys" ; then
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
-classpath "$CLASSPATH" \
|
|
||||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
|||||||
3
gradlew.bat
vendored
3
gradlew.bat
vendored
@@ -70,11 +70,10 @@ goto fail
|
|||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|||||||
@@ -1 +1,11 @@
|
|||||||
rootProject.name = 'state machine exporter'
|
rootProject.name = 'state machine exporter'
|
||||||
|
|
||||||
|
include ':file_combine'
|
||||||
|
include ':state_machine_exporter'
|
||||||
|
include ':state_machine_exporter_spring_based'
|
||||||
|
include ':state_machines:complex_state_machine'
|
||||||
|
include ':state_machines:dynamic_state_machine'
|
||||||
|
include ':state_machines:enumstate_state_machine'
|
||||||
|
include ':state_machines:forkjoin_state_machine'
|
||||||
|
include ':state_machines:inheritance_state_machine'
|
||||||
|
include ':state_machines:simple_state_machine'
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//package click.kamil.springstatemachineexporter;
|
|
||||||
//
|
|
||||||
//import org.springframework.boot.SpringApplication;
|
|
||||||
//import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
//import org.springframework.context.annotation.ComponentScan;
|
|
||||||
//
|
|
||||||
//@SpringBootApplication
|
|
||||||
//@ComponentScan(basePackages = {"click.kamil.examples"})
|
|
||||||
//public class StatemachinedemoApplication {
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
// SpringApplication.run(StatemachinedemoApplication.class, args);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package click.kamil.springstatemachineexporter;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.CommandLineRunner;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
class StatemachinedemoApplicationTests {
|
|
||||||
|
|
||||||
@MockitoBean
|
|
||||||
CommandLineRunner commandLineRunner;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void contextLoads() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
45
state_machine_exporter/.gitignore
vendored
Normal file
45
state_machine_exporter/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
40
state_machine_exporter/build.gradle
Normal file
40
state_machine_exporter/build.gradle
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil.springstatemachineexporter'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// deps for parsing java AST
|
||||||
|
implementation 'org.eclipse.jdt:org.eclipse.jdt.core:3.36.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok:1.18.46'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok:1.18.46'
|
||||||
|
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:6.1.0'
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-params:6.1.0'
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-engine:6.1.0'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.1.0'
|
||||||
|
testImplementation 'org.assertj:assertj-core:3.27.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -14,23 +14,26 @@ import click.kamil.springstatemachineexporter.ast.out.StateMachineExporter;
|
|||||||
import org.eclipse.jdt.core.dom.CompilationUnit;
|
import org.eclipse.jdt.core.dom.CompilationUnit;
|
||||||
import org.eclipse.jdt.core.dom.MethodDeclaration;
|
import org.eclipse.jdt.core.dom.MethodDeclaration;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static final String START_DIR = ".";
|
private static final String START_DIR = ".";
|
||||||
|
private static final String OUTPUT_DIR = "./out";
|
||||||
private static final String EXTENSION = ".java";
|
private static final String EXTENSION = ".java";
|
||||||
private static final List<String> TARGET_ANNOTATIONS = List.of("EnableStateMachineFactory", "EnableStateMachine");
|
private static final List<String> TARGET_ANNOTATIONS = List.of("EnableStateMachineFactory", "EnableStateMachine");
|
||||||
public static final Set<String> STATE_MACHINE_RETURN_TYPES = Set.of("StateMachine");
|
public static final Set<String> STATE_MACHINE_RETURN_TYPES = Set.of("StateMachine");
|
||||||
|
|
||||||
static void processAnnotationFoundSource(String source, Path javaFile, List<StateMachineExporter> outputs) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
runExporter(Path.of(START_DIR), Path.of(OUTPUT_DIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void processAnnotationFoundSource(String source, Path javaFile, List<StateMachineExporter> outputs, Path outputDir) throws IOException {
|
||||||
MethodDeclaration configureMethod = new StateMachineTransitionConfigurationMethodFinder(source).findConfigureMethod();
|
MethodDeclaration configureMethod = new StateMachineTransitionConfigurationMethodFinder(source).findConfigureMethod();
|
||||||
if (configureMethod != null) {
|
if (configureMethod != null) {
|
||||||
System.out.println("Found configure method in: " + javaFile.toAbsolutePath());
|
System.out.println("Found configure method in: " + javaFile.toAbsolutePath());
|
||||||
@@ -60,23 +63,31 @@ public class Main {
|
|||||||
endStates.addAll(visitor.getEndStates());
|
endStates.addAll(visitor.getEndStates());
|
||||||
|
|
||||||
String baseName = javaFile.getFileName().toString().replaceFirst("[.][^.]+$", "");
|
String baseName = javaFile.getFileName().toString().replaceFirst("[.][^.]+$", "");
|
||||||
|
generateOutputs(outputDir, baseName, transitions, startStates, endStates, outputs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate over outputs and generate files dynamically
|
private static void generateOutputs(Path outputDir, String baseName, List<Transition> transitions,
|
||||||
for (StateMachineExporter output : outputs) {
|
Set<String> startStates, Set<String> endStates,
|
||||||
String content = output.export(transitions, startStates, endStates, true);
|
List<StateMachineExporter> outputs) throws IOException {
|
||||||
String fileName = baseName + output.getFileExtension();
|
|
||||||
try (PrintWriter out = new PrintWriter(fileName)) {
|
Path targetDir = outputDir.resolve(baseName);
|
||||||
out.println(content);
|
Files.createDirectories(targetDir);
|
||||||
}
|
|
||||||
|
for (StateMachineExporter output : outputs) {
|
||||||
|
String content = output.export(transitions, startStates, endStates, true);
|
||||||
|
String fileName = baseName + output.getFileExtension();
|
||||||
|
|
||||||
|
try (PrintWriter out = new PrintWriter(targetDir.resolve(fileName).toFile())) {
|
||||||
|
out.println(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void runExporter(Path inputDir, Path outputDir) throws IOException {
|
||||||
AstFileFinder finder = new AstFileFinder();
|
AstFileFinder finder = new AstFileFinder();
|
||||||
List<Path> javaFiles = FileUtils.findFilesWithExtension(Set.of(Paths.get(START_DIR)), EXTENSION);
|
List<Path> javaFiles = FileUtils.findFilesWithExtension(Set.of(inputDir), EXTENSION);
|
||||||
|
|
||||||
// List of output handlers
|
|
||||||
List<StateMachineExporter> outputs = List.of(
|
List<StateMachineExporter> outputs = List.of(
|
||||||
new PlantUml(),
|
new PlantUml(),
|
||||||
new Dot(),
|
new Dot(),
|
||||||
@@ -86,19 +97,17 @@ public class Main {
|
|||||||
for (Path javaFile : javaFiles) {
|
for (Path javaFile : javaFiles) {
|
||||||
String source = Files.readString(javaFile);
|
String source = Files.readString(javaFile);
|
||||||
if (finder.hasClassWithAnnotation(source, TARGET_ANNOTATIONS)) {
|
if (finder.hasClassWithAnnotation(source, TARGET_ANNOTATIONS)) {
|
||||||
System.out.println("Found annotation in: " + javaFile.toAbsolutePath());
|
processAnnotationFoundSource(source, javaFile, outputs, outputDir);
|
||||||
processAnnotationFoundSource(source, javaFile, outputs);
|
|
||||||
} else if (finder.hasFunctionReturningType(source, STATE_MACHINE_RETURN_TYPES)) {
|
} else if (finder.hasFunctionReturningType(source, STATE_MACHINE_RETURN_TYPES)) {
|
||||||
System.out.println("Found StateMachine return type in: " + javaFile.toAbsolutePath());
|
processReturnTypeFoundSource(source, javaFile, outputs, outputDir);
|
||||||
processReturnTypeFoundSource(source, javaFile, outputs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void processReturnTypeFoundSource(String source, Path javaFile, List<StateMachineExporter> outputs) {
|
static void processReturnTypeFoundSource(String source, Path javaFile, List<StateMachineExporter> outputs, Path outputDir) throws IOException {
|
||||||
Set<MethodDeclaration> methodsWithReturnType = new StateMachineTransitionConfigurationMethodFinder(source).findMethodsWithReturnType(STATE_MACHINE_RETURN_TYPES);
|
Set<MethodDeclaration> methodsWithReturnType = new StateMachineTransitionConfigurationMethodFinder(source).findMethodsWithReturnType(STATE_MACHINE_RETURN_TYPES);
|
||||||
if (!methodsWithReturnType.isEmpty()) {
|
if (!methodsWithReturnType.isEmpty()) {
|
||||||
methodsWithReturnType.forEach(m -> {
|
for (MethodDeclaration m : methodsWithReturnType) {
|
||||||
System.out.println("Found method returning StateMachine in: " + javaFile.toAbsolutePath());
|
System.out.println("Found method returning StateMachine in: " + javaFile.toAbsolutePath());
|
||||||
System.out.println("Method body:\n" + m.getBody());
|
System.out.println("Method body:\n" + m.getBody());
|
||||||
List<Transition> transitions = AstTransitionParser.parseTransitions2(m);
|
List<Transition> transitions = AstTransitionParser.parseTransitions2(m);
|
||||||
@@ -125,20 +134,8 @@ public class Main {
|
|||||||
endStates.addAll(visitor.getEndStates());
|
endStates.addAll(visitor.getEndStates());
|
||||||
|
|
||||||
String baseName = javaFile.getFileName().toString().replaceFirst("[.][^.]+$", "");
|
String baseName = javaFile.getFileName().toString().replaceFirst("[.][^.]+$", "");
|
||||||
|
generateOutputs(outputDir, baseName, transitions, startStates, endStates, outputs);
|
||||||
// Iterate over outputs and generate files dynamically
|
}
|
||||||
for (StateMachineExporter output : outputs) {
|
|
||||||
String content = output.export(transitions, startStates, endStates, true);
|
|
||||||
String fileName = baseName + output.getFileExtension();
|
|
||||||
try (PrintWriter out = new PrintWriter(fileName)) {
|
|
||||||
out.println(content);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package click.kamil.springstatemachineexporter.ast.common;
|
||||||
|
|
||||||
|
public final class StringUtils {
|
||||||
|
|
||||||
|
public static boolean isBlank(String string) {
|
||||||
|
if (isEmpty(string)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < string.length(); i++) {
|
||||||
|
if (!Character.isWhitespace(string.charAt(i))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNotBlank(String string) {
|
||||||
|
return !isBlank(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEmpty(String string) {
|
||||||
|
return string == null || string.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNotEmpty(String string) {
|
||||||
|
return !isEmpty(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String truncate(String string, int maxLength) {
|
||||||
|
if (string.length() > maxLength) {
|
||||||
|
return string.substring(0, maxLength);
|
||||||
|
}
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String truncate(String string, int maxLength, String truncationIndicator) {
|
||||||
|
if (truncationIndicator.length() >= maxLength) {
|
||||||
|
throw new IllegalArgumentException("maxLength must be greater than length of truncationIndicator");
|
||||||
|
}
|
||||||
|
if (string.length() > maxLength) {
|
||||||
|
int remainingLength = maxLength - truncationIndicator.length();
|
||||||
|
return string.substring(0, remainingLength) + truncationIndicator;
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
private StringUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package click.kamil.springstatemachineexporter.ast.out;
|
package click.kamil.springstatemachineexporter.ast.out;
|
||||||
|
|
||||||
import click.kamil.springstatemachineexporter.ast.app.domain.Transition;
|
import click.kamil.springstatemachineexporter.ast.app.domain.Transition;
|
||||||
import io.micrometer.common.util.StringUtils;
|
import click.kamil.springstatemachineexporter.ast.common.StringUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.springstatemachineexporter;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MainTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package click.kamil.springstatemachineexporter;
|
||||||
|
|
||||||
|
import click.kamil.springstatemachineexporter.ast.out.Dot;
|
||||||
|
import click.kamil.springstatemachineexporter.ast.out.PlantUml;
|
||||||
|
import click.kamil.springstatemachineexporter.ast.out.Scxml;
|
||||||
|
import click.kamil.springstatemachineexporter.ast.out.StateMachineExporter;
|
||||||
|
import click.kamil.springstatemachineexporter.utils.TestScenario;
|
||||||
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
class RegressionTest {
|
||||||
|
|
||||||
|
static List<TestScenario> provideTestScenarios() {
|
||||||
|
return List.of(
|
||||||
|
new TestScenario(
|
||||||
|
"Complex State Machine",
|
||||||
|
Path.of("../state_machines/complex_state_machine"),
|
||||||
|
Path.of("src/test/resources/golden/ComplexStateMachineConfig"),
|
||||||
|
"ComplexStateMachineConfig"
|
||||||
|
),
|
||||||
|
new TestScenario(
|
||||||
|
"Fork Join State Machine",
|
||||||
|
Path.of("../state_machines/forkjoin_state_machine"),
|
||||||
|
Path.of("src/test/resources/golden/ForkJoinStateMachineConfig"),
|
||||||
|
"ForkJoinStateMachineConfig"
|
||||||
|
),
|
||||||
|
new TestScenario(
|
||||||
|
"Kamil Enum State Machine",
|
||||||
|
Path.of("../state_machines/enumstate_state_machine"),
|
||||||
|
Path.of("src/test/resources/golden/KamilEnumStateMachineConfiguration"),
|
||||||
|
"KamilEnumStateMachineConfiguration"
|
||||||
|
),
|
||||||
|
new TestScenario(
|
||||||
|
"Simple Enum Join State Machine",
|
||||||
|
Path.of("../state_machines/simple_state_machine"),
|
||||||
|
Path.of("src/test/resources/golden/SimpleEnumStateMachineConfiguration"),
|
||||||
|
"SimpleEnumStateMachineConfiguration"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ParameterizedTest(name = "{0}")
|
||||||
|
@MethodSource("provideTestScenarios")
|
||||||
|
void testOutputMatchesGolden(TestScenario scenario, @TempDir Path tempDir) throws Exception {
|
||||||
|
Main.runExporter(scenario.inputPath(), tempDir);
|
||||||
|
|
||||||
|
List<StateMachineExporter> exporters = List.of(
|
||||||
|
new PlantUml(),
|
||||||
|
new Dot(),
|
||||||
|
new Scxml()
|
||||||
|
);
|
||||||
|
|
||||||
|
String baseName = scenario.baseName();
|
||||||
|
|
||||||
|
for (StateMachineExporter exporter : exporters) {
|
||||||
|
String fileName = baseName + exporter.getFileExtension();
|
||||||
|
|
||||||
|
Path actualFile = tempDir.resolve(baseName).resolve(fileName);
|
||||||
|
Path goldenFile = scenario.goldenPath().resolve(fileName);
|
||||||
|
|
||||||
|
assertThat(actualFile)
|
||||||
|
.as("File %s should exist in output", fileName)
|
||||||
|
.exists();
|
||||||
|
|
||||||
|
assertThat(actualFile)
|
||||||
|
.as("Content mismatch for %s", fileName)
|
||||||
|
.hasSameTextualContentAs(goldenFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package click.kamil.springstatemachineexporter.utils;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public record TestScenario(
|
||||||
|
String name,
|
||||||
|
Path inputPath,
|
||||||
|
Path goldenPath,
|
||||||
|
String baseName
|
||||||
|
) {}
|
||||||
45
state_machine_exporter_spring_based/.gitignore
vendored
Normal file
45
state_machine_exporter_spring_based/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
43
state_machine_exporter_spring_based/build.gradle
Normal file
43
state_machine_exporter_spring_based/build.gradle
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.5.3'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':state_machines:simple_state_machine')
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package click.kamil.springstatemachineexporter;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
//import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
//@ComponentScan(basePackages = {"click.kamil."})
|
||||||
|
class StatemachinedemoApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StatemachinedemoApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=statemachinedemo
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
45
state_machines/complex_state_machine/.gitignore
vendored
Normal file
45
state_machines/complex_state_machine/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
@@ -13,6 +13,10 @@ java {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
compileOnly {
|
compileOnly {
|
||||||
extendsFrom annotationProcessor
|
extendsFrom annotationProcessor
|
||||||
@@ -27,9 +31,6 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-starter'
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
||||||
|
|
||||||
// deps for parsing java AST
|
|
||||||
implementation 'org.eclipse.jdt:org.eclipse.jdt.core:3.36.0'
|
|
||||||
|
|
||||||
compileOnly 'org.projectlombok:lombok'
|
compileOnly 'org.projectlombok:lombok'
|
||||||
annotationProcessor 'org.projectlombok:lombok'
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine.complex.app;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
class StateMachineApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StateMachineApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=statemachinedemo
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
45
state_machines/dynamic_state_machine/.gitignore
vendored
Normal file
45
state_machines/dynamic_state_machine/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
42
state_machines/dynamic_state_machine/build.gradle
Normal file
42
state_machines/dynamic_state_machine/build.gradle
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.5.3'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine.dynamic.app;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
class StateMachineApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StateMachineApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=statemachinedemo
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
45
state_machines/enumstate_state_machine/.gitignore
vendored
Normal file
45
state_machines/enumstate_state_machine/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
42
state_machines/enumstate_state_machine/build.gradle
Normal file
42
state_machines/enumstate_state_machine/build.gradle
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.5.3'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine.enumstate.app;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
class StateMachineApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StateMachineApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=statemachinedemo
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
45
state_machines/forkjoin_state_machine/.gitignore
vendored
Normal file
45
state_machines/forkjoin_state_machine/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
42
state_machines/forkjoin_state_machine/build.gradle
Normal file
42
state_machines/forkjoin_state_machine/build.gradle
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.5.3'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine.forkjoin.app;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
class StateMachineApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StateMachineApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=statemachinedemo
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
45
state_machines/inheritance_state_machine/.gitignore
vendored
Normal file
45
state_machines/inheritance_state_machine/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
42
state_machines/inheritance_state_machine/build.gradle
Normal file
42
state_machines/inheritance_state_machine/build.gradle
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.5.3'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine.inheritancestate.app;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
class StateMachineApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StateMachineApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=statemachinedemo
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
45
state_machines/simple_state_machine/.gitignore
vendored
Normal file
45
state_machines/simple_state_machine/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
HELP.md
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### added
|
||||||
|
*.png
|
||||||
|
*.dot
|
||||||
|
*.scxml.xml
|
||||||
|
Combined.java
|
||||||
42
state_machines/simple_state_machine/build.gradle
Normal file
42
state_machines/simple_state_machine/build.gradle
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.5.3'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'click.kamil'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
|
||||||
|
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine.simple.app;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
class StateMachineApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StateMachineApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
spring.application.name=statemachinedemo
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package click.kamil.examples.statemachine;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class MyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user