@Test public void testDiagnoseInstance() throws Exception { String path = InstanceHelpers.computeInstancePath( this.app.getWar()); ManagedApplication ma = new ManagedApplication( this.app ); this.managerWrapper.addManagedApplication( ma ); Diagnostic diag = this.client.getDebugDelegate().diagnoseInstance( this.app.getName(), path ); Assert.assertNotNull( diag ); Assert.assertEquals( path, diag.getInstancePath()); Assert.assertEquals( 1, diag.getDependenciesInformation().size()); }
public Diagnostic diagnoseInstance( String applicationName, String instancePath ) throws DebugWsException { this.logger.finer( "Diagnosing instance " + instancePath + " in application " + applicationName ); WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "diagnose-instance" ); path = path.queryParam( "application-name", applicationName ); path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( ClientResponse.class ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new DebugWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); return response.getEntity( Diagnostic.class ); }
DebugWsDelegate { public Diagnostic diagnoseInstance( String applicationName, String instancePath ) throws DebugWsException { this.logger.finer( "Diagnosing instance " + instancePath + " in application " + applicationName ); WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "diagnose-instance" ); path = path.queryParam( "application-name", applicationName ); path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( ClientResponse.class ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new DebugWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); return response.getEntity( Diagnostic.class ); } }
DebugWsDelegate { public Diagnostic diagnoseInstance( String applicationName, String instancePath ) throws DebugWsException { this.logger.finer( "Diagnosing instance " + instancePath + " in application " + applicationName ); WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "diagnose-instance" ); path = path.queryParam( "application-name", applicationName ); path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( ClientResponse.class ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new DebugWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); return response.getEntity( Diagnostic.class ); } DebugWsDelegate( WebResource resource, WsClient wsClient ); }
DebugWsDelegate { public Diagnostic diagnoseInstance( String applicationName, String instancePath ) throws DebugWsException { this.logger.finer( "Diagnosing instance " + instancePath + " in application " + applicationName ); WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "diagnose-instance" ); path = path.queryParam( "application-name", applicationName ); path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( ClientResponse.class ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new DebugWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); return response.getEntity( Diagnostic.class ); } DebugWsDelegate( WebResource resource, WsClient wsClient ); String checkMessagingConnectionForTheDm( String message ); String checkMessagingConnectionWithAgent( String applicationName, String scopedInstancePath, String message ); Diagnostic diagnoseInstance( String applicationName, String instancePath ); List<Diagnostic> diagnoseApplication( String applicationName ); }
DebugWsDelegate { public Diagnostic diagnoseInstance( String applicationName, String instancePath ) throws DebugWsException { this.logger.finer( "Diagnosing instance " + instancePath + " in application " + applicationName ); WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "diagnose-instance" ); path = path.queryParam( "application-name", applicationName ); path = path.queryParam( "instance-path", instancePath ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( ClientResponse.class ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new DebugWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); return response.getEntity( Diagnostic.class ); } DebugWsDelegate( WebResource resource, WsClient wsClient ); String checkMessagingConnectionForTheDm( String message ); String checkMessagingConnectionWithAgent( String applicationName, String scopedInstancePath, String message ); Diagnostic diagnoseInstance( String applicationName, String instancePath ); List<Diagnostic> diagnoseApplication( String applicationName );  }