A report generator instance have been create using the BasicHtmlReportGeneratorImpl.getInstance() method.
The next step is to register it with a core component instance to listen for events during execution of operations and produce a report when execution of an operation is complete:
// create core component PineappleCore core = CoreFactory.createCore(); // create the report generator with default settings ResultListener generator = BasicHtmlReportGeneratorImpl.getInstance(); // register the report generator core.addListener(generator);
The last step is to execute and operation and have the report generator create a report when the execution of the operation is completed:
// get user.home String userHome = System.getProperty( "user.home" ); // define default pineapple runtime directory File runtimeDirectory = new File( userHome, ".pineapple" ); // define modules directory File modulesDirectory = new File( runtimeDirectory, "modules" ); // setup parameters String operation = "run-tests"; String environment = "production-2-a"; String module = "jee-platform-infrastructure-tests" ; // execute operation Future<String> future; future = core.execute( operation, environment, modulesDirectory, module ); // invoke get-method to block until execution is complete String result = future.get();
This instance of the core component will:
The method is asynchronous and will return a Future<String> object once the operation is added to the execution queue. To wait for the operation is finished, invoke the get() method on the Future object.