@Test public void testGetChangeRecords() throws Exception { when( meta.isInFields() ).thenReturn( true ); when( meta.getIsAFile() ).thenReturn( false ); when( meta.isReadUrl() ).thenReturn( false ); when( meta.getXMLField() ).thenReturn( "xml" ); analyzer.setBaseStepMeta( meta ); GetXMLDataField[] fields = new GetXMLDataField[2]; GetXMLDataField field1 = new GetXMLDataField( "name" ); GetXMLDataField field2 = new GetXMLDataField( "age" ); field1.setXPath( "field1/xpath" ); field2.setElementType( 1 ); field1.setResultType( 1 ); field2.setRepeated( true ); fields[0] = field1; fields[1] = field2; when( meta.getInputFields() ).thenReturn( fields ); StepNodes inputs = new StepNodes(); inputs.addNode( "previousStep", "xml", node ); doReturn( inputs ).when( analyzer ).getInputs(); Set<ComponentDerivationRecord> changeRecords = analyzer.getChangeRecords( meta ); assertNotNull( changeRecords ); assertEquals( 2, changeRecords.size() ); }
@Override public Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ) throws MetaverseAnalyzerException { Set<ComponentDerivationRecord> changes = new HashSet<>(); boolean isInFields = meta.isInFields(); boolean isAFile = meta.getIsAFile(); boolean isAUrl = meta.isReadUrl(); if ( isInFields && !isAFile && !isAUrl ) { GetXMLDataField[] fields = baseStepMeta.getInputFields(); if ( getInputs() != null ) { Set<StepField> inputFields = getInputs().getFieldNames(); for ( StepField inputField : inputFields ) { if ( inputField.getFieldName().equals( meta.getXMLField() ) ) { for ( GetXMLDataField field : fields ) { ComponentDerivationRecord change = new ComponentDerivationRecord( meta.getXMLField(), field.getName() ); changes.add( change ); } break; } } } } return changes; }
GetXMLDataStepAnalyzer extends ExternalResourceStepAnalyzer<GetXMLDataMeta> { @Override public Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ) throws MetaverseAnalyzerException { Set<ComponentDerivationRecord> changes = new HashSet<>(); boolean isInFields = meta.isInFields(); boolean isAFile = meta.getIsAFile(); boolean isAUrl = meta.isReadUrl(); if ( isInFields && !isAFile && !isAUrl ) { GetXMLDataField[] fields = baseStepMeta.getInputFields(); if ( getInputs() != null ) { Set<StepField> inputFields = getInputs().getFieldNames(); for ( StepField inputField : inputFields ) { if ( inputField.getFieldName().equals( meta.getXMLField() ) ) { for ( GetXMLDataField field : fields ) { ComponentDerivationRecord change = new ComponentDerivationRecord( meta.getXMLField(), field.getName() ); changes.add( change ); } break; } } } } return changes; } }
GetXMLDataStepAnalyzer extends ExternalResourceStepAnalyzer<GetXMLDataMeta> { @Override public Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ) throws MetaverseAnalyzerException { Set<ComponentDerivationRecord> changes = new HashSet<>(); boolean isInFields = meta.isInFields(); boolean isAFile = meta.getIsAFile(); boolean isAUrl = meta.isReadUrl(); if ( isInFields && !isAFile && !isAUrl ) { GetXMLDataField[] fields = baseStepMeta.getInputFields(); if ( getInputs() != null ) { Set<StepField> inputFields = getInputs().getFieldNames(); for ( StepField inputField : inputFields ) { if ( inputField.getFieldName().equals( meta.getXMLField() ) ) { for ( GetXMLDataField field : fields ) { ComponentDerivationRecord change = new ComponentDerivationRecord( meta.getXMLField(), field.getName() ); changes.add( change ); } break; } } } } return changes; }  }
GetXMLDataStepAnalyzer extends ExternalResourceStepAnalyzer<GetXMLDataMeta> { @Override public Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ) throws MetaverseAnalyzerException { Set<ComponentDerivationRecord> changes = new HashSet<>(); boolean isInFields = meta.isInFields(); boolean isAFile = meta.getIsAFile(); boolean isAUrl = meta.isReadUrl(); if ( isInFields && !isAFile && !isAUrl ) { GetXMLDataField[] fields = baseStepMeta.getInputFields(); if ( getInputs() != null ) { Set<StepField> inputFields = getInputs().getFieldNames(); for ( StepField inputField : inputFields ) { if ( inputField.getFieldName().equals( meta.getXMLField() ) ) { for ( GetXMLDataField field : fields ) { ComponentDerivationRecord change = new ComponentDerivationRecord( meta.getXMLField(), field.getName() ); changes.add( change ); } break; } } } } return changes; }  @Override Set<Class<? extends BaseStepMeta>> getSupportedSteps(); @Override Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ); @Override IMetaverseNode createResourceNode( IExternalResourceInfo resource ); @Override String getResourceInputNodeType(); @Override String getResourceOutputNodeType(); @Override boolean isOutput(); @Override boolean isInput(); }
GetXMLDataStepAnalyzer extends ExternalResourceStepAnalyzer<GetXMLDataMeta> { @Override public Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ) throws MetaverseAnalyzerException { Set<ComponentDerivationRecord> changes = new HashSet<>(); boolean isInFields = meta.isInFields(); boolean isAFile = meta.getIsAFile(); boolean isAUrl = meta.isReadUrl(); if ( isInFields && !isAFile && !isAUrl ) { GetXMLDataField[] fields = baseStepMeta.getInputFields(); if ( getInputs() != null ) { Set<StepField> inputFields = getInputs().getFieldNames(); for ( StepField inputField : inputFields ) { if ( inputField.getFieldName().equals( meta.getXMLField() ) ) { for ( GetXMLDataField field : fields ) { ComponentDerivationRecord change = new ComponentDerivationRecord( meta.getXMLField(), field.getName() ); changes.add( change ); } break; } } } } return changes; }  @Override Set<Class<? extends BaseStepMeta>> getSupportedSteps(); @Override Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ); @Override IMetaverseNode createResourceNode( IExternalResourceInfo resource ); @Override String getResourceInputNodeType(); @Override String getResourceOutputNodeType(); @Override boolean isOutput(); @Override boolean isInput();  }