diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/AnalysisResult.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/AnalysisResult.java index 75ddd83..c10beda 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/AnalysisResult.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/AnalysisResult.java @@ -35,6 +35,11 @@ public class AnalysisResult { @Builder.Default private List flows = java.util.Collections.emptyList(); + /** Resolved {@code StateMachineConfigurerAdapter} state type; persisted for JSON round-trip. */ + private String stateTypeFqn; + /** Resolved {@code StateMachineConfigurerAdapter} event type; persisted for JSON round-trip. */ + private String eventTypeFqn; + @Builder.Default private CodebaseMetadata metadata = CodebaseMetadata.empty(); @@ -56,7 +61,9 @@ public class AnalysisResult { // 2. Resolve states (State record is immutable, so recreate) if (states != null) { this.states = states.stream() - .map(s -> click.kamil.springstatemachineexporter.model.State.of(s.rawName(), resolver.resolveValue(s.fullIdentifier(), properties))) + .map(s -> click.kamil.springstatemachineexporter.model.State.of( + resolver.resolveValue(s.rawName(), properties), + resolver.resolveValue(s.fullIdentifier(), properties))) .collect(java.util.stream.Collectors.toSet()); } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/ConstantResolver.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/ConstantResolver.java index 9c251e4..57e8abb 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/ConstantResolver.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/ConstantResolver.java @@ -1037,9 +1037,19 @@ public class ConstantResolver { } if (valueExpr instanceof StringLiteral sl) { - return sl.getLiteralValue(); + String literal = sl.getLiteralValue(); + if (literal != null && literal.contains("${")) { + return click.kamil.springstatemachineexporter.analysis.util.PlaceholderResolver.resolve( + literal, java.util.Collections.emptyMap()); + } + return literal; } - return valueExpr != null ? valueExpr.toString().replaceAll("^\"|\"$", "") : null; + String raw = valueExpr != null ? valueExpr.toString().replaceAll("^\"|\"$", "") : null; + if (raw != null && raw.contains("${")) { + return click.kamil.springstatemachineexporter.analysis.util.PlaceholderResolver.resolve( + raw, java.util.Collections.emptyMap()); + } + return raw; } private TypeDeclaration findEnclosingType(ASTNode node) { diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/MachineEnumCanonicalizer.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/MachineEnumCanonicalizer.java index d428e94..a0c2d9e 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/MachineEnumCanonicalizer.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/resolver/MachineEnumCanonicalizer.java @@ -190,13 +190,26 @@ public final class MachineEnumCanonicalizer { if (state == null || enumTypeFqn == null || enumTypeFqn.isBlank()) { return state; } - String canonical = canonicalizeLabel( - state.fullIdentifier() != null ? state.fullIdentifier() : state.rawName(), - enumTypeFqn); - if (canonical.equals(state.fullIdentifier())) { + String raw = resolvePlaceholder(state.rawName()); + String full = resolvePlaceholder( + state.fullIdentifier() != null ? state.fullIdentifier() : state.rawName()); + String canonical = canonicalizeLabel(full, enumTypeFqn); + if (canonical.equals(state.fullIdentifier()) && raw.equals(state.rawName())) { return state; } - return State.of(state.rawName(), canonical); + if (isStringOrPrimitiveType(enumTypeFqn) && canonical.startsWith(enumTypeFqn + ".")) { + String constant = canonical.substring(enumTypeFqn.length() + 1); + raw = "\"" + constant + "\""; + } + return State.of(raw, canonical); + } + + private static String resolvePlaceholder(String value) { + if (value == null || !value.contains("${")) { + return value; + } + return click.kamil.springstatemachineexporter.analysis.util.PlaceholderResolver.resolve( + value, java.util.Collections.emptyMap()); } public static boolean isMachineEnumReference(String value, String enumTypeFqn) { @@ -230,6 +243,10 @@ public final class MachineEnumCanonicalizer { if (value == null || value.isBlank() || enumTypeFqn == null || enumTypeFqn.isBlank()) { return value; } + value = resolvePlaceholder(value); + if (value == null || value.isBlank()) { + return value; + } if (value.length() >= 2 && value.startsWith("\"") && value.endsWith("\"")) { return stripQuotes(value); } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizer.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizer.java index 306d255..32d6e25 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizer.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizer.java @@ -23,17 +23,50 @@ public final class AnalysisResultFinalizer { } public static void finalizeResult(AnalysisResult result, CodebaseContext context) { - if (result == null || context == null) { + if (result == null) { + return; + } + StateMachineTypeResolver.MachineTypes machineTypes = JsonExportContextFactory.resolveMachineTypes( + result.getName(), + result.getStateTypeFqn(), + result.getEventTypeFqn(), + context); + finalizeResult(result, context, machineTypes); + } + + public static void finalizeResult( + AnalysisResult result, + CodebaseContext context, + StateMachineTypeResolver.MachineTypes machineTypes) { + if (result == null || machineTypes == null) { return; } - StateMachineTypeResolver.MachineTypes machineTypes = - StateMachineTypeResolver.resolveTypes(result.getName(), context); + persistMachineTypes(result, machineTypes); + applyCanonicalization(result, machineTypes); + if (context != null) { + AnalysisCanonicalFormValidator.enforce(result, context); + } else { + AnalysisCanonicalFormValidator.enforceWithMachineTypes(result, machineTypes); + } + } + + private static void persistMachineTypes( + AnalysisResult result, + StateMachineTypeResolver.MachineTypes machineTypes) { + result.setStateTypeFqn(machineTypes.stateTypeFqn()); + result.setEventTypeFqn(machineTypes.eventTypeFqn()); + } + + private static void applyCanonicalization( + AnalysisResult result, + StateMachineTypeResolver.MachineTypes machineTypes) { MachineEnumCanonicalizer.canonicalizeTransitions(result.getTransitions(), machineTypes); if (result.getStates() != null) { - result.setStates(MachineEnumCanonicalizer.canonicalizeStates(result.getStates(), machineTypes.stateTypeFqn())); + result.setStates(MachineEnumCanonicalizer.canonicalizeStates( + result.getStates(), machineTypes.stateTypeFqn())); } result.setStartStates(MachineEnumCanonicalizer.canonicalizeStateLabels( result.getStartStates(), machineTypes.stateTypeFqn())); @@ -51,8 +84,6 @@ public final class AnalysisResultFinalizer { .properties(metadata.getProperties()) .build()); } - - AnalysisCanonicalFormValidator.enforce(result, context); } private static List canonicalizeTriggers( diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/JsonExportContextFactory.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/JsonExportContextFactory.java new file mode 100644 index 0000000..b1b683d --- /dev/null +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/JsonExportContextFactory.java @@ -0,0 +1,73 @@ +package click.kamil.springstatemachineexporter.analysis.service; + +import click.kamil.springstatemachineexporter.analysis.resolver.StateMachineTypeResolver; +import click.kamil.springstatemachineexporter.ast.common.CodebaseContext; +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +/** Builds a minimal {@link CodebaseContext} for JSON re-export when sources are available. */ +@Slf4j +public final class JsonExportContextFactory { + + private JsonExportContextFactory() { + } + + public static Path findProjectRoot(Path start) { + Path current = start != null ? start.toAbsolutePath().normalize() : null; + while (current != null) { + if (Files.exists(current.resolve("settings.gradle")) + || Files.exists(current.resolve("pom.xml")) + || Files.exists(current.resolve("build.gradle"))) { + return current; + } + current = current.getParent(); + } + return null; + } + + public static CodebaseContext scanProjectRoot(Path projectRoot, List activeProfiles) throws IOException { + CodebaseContext context = new CodebaseContext(); + if (activeProfiles != null) { + context.setActiveProfiles(activeProfiles); + } + context.setProjectRoot(projectRoot); + context.setResolveBindings(true); + + Path mainJava = projectRoot.resolve("src/main/java"); + if (Files.isDirectory(mainJava)) { + context.setSourcepath(List.of(mainJava.toString())); + context.scan(projectRoot); + return context; + } + + click.kamil.springstatemachineexporter.analysis.resolver.SiblingDependencyResolver siblingResolver = + new click.kamil.springstatemachineexporter.analysis.resolver.SiblingDependencyResolver(); + var projectGraph = siblingResolver.analyzeProject(projectRoot); + var scanPaths = projectGraph.resolveScanPaths(projectRoot, false); + context.scan(scanPaths, java.util.Collections.emptySet()); + return context; + } + + public static StateMachineTypeResolver.MachineTypes resolveMachineTypes( + String machineName, + String embeddedStateTypeFqn, + String embeddedEventTypeFqn, + CodebaseContext context) { + if (context != null && machineName != null) { + StateMachineTypeResolver.MachineTypes resolved = + StateMachineTypeResolver.resolveTypes(machineName, context); + if (resolved.stateTypeFqn() != null || resolved.eventTypeFqn() != null) { + return resolved; + } + } + return new StateMachineTypeResolver.MachineTypes(embeddedStateTypeFqn, embeddedEventTypeFqn); + } + + private static boolean hasPackageQualifiedType(String typeFqn) { + return typeFqn != null && typeFqn.contains("."); + } +} diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/validation/AnalysisCanonicalFormValidator.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/validation/AnalysisCanonicalFormValidator.java index d987901..a4fc677 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/validation/AnalysisCanonicalFormValidator.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/validation/AnalysisCanonicalFormValidator.java @@ -49,6 +49,46 @@ public final class AnalysisCanonicalFormValidator { return violations; } + validateFields(result, machineTypes, violations); + return violations; + } + + public static List validateWithMachineTypes( + AnalysisResult result, + StateMachineTypeResolver.MachineTypes machineTypes) { + List violations = new ArrayList<>(); + if (result == null || machineTypes == null) { + return violations; + } + if (!hasPackageQualifiedEnumType(machineTypes.stateTypeFqn()) + && !hasPackageQualifiedEnumType(machineTypes.eventTypeFqn())) { + return violations; + } + + validateFields(result, machineTypes, violations); + return violations; + } + + public static void enforce(AnalysisResult result, CodebaseContext context) { + List violations = validate(result, context); + if (!violations.isEmpty()) { + throw new AnalysisCanonicalFormException(violations); + } + } + + public static void enforceWithMachineTypes( + AnalysisResult result, + StateMachineTypeResolver.MachineTypes machineTypes) { + List violations = validateWithMachineTypes(result, machineTypes); + if (!violations.isEmpty()) { + throw new AnalysisCanonicalFormException(violations); + } + } + + private static void validateFields( + AnalysisResult result, + StateMachineTypeResolver.MachineTypes machineTypes, + List violations) { validateTransitions(result.getTransitions(), machineTypes, violations); validateStateCollection(result.getStates(), machineTypes.stateTypeFqn(), "states", violations); validateStateLabels(result.getStartStates(), machineTypes.stateTypeFqn(), "startStates", violations); @@ -58,15 +98,6 @@ public final class AnalysisCanonicalFormValidator { validateTriggers(result.getMetadata().getTriggers(), machineTypes, violations); validateCallChains(result.getMetadata().getCallChains(), machineTypes, violations); } - - return violations; - } - - public static void enforce(AnalysisResult result, CodebaseContext context) { - List violations = validate(result, context); - if (!violations.isEmpty()) { - throw new AnalysisCanonicalFormException(violations); - } } private static String describeTypes(StateMachineTypeResolver.MachineTypes machineTypes) { diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/StateResolver.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/StateResolver.java index 41289e4..2123594 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/StateResolver.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/StateResolver.java @@ -69,17 +69,26 @@ public class StateResolver { } private String extractAnnotationValue(Annotation ann) { + String raw; if (ann instanceof SingleMemberAnnotation sma) { - return stripQuotes(sma.getValue().toString()); + raw = stripQuotes(sma.getValue().toString()); } else if (ann instanceof NormalAnnotation na) { + raw = null; for (Object pairObj : na.values()) { MemberValuePair pair = (MemberValuePair) pairObj; if ("value".equals(pair.getName().getIdentifier())) { - return stripQuotes(pair.getValue().toString()); + raw = stripQuotes(pair.getValue().toString()); + break; } } + } else { + return null; } - return null; + if (raw != null && raw.contains("${")) { + return click.kamil.springstatemachineexporter.analysis.util.PlaceholderResolver.resolve( + raw, java.util.Collections.emptyMap()); + } + return raw; } private String stripQuotes(String s) { diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/command/ExporterCommand.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/command/ExporterCommand.java index b79403d..6713240 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/command/ExporterCommand.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/command/ExporterCommand.java @@ -30,7 +30,7 @@ public class ExporterCommand implements Callable { @CommandLine.Spec CommandLine.Model.CommandSpec spec; - @Option(names = {"-i", "--input"}, description = "Input directory containing the Spring Boot project source code.") + @Option(names = {"-i", "--input"}, description = "Input directory containing the Spring Boot project source code. With -j, optionally rescans sources to resolve machine enum types.") private Path inputDir; @Option(names = {"-j", "--json"}, description = "Input JSON file containing the state machine definition.") @@ -91,7 +91,7 @@ public class ExporterCommand implements Callable { try { List profiles = activeProfiles != null ? activeProfiles : java.util.Collections.emptyList(); if (jsonFile != null) { - exportService.runJsonExporter(jsonFile, outputDir, selectedFormats, profiles, eventFormat, stateFormat); + exportService.runJsonExporter(jsonFile, outputDir, selectedFormats, profiles, eventFormat, stateFormat, inputDir); } else { exportService.runExporter(inputDir, outputDir, selectedFormats, renderChoicesAsDiamonds, profiles, null, null, eventFormat, stateFormat, includeGeneratedSources, inlineAccessors); } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/exporter/JsonExporter.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/exporter/JsonExporter.java index 34a502c..bd6fe5b 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/exporter/JsonExporter.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/exporter/JsonExporter.java @@ -20,15 +20,9 @@ public class JsonExporter implements StateMachineExporter { @Override public String export(click.kamil.springstatemachineexporter.analysis.model.AnalysisResult result, ExportOptions options) { try { - java.util.Map output = new java.util.HashMap<>(); - output.put("name", result.getName()); - output.put("transitions", result.getTransitions()); - output.put("startStates", result.getStartStates()); - output.put("endStates", result.getEndStates()); - output.put("renderChoicesAsDiamonds", options.isRenderChoicesAsDiamonds()); - output.put("metadata", result.getMetadata()); - - return objectMapper.writeValueAsString(output); + // Full AnalysisResult serialization: self-contained interchange format for downstream + // exporters (HTML, etc.) without requiring source code re-analysis. + return objectMapper.writeValueAsString(result); } catch (Exception e) { throw new RuntimeException("Failed to export to JSON", e); } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/service/ExportService.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/service/ExportService.java index ced2446..b1139b6 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/service/ExportService.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/service/ExportService.java @@ -172,12 +172,37 @@ public class ExportService { } public void runJsonExporter(Path jsonFile, Path outputDir, List selectedFormats, List activeProfiles, click.kamil.springstatemachineexporter.exporter.EnumFormat eventFormat, click.kamil.springstatemachineexporter.exporter.EnumFormat stateFormat) throws IOException { + runJsonExporter(jsonFile, outputDir, selectedFormats, activeProfiles, eventFormat, stateFormat, null); + } + + public void runJsonExporter(Path jsonFile, Path outputDir, List selectedFormats, List activeProfiles, click.kamil.springstatemachineexporter.exporter.EnumFormat eventFormat, click.kamil.springstatemachineexporter.exporter.EnumFormat stateFormat, Path optionalSourceDir) throws IOException { JsonImportService jsonImportService = new JsonImportService(); AnalysisResult result = jsonImportService.importAnalysisResult(jsonFile); - - // Apply property resolution pass if placeholders exist + resolveProperties(result, activeProfiles); - + + CodebaseContext context = null; + Path sourceRoot = optionalSourceDir; + if (sourceRoot == null) { + sourceRoot = click.kamil.springstatemachineexporter.analysis.service.JsonExportContextFactory + .findProjectRoot(jsonFile.toAbsolutePath().getParent()); + } + if (sourceRoot != null) { + log.info("JSON re-export: scanning source project at {}", sourceRoot); + context = click.kamil.springstatemachineexporter.analysis.service.JsonExportContextFactory + .scanProjectRoot(sourceRoot, activeProfiles); + } else { + log.info("JSON re-export: no source project found; using embedded machine types if present"); + } + + StateMachineTypeResolver.MachineTypes machineTypes = + click.kamil.springstatemachineexporter.analysis.service.JsonExportContextFactory.resolveMachineTypes( + result.getName(), + result.getStateTypeFqn(), + result.getEventTypeFqn(), + context); + AnalysisResultFinalizer.finalizeResult(result, context, machineTypes); + generateOutputs(outputDir, result, selectedFormats, eventFormat, stateFormat); } diff --git a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/EnterpriseInitialStateExportTest.java b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/EnterpriseInitialStateExportTest.java new file mode 100644 index 0000000..113c548 --- /dev/null +++ b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/EnterpriseInitialStateExportTest.java @@ -0,0 +1,36 @@ +package click.kamil.springstatemachineexporter; + +import click.kamil.springstatemachineexporter.exporter.JsonExporter; +import click.kamil.springstatemachineexporter.service.ExportService; +import click.kamil.springstatemachineexporter.service.JsonImportService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import java.nio.file.Path; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +class EnterpriseInitialStateExportTest { + + @Test + void shouldExportCanonicalInitialStateForValuePlaceholder(@TempDir Path outputDir) throws Exception { + Path inputDir = Path.of("../state_machines/enterprise_order_system").toAbsolutePath().normalize(); + + ExportService exportService = new ExportService(List.of(new JsonExporter())); + exportService.runExporter(inputDir, outputDir, List.of("json"), true, List.of()); + + Path jsonFile = outputDir.resolve("click.kamil.examples.enterprise.config.EnterpriseStateMachineConfig") + .resolve("click.kamil.examples.enterprise.config.EnterpriseStateMachineConfig.json"); + + var result = new JsonImportService().importAnalysisResult(jsonFile); + + assertThat(result.getStateTypeFqn()).isEqualTo("String"); + assertThat(result.getStartStates()).containsExactly("String.NEW"); + assertThat(result.getStates()) + .anyMatch(s -> "String.NEW".equals(s.fullIdentifier()) + && !s.rawName().contains("${")); + assertThat(result.getStates()) + .noneMatch(s -> s.rawName().contains("${order.initial.state")); + } +} diff --git a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/resolver/EnterpriseStringMachineTypeTest.java b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/resolver/EnterpriseStringMachineTypeTest.java new file mode 100644 index 0000000..69cbe24 --- /dev/null +++ b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/resolver/EnterpriseStringMachineTypeTest.java @@ -0,0 +1,30 @@ +package click.kamil.springstatemachineexporter.analysis.resolver; + +import click.kamil.springstatemachineexporter.ast.common.CodebaseContext; +import org.junit.jupiter.api.Test; + +import java.nio.file.Path; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +class EnterpriseStringMachineTypeTest { + + @Test + void shouldResolveStringTypesForEnterpriseConfig() throws Exception { + Path projectRoot = Path.of("../state_machines/enterprise_order_system").toAbsolutePath().normalize(); + Path javaRoot = projectRoot.resolve("src/main/java"); + + CodebaseContext context = new CodebaseContext(); + context.setSourcepath(List.of(javaRoot.toString())); + context.scan(javaRoot); + + StateMachineTypeResolver.MachineTypes types = StateMachineTypeResolver.resolveTypes( + "click.kamil.examples.enterprise.config.EnterpriseStateMachineConfig", context); + + assertThat(types.stateTypeFqn()).isEqualTo("String"); + assertThat(types.eventTypeFqn()).isEqualTo("String"); + assertThat(MachineEnumCanonicalizer.canonicalizeLabel("NEW", types.stateTypeFqn())) + .isEqualTo("String.NEW"); + } +} diff --git a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizerTest.java b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizerTest.java index 437c03a..8baf7cf 100644 --- a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizerTest.java +++ b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/AnalysisResultFinalizerTest.java @@ -58,6 +58,36 @@ class AnalysisResultFinalizerTest { .containsExactly("com.example.order.OrderState.NEW"); assertThat(result.getMetadata().getTriggers().get(0).getPolymorphicEvents()) .containsExactly("com.example.order.OrderEvent.PAY"); + assertThat(result.getStateTypeFqn()).isEqualTo("com.example.order.OrderState"); + assertThat(result.getEventTypeFqn()).isEqualTo("com.example.order.OrderEvent"); + } + + @Test + void shouldCanonicalizeUsingEmbeddedMachineTypesWithoutContext() { + Transition transition = new Transition(); + transition.setEvent(Event.of("OrderEvent.PAY", "OrderEvent.PAY")); + transition.setSourceStates(List.of(State.of("OrderState.NEW", "OrderState.NEW"))); + transition.setTargetStates(List.of(State.of("OrderState.PAID", "OrderState.PAID"))); + + AnalysisResult result = AnalysisResult.builder() + .name("com.example.config.OrderStateMachineConfiguration") + .stateTypeFqn("com.example.order.OrderState") + .eventTypeFqn("com.example.order.OrderEvent") + .transitions(List.of(transition)) + .startStates(Set.of("OrderState.NEW")) + .build(); + + AnalysisResultFinalizer.finalizeResult( + result, + null, + new click.kamil.springstatemachineexporter.analysis.resolver.StateMachineTypeResolver.MachineTypes( + "com.example.order.OrderState", + "com.example.order.OrderEvent")); + + assertThat(result.getTransitions().get(0).getEvent().fullIdentifier()) + .isEqualTo("com.example.order.OrderEvent.PAY"); + assertThat(result.getStartStates()) + .containsExactly("com.example.order.OrderState.NEW"); } @Test diff --git a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/JsonRoundTripCanonicalizationTest.java b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/JsonRoundTripCanonicalizationTest.java new file mode 100644 index 0000000..2ed4d47 --- /dev/null +++ b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/JsonRoundTripCanonicalizationTest.java @@ -0,0 +1,139 @@ +package click.kamil.springstatemachineexporter.analysis.service; + +import click.kamil.springstatemachineexporter.analysis.model.AnalysisResult; +import click.kamil.springstatemachineexporter.analysis.model.CodebaseMetadata; +import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint; +import click.kamil.springstatemachineexporter.exporter.ExportOptions; +import click.kamil.springstatemachineexporter.exporter.JsonExporter; +import click.kamil.springstatemachineexporter.model.Event; +import click.kamil.springstatemachineexporter.model.State; +import click.kamil.springstatemachineexporter.model.Transition; +import click.kamil.springstatemachineexporter.service.ExportService; +import click.kamil.springstatemachineexporter.service.JsonImportService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; + +class JsonRoundTripCanonicalizationTest { + + @Test + void shouldCanonicalizeOnJsonReExportUsingEmbeddedMachineTypes(@TempDir Path tempDir) throws Exception { + writeSampleProject(tempDir); + + AnalysisResult shortForm = AnalysisResult.builder() + .name("com.example.config.OrderStateMachineConfiguration") + .stateTypeFqn("com.example.order.OrderState") + .eventTypeFqn("com.example.order.OrderEvent") + .transitions(List.of(shortTransition( + "OrderEvent.PAY", + "OrderState.NEW", + "OrderState.PAID"))) + .startStates(Set.of("OrderState.NEW")) + .metadata(CodebaseMetadata.builder() + .triggers(List.of(TriggerPoint.builder() + .event("OrderEvent.PAY") + .polymorphicEvents(List.of("OrderEvent.PAY")) + .className("com.example.web.OrderController") + .methodName("pay") + .sourceFile("OrderController.java") + .build())) + .build()) + .build(); + + Path jsonFile = tempDir.resolve("machine.json"); + Files.writeString(jsonFile, new JsonExporter().export(shortForm, ExportOptions.builder().build())); + + Path outputDir = tempDir.resolve("out"); + ExportService exportService = new ExportService(List.of(new JsonExporter())); + exportService.runJsonExporter(jsonFile, outputDir, List.of("json")); + + AnalysisResult roundTripped = new JsonImportService().importAnalysisResult( + outputDir.resolve("com.example.config.OrderStateMachineConfiguration") + .resolve("com.example.config.OrderStateMachineConfiguration.json")); + + assertThat(roundTripped.getStateTypeFqn()).isEqualTo("com.example.order.OrderState"); + assertThat(roundTripped.getEventTypeFqn()).isEqualTo("com.example.order.OrderEvent"); + assertThat(roundTripped.getTransitions().get(0).getEvent().fullIdentifier()) + .isEqualTo("com.example.order.OrderEvent.PAY"); + assertThat(roundTripped.getStartStates()) + .containsExactly("com.example.order.OrderState.NEW"); + assertThat(roundTripped.getMetadata().getTriggers().get(0).getPolymorphicEvents()) + .containsExactly("com.example.order.OrderEvent.PAY"); + } + + @Test + void shouldResolveMachineTypesFromSourceProjectWhenJsonLacksEmbeddedTypes(@TempDir Path tempDir) throws Exception { + writeSampleProject(tempDir.resolve("project")); + Path projectRoot = tempDir.resolve("project"); + + AnalysisResult shortForm = AnalysisResult.builder() + .name("com.example.config.OrderStateMachineConfiguration") + .transitions(List.of(shortTransition( + "OrderEvent.PAY", + "OrderState.NEW", + "OrderState.PAID"))) + .build(); + + Path jsonFile = tempDir.resolve("legacy.json"); + Files.writeString(jsonFile, new JsonExporter().export(shortForm, ExportOptions.builder().build())); + + Path outputDir = tempDir.resolve("out"); + ExportService exportService = new ExportService(List.of(new JsonExporter())); + exportService.runJsonExporter(jsonFile, outputDir, List.of("json"), List.of(), null, null, projectRoot); + + AnalysisResult roundTripped = new JsonImportService().importAnalysisResult( + outputDir.resolve("com.example.config.OrderStateMachineConfiguration") + .resolve("com.example.config.OrderStateMachineConfiguration.json")); + + assertThat(roundTripped.getTransitions().get(0).getEvent().fullIdentifier()) + .isEqualTo("com.example.order.OrderEvent.PAY"); + } + + @Test + void shouldFindProjectRootFromJsonDirectory(@TempDir Path tempDir) throws Exception { + Path projectRoot = tempDir.resolve("my-app"); + writeSampleProject(projectRoot); + Path nestedJsonDir = projectRoot.resolve("build/export"); + Files.createDirectories(nestedJsonDir); + + assertThat(JsonExportContextFactory.findProjectRoot(nestedJsonDir)) + .isEqualTo(projectRoot.toAbsolutePath().normalize()); + } + + private static Transition shortTransition(String event, String source, String target) { + Transition transition = new Transition(); + transition.setEvent(Event.of(event, event)); + transition.setSourceStates(List.of(State.of(source, source))); + transition.setTargetStates(List.of(State.of(target, target))); + return transition; + } + + private static void writeSampleProject(Path projectRoot) throws Exception { + Path javaRoot = projectRoot.resolve("src/main/java"); + Path orderPkg = javaRoot.resolve("com/example/order"); + Path configPkg = javaRoot.resolve("com/example/config"); + Files.createDirectories(orderPkg); + Files.createDirectories(configPkg); + Files.writeString(projectRoot.resolve("build.gradle"), "plugins { id 'java' }"); + Files.writeString(orderPkg.resolve("OrderState.java"), + "package com.example.order; public enum OrderState { NEW, PAID }"); + Files.writeString(orderPkg.resolve("OrderEvent.java"), + "package com.example.order; public enum OrderEvent { PAY }"); + Files.writeString(configPkg.resolve("OrderStateMachineConfiguration.java"), + """ + package com.example.config; + import com.example.order.OrderEvent; + import com.example.order.OrderState; + import org.springframework.statemachine.config.EnumStateMachineConfigurerAdapter; + public class OrderStateMachineConfiguration + extends EnumStateMachineConfigurerAdapter { + } + """); + } +} diff --git a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/exporter/JsonInterchangeContractTest.java b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/exporter/JsonInterchangeContractTest.java new file mode 100644 index 0000000..52cde64 --- /dev/null +++ b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/exporter/JsonInterchangeContractTest.java @@ -0,0 +1,56 @@ +package click.kamil.springstatemachineexporter.exporter; + +import click.kamil.springstatemachineexporter.analysis.model.AnalysisResult; +import click.kamil.springstatemachineexporter.analysis.model.BusinessFlow; +import click.kamil.springstatemachineexporter.analysis.model.CodebaseMetadata; +import click.kamil.springstatemachineexporter.model.Event; +import click.kamil.springstatemachineexporter.model.State; +import click.kamil.springstatemachineexporter.model.Transition; +import click.kamil.springstatemachineexporter.service.JsonImportService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; + +class JsonInterchangeContractTest { + + @Test + void shouldExportCompleteSelfContainedAnalysisResult(@TempDir Path tempDir) throws Exception { + Transition transition = new Transition(); + transition.setEvent(Event.of("OrderEvent.PAY", "com.example.order.OrderEvent.PAY")); + transition.setSourceStates(List.of(State.of("OrderState.NEW", "com.example.order.OrderState.NEW"))); + transition.setTargetStates(List.of(State.of("OrderState.PAID", "com.example.order.OrderState.PAID"))); + + AnalysisResult original = AnalysisResult.builder() + .name("com.example.config.OrderStateMachineConfiguration") + .stateTypeFqn("com.example.order.OrderState") + .eventTypeFqn("com.example.order.OrderEvent") + .states(Set.of(State.of("OrderState.NEW", "com.example.order.OrderState.NEW"))) + .transitions(List.of(transition)) + .startStates(Set.of("com.example.order.OrderState.NEW")) + .endStates(Set.of("com.example.order.OrderState.PAID")) + .renderChoicesAsDiamonds(true) + .flows(List.of(BusinessFlow.builder().name("Pay flow").steps(List.of("PAY")).build())) + .metadata(CodebaseMetadata.empty()) + .build(); + + Path jsonFile = tempDir.resolve("machine.json"); + Files.writeString(jsonFile, new JsonExporter().export(original, ExportOptions.builder().build())); + + AnalysisResult imported = new JsonImportService().importAnalysisResult(jsonFile); + + assertThat(imported.getName()).isEqualTo(original.getName()); + assertThat(imported.getStateTypeFqn()).isEqualTo("com.example.order.OrderState"); + assertThat(imported.getEventTypeFqn()).isEqualTo("com.example.order.OrderEvent"); + assertThat(imported.getStates()).hasSize(1); + assertThat(imported.getFlows()).extracting(BusinessFlow::getName).containsExactly("Pay flow"); + assertThat(imported.isRenderChoicesAsDiamonds()).isTrue(); + assertThat(imported.getTransitions().get(0).getEvent().fullIdentifier()) + .isEqualTo("com.example.order.OrderEvent.PAY"); + } +} diff --git a/state_machine_exporter/src/test/resources/golden/ComplexStateMachineConfig/ComplexStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/ComplexStateMachineConfig/ComplexStateMachineConfig.json index e9b0774..b953c9e 100644 --- a/state_machine_exporter/src/test/resources/golden/ComplexStateMachineConfig/ComplexStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/ComplexStateMachineConfig/ComplexStateMachineConfig.json @@ -1,17 +1,69 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.complex.ComplexStateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "ComplexStateMachineConfig.States.STATE1" ], + "states" : [ { + "rawName" : "States.STATE2", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE8" + }, { + "rawName" : "States.STATE11", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE11" + }, { + "rawName" : "States.STATE13", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE13" + }, { + "rawName" : "States.STATE15", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE15" + }, { + "rawName" : "States.STATE17", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE17" + }, { + "rawName" : "States.STATE19", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE19" + }, { + "rawName" : "States.STATE20", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE20" + }, { + "rawName" : "ComplexStateMachineConfig.States.STATE1", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE1" + }, { + "rawName" : "States.STATE1", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE9" + }, { + "rawName" : "States.STATE10", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE10" + }, { + "rawName" : "States.STATE12", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE12" + }, { + "rawName" : "States.STATE14", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE14" + }, { + "rawName" : "States.STATE16", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE16" + }, { + "rawName" : "States.STATE18", + "fullIdentifier" : "ComplexStateMachineConfig.States.STATE18" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -681,5 +733,20 @@ "actions" : [ ], "order" : 1 } ], - "endStates" : [ ] + "startStates" : [ "ComplexStateMachineConfig.States.STATE1" ], + "endStates" : [ ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "ComplexStateMachineConfig.States", + "eventTypeFqn" : "ComplexStateMachineConfig.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json index 4fb4720..7191c74 100644 --- a/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json @@ -1,70 +1,42 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ { - "type" : "CUSTOM", - "name" : "INTERCEPTOR: SecurityInterceptor.preHandle", - "className" : "click.kamil.examples.enterprise.api.SecurityInterceptor", - "methodName" : "preHandle", - "sourceFile" : null, - "metadata" : { - "interceptorType" : "Spring MVC Interceptor" - }, - "parameters" : [ ] - }, { - "type" : "REST", - "name" : "POST /api/enterprise/payments", - "className" : "click.kamil.examples.enterprise.api.ReactivePaymentController", - "methodName" : "pay", - "sourceFile" : "src/main/java/click/kamil/examples/enterprise/api/ReactivePaymentController.java", - "metadata" : { - "path" : "/api/enterprise/payments", - "verb" : "POST" - }, - "parameters" : [ { - "name" : "orderId", - "type" : "String", - "annotations" : [ "RequestBody" ] - } ] - }, { - "type" : "JMS", - "name" : "JMS: shipping.queue", - "className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener", - "methodName" : "onShippingReady", - "sourceFile" : "src/main/java/click/kamil/examples/enterprise/messaging/ShippingJmsListener.java", - "metadata" : { - "protocol" : "JMS", - "destination" : "shipping.queue" - }, - "parameters" : [ { - "name" : "orderId", - "type" : "String", - "annotations" : [ ] - } ] - }, { - "type" : "RABBIT", - "name" : "RABBIT: returns.queue", - "className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener", - "methodName" : "onReturn", - "sourceFile" : "src/main/java/click/kamil/examples/enterprise/messaging/ReturnsRabbitListener.java", - "metadata" : { - "protocol" : "RABBIT", - "destination" : "returns.queue" - }, - "parameters" : [ { - "name" : "orderId", - "type" : "String", - "annotations" : [ ] - } ] - } ], - "callChains" : [ ], - "properties" : { - "default" : { } - } - }, "name" : "click.kamil.examples.enterprise.config.EnterpriseStateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "String.NEW" ], + "states" : [ { + "rawName" : "String.CANCELLED", + "fullIdentifier" : "String.CANCELLED" + }, { + "rawName" : "\"NEW\"", + "fullIdentifier" : "String.NEW" + }, { + "rawName" : "\"CANCELLED\"", + "fullIdentifier" : "String.CANCELLED" + }, { + "rawName" : "\"PENDING_PAYMENT\"", + "fullIdentifier" : "String.PENDING_PAYMENT" + }, { + "rawName" : "\"SHIPPED\"", + "fullIdentifier" : "String.SHIPPED" + }, { + "rawName" : "\"PAID\"", + "fullIdentifier" : "String.PAID" + }, { + "rawName" : "String.DELIVERED", + "fullIdentifier" : "String.DELIVERED" + }, { + "rawName" : "\"CHECK_AVAILABILITY\"", + "fullIdentifier" : "String.CHECK_AVAILABILITY" + }, { + "rawName" : "\"DELIVERED\"", + "fullIdentifier" : "String.DELIVERED" + }, { + "rawName" : "String.NEW", + "fullIdentifier" : "String.NEW" + }, { + "rawName" : "\"RETURNED\"", + "fullIdentifier" : "String.RETURNED" + }, { + "rawName" : "String.RETURNED", + "fullIdentifier" : "String.RETURNED" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -203,5 +175,85 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "String.CANCELLED", "String.RETURNED", "String.DELIVERED" ] + "startStates" : [ "String.NEW" ], + "endStates" : [ "String.CANCELLED", "String.RETURNED", "String.DELIVERED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ { + "name" : "Success Path (Order to Shipment)", + "description" : "The standard customer journey: Order Placement -> Availability Check -> Payment -> Shipment.", + "steps" : [ "PLACE_ORDER", "CHECK_AVAILABILITY->PENDING_PAYMENT", "PAY_ORDER", "SHIP_ORDER" ] + }, { + "name" : "Immediate Cancellation", + "description" : "User cancels the order immediately after payment.", + "steps" : [ "PLACE_ORDER", "CHECK_AVAILABILITY->PENDING_PAYMENT", "PAY_ORDER", "CANCEL_ORDER" ] + }, { + "name" : "Stock Out Flow", + "description" : "Order is cancelled because items are out of stock.", + "steps" : [ "PLACE_ORDER", "CHECK_AVAILABILITY->CANCELLED" ] + } ], + "stateTypeFqn" : "String", + "eventTypeFqn" : "String", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ { + "type" : "CUSTOM", + "name" : "INTERCEPTOR: SecurityInterceptor.preHandle", + "className" : "click.kamil.examples.enterprise.api.SecurityInterceptor", + "methodName" : "preHandle", + "sourceFile" : null, + "metadata" : { + "interceptorType" : "Spring MVC Interceptor" + }, + "parameters" : [ ] + }, { + "type" : "REST", + "name" : "POST /api/enterprise/payments", + "className" : "click.kamil.examples.enterprise.api.ReactivePaymentController", + "methodName" : "pay", + "sourceFile" : "src/main/java/click/kamil/examples/enterprise/api/ReactivePaymentController.java", + "metadata" : { + "path" : "/api/enterprise/payments", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "orderId", + "type" : "String", + "annotations" : [ "RequestBody" ] + } ] + }, { + "type" : "JMS", + "name" : "JMS: shipping.queue", + "className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener", + "methodName" : "onShippingReady", + "sourceFile" : "src/main/java/click/kamil/examples/enterprise/messaging/ShippingJmsListener.java", + "metadata" : { + "protocol" : "JMS", + "destination" : "shipping.queue" + }, + "parameters" : [ { + "name" : "orderId", + "type" : "String", + "annotations" : [ ] + } ] + }, { + "type" : "RABBIT", + "name" : "RABBIT: returns.queue", + "className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener", + "methodName" : "onReturn", + "sourceFile" : "src/main/java/click/kamil/examples/enterprise/messaging/ReturnsRabbitListener.java", + "metadata" : { + "protocol" : "RABBIT", + "destination" : "returns.queue" + }, + "parameters" : [ { + "name" : "orderId", + "type" : "String", + "annotations" : [ ] + } ] + } ], + "callChains" : [ ], + "properties" : { + "default" : { } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.dot b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.dot index 653e9c3..efd77de 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.dot +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.dot @@ -4,7 +4,7 @@ digraph statemachine { edge [fontname="Arial", fontsize=10]; _start [shape=circle, label="", fillcolor=black, width=0.1]; - _start -> INIT_STATE; + _start -> START; CANCELLED [fillcolor=lightgray]; COMPLETED [fillcolor=lightgray]; START -> PROCESSING [label="String.SUBMIT_EVENT", style="solid", color="black"]; diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json index d98caf0..39f204b 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json @@ -1,4 +1,130 @@ { + "name" : "click.kamil.examples.statemachine.extended.config.ExtendedStateMachineConfig", + "states" : [ { + "rawName" : "\"COMPLETED\"", + "fullIdentifier" : "String.COMPLETED" + }, { + "rawName" : "\"CANCELLED\"", + "fullIdentifier" : "String.CANCELLED" + }, { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + }, { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + }, { + "rawName" : "String.START", + "fullIdentifier" : "String.START" + } ], + "transitions" : [ { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "event" : { + "rawName" : "MyEvents.SUBMIT", + "fullIdentifier" : "String.SUBMIT_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "targetStates" : [ { + "rawName" : "\"COMPLETED\"", + "fullIdentifier" : "String.COMPLETED" + } ], + "event" : { + "rawName" : "\"FINISH\"", + "fullIdentifier" : "String.FINISH" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "targetStates" : [ { + "rawName" : "\"CANCELLED\"", + "fullIdentifier" : "String.CANCELLED" + } ], + "event" : { + "rawName" : "MyEvents.CANCEL", + "fullIdentifier" : "String.CANCEL_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "event" : { + "rawName" : "\"REACTIVE_EVENT\"", + "fullIdentifier" : "String.REACTIVE_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "event" : { + "rawName" : "\"AUDIT_EVENT\"", + "fullIdentifier" : "String.AUDIT_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "event" : { + "rawName" : "\"EXTERNAL_TRIGGER\"", + "fullIdentifier" : "String.EXTERNAL_TRIGGER" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + } ], + "startStates" : [ "String.START" ], + "endStates" : [ "String.CANCELLED", "String.COMPLETED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "String", + "eventTypeFqn" : "String", "metadata" : { "triggers" : [ { "event" : "[LIFECYCLE:RESTORE]", @@ -135,112 +261,5 @@ "app.states.initial" : "PROD_INITIAL" } } - }, - "name" : "click.kamil.examples.statemachine.extended.config.ExtendedStateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "String.INIT_STATE" ], - "transitions" : [ { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "event" : { - "rawName" : "MyEvents.SUBMIT", - "fullIdentifier" : "String.SUBMIT_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "targetStates" : [ { - "rawName" : "\"COMPLETED\"", - "fullIdentifier" : "String.COMPLETED" - } ], - "event" : { - "rawName" : "\"FINISH\"", - "fullIdentifier" : "String.FINISH" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "targetStates" : [ { - "rawName" : "\"CANCELLED\"", - "fullIdentifier" : "String.CANCELLED" - } ], - "event" : { - "rawName" : "MyEvents.CANCEL", - "fullIdentifier" : "String.CANCEL_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "event" : { - "rawName" : "\"REACTIVE_EVENT\"", - "fullIdentifier" : "String.REACTIVE_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "event" : { - "rawName" : "\"AUDIT_EVENT\"", - "fullIdentifier" : "String.AUDIT_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "event" : { - "rawName" : "\"EXTERNAL_TRIGGER\"", - "fullIdentifier" : "String.EXTERNAL_TRIGGER" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - } ], - "endStates" : [ "String.CANCELLED", "String.COMPLETED" ] + } } diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.puml b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.puml index 558f6a8..b8aa78e 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.puml +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.puml @@ -21,7 +21,7 @@ skinparam ArrowThickness 1 skinparam dpi 110 skinparam svgLinkTarget _self -[*] --> String.INIT_STATE +[*] --> String.START String.START -[#1E90FF,bold]-> String.PROCESSING <> : String.SUBMIT_EVENT diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.scxml.xml b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.scxml.xml index e1b75aa..e11c16e 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.scxml.xml +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.scxml.xml @@ -1,5 +1,5 @@ - + @@ -14,7 +14,5 @@ - - diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.dot b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.dot index db8e769..efd77de 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.dot +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.dot @@ -4,7 +4,7 @@ digraph statemachine { edge [fontname="Arial", fontsize=10]; _start [shape=circle, label="", fillcolor=black, width=0.1]; - _start -> PROD_INITIAL; + _start -> START; CANCELLED [fillcolor=lightgray]; COMPLETED [fillcolor=lightgray]; START -> PROCESSING [label="String.SUBMIT_EVENT", style="solid", color="black"]; diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json index c32fe63..39f204b 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json @@ -1,4 +1,130 @@ { + "name" : "click.kamil.examples.statemachine.extended.config.ExtendedStateMachineConfig", + "states" : [ { + "rawName" : "\"COMPLETED\"", + "fullIdentifier" : "String.COMPLETED" + }, { + "rawName" : "\"CANCELLED\"", + "fullIdentifier" : "String.CANCELLED" + }, { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + }, { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + }, { + "rawName" : "String.START", + "fullIdentifier" : "String.START" + } ], + "transitions" : [ { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "event" : { + "rawName" : "MyEvents.SUBMIT", + "fullIdentifier" : "String.SUBMIT_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "targetStates" : [ { + "rawName" : "\"COMPLETED\"", + "fullIdentifier" : "String.COMPLETED" + } ], + "event" : { + "rawName" : "\"FINISH\"", + "fullIdentifier" : "String.FINISH" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "targetStates" : [ { + "rawName" : "\"CANCELLED\"", + "fullIdentifier" : "String.CANCELLED" + } ], + "event" : { + "rawName" : "MyEvents.CANCEL", + "fullIdentifier" : "String.CANCEL_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "event" : { + "rawName" : "\"REACTIVE_EVENT\"", + "fullIdentifier" : "String.REACTIVE_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "event" : { + "rawName" : "\"AUDIT_EVENT\"", + "fullIdentifier" : "String.AUDIT_EVENT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + } ], + "targetStates" : [ { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + } ], + "event" : { + "rawName" : "\"EXTERNAL_TRIGGER\"", + "fullIdentifier" : "String.EXTERNAL_TRIGGER" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + } ], + "startStates" : [ "String.START" ], + "endStates" : [ "String.CANCELLED", "String.COMPLETED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "String", + "eventTypeFqn" : "String", "metadata" : { "triggers" : [ { "event" : "[LIFECYCLE:RESTORE]", @@ -135,112 +261,5 @@ "app.states.initial" : "PROD_INITIAL" } } - }, - "name" : "click.kamil.examples.statemachine.extended.config.ExtendedStateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "String.PROD_INITIAL" ], - "transitions" : [ { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "event" : { - "rawName" : "MyEvents.SUBMIT", - "fullIdentifier" : "String.SUBMIT_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "targetStates" : [ { - "rawName" : "\"COMPLETED\"", - "fullIdentifier" : "String.COMPLETED" - } ], - "event" : { - "rawName" : "\"FINISH\"", - "fullIdentifier" : "String.FINISH" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "targetStates" : [ { - "rawName" : "\"CANCELLED\"", - "fullIdentifier" : "String.CANCELLED" - } ], - "event" : { - "rawName" : "MyEvents.CANCEL", - "fullIdentifier" : "String.CANCEL_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "event" : { - "rawName" : "\"REACTIVE_EVENT\"", - "fullIdentifier" : "String.REACTIVE_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "event" : { - "rawName" : "\"AUDIT_EVENT\"", - "fullIdentifier" : "String.AUDIT_EVENT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "\"START\"", - "fullIdentifier" : "String.START" - } ], - "targetStates" : [ { - "rawName" : "\"PROCESSING\"", - "fullIdentifier" : "String.PROCESSING" - } ], - "event" : { - "rawName" : "\"EXTERNAL_TRIGGER\"", - "fullIdentifier" : "String.EXTERNAL_TRIGGER" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - } ], - "endStates" : [ "String.CANCELLED", "String.COMPLETED" ] + } } diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.puml b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.puml index c66a058..b8aa78e 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.puml +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.puml @@ -21,7 +21,7 @@ skinparam ArrowThickness 1 skinparam dpi 110 skinparam svgLinkTarget _self -[*] --> String.PROD_INITIAL +[*] --> String.START String.START -[#1E90FF,bold]-> String.PROCESSING <> : String.SUBMIT_EVENT diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.scxml.xml b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.scxml.xml index f876600..e11c16e 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.scxml.xml +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.scxml.xml @@ -1,5 +1,5 @@ - + @@ -14,7 +14,5 @@ - - diff --git a/state_machine_exporter/src/test/resources/golden/F1StateMachineConfiguration/F1StateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/F1StateMachineConfiguration/F1StateMachineConfiguration.json index 464aba0..7cedbca 100644 --- a/state_machine_exporter/src/test/resources/golden/F1StateMachineConfiguration/F1StateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/F1StateMachineConfiguration/F1StateMachineConfiguration.json @@ -1,17 +1,93 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.F1StateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "states" : [ { + "rawName" : "States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE9" + }, { + "rawName" : "States.STATEY", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEY" + }, { + "rawName" : "States.STATE_EXTRA_2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_2" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE11", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE11" + }, { + "rawName" : "States.STATE13", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE13" + }, { + "rawName" : "States.STATE15", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE15" + }, { + "rawName" : "States.STATE17", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE17" + }, { + "rawName" : "States.STATE19", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE19" + }, { + "rawName" : "States.STATE20", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE20" + }, { + "rawName" : "States.STATE2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE8" + }, { + "rawName" : "States.STATEX", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEX" + }, { + "rawName" : "States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.STATE_EXTRA_1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_1" + }, { + "rawName" : "States.STATE_EXTRA_3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_3" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.CANCEL" + }, { + "rawName" : "States.STATE10", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE10" + }, { + "rawName" : "States.STATE12", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE12" + }, { + "rawName" : "States.STATE14", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE14" + }, { + "rawName" : "States.STATE16", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE16" + }, { + "rawName" : "States.STATE18", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE18" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -921,5 +997,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ] + "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States", + "eventTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/F2StateMachineConfiguration/F2StateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/F2StateMachineConfiguration/F2StateMachineConfiguration.json index bcd5e2e..d1a4771 100644 --- a/state_machine_exporter/src/test/resources/golden/F2StateMachineConfiguration/F2StateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/F2StateMachineConfiguration/F2StateMachineConfiguration.json @@ -1,17 +1,96 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.F2StateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "states" : [ { + "rawName" : "States.STATE_EXTRA_1_1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_1_1" + }, { + "rawName" : "States.STATE_EXTRA_1_3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_1_3" + }, { + "rawName" : "States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE9" + }, { + "rawName" : "States.STATEY", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEY" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE11", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE11" + }, { + "rawName" : "States.STATE13", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE13" + }, { + "rawName" : "States.STATE15", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE15" + }, { + "rawName" : "States.STATE17", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE17" + }, { + "rawName" : "States.STATE19", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE19" + }, { + "rawName" : "States.STATE20", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE20" + }, { + "rawName" : "States.STATE_EXTRA_1_2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_1_2" + }, { + "rawName" : "States.STATE2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE8" + }, { + "rawName" : "States.STATEX", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEX" + }, { + "rawName" : "States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.STATE_EXTRA_1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_1" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.CANCEL" + }, { + "rawName" : "States.STATE10", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE10" + }, { + "rawName" : "States.STATE12", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE12" + }, { + "rawName" : "States.STATE14", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE14" + }, { + "rawName" : "States.STATE16", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE16" + }, { + "rawName" : "States.STATE18", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE18" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -938,5 +1017,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ] + "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States", + "eventTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/ForkJoinStateMachineConfig/ForkJoinStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/ForkJoinStateMachineConfig/ForkJoinStateMachineConfig.json index cd4be4f..60f8ee4 100644 --- a/state_machine_exporter/src/test/resources/golden/ForkJoinStateMachineConfig/ForkJoinStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/ForkJoinStateMachineConfig/ForkJoinStateMachineConfig.json @@ -1,17 +1,36 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.forkjoin.ForkJoinStateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "ForkJoinStateMachineConfig.States.START" ], + "states" : [ { + "rawName" : "States.REGION2_STATE1", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.REGION2_STATE1" + }, { + "rawName" : "States.REGION2_STATE2", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.REGION2_STATE2" + }, { + "rawName" : "States.JOIN", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.JOIN" + }, { + "rawName" : "States.START", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.START" + }, { + "rawName" : "States.REGION1_STATE1", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.REGION1_STATE1" + }, { + "rawName" : "States.REGION1_STATE2", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.REGION1_STATE2" + }, { + "rawName" : "States.END", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.END" + }, { + "rawName" : "ForkJoinStateMachineConfig.States.END", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.END" + }, { + "rawName" : "States.FORK", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.FORK" + }, { + "rawName" : "ForkJoinStateMachineConfig.States.START", + "fullIdentifier" : "ForkJoinStateMachineConfig.States.START" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -115,5 +134,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "ForkJoinStateMachineConfig.States.END" ] + "startStates" : [ "ForkJoinStateMachineConfig.States.START" ], + "endStates" : [ "ForkJoinStateMachineConfig.States.END" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "ForkJoinStateMachineConfig.States", + "eventTypeFqn" : "ForkJoinStateMachineConfig.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/G1StateMachineConfiguration/G1StateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/G1StateMachineConfiguration/G1StateMachineConfiguration.json index d6092cf..14e74a3 100644 --- a/state_machine_exporter/src/test/resources/golden/G1StateMachineConfiguration/G1StateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/G1StateMachineConfiguration/G1StateMachineConfiguration.json @@ -1,17 +1,60 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.G1StateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "states" : [ { + "rawName" : "States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE9" + }, { + "rawName" : "States.STATEY", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEY" + }, { + "rawName" : "States.STATE_EXTRA_2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_2" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE8" + }, { + "rawName" : "States.STATEX", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEX" + }, { + "rawName" : "States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.STATE_EXTRA_3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_3" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.CANCEL" + }, { + "rawName" : "States.STATE10", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE10" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -445,5 +488,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ] + "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States", + "eventTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/G2StateMachineConfiguration/G2StateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/G2StateMachineConfiguration/G2StateMachineConfiguration.json index eff78ed..1dfd657 100644 --- a/state_machine_exporter/src/test/resources/golden/G2StateMachineConfiguration/G2StateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/G2StateMachineConfiguration/G2StateMachineConfiguration.json @@ -1,17 +1,60 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.G2StateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "states" : [ { + "rawName" : "States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE9" + }, { + "rawName" : "States.STATEY", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEY" + }, { + "rawName" : "States.STATE_EXTRA_2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_2" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" + }, { + "rawName" : "States.STATE2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE8" + }, { + "rawName" : "States.STATEX", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEX" + }, { + "rawName" : "States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.STATE_EXTRA_1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE_EXTRA_1" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" + }, { + "rawName" : "States.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.CANCEL" + }, { + "rawName" : "States.STATE10", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE10" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -462,5 +505,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ] + "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATE1" ], + "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States.STATEZ" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.States", + "eventTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate3.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json index 3eb30b3..d6e6d0e 100644 --- a/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json @@ -1,15 +1,15 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { } - } - }, "name" : "click.kamil.examples.statemachine.inheritance.config.InheritanceStateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "String.START" ], + "states" : [ { + "rawName" : "\"WORKING\"", + "fullIdentifier" : "String.WORKING" + }, { + "rawName" : "\"START\"", + "fullIdentifier" : "String.START" + }, { + "rawName" : "String.START", + "fullIdentifier" : "String.START" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -28,5 +28,18 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "String.WORKING" ] + "startStates" : [ "String.START" ], + "endStates" : [ "String.WORKING" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "String", + "eventTypeFqn" : "String", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/KamilEnumStateMachineConfiguration/KamilEnumStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/KamilEnumStateMachineConfiguration/KamilEnumStateMachineConfiguration.json index eb64a1b..f1a30f4 100644 --- a/state_machine_exporter/src/test/resources/golden/KamilEnumStateMachineConfiguration/KamilEnumStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/KamilEnumStateMachineConfiguration/KamilEnumStateMachineConfiguration.json @@ -1,17 +1,39 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.enumstate.KamilEnumStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.enumstate.OrderStates.SUBMITTED" ], + "states" : [ { + "rawName" : "OrderStates.CANCELED", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.CANCELED" + }, { + "rawName" : "OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.SUBMITTED" + }, { + "rawName" : "OrderStates.FULFILLED", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.FULFILLED" + }, { + "rawName" : "click.kamil.examples.statemachine.enumstate.OrderStates.CANCELED", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.CANCELED" + }, { + "rawName" : "OrderStates.PAID1", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.PAID1" + }, { + "rawName" : "OrderStates.PAID2", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.PAID2" + }, { + "rawName" : "OrderStates.PAID3", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.PAID3" + }, { + "rawName" : "OrderStates.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.PAID" + }, { + "rawName" : "click.kamil.examples.statemachine.enumstate.OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.SUBMITTED" + }, { + "rawName" : "click.kamil.examples.statemachine.enumstate.OrderStates.FULFILLED", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.FULFILLED" + }, { + "rawName" : "OrderStates.HAPPEN", + "fullIdentifier" : "click.kamil.examples.statemachine.enumstate.OrderStates.HAPPEN" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -252,5 +274,20 @@ } ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.enumstate.OrderStates.CANCELED", "click.kamil.examples.statemachine.enumstate.OrderStates.FULFILLED" ] + "startStates" : [ "click.kamil.examples.statemachine.enumstate.OrderStates.SUBMITTED" ], + "endStates" : [ "click.kamil.examples.statemachine.enumstate.OrderStates.CANCELED", "click.kamil.examples.statemachine.enumstate.OrderStates.FULFILLED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.enumstate.OrderStates", + "eventTypeFqn" : "click.kamil.examples.statemachine.enumstate.OrderEvents", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json b/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json index 003cc86..0fc35bd 100644 --- a/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json +++ b/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json @@ -1,15 +1,21 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { } - } - }, "name" : "click.kamil.maven.core.MavenOrderStateMachine", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "String.INIT" ], + "states" : [ { + "rawName" : "\"DONE\"", + "fullIdentifier" : "String.DONE" + }, { + "rawName" : "String.INIT", + "fullIdentifier" : "String.INIT" + }, { + "rawName" : "\"INIT\"", + "fullIdentifier" : "String.INIT" + }, { + "rawName" : "\"BUSY\"", + "fullIdentifier" : "String.BUSY" + }, { + "rawName" : "String.DONE", + "fullIdentifier" : "String.DONE" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -52,5 +58,18 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "String.DONE" ] + "startStates" : [ "String.INIT" ], + "endStates" : [ "String.DONE" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "String", + "eventTypeFqn" : "String", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/OneStateMachineConfiguration/OneStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/OneStateMachineConfiguration/OneStateMachineConfiguration.json index 9838938..5ad0810 100644 --- a/state_machine_exporter/src/test/resources/golden/OneStateMachineConfiguration/OneStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/OneStateMachineConfiguration/OneStateMachineConfiguration.json @@ -1,17 +1,84 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.inheritancestate.OneStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.inheritancestate.States.STATE1" ], + "states" : [ { + "rawName" : "States.STATE11", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE11" + }, { + "rawName" : "States.STATE13", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE13" + }, { + "rawName" : "States.STATE15", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE15" + }, { + "rawName" : "States.STATE17", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE17" + }, { + "rawName" : "States.STATE19", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE19" + }, { + "rawName" : "States.STATE20", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE20" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritancestate.States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATEZ" + }, { + "rawName" : "States.STATE2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE8" + }, { + "rawName" : "States.STATEX", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATEX" + }, { + "rawName" : "States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATEZ" + }, { + "rawName" : "States.STATE10", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE10" + }, { + "rawName" : "States.STATE12", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE12" + }, { + "rawName" : "States.STATE14", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE14" + }, { + "rawName" : "States.STATE16", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE16" + }, { + "rawName" : "States.STATE18", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE18" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritancestate.States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE1" + }, { + "rawName" : "States.STATE_EXTRA_1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE_EXTRA_1" + }, { + "rawName" : "States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATE9" + }, { + "rawName" : "States.STATEY", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritancestate.States.STATEY" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -750,5 +817,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.inheritancestate.States.STATEZ" ] + "startStates" : [ "click.kamil.examples.statemachine.inheritancestate.States.STATE1" ], + "endStates" : [ "click.kamil.examples.statemachine.inheritancestate.States.STATEZ" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.inheritancestate.States", + "eventTypeFqn" : "click.kamil.examples.statemachine.inheritancestate.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json index 89064aa..94b9e7f 100644 --- a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json @@ -1,45 +1,21 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ { - "type" : "REST", - "name" : "POST /orders/submit", - "className" : "click.kamil.multi.core.OrderController", - "methodName" : "submitOrder", - "sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java", - "metadata" : { - "path" : "/orders/submit", - "verb" : "POST" - }, - "parameters" : [ { - "name" : "orderId", - "type" : "String", - "annotations" : [ "RequestBody" ] - } ] - }, { - "type" : "REST", - "name" : "POST /orders/submit", - "className" : "click.kamil.multi.api.OrderApi", - "methodName" : "submitOrder", - "sourceFile" : "api-module/src/main/java/click/kamil/multi/api/OrderApi.java", - "metadata" : { - "path" : "/orders/submit", - "verb" : "POST" - }, - "parameters" : [ { - "name" : "orderId", - "type" : "String", - "annotations" : [ "RequestBody" ] - } ] - } ], - "callChains" : [ ], - "properties" : { - "default" : { } - } - }, "name" : "click.kamil.multi.core.OrderStateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "String.NEW" ], + "states" : [ { + "rawName" : "\"COMPLETED\"", + "fullIdentifier" : "String.COMPLETED" + }, { + "rawName" : "\"NEW\"", + "fullIdentifier" : "String.NEW" + }, { + "rawName" : "\"PROCESSING\"", + "fullIdentifier" : "String.PROCESSING" + }, { + "rawName" : "String.COMPLETED", + "fullIdentifier" : "String.COMPLETED" + }, { + "rawName" : "String.NEW", + "fullIdentifier" : "String.NEW" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -82,5 +58,48 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "String.COMPLETED" ] + "startStates" : [ "String.NEW" ], + "endStates" : [ "String.COMPLETED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "String", + "eventTypeFqn" : "String", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ { + "type" : "REST", + "name" : "POST /orders/submit", + "className" : "click.kamil.multi.core.OrderController", + "methodName" : "submitOrder", + "sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java", + "metadata" : { + "path" : "/orders/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "orderId", + "type" : "String", + "annotations" : [ "RequestBody" ] + } ] + }, { + "type" : "REST", + "name" : "POST /orders/submit", + "className" : "click.kamil.multi.api.OrderApi", + "methodName" : "submitOrder", + "sourceFile" : "api-module/src/main/java/click/kamil/multi/api/OrderApi.java", + "metadata" : { + "path" : "/orders/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "orderId", + "type" : "String", + "annotations" : [ "RequestBody" ] + } ] + } ], + "callChains" : [ ], + "properties" : { + "default" : { } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json index 2d351b6..3672374 100644 --- a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json @@ -1,4 +1,69 @@ { + "name" : "click.kamil.enterprise.machines.order.OrderStateMachineConfiguration", + "states" : [ { + "rawName" : "OrderState.PENDING", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.PENDING" + }, { + "rawName" : "OrderState.NEW", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.NEW" + }, { + "rawName" : "OrderState.SHIPPED", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.SHIPPED" + }, { + "rawName" : "click.kamil.enterprise.machines.order.OrderState.SHIPPED", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.SHIPPED" + }, { + "rawName" : "click.kamil.enterprise.machines.order.OrderState.NEW", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.NEW" + } ], + "transitions" : [ { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.NEW", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.NEW" + } ], + "targetStates" : [ { + "rawName" : "OrderState.PENDING", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.PENDING" + } ], + "event" : { + "rawName" : "OrderEvent.PAY", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderEvent.PAY" + }, + "guards" : [ ], + "actions" : [ { + "expression" : "context -> System.out.println(\"Payment processed.\")", + "isLambda" : true, + "internalLogic" : "context -> System.out.println(\"Payment processed.\")", + "lineNumber" : 28, + "className" : "click.kamil.enterprise.machines.order.OrderStateMachineConfiguration", + "sourceFile" : "src/main/java/click/kamil/enterprise/machines/order/OrderStateMachineConfiguration.java" + } ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.PENDING", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.PENDING" + } ], + "targetStates" : [ { + "rawName" : "OrderState.SHIPPED", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.SHIPPED" + } ], + "event" : { + "rawName" : "OrderEvent.SHIP", + "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + } ], + "startStates" : [ "click.kamil.enterprise.machines.order.OrderState.NEW" ], + "endStates" : [ "click.kamil.enterprise.machines.order.OrderState.SHIPPED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.enterprise.machines.order.OrderState", + "eventTypeFqn" : "click.kamil.enterprise.machines.order.OrderEvent", "metadata" : { "triggers" : [ { "event" : "click.kamil.enterprise.machines.order.OrderEvent.PAY", @@ -186,51 +251,5 @@ "properties" : { "default" : { } } - }, - "name" : "click.kamil.enterprise.machines.order.OrderStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.enterprise.machines.order.OrderState.NEW" ], - "transitions" : [ { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.NEW", - "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.NEW" - } ], - "targetStates" : [ { - "rawName" : "OrderState.PENDING", - "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.PENDING" - } ], - "event" : { - "rawName" : "OrderEvent.PAY", - "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderEvent.PAY" - }, - "guards" : [ ], - "actions" : [ { - "expression" : "context -> System.out.println(\"Payment processed.\")", - "isLambda" : true, - "internalLogic" : "context -> System.out.println(\"Payment processed.\")", - "lineNumber" : 28, - "className" : "click.kamil.enterprise.machines.order.OrderStateMachineConfiguration", - "sourceFile" : "src/main/java/click/kamil/enterprise/machines/order/OrderStateMachineConfiguration.java" - } ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.PENDING", - "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.PENDING" - } ], - "targetStates" : [ { - "rawName" : "OrderState.SHIPPED", - "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderState.SHIPPED" - } ], - "event" : { - "rawName" : "OrderEvent.SHIP", - "fullIdentifier" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - } ], - "endStates" : [ "click.kamil.enterprise.machines.order.OrderState.SHIPPED" ] + } } diff --git a/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json index a0d2639..3550bad 100644 --- a/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json @@ -1,4 +1,96 @@ { + "name" : "click.kamil.examples.statemachine.polymorphic.PolymorphicStateMachineConfiguration", + "states" : [ { + "rawName" : "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" + }, { + "rawName" : "OrderStates.CANCELED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.CANCELED" + }, { + "rawName" : "OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" + }, { + "rawName" : "OrderStates.FULFILLED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.FULFILLED" + }, { + "rawName" : "OrderStates.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.PAID" + } ], + "transitions" : [ { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" + } ], + "targetStates" : [ { + "rawName" : "OrderStates.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.PAID" + } ], + "event" : { + "rawName" : "OrderEvents.PAY", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.PAY" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderStates.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.PAID" + } ], + "targetStates" : [ { + "rawName" : "OrderStates.FULFILLED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.FULFILLED" + } ], + "event" : { + "rawName" : "OrderEvents.FULFILL", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.FULFILL" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" + } ], + "targetStates" : [ { + "rawName" : "OrderStates.CANCELED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.CANCELED" + } ], + "event" : { + "rawName" : "OrderEvents.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.CANCEL" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderStates.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.PAID" + } ], + "targetStates" : [ { + "rawName" : "OrderStates.CANCELED", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.CANCELED" + } ], + "event" : { + "rawName" : "OrderEvents.ABCD", + "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.ABCD" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + } ], + "startStates" : [ "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" ], + "endStates" : [ "click.kamil.examples.statemachine.polymorphic.OrderStates.CANCELED", "click.kamil.examples.statemachine.polymorphic.OrderStates.FULFILLED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.polymorphic.OrderStates", + "eventTypeFqn" : "click.kamil.examples.statemachine.polymorphic.OrderEvents", "metadata" : { "triggers" : [ { "event" : "event", @@ -603,78 +695,5 @@ "spring.application.name" : "statemachinedemo" } } - }, - "name" : "click.kamil.examples.statemachine.polymorphic.PolymorphicStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" ], - "transitions" : [ { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderStates.SUBMITTED", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" - } ], - "targetStates" : [ { - "rawName" : "OrderStates.PAID", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.PAID" - } ], - "event" : { - "rawName" : "OrderEvents.PAY", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.PAY" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderStates.PAID", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.PAID" - } ], - "targetStates" : [ { - "rawName" : "OrderStates.FULFILLED", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.FULFILLED" - } ], - "event" : { - "rawName" : "OrderEvents.FULFILL", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.FULFILL" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderStates.SUBMITTED", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.SUBMITTED" - } ], - "targetStates" : [ { - "rawName" : "OrderStates.CANCELED", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.CANCELED" - } ], - "event" : { - "rawName" : "OrderEvents.CANCEL", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.CANCEL" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderStates.PAID", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.PAID" - } ], - "targetStates" : [ { - "rawName" : "OrderStates.CANCELED", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderStates.CANCELED" - } ], - "event" : { - "rawName" : "OrderEvents.ABCD", - "fullIdentifier" : "click.kamil.examples.statemachine.polymorphic.OrderEvents.ABCD" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - } ], - "endStates" : [ "click.kamil.examples.statemachine.polymorphic.OrderStates.CANCELED", "click.kamil.examples.statemachine.polymorphic.OrderStates.FULFILLED" ] + } } diff --git a/state_machine_exporter/src/test/resources/golden/SimpleEnumStateMachineConfiguration/SimpleEnumStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/SimpleEnumStateMachineConfiguration/SimpleEnumStateMachineConfiguration.json index 976f43c..1d701a7 100644 --- a/state_machine_exporter/src/test/resources/golden/SimpleEnumStateMachineConfiguration/SimpleEnumStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/SimpleEnumStateMachineConfiguration/SimpleEnumStateMachineConfiguration.json @@ -1,17 +1,39 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.simple.SimpleEnumStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.simple.OrderStates.SUBMITTED" ], + "states" : [ { + "rawName" : "OrderStates.CANCELED", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.CANCELED" + }, { + "rawName" : "OrderStates.PAID2", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.PAID2" + }, { + "rawName" : "OrderStates.PAID3", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.PAID3" + }, { + "rawName" : "OrderStates.PAID1", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.PAID1" + }, { + "rawName" : "click.kamil.examples.statemachine.simple.OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.SUBMITTED" + }, { + "rawName" : "click.kamil.examples.statemachine.simple.OrderStates.FULFILLED", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.FULFILLED" + }, { + "rawName" : "click.kamil.examples.statemachine.simple.OrderStates.CANCELED", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.CANCELED" + }, { + "rawName" : "OrderStates.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.SUBMITTED" + }, { + "rawName" : "OrderStates.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.PAID" + }, { + "rawName" : "OrderStates.FULFILLED", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.FULFILLED" + }, { + "rawName" : "OrderStates.HAPPEN", + "fullIdentifier" : "click.kamil.examples.statemachine.simple.OrderStates.HAPPEN" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -270,5 +292,20 @@ } ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.simple.OrderStates.CANCELED", "click.kamil.examples.statemachine.simple.OrderStates.FULFILLED" ] + "startStates" : [ "click.kamil.examples.statemachine.simple.OrderStates.SUBMITTED" ], + "endStates" : [ "click.kamil.examples.statemachine.simple.OrderStates.CANCELED", "click.kamil.examples.statemachine.simple.OrderStates.FULFILLED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.simple.OrderStates", + "eventTypeFqn" : "click.kamil.examples.statemachine.simple.OrderEvents", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/StandardDocumentStateMachineConfiguration/StandardDocumentStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/StandardDocumentStateMachineConfiguration/StandardDocumentStateMachineConfiguration.json index 9b39659..ce4d2f9 100644 --- a/state_machine_exporter/src/test/resources/golden/StandardDocumentStateMachineConfiguration/StandardDocumentStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/StandardDocumentStateMachineConfiguration/StandardDocumentStateMachineConfiguration.json @@ -1,4 +1,79 @@ { + "name" : "click.kamil.examples.statemachine.layered.document.config.StandardDocumentStateMachineConfiguration", + "states" : [ { + "rawName" : "DocumentState.REJECTED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.REJECTED" + }, { + "rawName" : "click.kamil.examples.statemachine.layered.document.DocumentState.DRAFT", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.DRAFT" + }, { + "rawName" : "DocumentState.DRAFT", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.DRAFT" + }, { + "rawName" : "DocumentState.APPROVED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.APPROVED" + }, { + "rawName" : "DocumentState.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.SUBMITTED" + } ], + "transitions" : [ { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "DocumentState.DRAFT", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.DRAFT" + } ], + "targetStates" : [ { + "rawName" : "DocumentState.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.SUBMITTED" + } ], + "event" : { + "rawName" : "DocumentTransitionEvent.SUBMIT", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentTransitionEvent.SUBMIT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "DocumentState.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.SUBMITTED" + } ], + "targetStates" : [ { + "rawName" : "DocumentState.APPROVED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.APPROVED" + } ], + "event" : { + "rawName" : "DocumentTransitionEvent.APPROVE", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentTransitionEvent.APPROVE" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "DocumentState.SUBMITTED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.SUBMITTED" + } ], + "targetStates" : [ { + "rawName" : "DocumentState.REJECTED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.REJECTED" + } ], + "event" : { + "rawName" : "DocumentTransitionEvent.REJECT", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentTransitionEvent.REJECT" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + } ], + "startStates" : [ "click.kamil.examples.statemachine.layered.document.DocumentState.DRAFT" ], + "endStates" : [ "click.kamil.examples.statemachine.layered.document.DocumentState.REJECTED", "click.kamil.examples.statemachine.layered.document.DocumentState.APPROVED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.layered.document.DocumentState", + "eventTypeFqn" : "click.kamil.examples.statemachine.layered.document.DocumentTransitionEvent", "metadata" : { "triggers" : [ { "event" : "event", @@ -250,61 +325,5 @@ "properties" : { "default" : { } } - }, - "name" : "click.kamil.examples.statemachine.layered.document.config.StandardDocumentStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.layered.document.DocumentState.DRAFT" ], - "transitions" : [ { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "DocumentState.DRAFT", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.DRAFT" - } ], - "targetStates" : [ { - "rawName" : "DocumentState.SUBMITTED", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.SUBMITTED" - } ], - "event" : { - "rawName" : "DocumentTransitionEvent.SUBMIT", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentTransitionEvent.SUBMIT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "DocumentState.SUBMITTED", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.SUBMITTED" - } ], - "targetStates" : [ { - "rawName" : "DocumentState.APPROVED", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.APPROVED" - } ], - "event" : { - "rawName" : "DocumentTransitionEvent.APPROVE", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentTransitionEvent.APPROVE" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "DocumentState.SUBMITTED", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.SUBMITTED" - } ], - "targetStates" : [ { - "rawName" : "DocumentState.REJECTED", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentState.REJECTED" - } ], - "event" : { - "rawName" : "DocumentTransitionEvent.REJECT", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.document.DocumentTransitionEvent.REJECT" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - } ], - "endStates" : [ "click.kamil.examples.statemachine.layered.document.DocumentState.REJECTED", "click.kamil.examples.statemachine.layered.document.DocumentState.APPROVED" ] + } } diff --git a/state_machine_exporter/src/test/resources/golden/StandardOrderStateMachineConfiguration/StandardOrderStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/StandardOrderStateMachineConfiguration/StandardOrderStateMachineConfiguration.json index 592b34a..06b27c7 100644 --- a/state_machine_exporter/src/test/resources/golden/StandardOrderStateMachineConfiguration/StandardOrderStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/StandardOrderStateMachineConfiguration/StandardOrderStateMachineConfiguration.json @@ -1,4 +1,79 @@ { + "name" : "click.kamil.examples.statemachine.layered.order.config.StandardOrderStateMachineConfiguration", + "states" : [ { + "rawName" : "OrderState.CANCELLED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.CANCELLED" + }, { + "rawName" : "OrderState.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.PAID" + }, { + "rawName" : "OrderState.SHIPPED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.SHIPPED" + }, { + "rawName" : "OrderState.NEW", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.NEW" + }, { + "rawName" : "click.kamil.examples.statemachine.layered.order.OrderState.NEW", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.NEW" + } ], + "transitions" : [ { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.NEW", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.NEW" + } ], + "targetStates" : [ { + "rawName" : "OrderState.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.PAID" + } ], + "event" : { + "rawName" : "OrderTransitionEvent.PAY", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderTransitionEvent.PAY" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.PAID" + } ], + "targetStates" : [ { + "rawName" : "OrderState.SHIPPED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.SHIPPED" + } ], + "event" : { + "rawName" : "OrderTransitionEvent.SHIP", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderTransitionEvent.SHIP" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.PAID", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.PAID" + } ], + "targetStates" : [ { + "rawName" : "OrderState.CANCELLED", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.CANCELLED" + } ], + "event" : { + "rawName" : "OrderTransitionEvent.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderTransitionEvent.CANCEL" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + } ], + "startStates" : [ "click.kamil.examples.statemachine.layered.order.OrderState.NEW" ], + "endStates" : [ "click.kamil.examples.statemachine.layered.order.OrderState.SHIPPED", "click.kamil.examples.statemachine.layered.order.OrderState.CANCELLED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.layered.order.OrderState", + "eventTypeFqn" : "click.kamil.examples.statemachine.layered.order.OrderTransitionEvent", "metadata" : { "triggers" : [ { "event" : "event", @@ -386,61 +461,5 @@ "properties" : { "default" : { } } - }, - "name" : "click.kamil.examples.statemachine.layered.order.config.StandardOrderStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.layered.order.OrderState.NEW" ], - "transitions" : [ { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.NEW", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.NEW" - } ], - "targetStates" : [ { - "rawName" : "OrderState.PAID", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.PAID" - } ], - "event" : { - "rawName" : "OrderTransitionEvent.PAY", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderTransitionEvent.PAY" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.PAID", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.PAID" - } ], - "targetStates" : [ { - "rawName" : "OrderState.SHIPPED", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.SHIPPED" - } ], - "event" : { - "rawName" : "OrderTransitionEvent.SHIP", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderTransitionEvent.SHIP" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.PAID", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.PAID" - } ], - "targetStates" : [ { - "rawName" : "OrderState.CANCELLED", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderState.CANCELLED" - } ], - "event" : { - "rawName" : "OrderTransitionEvent.CANCEL", - "fullIdentifier" : "click.kamil.examples.statemachine.layered.order.OrderTransitionEvent.CANCEL" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - } ], - "endStates" : [ "click.kamil.examples.statemachine.layered.order.OrderState.SHIPPED", "click.kamil.examples.statemachine.layered.order.OrderState.CANCELLED" ] + } } diff --git a/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json index b5f162b..84f639a 100644 --- a/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json @@ -1,4 +1,96 @@ { + "name" : "click.kamil.domain.StateMachineConfig", + "states" : [ { + "rawName" : "OrderState.NEW", + "fullIdentifier" : "click.kamil.domain.OrderState.NEW" + }, { + "rawName" : "click.kamil.domain.OrderState.NEW", + "fullIdentifier" : "click.kamil.domain.OrderState.NEW" + }, { + "rawName" : "OrderState.CANCELLED", + "fullIdentifier" : "click.kamil.domain.OrderState.CANCELLED" + }, { + "rawName" : "OrderState.PROCESSING", + "fullIdentifier" : "click.kamil.domain.OrderState.PROCESSING" + }, { + "rawName" : "OrderState.COMPLETED", + "fullIdentifier" : "click.kamil.domain.OrderState.COMPLETED" + } ], + "transitions" : [ { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.NEW", + "fullIdentifier" : "click.kamil.domain.OrderState.NEW" + } ], + "targetStates" : [ { + "rawName" : "OrderState.PROCESSING", + "fullIdentifier" : "click.kamil.domain.OrderState.PROCESSING" + } ], + "event" : { + "rawName" : "OrderEvent.PROCESS", + "fullIdentifier" : "click.kamil.domain.OrderEvent.PROCESS" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.PROCESSING", + "fullIdentifier" : "click.kamil.domain.OrderState.PROCESSING" + } ], + "targetStates" : [ { + "rawName" : "OrderState.COMPLETED", + "fullIdentifier" : "click.kamil.domain.OrderState.COMPLETED" + } ], + "event" : { + "rawName" : "OrderEvent.COMPLETE", + "fullIdentifier" : "click.kamil.domain.OrderEvent.COMPLETE" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.NEW", + "fullIdentifier" : "click.kamil.domain.OrderState.NEW" + } ], + "targetStates" : [ { + "rawName" : "OrderState.CANCELLED", + "fullIdentifier" : "click.kamil.domain.OrderState.CANCELLED" + } ], + "event" : { + "rawName" : "OrderEvent.CANCEL", + "fullIdentifier" : "click.kamil.domain.OrderEvent.CANCEL" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + }, { + "type" : "EXTERNAL", + "sourceStates" : [ { + "rawName" : "OrderState.PROCESSING", + "fullIdentifier" : "click.kamil.domain.OrderState.PROCESSING" + } ], + "targetStates" : [ { + "rawName" : "OrderState.CANCELLED", + "fullIdentifier" : "click.kamil.domain.OrderState.CANCELLED" + } ], + "event" : { + "rawName" : "OrderEvent.CANCEL", + "fullIdentifier" : "click.kamil.domain.OrderEvent.CANCEL" + }, + "guards" : [ ], + "actions" : [ ], + "order" : null + } ], + "startStates" : [ "click.kamil.domain.OrderState.NEW" ], + "endStates" : [ "click.kamil.domain.OrderState.COMPLETED", "click.kamil.domain.OrderState.CANCELLED" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.domain.OrderState", + "eventTypeFqn" : "click.kamil.domain.OrderEvent", "metadata" : { "triggers" : [ { "event" : "event", @@ -344,78 +436,5 @@ "properties" : { "default" : { } } - }, - "name" : "click.kamil.domain.StateMachineConfig", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.domain.OrderState.NEW" ], - "transitions" : [ { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.NEW", - "fullIdentifier" : "click.kamil.domain.OrderState.NEW" - } ], - "targetStates" : [ { - "rawName" : "OrderState.PROCESSING", - "fullIdentifier" : "click.kamil.domain.OrderState.PROCESSING" - } ], - "event" : { - "rawName" : "OrderEvent.PROCESS", - "fullIdentifier" : "click.kamil.domain.OrderEvent.PROCESS" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.PROCESSING", - "fullIdentifier" : "click.kamil.domain.OrderState.PROCESSING" - } ], - "targetStates" : [ { - "rawName" : "OrderState.COMPLETED", - "fullIdentifier" : "click.kamil.domain.OrderState.COMPLETED" - } ], - "event" : { - "rawName" : "OrderEvent.COMPLETE", - "fullIdentifier" : "click.kamil.domain.OrderEvent.COMPLETE" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.NEW", - "fullIdentifier" : "click.kamil.domain.OrderState.NEW" - } ], - "targetStates" : [ { - "rawName" : "OrderState.CANCELLED", - "fullIdentifier" : "click.kamil.domain.OrderState.CANCELLED" - } ], - "event" : { - "rawName" : "OrderEvent.CANCEL", - "fullIdentifier" : "click.kamil.domain.OrderEvent.CANCEL" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - }, { - "type" : "EXTERNAL", - "sourceStates" : [ { - "rawName" : "OrderState.PROCESSING", - "fullIdentifier" : "click.kamil.domain.OrderState.PROCESSING" - } ], - "targetStates" : [ { - "rawName" : "OrderState.CANCELLED", - "fullIdentifier" : "click.kamil.domain.OrderState.CANCELLED" - } ], - "event" : { - "rawName" : "OrderEvent.CANCEL", - "fullIdentifier" : "click.kamil.domain.OrderEvent.CANCEL" - }, - "guards" : [ ], - "actions" : [ ], - "order" : null - } ], - "endStates" : [ "click.kamil.domain.OrderState.COMPLETED", "click.kamil.domain.OrderState.CANCELLED" ] + } } diff --git a/state_machine_exporter/src/test/resources/golden/ThreeStateMachineConfiguration/ThreeStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/ThreeStateMachineConfiguration/ThreeStateMachineConfiguration.json index c8375ff..a3e8203 100644 --- a/state_machine_exporter/src/test/resources/golden/ThreeStateMachineConfiguration/ThreeStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/ThreeStateMachineConfiguration/ThreeStateMachineConfiguration.json @@ -1,17 +1,93 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.ThreeStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE1" ], + "states" : [ { + "rawName" : "States.STATE10", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE10" + }, { + "rawName" : "States.STATE12", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE12" + }, { + "rawName" : "States.STATE14", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE14" + }, { + "rawName" : "States.STATE16", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE16" + }, { + "rawName" : "States.STATE18", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE18" + }, { + "rawName" : "States.STATE_EXTRA_1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE_EXTRA_1" + }, { + "rawName" : "States.STATE_EXTRA_3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE_EXTRA_3" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE1" + }, { + "rawName" : "States.STATE2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE8" + }, { + "rawName" : "States.STATEX", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATEX" + }, { + "rawName" : "States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATEZ" + }, { + "rawName" : "States.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.CANCEL" + }, { + "rawName" : "States.STATE11", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE11" + }, { + "rawName" : "States.STATE13", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE13" + }, { + "rawName" : "States.STATE15", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE15" + }, { + "rawName" : "States.STATE17", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE17" + }, { + "rawName" : "States.STATE19", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE19" + }, { + "rawName" : "States.STATE20", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE20" + }, { + "rawName" : "States.STATE_EXTRA_2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE_EXTRA_2" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATEZ" + }, { + "rawName" : "States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE9" + }, { + "rawName" : "States.STATEY", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATEY" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -921,5 +997,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATEZ" ] + "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATE1" ], + "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States.STATEZ" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.States", + "eventTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate2.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter/src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration/TwoStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration/TwoStateMachineConfiguration.json index 7f05503..7742198 100644 --- a/state_machine_exporter/src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration/TwoStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration/TwoStateMachineConfiguration.json @@ -1,17 +1,87 @@ { - "metadata" : { - "triggers" : [ ], - "entryPoints" : [ ], - "callChains" : [ ], - "properties" : { - "default" : { - "spring.application.name" : "statemachinedemo" - } - } - }, "name" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.TwoStateMachineConfiguration", - "renderChoicesAsDiamonds" : true, - "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE1" ], + "states" : [ { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE1" + }, { + "rawName" : "States.STATE1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE1" + }, { + "rawName" : "States.STATE3", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE3" + }, { + "rawName" : "States.STATE5", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE5" + }, { + "rawName" : "States.STATE7", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE7" + }, { + "rawName" : "States.STATE9", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE9" + }, { + "rawName" : "States.STATEY", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATEY" + }, { + "rawName" : "States.STATE11", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE11" + }, { + "rawName" : "States.STATE13", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE13" + }, { + "rawName" : "States.STATE15", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE15" + }, { + "rawName" : "States.STATE17", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE17" + }, { + "rawName" : "States.STATE19", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE19" + }, { + "rawName" : "States.STATE20", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE20" + }, { + "rawName" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATEZ" + }, { + "rawName" : "States.STATE2", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE2" + }, { + "rawName" : "States.STATE4", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE4" + }, { + "rawName" : "States.STATE6", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE6" + }, { + "rawName" : "States.STATE8", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE8" + }, { + "rawName" : "States.STATEX", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATEX" + }, { + "rawName" : "States.STATEZ", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATEZ" + }, { + "rawName" : "States.STATE_EXTRA_1", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE_EXTRA_1" + }, { + "rawName" : "States.STATE10", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE10" + }, { + "rawName" : "States.STATE12", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE12" + }, { + "rawName" : "States.STATE14", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE14" + }, { + "rawName" : "States.STATE16", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE16" + }, { + "rawName" : "States.STATE18", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE18" + }, { + "rawName" : "States.CANCEL", + "fullIdentifier" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.CANCEL" + } ], "transitions" : [ { "type" : "EXTERNAL", "sourceStates" : [ { @@ -869,5 +939,20 @@ "actions" : [ ], "order" : null } ], - "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATEZ" ] + "startStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATE1" ], + "endStates" : [ "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States.STATEZ" ], + "renderChoicesAsDiamonds" : true, + "flows" : [ ], + "stateTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.States", + "eventTypeFqn" : "click.kamil.examples.statemachine.inheritanceextrafunctionsstate.Events", + "metadata" : { + "triggers" : [ ], + "entryPoints" : [ ], + "callChains" : [ ], + "properties" : { + "default" : { + "spring.application.name" : "statemachinedemo" + } + } + } } diff --git a/state_machine_exporter_html/src/main/java/click/kamil/springstatemachineexporter/html/command/HtmlExporterCommand.java b/state_machine_exporter_html/src/main/java/click/kamil/springstatemachineexporter/html/command/HtmlExporterCommand.java index 21329b0..2a52129 100644 --- a/state_machine_exporter_html/src/main/java/click/kamil/springstatemachineexporter/html/command/HtmlExporterCommand.java +++ b/state_machine_exporter_html/src/main/java/click/kamil/springstatemachineexporter/html/command/HtmlExporterCommand.java @@ -32,7 +32,7 @@ public class HtmlExporterCommand implements Callable { @CommandLine.Spec CommandLine.Model.CommandSpec spec; - @Option(names = {"-i", "--input"}, description = "Input directory containing the Spring Boot project source code.") + @Option(names = {"-i", "--input"}, description = "Input directory containing the Spring Boot project source code. Optional with -j when JSON already contains machine types and canonical identifiers.") private Path inputDir; @Option(names = {"-j", "--json"}, description = "Input JSON file containing the state machine definition.") @@ -97,7 +97,7 @@ public class HtmlExporterCommand implements Callable { } if (jsonFile != null) { - exportService.runJsonExporter(jsonFile, outputDir, formats, profiles); + exportService.runJsonExporter(jsonFile, outputDir, formats, profiles, click.kamil.springstatemachineexporter.exporter.EnumFormat.fn, click.kamil.springstatemachineexporter.exporter.EnumFormat.fn, inputDir); } else { boolean renderChoicesAsDiamonds = !noDiamonds; exportService.runExporter(inputDir, outputDir, formats, renderChoicesAsDiamonds, profiles, flowsFile, machineFilter, click.kamil.springstatemachineexporter.exporter.EnumFormat.fn, click.kamil.springstatemachineexporter.exporter.EnumFormat.fn, includeGeneratedSources); diff --git a/state_machine_exporter_html/src/test/java/click/kamil/springstatemachineexporter/html/JsonToHtmlInterchangeTest.java b/state_machine_exporter_html/src/test/java/click/kamil/springstatemachineexporter/html/JsonToHtmlInterchangeTest.java new file mode 100644 index 0000000..0a37420 --- /dev/null +++ b/state_machine_exporter_html/src/test/java/click/kamil/springstatemachineexporter/html/JsonToHtmlInterchangeTest.java @@ -0,0 +1,46 @@ +package click.kamil.springstatemachineexporter.html; + +import click.kamil.springstatemachineexporter.html.exporter.HtmlExporter; +import click.kamil.springstatemachineexporter.service.ExportService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Verifies that a finalized JSON export alone is sufficient for the HTML portal — + * no source directory required when machine types and canonical identifiers are present. + */ +class JsonToHtmlInterchangeTest { + + private static final Path ORDER_GOLDEN_JSON = Path.of( + "../state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json") + .toAbsolutePath() + .normalize(); + + @Test + void shouldGenerateInteractiveHtmlFromJsonOnly(@TempDir Path tempDir) throws Exception { + assertThat(ORDER_GOLDEN_JSON).exists(); + + ExportService exportService = new ExportService(List.of(new HtmlExporter())); + exportService.runJsonExporter(ORDER_GOLDEN_JSON, tempDir, List.of("html"), List.of()); + + Path machineDir = tempDir.resolve("click.kamil.enterprise.machines.order.OrderStateMachineConfiguration"); + Path htmlFile = machineDir.resolve("click.kamil.enterprise.machines.order.OrderStateMachineConfiguration.html"); + assertThat(htmlFile).exists(); + + String html = Files.readString(htmlFile); + assertThat(html).contains(""); + assertThat(html).contains("click.kamil.enterprise.machines.order.OrderStateMachineConfiguration"); + + // SVG link IDs derive from fn-formatted enum labels; matchedTransitions use package-canonical values. + assertThat(html).contains("OrderState_NEW__OrderEvent_PAY"); + assertThat(html).contains("click.kamil.enterprise.machines.order.OrderEvent.PAY"); + assertThat(html).contains("POST /api/machine/order/pay"); + assertThat(html).contains("\"stateTypeFqn\" : \"click.kamil.enterprise.machines.order.OrderState\""); + } +}