ApplicationWsDelegate { public List<String> listAllCommands( String applicationName ) { this.logger.finer( "Listing commands in " + applicationName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ) .path( applicationName ).path( "commands" ); List<String> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<String>> () {}); if( result != null ) { this.logger.finer( result.size() + " command(s) were found for " + applicationName + "." ); } else { this.logger.finer( "No command was found for " + applicationName + "." ); result = new ArrayList<>( 0 ); } return result; } 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 public void testListAllCommands() throws Exception { List<String> cmds = this.client.getApplicationDelegate().listAllCommands( this.app.getName()); Assert.assertEquals( 0, cmds.size()); File cmdFile = new File( this.app.getDirectory(), Constants.PROJECT_DIR_COMMANDS + "/cmd" + Constants.FILE_EXT_COMMANDS ); Assert.assertTrue( cmdFile.getParentFile().mkdirs()); Utils.writeStringInto( "write this into /tmp", cmdFile ); cmds = this.client.getApplicationDelegate().listAllCommands( this.app.getName()); Assert.assertEquals( 1, cmds.size()); Assert.assertEquals( "cmd", cmds.get( 0 )); }