Implement the com.alpha.pineapple.execution.ResultListener which is defined in the pineapple-api project:
public class LoggingListenerImpl implements ResultListener { /** * Logger object. */ Logger logger = Logger.getLogger( this.getClass().getName() ); public void notify(ExecutionResultNotification notification) { { // get result ExecutionResult result = notification.getResult(); // log debug message if (logger.isDebugEnabled()) { StringBuilder message = new StringBuilder(); message.append( "Received notification <" ); message.append( result.toString() ); message.append( ">." ); logger.debug( message.toString() ); } } }
In your client of choice, create the core component and register the listener:
// create core component CoreFactory coreFactory = new CoreFactory(); PineappleCore core = coreFactory.createCore(); // create the listener ResultListener listener = new LoggingListenerImpl (); // register the listener core.addListener(listener);
In your client of choice, invoke an operation:
// 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();
And look in your Log4j log to inspect the notifications...