ApplicationWsDelegate { public void deployAndStartAll( String applicationName, String instancePath ) throws ApplicationWsException { this.logger.finer( "Deploying and starting instances in " + applicationName + " from instance = " + instancePath ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "deploy-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 );  }
@Test( expected = ApplicationWsException.class ) public void testDeployAndStartAll_invalidApp() throws Exception { String instancePath = InstanceHelpers.computeInstancePath( this.app.getTomcat()); this.client.getApplicationDelegate().deployAndStartAll( "oops", instancePath ); }
@Test public void testDeployAndStartAll() 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().deployAndStartAll( this.app.getName(), instancePath ); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); List<Message> messages = this.ma.removeAwaitingMessages( this.app.getTomcatVm()); Assert.assertEquals( 2, messages.size()); Assert.assertEquals( MsgCmdChangeInstanceState.class, messages.get( 0 ).getClass()); Assert.assertEquals( InstanceHelpers.computeInstancePath( this.app.getTomcat()), ((MsgCmdChangeInstanceState) messages.get( 0 )).getInstancePath()); Assert.assertEquals( MsgCmdChangeInstanceState.class, messages.get( 1 ).getClass()); Assert.assertEquals( InstanceHelpers.computeInstancePath( this.app.getWar()), ((MsgCmdChangeInstanceState) messages.get( 1 )).getInstancePath()); }