Maven Invoker Plugin
  1. Maven Invoker Plugin
  2. MINVOKER-63

Inject some Verifier-like component into the scripts to ease common assertions

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      Many pre-/post-build hook scripts share very similar patterns to check for existence/absence of files, JAR entries etc. Those scripts could be greatly condensed if the Invoker Plugin provided a Verifier-like component to perform these common assertions using dedicated methods. In detail, offer Verifier.assert*() for the scripts.

        Issue Links

          Activity

          Benjamin Bentmann created issue -
          Hide
          Benjamin Bentmann added a comment -

          Some first thoughts on the API of this Asserter component:

          • setCurrentDirectory(String/File path)
          • assertFile(String/File path)
          • assertDirectory(String/File path)
          • assertNotPath(String/File path)
          • assertNotPaths(String includes, String excludes)
          • assertFileContents(String/File path, String encoding, String regex)
          • setCurrentArchive(String/File path)
          • assertArchiveEntry(String path)
          • assertNotArchiveEntry(String path)
          • assertNotArchiveEntries(String includes, String excludes)
          • assertArchiveEntryContents(String path, String encoding, String regex)
          • dispose()

          The archive assertions should be reviewed to support nested archives.

          Show
          Benjamin Bentmann added a comment - Some first thoughts on the API of this Asserter component: setCurrentDirectory(String/File path) assertFile(String/File path) assertDirectory(String/File path) assertNotPath(String/File path) assertNotPaths(String includes, String excludes) assertFileContents(String/File path, String encoding, String regex) setCurrentArchive(String/File path) assertArchiveEntry(String path) assertNotArchiveEntry(String path) assertNotArchiveEntries(String includes, String excludes) assertArchiveEntryContents(String path, String encoding, String regex) dispose() The archive assertions should be reviewed to support nested archives.
          Hide
          Olivier Lamy (*$^¨%`£) added a comment -

          setup() or initialiaze() in first ?

          Show
          Olivier Lamy (*$^¨%`£) added a comment - setup() or initialiaze() in first ?
          Hide
          Benjamin Bentmann added a comment -

          Not sure whether we need those. I currently have a simple/lightweight POJO class in mind (i.e. not a component in the Plexus sense) that just has some constructors for initialization and that's it. The dispose() is intended to release resources like file handles on archives. However, it's not fully thought up (at least on my side ).

          To further illustrate the intended usage:

          In the Invoker Plugin
          // setup the asserter for the current IT
          Asserter asserter = new Asserter();
          asserter.setCurrentDirectory( basedir );
          
          // pass it on to the script interpreter as a global variable
          runHookScript( ..., asserter );
          
          // tidy up
          asserter.dispose();
          
          In the Hook Script
          asserter.assertFile( "target/foo-1.0.jar" );
          asserter.setCurrentDirectory( "target/exploded" );
          asserter.assertFile( "WEB-INF/lib/bar-1.0.jar" );
          
          Show
          Benjamin Bentmann added a comment - Not sure whether we need those. I currently have a simple/lightweight POJO class in mind (i.e. not a component in the Plexus sense) that just has some constructors for initialization and that's it. The dispose() is intended to release resources like file handles on archives. However, it's not fully thought up (at least on my side ). To further illustrate the intended usage: In the Invoker Plugin // setup the asserter for the current IT Asserter asserter = new Asserter(); asserter.setCurrentDirectory( basedir ); // pass it on to the script interpreter as a global variable runHookScript( ..., asserter ); // tidy up asserter.dispose(); In the Hook Script asserter.assertFile( "target/foo-1.0.jar" ); asserter.setCurrentDirectory( "target/exploded" ); asserter.assertFile( "WEB-INF/lib/bar-1.0.jar" );
          luke w patterson made changes -
          Field Original Value New Value
          Link This issue relates to MINVOKER-113 [ MINVOKER-113 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 10:28:53 UTC 2015 [ 1428229733495 ]
          Mark Thomas made changes -
          Workflow jira [ 12721774 ] Default workflow, editable Closed status [ 12762015 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 00:02:09 UTC 2015 [ 1428278529346 ]
          Mark Thomas made changes -
          Workflow jira [ 12959254 ] Default workflow, editable Closed status [ 12996116 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Benjamin Bentmann
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development