Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ subprojects {
name "SE Nexus"
url = publicNexus
}

maven {
Comment thread
Deni1593 marked this conversation as resolved.
name "Official SysMLv2 Github Package Registry"
url sysmlGithub
credentials {
username = githubUser
password = githubToken
}
}
}

// Java JDK Warning
Expand Down
3 changes: 3 additions & 0 deletions language/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ dependencies {

implementation "org.apache.commons:commons-lang3:$commons_lang_version"
implementation "commons-cli:commons-cli:$commons_cli_version"

def omg_version = "0.18.0"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Move this definition in the gradle properties file and use the same version in both subprojects.

  2. Please use an up to date official parser version... The java version may match but there were changes to the sysml specification since then. probably 0.58. My fault

testImplementation(group: "org.omg.sysml", name: "org.omg.sysml.interactive", version: omg_version, classifier: "all")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little problematic. In the pipeline we have a flag "isPipelineFullBuild" that only loads the visualization subproject only if the flag is set. This way the user can check out the projects without having a github login. This breaks that principle. This needs to be a conditional dependency and the test itself needs to be excluded from the test source sets both depending on the flag.

}

/* ============================================================ */
Expand Down
84 changes: 84 additions & 0 deletions language/src/test/java/parser/ParsersComparisonTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package parser;

import de.monticore.lang.sysmlv2.SysMLv2Mill;
import de.monticore.lang.sysmlv2._ast.ASTSysMLModel;
import de.monticore.lang.sysmlv2._parser.SysMLv2Parser;
import de.se_rwth.commons.logging.Log;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.omg.sysml.interactive.SysMLInteractive;
import org.omg.sysml.interactive.SysMLInteractiveResult;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.*;

public class ParsersComparisonTest {
private static final String MODEL_PATH = "src/test/resources/parser";

private SysMLv2Parser parser = SysMLv2Mill.parser();

// SysMLInteractive is a singleton; keep one reference
private static SysMLInteractive official;

@BeforeAll
public static void init() {
Log.init();
SysMLv2Mill.init();

official = SysMLInteractive.getInstance();
official.setVerbose(false);
}

@BeforeEach
public void reset() {
parser.setError(false);
}

@ParameterizedTest(name = "{index} - {0} does parse w/o errors (MontiCore + official)")
@ValueSource(strings = {
"packages.sysml",
"imports.sysml",
"ports.sysml",
"parts.sysml",
"states.sysml",
"parallel_states.sysml",
"actions.sysml",
"items.sysml",
"assert.sysml",
"constraints.sysml",
"requirements.sysml",
"streams.sysml",
"streamsFilter.sysml",
"refinement.sysml",
"cardinalities.sysml",
"connections.sysml",
"collections.sysml",
"StateDecomposition1.sysml",
"FlowConectionInterfaceExample.sysml",
"StateActions.sysml",
"ConditionalSuccessionExample-1.sysml"
})
public void testParsingModels(String modelName) throws IOException {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also temporarely add @disabled to the test to fix the pipeline until we decide how to fix the negative parsing errors.

Path modelPath = Path.of(MODEL_PATH, modelName);

// 1) MontiCore parser (existing behavior)
Optional<ASTSysMLModel> ast = SysMLv2Mill.parser().parse(modelPath.toString());
assertFalse(parser.hasErrors(), "MontiCore parsing should not have failed");
assertTrue(ast.isPresent(), "MontiCore AST should have been created");

// 2) Official OMG parser
String input = Files.readString(modelPath);
SysMLInteractiveResult result = official.eval(input);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not completely sure but this method probably also checks the official context conditions. So if line 70 only tests parsing then this should also only test parsing. Otherwise you are testing two different functionalities. Extract the method that is relevant and use it there.

But first look at the other comment.


assertFalse(
result.hasErrors(),
() -> "Official OMG parser errors for " + modelName + ":\n" + result.formatIssues()
);
}
}
Loading