NASA-PDS / pds4-information-model

The software tools and data necessary for generating the Information Model including PDS4 ontology, data, and information model.
https://nasa-pds.github.io/pds4-information-model/
Other
9 stars 6 forks source link

Initial Implementation of Cucumber Framework for LDDTool Tests #714

Open jordanpadams opened 4 months ago

jordanpadams commented 4 months ago

💡 Description

Task for necessary implementation for getting Cucumber working with LDDTool-related tests

⚔️ Parent Epic / Related Tickets

No response

miguelp1986 commented 4 months ago

@jordanpadams when trying to use Maven, I'm running into errors. I backed out my changes to see if I broke something, but I am still seeing the same errors when running Maven on the latest version of main:

mvn clean package                                                                                                                              
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for gov.nasa.pds.model:model-dmdocument:maven-plugin:14.4.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 138, column 21
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:buildnumber-maven-plugin is missing. @ line 69, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ line 90, column 19
[WARNING]
[WARNING] Some problems were encountered while building the effective model for gov.nasa.pds.model:model-ontology:jar:14.4.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:buildnumber-maven-plugin is missing. @ line 60, column 21
[WARNING] The expression ${pom.version} is deprecated. Please use ${project.version} instead.
[WARNING]
[WARNING] Some problems were encountered while building the effective model for gov.nasa.pds.model:model-lddtool:pom:14.4.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:buildnumber-maven-plugin is missing. @ line 60, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] PDS4 Information Model                                             [pom]
[INFO] Model DM-Document Maven Plugin                            [maven-plugin]
[INFO] Model Ontology                                                     [jar]
[INFO] Local Data Dictionary Tool                                         [pom]
[INFO]
[INFO] -------------------------< gov.nasa.pds:model >-------------------------
[INFO] Building PDS4 Information Model 14.4.0-SNAPSHOT                    [1/4]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ model ---
[INFO]
[INFO] ----------------< gov.nasa.pds.model:model-dmdocument >-----------------
[INFO] Building Model DM-Document Maven Plugin 14.4.0-SNAPSHOT            [2/4]
[INFO]   from model-dmdocument/pom.xml
[INFO] ----------------------------[ maven-plugin ]----------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ model-dmdocument ---
[INFO] Deleting /Users/MPena/repositories/pds4-information-model/model-dmdocument/target
[INFO]
[INFO] --- buildnumber:3.2.0:create (default) @ model-dmdocument ---
[INFO] Storing buildNumber: 2024-01-04 10:29:31 at timestamp: 1704392971589
[INFO] Executing: /bin/sh -c cd '/Users/MPena/repositories/pds4-information-model/model-dmdocument' && 'git' 'symbolic-ref' 'HEAD'
[INFO] Working directory: /Users/MPena/repositories/pds4-information-model/model-dmdocument
[INFO] Storing scmBranch: main
[INFO]
[INFO] --- plugin:3.7.1:helpmojo (help-goal) @ model-dmdocument ---
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ model-dmdocument ---
[INFO] skip non existing resourceDirectory /Users/MPena/repositories/pds4-information-model/model-dmdocument/src/main/resources
[INFO]
[INFO] --- compiler:3.8.1:compile (default-compile) @ model-dmdocument ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 98 source files to /Users/MPena/repositories/pds4-information-model/model-dmdocument/target/classes
[INFO] /Users/MPena/repositories/pds4-information-model/model-dmdocument/src/main/java/gov/nasa/pds/model/plugin/DOMProp.java: Some input files use or override a deprecated API that is marked for removal.
[INFO] /Users/MPena/repositories/pds4-information-model/model-dmdocument/src/main/java/gov/nasa/pds/model/plugin/DOMProp.java: Recompile with -Xlint:removal for details.
[INFO] /Users/MPena/repositories/pds4-information-model/model-dmdocument/src/main/java/gov/nasa/pds/model/plugin/AbstractGenerationPlugin.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/MPena/repositories/pds4-information-model/model-dmdocument/src/main/java/gov/nasa/pds/model/plugin/AbstractGenerationPlugin.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- plugin:3.7.1:descriptor (default-descriptor) @ model-dmdocument ---
[WARNING]

Some dependencies of Maven Plugins are expected to be in provided scope.
Please make sure that dependencies listed below declared in POM
have set '<scope>provided</scope>' as well.

The following dependencies are in wrong scope:
 * org.apache.maven:maven-plugin-api:jar:3.9.0:compile
 * org.apache.maven:maven-model:jar:3.9.0:compile
 * org.apache.maven:maven-artifact:jar:3.9.0:compile

[INFO] Using 'UTF-8' encoding to read mojo source files.
[INFO] java-annotations mojo extractor found 2 mojo descriptors.
[INFO] java-javadoc mojo extractor found 0 mojo descriptor.
[INFO] ant mojo extractor found 0 mojo descriptor.
[INFO] bsh mojo extractor found 0 mojo descriptor.
[INFO]
[INFO] --- plugin:3.7.1:descriptor (mojo-descriptor) @ model-dmdocument ---
[WARNING]

