@Test public void testFindComponentAncestors() throws Exception { List<Component> components = this.client.getApplicationDelegate().findComponentAncestors( "inexisting", "my-comp" ); Assert.assertEquals( 0, components.size()); components = this.client.getApplicationDelegate().findComponentAncestors( this.app.getName(), "my-comp" ); Assert.assertEquals( 0, components.size()); components = this.client.getApplicationDelegate().findComponentAncestors( this.app.getName(), this.app.getTomcat().getComponent().getName()); Assert.assertEquals( 1, components.size()); Assert.assertTrue( components.contains( this.app.getMySqlVm().getComponent())); Assert.assertTrue( components.contains( this.app.getTomcatVm().getComponent())); }
public List<Component> findComponentAncestors( String applicationName, String componentName ) { this.logger.finer( "Listing possible parent components for component " + componentName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "components/ancestors" ); if( componentName != null ) path = path.queryParam( "component-name", componentName ); List<Component> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Component>> () {}); if( result != null ) { this.logger.finer( result.size() + " possible parents was or were found for " + componentName + "." ); } else { this.logger.finer( "No possible parent was found for " + componentName + "." ); result = new ArrayList<>( 0 ); } return result; }
ApplicationWsDelegate { public List<Component> findComponentAncestors( String applicationName, String componentName ) { this.logger.finer( "Listing possible parent components for component " + componentName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "components/ancestors" ); if( componentName != null ) path = path.queryParam( "component-name", componentName ); List<Component> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Component>> () {}); if( result != null ) { this.logger.finer( result.size() + " possible parents was or were found for " + componentName + "." ); } else { this.logger.finer( "No possible parent was found for " + componentName + "." ); result = new ArrayList<>( 0 ); } return result; } }
ApplicationWsDelegate { public List<Component> findComponentAncestors( String applicationName, String componentName ) { this.logger.finer( "Listing possible parent components for component " + componentName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "components/ancestors" ); if( componentName != null ) path = path.queryParam( "component-name", componentName ); List<Component> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Component>> () {}); if( result != null ) { this.logger.finer( result.size() + " possible parents was or were found for " + componentName + "." ); } else { this.logger.finer( "No possible parent was found for " + componentName + "." ); result = new ArrayList<>( 0 ); } return result; } ApplicationWsDelegate( WebResource resource, WsClient wsClient ); }
ApplicationWsDelegate { public List<Component> findComponentAncestors( String applicationName, String componentName ) { this.logger.finer( "Listing possible parent components for component " + componentName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "components/ancestors" ); if( componentName != null ) path = path.queryParam( "component-name", componentName ); List<Component> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Component>> () {}); if( result != null ) { this.logger.finer( result.size() + " possible parents was or were found for " + componentName + "." ); } else { this.logger.finer( "No possible parent was found for " + componentName + "." ); 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 ); }
ApplicationWsDelegate { public List<Component> findComponentAncestors( String applicationName, String componentName ) { this.logger.finer( "Listing possible parent components for component " + componentName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "components/ancestors" ); if( componentName != null ) path = path.queryParam( "component-name", componentName ); List<Component> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Component>> () {}); if( result != null ) { this.logger.finer( result.size() + " possible parents was or were found for " + componentName + "." ); } else { this.logger.finer( "No possible parent was found for " + componentName + "." ); 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 );  }