From 1112a71e2c1a9fe8e6b40a3572ae5dd42d2d3ff8 Mon Sep 17 00:00:00 2001 From: Yauhenikapl Date: Thu, 8 Feb 2024 12:49:26 +0300 Subject: [PATCH] Fix build Fixes: #468 --- .../org/eclipse/esmf/aas/to/AasToAspectCommand.java | 12 +++++++----- .../test/java/org/eclipse/esmf/ProcessLauncher.java | 7 +++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/samm-cli/src/main/java/org/eclipse/esmf/aas/to/AasToAspectCommand.java b/tools/samm-cli/src/main/java/org/eclipse/esmf/aas/to/AasToAspectCommand.java index 190de3731..1675e01a0 100644 --- a/tools/samm-cli/src/main/java/org/eclipse/esmf/aas/to/AasToAspectCommand.java +++ b/tools/samm-cli/src/main/java/org/eclipse/esmf/aas/to/AasToAspectCommand.java @@ -41,7 +41,8 @@ public class AasToAspectCommand extends AbstractCommand { @CommandLine.Option( names = { "--output-directory", "-d" }, description = "Output directory to write files to" ) private String outputPath = "."; - @CommandLine.Option( names = { "--submodel-template", "-s" }, description = "Select the submodel template(s) to include, as returned by the aas list command" ) + @CommandLine.Option( names = { "--submodel-template", + "-s" }, description = "Select the submodel template(s) to include, as returned by the aas list command" ) private List selectedOptions = new ArrayList<>(); @CommandLine.Mixin @@ -61,10 +62,11 @@ private void generateAspects( final AasToAspectModelGenerator generator ) { final StructuredModelsRoot modelsRoot = new StructuredModelsRoot( Path.of( outputPath ) ); final List generatedAspects = generator.generateAspects(); - final List filteredAspects = IntStream.range( 0, generatedAspects.size() ) - .filter( index -> selectedOptions.contains( index + 1 ) ) - .mapToObj( generatedAspects::get ) - .toList(); + final List filteredAspects = this.selectedOptions.isEmpty() ? generatedAspects : + IntStream.range( 0, generatedAspects.size() ) + .filter( index -> selectedOptions.contains( index + 1 ) ) + .mapToObj( generatedAspects::get ) + .toList(); for ( final Aspect aspect : filteredAspects ) { final String aspectString = AspectSerializer.INSTANCE.apply( aspect ); diff --git a/tools/samm-cli/src/test/java/org/eclipse/esmf/ProcessLauncher.java b/tools/samm-cli/src/test/java/org/eclipse/esmf/ProcessLauncher.java index 32a12b8ec..0f8d217d5 100644 --- a/tools/samm-cli/src/test/java/org/eclipse/esmf/ProcessLauncher.java +++ b/tools/samm-cli/src/test/java/org/eclipse/esmf/ProcessLauncher.java @@ -34,8 +34,7 @@ public ExecutionResult apply( final String... arguments ) { } public ExecutionResult runAndExpectSuccess( final String... arguments ) { - final ExecutionResult result = apply( - new ExecutionContext( Arrays.asList( arguments ), Optional.empty(), new File( System.getProperty( "user.dir" ) ) ) ); + final ExecutionResult result = apply( arguments ); if ( result.exitStatus() != 0 ) { System.out.printf( "Execution failed (status %d):%n", result.exitStatus() ); System.out.println( "stdout:" ); @@ -48,9 +47,9 @@ public ExecutionResult runAndExpectSuccess( final String... arguments ) { return result; } - public static record ExecutionContext( List arguments, Optional stdin, File workingDirectory ) { + public static record ExecutionContext(List arguments, Optional stdin, File workingDirectory) { } - public static record ExecutionResult( int exitStatus, String stdout, String stderr, byte[] stdoutRaw, byte[] stderrRaw ) { + public static record ExecutionResult(int exitStatus, String stdout, String stderr, byte[] stdoutRaw, byte[] stderrRaw) { } }