Some dependencies of Maven Plugins are expected to be in provided scope.
Please make sure that dependencies listed below declared in POM
have set '<scope>provided</scope>' as well.

The following dependencies are in wrong scope:
 * org.apache.maven:maven-plugin-api:jar:3.9.0:compile
 * org.apache.maven:maven-model:jar:3.9.0:compile
 * org.apache.maven:maven-artifact:jar:3.9.0:compile

[INFO] Using 'UTF-8' encoding to read mojo source files.
[INFO] java-annotations mojo extractor found 2 mojo descriptors.
[INFO] java-javadoc mojo extractor found 0 mojo descriptor.
[INFO] ant mojo extractor found 0 mojo descriptor.
[INFO] bsh mojo extractor found 0 mojo descriptor.
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ model-dmdocument ---
[INFO] skip non existing resourceDirectory /Users/MPena/repositories/pds4-information-model/model-dmdocument/src/test/resources
[INFO]
[INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ model-dmdocument ---
[INFO] No sources to compile
[INFO]
[INFO] --- surefire:3.0.0-M8:test (default-test) @ model-dmdocument ---
[INFO] No tests to run.
[INFO]
[INFO] --- jar:3.3.0:jar (default-jar) @ model-dmdocument ---
[INFO] Building jar: /Users/MPena/repositories/pds4-information-model/model-dmdocument/target/model-dmdocument-14.4.0-SNAPSHOT.jar
[INFO]
[INFO] --- plugin:3.7.1:addPluginArtifactMetadata (default-addPluginArtifactMetadata) @ model-dmdocument ---
[INFO]
[INFO] -----------------< gov.nasa.pds.model:model-ontology >------------------
[INFO] Building Model Ontology 14.4.0-SNAPSHOT                            [3/4]
[INFO]   from model-ontology/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ model-ontology ---
[INFO]
[INFO] --- buildnumber:3.2.0:create (default) @ model-ontology ---
[INFO] Storing buildNumber: 2024-01-04 10:29:34 at timestamp: 1704392974715
[INFO] Executing: /bin/sh -c cd '/Users/MPena/repositories/pds4-information-model/model-ontology' && 'git' 'symbolic-ref' 'HEAD'
[INFO] Working directory: /Users/MPena/repositories/pds4-information-model/model-ontology
[INFO] Storing scmBranch: main
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ model-ontology ---
[INFO] skip non existing resourceDirectory /Users/MPena/repositories/pds4-information-model/model-ontology/src/main/resources
[INFO]
[INFO] --- antrun:3.1.0:run (default) @ model-ontology ---
[WARNING]  Parameter 'tasks' is deprecated: Use {@link #target} instead. For version 3.0.0, this parameter is only defined to break the build if
            you use it!
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for PDS4 Information Model 14.4.0-SNAPSHOT:
[INFO]
[INFO] PDS4 Information Model ............................. SUCCESS [  0.073 s]
[INFO] Model DM-Document Maven Plugin ..................... SUCCESS [  3.372 s]
[INFO] Model Ontology ..................................... FAILURE [  0.039 s]
[INFO] Local Data Dictionary Tool ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.539 s
[INFO] Finished at: 2024-01-04T10:29:34-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.1.0:run (default) on project model-ontology: You are using 'tasks' which has been removed from the maven-antrun-plugin. Please use 'target' and refer to the >>Major Version Upgrade to version 3.0.0<< on the plugin site. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :model-ontology
miguelp1986 commented 4 months ago

Here is the output with debug logging: maven_debug_logs.txt

jordanpadams commented 4 months ago

@miguelp1986 do a pull and give it a shot now.

Note: this will still not build in openJDK 17: https://github.com/NASA-PDS/pds4-information-model/issues/702

nutjob4life commented 2 months ago

Miguel has this in progress (while also working on some validate tests for B14.1)

tloubrieu-jpl commented 1 month ago

The cucumber configuration work now.

jordanpadams commented 1 month ago

@miguelp1986 do we have a PR for this or is this just still in work?

miguelp1986 commented 1 month ago

@jordanpadams I thought that I was pretty much done setting up the test framework, but looks like I'm having issues parsing out the command arguments for lddtool. So not quite ready for a PR yet.

miguelp1986 commented 1 month ago

@jordanpadams @tloubrieu-jpl It looks like I need to set PARENT_DIR to the lib directory which houses DMDocument.jar file, although I don't see that file in the repository.

Here is the error:

Scenario Outline: Running lddtool with different parameters                                                 # features/integration.feature:13
arg: --help
  Given a test "help" with "--help" as arguments                                                            # cucumber.StepDefs.i_have_lddtool_installed(java.lang.String,java.lang.String)
  When I execute lddtool                                                                                    # cucumber.StepDefs.i_run_lddtool_with()
  Then the produced output from lddtool command should be similar to "usage: LDDTool" or no error reported. # cucumber.StepDefs.i_should_receive(java.lang.String)

Scenario Outline: Running lddtool with different parameters                                                                   # features/integration.feature:14
arg: --version
  Given a test "version" with "--version" as arguments                                                                        # cucumber.StepDefs.i_have_lddtool_installed(java.lang.String,java.lang.String)
  When I execute lddtool                                                                                                      # cucumber.StepDefs.i_run_lddtool_with()
  Then the produced output from lddtool command should be similar to "LDDTool Version: 14.4.0-SNAPSHOT" or no error reported. # cucumber.StepDefs.i_should_receive(java.lang.String)
      org.opentest4j.AssertionFailedError: Expected response: LDDTool Version: 14.4.0-SNAPSHOT Actual response: usage: LDDTool [-h] [-p] [-l] [-d] [-D] [-J] [-m] [-M] [-n] [-N] [-1] [-T] [-O] [-o] [-C] [-v] [-V {1B00,1B10,1C00,1D00,1E00,1F00,1G00,1H00,1I00,1J00,1K00,1L00,1M00}]
               [fileNameArr [fileNameArr ...]]

LDDTool process control:

positional arguments:
  fileNameArr            Ingest_LDD files to process.

named arguments:
  -h, --help             show this help message and exit
  -p, --PDS4 processing  Set the context to PDS4 (default: false)
  -l, --LDD              Process one or more local data dictionary input files (default: false)
  -d, --discipline       Omit the term "mission" from the namespace of a dictionary (default: false)
  -D, --DataDict         Write the Data Dictionary DocBook file (default: false)
  -J, --JSON             Write the data dictionary to a JSON formatted file (default: false)
  -m, --merge            Generate file to merge the local dictionary into the master dictionary (default: false)
  -M, --Mission          This option has no effect starting with PDS4 IM Version  1.14.0.0.  See  the  LDDTool  Usage  document  for more information on how to provide this information.
                         (default: false)
  -n, --nuance           Write nuance property maps to LDD schema annotation in JSON (default: false)
  -N, --Namespace        Print the list of configured namespaces to the log (default: false)
  -1, --IM Spec          Write the Information Model Specification for an LDD (default: false)
  -T, --TermMap          Terminological mapping to alternate names (default: false)
  -O, --OWL/RDF/TTL      OWL/RDF/TTL output in TTL format (IM Classification) (default: false)
  -o, --OWL/RDF          OWL/RDF output in RDF format (IM Export) (default: false)
  -C, --Custom           Customized processing and reporting (default: false)
  -v, --version          Returns the LDDTool version number (default: false)
  -V {1B00,1B10,1C00,1D00,1E00,1F00,1G00,1H00,1I00,1J00,1K00,1L00,1M00}, --IM Version {1B00,1B10,1C00,1D00,1E00,1F00,1G00,1H00,1I00,1J00,1K00,1L00,1M00}
                         Set the IM Version (default: 1M00)
>>  INFO Exit(0)

>>  FATAL ERROR Environment variable PARENT_DIR is null
jordanpadams commented 1 month ago

@miguelp1986 what version of JAVA are you running? This is most likely related to this issue @jshughes is also working on: https://github.com/NASA-PDS/pds4-information-model/issues/702#issuecomment-1946489953

miguelp1986 commented 1 month ago

@jordanpadams

╰─ java --version                                                                                                                                                                          ─╯
openjdk 11.0.22 2024-01-16
OpenJDK Runtime Environment Homebrew (build 11.0.22+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.22+0, mixed mode)
miguelp1986 commented 1 month ago

I haven't merged main into my branch for a while, so if fixes were introduced for this, I might not have them.

jordanpadams commented 1 month ago

@miguelp1986 status: issue above. due to weird env variable variable. blocked by https://github.com/NASA-PDS/pds4-information-model/issues/702#issuecomment-1946489953

jordanpadams commented 1 month ago

@miguelp1986 do you have a branch somewhere that I can test this?

miguelp1986 commented 1 month ago

@jordanpadams Here is the latest code with the cucumber tests.

You can run the tests by running mvn clean test in the model-lddtool directory.

tloubrieu-jpl commented 1 month ago

@miguelp1986 tested the updated code in the branch of LDDtools but he's still having the same error. @jshughes and @miguelp1986 will solve that together.

miguelp1986 commented 1 month ago

@jshughes I merged your changes from PR #742 into my branch and I'm still seeing FATAL ERROR Environment variable PARENT_DIR is null. Are there environment variables that I must set before running lddtool?

jordanpadams commented 4 weeks ago

@miguelp1986 I merged main into your branch and it looks like you should be unblocked. Some tests are still failing, but for a different reason now.