@Test public void testStopAll() throws Exception { Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); Assert.assertEquals( 0, this.ma.removeAwaitingMessages( this.app.getTomcatVm()).size()); String instancePath = InstanceHelpers.computeInstancePath( this.app.getTomcat()); this.client.getApplicationDelegate().stopAll( this.app.getName(), instancePath ); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); List<Message> messages = this.ma.removeAwaitingMessages( this.app.getTomcatVm()); Assert.assertEquals( 1, messages.size()); Assert.assertEquals( MsgCmdChangeInstanceState.class, messages.get( 0 ).getClass()); Assert.assertEquals( instancePath, ((MsgCmdChangeInstanceState) messages.get( 0 )).getInstancePath()); }
public void stopAll( String applicationName, String instancePath ) throws ApplicationWsException { this.logger.finer( "Stopping instances in " + applicationName + " from instance = " + instancePath ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "stop-all" ); if( instancePath != null ) path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); handleResponse( response ); this.logger.finer( String.valueOf( response.getStatusInfo())); }
ApplicationWsDelegate { public void stopAll( String applicationName, String instancePath ) throws ApplicationWsException { this.logger.finer( "Stopping instances in " + applicationName + " from instance = " + instancePath ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "stop-all" ); if( instancePath != null ) path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); handleResponse( response ); this.logger.finer( String.valueOf( response.getStatusInfo())); } }
ApplicationWsDelegate { public void stopAll( String applicationName, String instancePath ) throws ApplicationWsException { this.logger.finer( "Stopping instances in " + applicationName + " from instance = " + instancePath ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "stop-all" ); if( instancePath != null ) path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); handleResponse( response ); this.logger.finer( String.valueOf( response.getStatusInfo())); } ApplicationWsDelegate( WebResource resource, WsClient wsClient ); }
ApplicationWsDelegate { public void stopAll( String applicationName, String instancePath ) throws ApplicationWsException { this.logger.finer( "Stopping instances in " + applicationName + " from instance = " + instancePath ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "stop-all" ); if( instancePath != null ) path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); handleResponse( response ); this.logger.finer( String.valueOf( response.getStatusInfo())); } ApplicationWsDelegate( WebResource resource, WsClient wsClient ); void changeInstanceState( String applicationName, InstanceStatus newStatus, String instancePath ); void setDescription( String applicationName, String newDesc ); void deployAndStartAll( String applicationName, String instancePath ); void stopAll( String applicationName, String instancePath ); void undeployAll( String applicationName, String instancePath ); List<Instance> listChildrenInstances( String applicationName, String instancePath, boolean all ); void addInstance( String applicationName, String parentInstancePath, Instance instance ); void removeInstance( String applicationName, String instancePath ); void resynchronize( String applicationName ); List<Component> listAllComponents( String applicationName ); List<Component> findComponentChildren( String applicationName, String componentName ); List<Component> findComponentAncestors( String applicationName, String componentName ); void bindApplication( String applicationName, String boundTplName, String boundApp ); List<String> listAllCommands( String applicationName ); }
ApplicationWsDelegate { public void stopAll( String applicationName, String instancePath ) throws ApplicationWsException { this.logger.finer( "Stopping instances in " + applicationName + " from instance = " + instancePath ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "stop-all" ); if( instancePath != null ) path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); handleResponse( response ); this.logger.finer( String.valueOf( response.getStatusInfo())); } ApplicationWsDelegate( WebResource resource, WsClient wsClient ); void changeInstanceState( String applicationName, InstanceStatus newStatus, String instancePath ); void setDescription( String applicationName, String newDesc ); void deployAndStartAll( String applicationName, String instancePath ); void stopAll( String applicationName, String instancePath ); void undeployAll( String applicationName, String instancePath ); List<Instance> listChildrenInstances( String applicationName, String instancePath, boolean all ); void addInstance( String applicationName, String parentInstancePath, Instance instance ); void removeInstance( String applicationName, String instancePath ); void resynchronize( String applicationName ); List<Component> listAllComponents( String applicationName ); List<Component> findComponentChildren( String applicationName, String componentName ); List<Component> findComponentAncestors( String applicationName, String componentName ); void bindApplication( String applicationName, String boundTplName, String boundApp ); List<String> listAllCommands( String applicationName );  }