@Test public void testFindTargetById() throws Exception { Response resp = this.resource.findTargetById( "2" ); Assert.assertEquals( Status.NOT_FOUND.getStatusCode(), resp.getStatus()); String t2 = (String) this.resource.createOrUpdateTarget( "id: tid\nhandler: h\ndescription: we do not care", null ).getEntity(); resp = this.resource.findTargetById( t2 ); Assert.assertEquals( Status.OK.getStatusCode(), resp.getStatus()); TargetWrapperDescriptor twd = (TargetWrapperDescriptor) resp.getEntity(); Assert.assertNotNull( twd ); Assert.assertEquals( t2, twd.getId()); Assert.assertEquals( "we do not care", twd.getDescription()); Assert.assertNull( twd.getName()); }
@Override public Response findTargetById( String targetId ) { this.logger.fine( "Request: get details about target " + targetId + "." ); TargetWrapperDescriptor twb = this.manager.targetsMngr().findTargetById( targetId ); Response response; if( twb == null ) response = Response.status( Status.NOT_FOUND ).build(); else response = Response.ok().entity( twb ).build(); return response; }
TargetResource implements ITargetResource { @Override public Response findTargetById( String targetId ) { this.logger.fine( "Request: get details about target " + targetId + "." ); TargetWrapperDescriptor twb = this.manager.targetsMngr().findTargetById( targetId ); Response response; if( twb == null ) response = Response.status( Status.NOT_FOUND ).build(); else response = Response.ok().entity( twb ).build(); return response; } }
TargetResource implements ITargetResource { @Override public Response findTargetById( String targetId ) { this.logger.fine( "Request: get details about target " + targetId + "." ); TargetWrapperDescriptor twb = this.manager.targetsMngr().findTargetById( targetId ); Response response; if( twb == null ) response = Response.status( Status.NOT_FOUND ).build(); else response = Response.ok().entity( twb ).build(); return response; } TargetResource( Manager manager ); }
TargetResource implements ITargetResource { @Override public Response findTargetById( String targetId ) { this.logger.fine( "Request: get details about target " + targetId + "." ); TargetWrapperDescriptor twb = this.manager.targetsMngr().findTargetById( targetId ); Response response; if( twb == null ) response = Response.status( Status.NOT_FOUND ).build(); else response = Response.ok().entity( twb ).build(); return response; } TargetResource( Manager manager ); @Override List<TargetWrapperDescriptor> listTargets( String name, String qualifier ); @Override Response createOrUpdateTarget( String rawProperties, String targetId ); @Override Response loadTargetArchive( InputStream uploadedInputStream, FormDataContentDisposition fileDetail ); @Override Response deleteTarget( String targetId ); @Override Response getTargetProperties( String targetId ); @Override Response findTargetById( String targetId ); @Override Response associateTarget(
			String name,
			String qualifier,
			String instancePathOrComponentName,
			String targetId,
			boolean bind ); @Override Response updateHint( String name, String qualifier, String targetId, boolean bind ); @Override List<TargetUsageItem> findUsageStatistics( String targetId ); }
TargetResource implements ITargetResource { @Override public Response findTargetById( String targetId ) { this.logger.fine( "Request: get details about target " + targetId + "." ); TargetWrapperDescriptor twb = this.manager.targetsMngr().findTargetById( targetId ); Response response; if( twb == null ) response = Response.status( Status.NOT_FOUND ).build(); else response = Response.ok().entity( twb ).build(); return response; } TargetResource( Manager manager ); @Override List<TargetWrapperDescriptor> listTargets( String name, String qualifier ); @Override Response createOrUpdateTarget( String rawProperties, String targetId ); @Override Response loadTargetArchive( InputStream uploadedInputStream, FormDataContentDisposition fileDetail ); @Override Response deleteTarget( String targetId ); @Override Response getTargetProperties( String targetId ); @Override Response findTargetById( String targetId ); @Override Response associateTarget(
			String name,
			String qualifier,
			String instancePathOrComponentName,
			String targetId,
			boolean bind ); @Override Response updateHint( String name, String qualifier, String targetId, boolean bind ); @Override List<TargetUsageItem> findUsageStatistics( String targetId );  }