Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: support of parametrized that have complex naming conventions #799

Open
gibello opened this issue May 17, 2019 · 5 comments
Open

FEAT: support of parametrized that have complex naming conventions #799

gibello opened this issue May 17, 2019 · 5 comments

Comments

@gibello
Copy link

gibello commented May 17, 2019

Characteristics

  • Issue Type: bug
  • Reproducibility: always
  • Severity: crash
  • Tool/Service/Component: DSpot maven plugin 2.1.1-SNAPSHOT
  • Execution Environment: Ubuntu Linux 18.04
  • Reporter: Pierre-Yves Gibello, [email protected]

Description

DSpot crashes with NPE. Seems related to reporting ?

Steps to reproduce

Tested on authzforce core project (https://gitlab.ow2.org/authzforce/core).

DSpot launched in core/pdp-engine directory, as follows:
mvn eu.stamp-project:dspot-maven:2.1.1-SNAPSHOT:amplify-unit-tests -e

Ends with a NPE, and following stack:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:20 min
[INFO] Finished at: 2019-05-17T15:35:35+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal eu.stamp-project:dspot-maven:2.1.1-SNAPSHOT:amplify-unit-tests (default-cli) on project authzforce-ce-core-pdp-engine: Execution default-cli of goal eu.stamp-project:dspot-maven:2.1.1-SNAPSHOT:amplify-unit-tests failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal eu.stamp-project:dspot-maven:2.1.1-SNAPSHOT:amplify-unit-tests (default-cli) on project authzforce-ce-core-pdp-engine: Execution default-cli of goal eu.stamp-project:dspot-maven:2.1.1-SNAPSHOT:amplify-unit-tests failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal eu.stamp-project:dspot-maven:2.1.1-SNAPSHOT:amplify-unit-tests failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NullPointerException
    at eu.stamp_project.utils.report.output.selector.TestSelectorReportImpl.lambda$output$0 (TestSelectorReportImpl.java:34)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
    at java.util.HashMap$KeySpliterator.forEachRemaining (HashMap.java:1556)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential (ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect (ReferencePipeline.java:499)
    at eu.stamp_project.utils.report.output.selector.TestSelectorReportImpl.output (TestSelectorReportImpl.java:35)
    at eu.stamp_project.utils.report.GlobalReport.output (GlobalReport.java:35)
    at eu.stamp_project.DSpotMojo.execute (DSpotMojo.java:316)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] 
[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/PluginExecutionException
@danglotb
Copy link
Member

Hello @gibello

in the pdp-engine module, there are only parametrized tests.

It seems that the test-runner of DSpot does not support junit4 parametrized tests anymore. I might have introduced a regression.

I'm going to investigate.

In the meantime, I opened a pull request #805 to avoid the misleading error above.

@danglotb
Copy link
Member

Actually, this happened when I had some configuration in the pom.xml of pdp-engine.

Do you have modified your pom.xml? If so, could you provide me your configuration?

Thank you.

@danglotb danglotb added bug maven-plugin This issue is related to the module DSpot - Maven labels May 27, 2019
@gibello
Copy link
Author

gibello commented May 27, 2019

No config at all in the pom. Lanched exactly as specified in the issue : maybe not the right way to do (?), but should not produce a NPE.

@danglotb
Copy link
Member

Okay, I did reproduce using the -Duse-maven-to-exe-test command line option (without I do not have the error thrown).

The real errors is the following:

[INFO] [INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ authzforce-ce-core-pdp-engine ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.ow2.authzforce.core.pdp.impl.test.value.StandardJavaTypeToXacmlAttributeDatatypeConversionTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.435 sec - in org.ow2.authzforce.core.pdp.impl.test.value.StandardJavaTypeToXacmlAttributeDatatypeConversionTest
[INFO] 
[INFO] Results :
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time:  4.889 s
[INFO] [INFO] Finished at: 2019-05-27T20:32:52+02:00
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project authzforce-ce-core-pdp-engine: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]

The test-runner seems not to be able to execute parametrized tests using maven goals. It uses:

mvn clean test -Dtest=org.ow2.authzforce.core.pdp.impl.test.value.StandardJavaTypeToXacmlAttributeDatatypeConversionTest#test

to execute the test, which seems to be wrong since the test methods is parametrized.

I'll implement it ASAP and keep you update.

The reported errors (i.e. NPE on TestSelectorReport ) was a side effect of the fact that test-runner cannot (yet) execute parametrized tests with maven goals.

@danglotb
Copy link
Member

After further investigations, the problem comes from the way the parametrized tests are named.

For example, in org.ow2.authzforce.core.pdp.impl.test.DefaultEnvironmentPropertiesTest, the tests are named as follow:

@Parameters(name = "{index}: {1}; user={2}; sys={3} -> {5}")

There are two issues here:

  1. the spaces between elements.
  2. the presence of : in the name, which is the path separator of Linux.

Why it is an issue?

Because to run the tests, DSpot uses the library test-runner that uses a classic java command line to execute the tests.

In a command line, the spaces are used to separate arguments and the path separator is used to specify arrays/list.

This is why DSpot is not able to execute the tests, and thus amplify them.

To be honest, I do not have the development power nor the time to address this very specific issue.

As already mentioned, the best targets for DSpot are unit tests. I suggest you move forward to another case study since this one is not applicable to DSpot.

However, if anyone in your team wants to address this issue, I would be glad to support its development both on DSpot and test-runner by answering questions and giving directions to do so.

Thank you very much.

@danglotb danglotb added low priority task available wontfix and removed maven-plugin This issue is related to the module DSpot - Maven labels May 27, 2019
@danglotb danglotb changed the title NullPointerException using DSpot maven plugin FEAT: support of parametrized that have complex naming conventions May 27, 2019
@danglotb danglotb added feature and removed bug labels May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants