chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StopMojo.java [46:104]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void execute() throws MojoExecutionException {
        initCertStore();

        /** First check that the runner.jar is ready and up-to-date */
        if ( ! isReadyToDeploy() ) {
            LOG.info( "{} is NOT present, calling chop:runner goal now...", RUNNER_JAR );
            RunnerMojo runnerMojo = new RunnerMojo( this );
            runnerMojo.execute();
        }
        if ( ! isReadyToDeploy() ) {
            throw new MojoExecutionException( "Runner file was not ready and chop:runner failed" );
        }

        Properties props = new Properties();
        try {
            File extractedConfigPropFile = new File( getExtractedRunnerPath(), PROJECT_FILE );
            FileInputStream inputStream = new FileInputStream( extractedConfigPropFile );
            props.load( inputStream );
            inputStream.close();
        }
        catch ( Exception e ) {
            LOG.error( "Error while reading project.properties in runner.jar", e );
            throw new MojoExecutionException( e.getMessage() );
        }

        /** Stop tests TODO use chop-client module to talk to the coordinator */
        DefaultClientConfig clientConfig = new DefaultClientConfig();
        Client client = Client.create( clientConfig );
        WebResource resource = client.resource( endpoint ).path( "/stop" );

        LOG.info( "Commit ID: {}", props.getProperty( Project.GIT_UUID_KEY ) );
        LOG.info( "Artifact Id: {}", props.getProperty( Project.ARTIFACT_ID_KEY ) );
        LOG.info( "Group Id: {}", props.getProperty( Project.GROUP_ID_KEY ) );
        LOG.info( "Version: {}", props.getProperty( Project.PROJECT_VERSION_KEY ) );
        LOG.info( "Username: {}", username );

        ClientResponse resp = resource
                .queryParam( RestParams.COMMIT_ID, props.getProperty( Project.GIT_UUID_KEY ) )
                .queryParam( RestParams.MODULE_ARTIFACTID, props.getProperty( Project.ARTIFACT_ID_KEY ) )
                .queryParam( RestParams.MODULE_GROUPID, props.getProperty( Project.GROUP_ID_KEY ) )
                .queryParam( RestParams.MODULE_VERSION, props.getProperty( Project.PROJECT_VERSION_KEY ) )
                .queryParam( RestParams.USERNAME, username )
                .type( MediaType.APPLICATION_JSON )
                .accept( MediaType.APPLICATION_JSON )
                .post( ClientResponse.class );

        if( resp.getStatus() != Response.Status.OK.getStatusCode() &&
                resp.getStatus() != Response.Status.CREATED.getStatusCode() ) {
            LOG.error( "Could not get the status from coordinator, HTTP status: {}", resp.getStatus() );
            LOG.error( "Error Message: {}", resp.getEntity( String.class ) );

            throw new MojoExecutionException( "Stop plugin goal has failed" );
        }

        String result = resp.getEntity( String.class );
        LOG.info( "====== Response from the coordinator ======" );
        LOG.info( "Coordinator message: {}", result );
        LOG.info( "===========================================" );
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/ResetMojo.java [66:124]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void execute() throws MojoExecutionException {
        initCertStore();

        /** First check that the runner.jar is ready and up-to-date */
        if ( ! isReadyToDeploy() ) {
            LOG.info( "{} is NOT present, calling chop:runner goal now...", RUNNER_JAR );
            RunnerMojo runnerMojo = new RunnerMojo( this );
            runnerMojo.execute();
        }
        if ( ! isReadyToDeploy() ) {
            throw new MojoExecutionException( "Runner file was not ready and chop:runner failed" );
        }

        Properties props = new Properties();
        try {
            File extractedConfigPropFile = new File( getExtractedRunnerPath(), PROJECT_FILE );
            FileInputStream inputStream = new FileInputStream( extractedConfigPropFile );
            props.load( inputStream );
            inputStream.close();
        }
        catch ( Exception e ) {
            LOG.error( "Error while reading project.properties in runner.jar", e );
            throw new MojoExecutionException( e.getMessage() );
        }

        /** Reset stopped tests TODO use chop-client module to talk to the coordinator */
        DefaultClientConfig clientConfig = new DefaultClientConfig();
        Client client = Client.create( clientConfig );
        WebResource resource = client.resource( endpoint ).path( "/reset" );

        LOG.info( "Commit ID: {}", props.getProperty( Project.GIT_UUID_KEY ) );
        LOG.info( "Artifact Id: {}", props.getProperty( Project.ARTIFACT_ID_KEY ) );
        LOG.info( "Group Id: {}", props.getProperty( Project.GROUP_ID_KEY ) );
        LOG.info( "Version: {}", props.getProperty( Project.PROJECT_VERSION_KEY ) );
        LOG.info( "Username: {}", username );

        ClientResponse resp = resource
                .queryParam( RestParams.COMMIT_ID, props.getProperty( Project.GIT_UUID_KEY ) )
                .queryParam( RestParams.MODULE_ARTIFACTID, props.getProperty( Project.ARTIFACT_ID_KEY ) )
                .queryParam( RestParams.MODULE_GROUPID, props.getProperty( Project.GROUP_ID_KEY ) )
                .queryParam( RestParams.MODULE_VERSION, props.getProperty( Project.PROJECT_VERSION_KEY ) )
                .queryParam( RestParams.USERNAME, username )
                .type( MediaType.APPLICATION_JSON )
                .accept( MediaType.APPLICATION_JSON )
                .post( ClientResponse.class );

        if( resp.getStatus() != Response.Status.OK.getStatusCode() &&
                resp.getStatus() != Response.Status.CREATED.getStatusCode() ) {
            LOG.error( "Could not get the status from coordinator, HTTP status: {}", resp.getStatus() );
            LOG.error( "Error Message: {}", resp.getEntity( String.class ) );

            throw new MojoExecutionException( "Reset plugin goal has failed" );
        }

        String result = resp.getEntity( String.class );
        LOG.info( "====== Response from the coordinator ======" );
        LOG.info( "Coordinator message: {}", result );
        LOG.info( "===========================================" );
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



