Skip to content
Pascal Christoph edited this page Sep 24, 2024 · 1 revision

Many GitHub issues provide a link to metafacture Playground having a "flux". This "flux" can be integrated into your IDE for debugging, e.g. like this:

Open metafacture-flux/src/test/java/org/metafacture/flux/FluxGrammarTest.java. Add a test, e.g.:

    @Test
    public void runFlux()
        throws RecognitionException, IOException {
        final String script = "\"https://d-nb.info/1106253078/about/marcxml\"\n" +
            "| open-http(accept=\"application/xml\")\n" +
            "| decode-xml\n" +
            "| handle-marcxml\n" +
            "| encode-marcxml\n" +
            "| print\n" +
            "; //\n";

        final FluxProgramm program =  FluxCompiler.compile(createInputStream(script),  emptyMap());
        program.start();
    }

As the Standard Out is redirected, search for it and comment that out - otherwise you wouldn't see any output from the "print" flux command:

   //   System.setOut(new PrintStream(stdoutBuffer));

Now, not all of the flux-commands used here are part of the "metafacture-flux" module. We have to add the modules which provide these flux commands to have access to them. Concerning the "flux" we use here, add these lines to metafacture-flux/build.gradle:

  implementation project(':metafacture-biblio')
  implementation project(':metafacture-xml')

Now you can run or debug the test in your IDE.