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 );  }
@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()); }
@Test( expected = DebugWsException.class ) public void testDiagnoseInstance_inexistingInstance() throws Exception { ManagedApplication ma = new ManagedApplication( this.app ); this.managerWrapper.addManagedApplication( ma ); this.client.getDebugDelegate().diagnoseInstance( this.app.getName(), "/inexisting" ); }
@Test( expected = DebugWsException.class ) public void testDiagnoseInstance_inexistingApplication() throws Exception { String path = InstanceHelpers.computeInstancePath( this.app.getWar()); ManagedApplication ma = new ManagedApplication( this.app ); this.managerWrapper.addManagedApplication( ma ); this.client.getDebugDelegate().diagnoseInstance( "inexisting", path ); }