DebugResource implements IDebugResource { @Override public Response diagnoseInstance( String applicationName, String instancePath ) { this.logger.fine( "Request: create a diagnostic for " + instancePath + " in application " + applicationName ); final Application application = this.manager.applicationMngr().findApplicationByName( applicationName ); String lang = lang( this.manager ); final Instance instance; final Response response; if( application == null ) response = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang ).build(); else if(( instance = InstanceHelpers.findInstanceByPath( application, instancePath )) == null ) response = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, instance( instancePath ), application( applicationName )), lang ).build(); else response = Response.status( Status.OK ).entity( createDiagnostic( instance )).build(); return response; } DebugResource( Manager manager ); @Override Response checkMessagingConnectionForTheDm( String message ); @Override Response checkMessagingConnectionWithAgent(
			String applicationName,
			String scopedInstancePath,
			String message ); @Override Response diagnoseInstance( String applicationName, String instancePath ); @Override 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 ); Response resp = this.resource.diagnoseInstance( "inexisting", path ); Assert.assertEquals( Status.NOT_FOUND.getStatusCode(), resp.getStatus()); resp = this.resource.diagnoseInstance( this.app.getName(), "/inexisting" ); Assert.assertEquals( Status.NOT_FOUND.getStatusCode(), resp.getStatus()); resp = this.resource.diagnoseInstance( this.app.getName(), path ); Assert.assertEquals( Status.OK.getStatusCode(), resp.getStatus()); Diagnostic diag = (Diagnostic) resp.getEntity(); Assert.assertNotNull( diag ); Assert.assertEquals( path, diag.getInstancePath()); Assert.assertEquals( 1, diag.getDependenciesInformation().size()); }