@Test public void testGetUnavailableTargetKeys() throws Exception { final String targetStepName = "injectable step name"; TargetStepAttribute unavailableTargetAttr = new TargetStepAttribute( targetStepName, "NOT_THERE", false ); TargetStepAttribute availableTargetAttr = new TargetStepAttribute( targetStepName, "THERE", false ); SourceStepField sourceStep = new SourceStepField( TEST_SOURCE_STEP_NAME, TEST_FIELD ); Map<TargetStepAttribute, SourceStepField> targetMap = new HashMap<>( 2 ); targetMap.put( unavailableTargetAttr, sourceStep ); targetMap.put( availableTargetAttr, sourceStep ); StepMetaInterface smi = new InjectableTestStepMeta(); TransMeta transMeta = mockSingleStepTransMeta( targetStepName, smi ); Set<TargetStepAttribute> unavailable = MetaInject.getUnavailableTargetKeys( targetMap, transMeta, Collections.<TargetStepAttribute>emptySet() ); assertEquals( 1, unavailable.size() ); assertTrue( unavailable.contains( unavailableTargetAttr ) ); }
public static Set<TargetStepAttribute> getUnavailableTargetKeys( Map<TargetStepAttribute, SourceStepField> targetMap, TransMeta injectedTransMeta, Set<TargetStepAttribute> unavailableTargetSteps ) { Set<TargetStepAttribute> missingKeys = new HashSet<>(); Map<String, BeanInjectionInfo> beanInfos = getUsedStepBeanInfos( injectedTransMeta ); for ( TargetStepAttribute key : targetMap.keySet() ) { if ( !unavailableTargetSteps.contains( key ) ) { BeanInjectionInfo info = beanInfos.get( key.getStepname().toUpperCase() ); if ( info != null && !info.getProperties().containsKey( key.getAttributeKey() ) ) { missingKeys.add( key ); } } } return missingKeys; }
MetaInject extends BaseStep implements StepInterface { public static Set<TargetStepAttribute> getUnavailableTargetKeys( Map<TargetStepAttribute, SourceStepField> targetMap, TransMeta injectedTransMeta, Set<TargetStepAttribute> unavailableTargetSteps ) { Set<TargetStepAttribute> missingKeys = new HashSet<>(); Map<String, BeanInjectionInfo> beanInfos = getUsedStepBeanInfos( injectedTransMeta ); for ( TargetStepAttribute key : targetMap.keySet() ) { if ( !unavailableTargetSteps.contains( key ) ) { BeanInjectionInfo info = beanInfos.get( key.getStepname().toUpperCase() ); if ( info != null && !info.getProperties().containsKey( key.getAttributeKey() ) ) { missingKeys.add( key ); } } } return missingKeys; } }
MetaInject extends BaseStep implements StepInterface { public static Set<TargetStepAttribute> getUnavailableTargetKeys( Map<TargetStepAttribute, SourceStepField> targetMap, TransMeta injectedTransMeta, Set<TargetStepAttribute> unavailableTargetSteps ) { Set<TargetStepAttribute> missingKeys = new HashSet<>(); Map<String, BeanInjectionInfo> beanInfos = getUsedStepBeanInfos( injectedTransMeta ); for ( TargetStepAttribute key : targetMap.keySet() ) { if ( !unavailableTargetSteps.contains( key ) ) { BeanInjectionInfo info = beanInfos.get( key.getStepname().toUpperCase() ); if ( info != null && !info.getProperties().containsKey( key.getAttributeKey() ) ) { missingKeys.add( key ); } } } return missingKeys; } MetaInject( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); }
MetaInject extends BaseStep implements StepInterface { public static Set<TargetStepAttribute> getUnavailableTargetKeys( Map<TargetStepAttribute, SourceStepField> targetMap, TransMeta injectedTransMeta, Set<TargetStepAttribute> unavailableTargetSteps ) { Set<TargetStepAttribute> missingKeys = new HashSet<>(); Map<String, BeanInjectionInfo> beanInfos = getUsedStepBeanInfos( injectedTransMeta ); for ( TargetStepAttribute key : targetMap.keySet() ) { if ( !unavailableTargetSteps.contains( key ) ) { BeanInjectionInfo info = beanInfos.get( key.getStepname().toUpperCase() ); if ( info != null && !info.getProperties().containsKey( key.getAttributeKey() ) ) { missingKeys.add( key ); } } } return missingKeys; } MetaInject( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); static void removeUnavailableStepsFromMapping( Map<TargetStepAttribute, SourceStepField> targetMap,
      Set<SourceStepField> unavailableSourceSteps, Set<TargetStepAttribute> unavailableTargetSteps ); static Set<TargetStepAttribute> getUnavailableTargetSteps( Map<TargetStepAttribute, SourceStepField> targetMap,
      TransMeta injectedTransMeta ); static Set<TargetStepAttribute> getUnavailableTargetKeys( Map<TargetStepAttribute, SourceStepField> targetMap,
      TransMeta injectedTransMeta, Set<TargetStepAttribute> unavailableTargetSteps ); static Set<SourceStepField> getUnavailableSourceSteps( Map<TargetStepAttribute, SourceStepField> targetMap,
      TransMeta sourceTransMeta, StepMeta stepMeta ); }
MetaInject extends BaseStep implements StepInterface { public static Set<TargetStepAttribute> getUnavailableTargetKeys( Map<TargetStepAttribute, SourceStepField> targetMap, TransMeta injectedTransMeta, Set<TargetStepAttribute> unavailableTargetSteps ) { Set<TargetStepAttribute> missingKeys = new HashSet<>(); Map<String, BeanInjectionInfo> beanInfos = getUsedStepBeanInfos( injectedTransMeta ); for ( TargetStepAttribute key : targetMap.keySet() ) { if ( !unavailableTargetSteps.contains( key ) ) { BeanInjectionInfo info = beanInfos.get( key.getStepname().toUpperCase() ); if ( info != null && !info.getProperties().containsKey( key.getAttributeKey() ) ) { missingKeys.add( key ); } } } return missingKeys; } MetaInject( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); static void removeUnavailableStepsFromMapping( Map<TargetStepAttribute, SourceStepField> targetMap,
      Set<SourceStepField> unavailableSourceSteps, Set<TargetStepAttribute> unavailableTargetSteps ); static Set<TargetStepAttribute> getUnavailableTargetSteps( Map<TargetStepAttribute, SourceStepField> targetMap,
      TransMeta injectedTransMeta ); static Set<TargetStepAttribute> getUnavailableTargetKeys( Map<TargetStepAttribute, SourceStepField> targetMap,
      TransMeta injectedTransMeta, Set<TargetStepAttribute> unavailableTargetSteps ); static Set<SourceStepField> getUnavailableSourceSteps( Map<TargetStepAttribute, SourceStepField> targetMap,
      TransMeta sourceTransMeta, StepMeta stepMeta );  }