Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Yauhenikapl committed Feb 8, 2024
1 parent 453b839 commit 1112a71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Integer> selectedOptions = new ArrayList<>();

@CommandLine.Mixin
Expand All @@ -61,10 +62,11 @@ private void generateAspects( final AasToAspectModelGenerator generator ) {
final StructuredModelsRoot modelsRoot = new StructuredModelsRoot( Path.of( outputPath ) );
final List<Aspect> generatedAspects = generator.generateAspects();

final List<Aspect> filteredAspects = IntStream.range( 0, generatedAspects.size() )
.filter( index -> selectedOptions.contains( index + 1 ) )
.mapToObj( generatedAspects::get )
.toList();
final List<Aspect> 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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:" );
Expand All @@ -48,9 +47,9 @@ public ExecutionResult runAndExpectSuccess( final String... arguments ) {
return result;
}

public static record ExecutionContext( List<String> arguments, Optional<byte[]> stdin, File workingDirectory ) {
public static record ExecutionContext(List<String> arguments, Optional<byte[]> 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) {
}
}

0 comments on commit 1112a71

Please sign in to comment.