@Test public void testFindTargetById() throws Exception { File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS + "/5" ); Utils.createDirectory( dir ); Utils.writeStringInto( "prop: done\nhandler = test", new File( dir, Constants.TARGET_PROPERTIES_FILE_NAME )); TargetWrapperDescriptor twb = this.mngr.findTargetById( dir.getName()); Assert.assertNotNull( twb ); Assert.assertEquals( dir.getName(), twb.getId()); Assert.assertEquals( "test", twb.getHandler()); Assert.assertFalse( twb.isDefault()); Assert.assertNull( twb.getName()); Assert.assertNull( twb.getDescription()); }
@Override public TargetWrapperDescriptor findTargetById( String targetId ) { File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS ); File targetDirectory = new File( dir, targetId ); return build( targetDirectory ); }
TargetsMngrImpl implements ITargetsMngr { @Override public TargetWrapperDescriptor findTargetById( String targetId ) { File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS ); File targetDirectory = new File( dir, targetId ); return build( targetDirectory ); } }
TargetsMngrImpl implements ITargetsMngr { @Override public TargetWrapperDescriptor findTargetById( String targetId ) { File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS ); File targetDirectory = new File( dir, targetId ); return build( targetDirectory ); } TargetsMngrImpl( IConfigurationMngr configurationMngr ); }
TargetsMngrImpl implements ITargetsMngr { @Override public TargetWrapperDescriptor findTargetById( String targetId ) { File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS ); File targetDirectory = new File( dir, targetId ); return build( targetDirectory ); } TargetsMngrImpl( IConfigurationMngr configurationMngr ); @Override String createTarget( String targetContent ); @Override String createTarget( File targetPropertiesFile, ApplicationTemplate creator ); @Override void updateTarget( String targetId, String newTargetContent ); @Override void deleteTarget( String targetId ); @Override void associateTargetWith( String targetId, AbstractApplication app, String instancePathOrComponentName ); @Override void dissociateTargetFrom( AbstractApplication app, String instancePathOrComponentName ); @Override void copyOriginalMapping( Application app ); @Override void applicationWasDeleted( AbstractApplication app ); @Override TargetProperties findTargetProperties( AbstractApplication app, String instancePath ); @Override TargetProperties findTargetProperties( String targetId ); @Override String findTargetId( AbstractApplication app, String instancePath, boolean strict ); @Override String findTargetId( AbstractApplication app, String instancePath ); @Override Map<String,byte[]> findScriptResourcesForAgent( String targetId ); @Override Map<String,byte[]> findScriptResourcesForAgent( AbstractApplication app, Instance scopedInstance ); @Override File findScriptForDm( AbstractApplication app, Instance scopedInstance ); @Override List<TargetWrapperDescriptor> listAllTargets(); @Override TargetWrapperDescriptor findTargetById( String targetId ); @Override List<TargetWrapperDescriptor> listPossibleTargets( AbstractApplication app ); @Override void addHint( String targetId, AbstractApplication app ); @Override void removeHint( String targetId, AbstractApplication app ); @Override TargetProperties lockAndGetTarget( Application app, Instance scopedInstance ); @Override void unlockTarget( Application app, Instance scopedInstance ); @Override List<TargetUsageItem> findUsageStatistics( String targetId ); }
TargetsMngrImpl implements ITargetsMngr { @Override public TargetWrapperDescriptor findTargetById( String targetId ) { File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS ); File targetDirectory = new File( dir, targetId ); return build( targetDirectory ); } TargetsMngrImpl( IConfigurationMngr configurationMngr ); @Override String createTarget( String targetContent ); @Override String createTarget( File targetPropertiesFile, ApplicationTemplate creator ); @Override void updateTarget( String targetId, String newTargetContent ); @Override void deleteTarget( String targetId ); @Override void associateTargetWith( String targetId, AbstractApplication app, String instancePathOrComponentName ); @Override void dissociateTargetFrom( AbstractApplication app, String instancePathOrComponentName ); @Override void copyOriginalMapping( Application app ); @Override void applicationWasDeleted( AbstractApplication app ); @Override TargetProperties findTargetProperties( AbstractApplication app, String instancePath ); @Override TargetProperties findTargetProperties( String targetId ); @Override String findTargetId( AbstractApplication app, String instancePath, boolean strict ); @Override String findTargetId( AbstractApplication app, String instancePath ); @Override Map<String,byte[]> findScriptResourcesForAgent( String targetId ); @Override Map<String,byte[]> findScriptResourcesForAgent( AbstractApplication app, Instance scopedInstance ); @Override File findScriptForDm( AbstractApplication app, Instance scopedInstance ); @Override List<TargetWrapperDescriptor> listAllTargets(); @Override TargetWrapperDescriptor findTargetById( String targetId ); @Override List<TargetWrapperDescriptor> listPossibleTargets( AbstractApplication app ); @Override void addHint( String targetId, AbstractApplication app ); @Override void removeHint( String targetId, AbstractApplication app ); @Override TargetProperties lockAndGetTarget( Application app, Instance scopedInstance ); @Override void unlockTarget( Application app, Instance scopedInstance ); @Override List<TargetUsageItem> findUsageStatistics( String targetId );  }