@Test public void exportResources() throws KettleException { VariableSpace variableSpace = mock( VariableSpace.class ); ResourceNamingInterface resourceNamingInterface = mock( ResourceNamingInterface.class ); Repository repository = mock( Repository.class ); IMetaStore metaStore = mock( IMetaStore.class ); MetaInjectMeta injectMetaSpy = spy( metaInjectMeta ); TransMeta transMeta = mock( TransMeta.class ); Map<String, ResourceDefinition> definitions = Collections.<String, ResourceDefinition>emptyMap(); doReturn( TEST_FILE_NAME ).when( transMeta ).exportResources( transMeta, definitions, resourceNamingInterface, repository, metaStore ); doReturn( transMeta ).when( injectMetaSpy ).loadTransformationMeta( repository, variableSpace ); String actualExportedFileName = injectMetaSpy.exportResources( variableSpace, definitions, resourceNamingInterface, repository, metaStore ); assertEquals( TEST_FILE_NAME, actualExportedFileName ); assertEquals( EXPORTED_FILE_NAME, injectMetaSpy.getFileName() ); verify( transMeta ).exportResources( transMeta, definitions, resourceNamingInterface, repository, metaStore ); }
@Override public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { TransMeta executorTransMeta = loadTransformationMeta( repository, space ); String proposedNewFilename = executorTransMeta.exportResources( executorTransMeta, definitions, resourceNamingInterface, repository, metaStore ); String newFilename = "${" + Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY + "}/" + proposedNewFilename; executorTransMeta.setFilename( newFilename ); executorTransMeta.setRepositoryDirectory( new RepositoryDirectory() ); fileName = newFilename; return proposedNewFilename; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "MetaInjectMeta.Exception.UnableToLoadTrans", fileName ) ); } }
MetaInjectMeta extends BaseStepMeta implements StepMetaInterface, StepMetaChangeListenerInterface { @Override public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { TransMeta executorTransMeta = loadTransformationMeta( repository, space ); String proposedNewFilename = executorTransMeta.exportResources( executorTransMeta, definitions, resourceNamingInterface, repository, metaStore ); String newFilename = "${" + Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY + "}/" + proposedNewFilename; executorTransMeta.setFilename( newFilename ); executorTransMeta.setRepositoryDirectory( new RepositoryDirectory() ); fileName = newFilename; return proposedNewFilename; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "MetaInjectMeta.Exception.UnableToLoadTrans", fileName ) ); } } }
MetaInjectMeta extends BaseStepMeta implements StepMetaInterface, StepMetaChangeListenerInterface { @Override public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { TransMeta executorTransMeta = loadTransformationMeta( repository, space ); String proposedNewFilename = executorTransMeta.exportResources( executorTransMeta, definitions, resourceNamingInterface, repository, metaStore ); String newFilename = "${" + Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY + "}/" + proposedNewFilename; executorTransMeta.setFilename( newFilename ); executorTransMeta.setRepositoryDirectory( new RepositoryDirectory() ); fileName = newFilename; return proposedNewFilename; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "MetaInjectMeta.Exception.UnableToLoadTrans", fileName ) ); } } MetaInjectMeta(); }
MetaInjectMeta extends BaseStepMeta implements StepMetaInterface, StepMetaChangeListenerInterface { @Override public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { TransMeta executorTransMeta = loadTransformationMeta( repository, space ); String proposedNewFilename = executorTransMeta.exportResources( executorTransMeta, definitions, resourceNamingInterface, repository, metaStore ); String newFilename = "${" + Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY + "}/" + proposedNewFilename; executorTransMeta.setFilename( newFilename ); executorTransMeta.setRepositoryDirectory( new RepositoryDirectory() ); fileName = newFilename; return proposedNewFilename; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "MetaInjectMeta.Exception.UnableToLoadTrans", fileName ) ); } } MetaInjectMeta(); @Override Object clone(); @Override void setDefault(); @Override String getXML(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); @Override void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep,
                         VariableSpace space, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr,
                                Trans trans ); @Override StepDataInterface getStepData(); Map<TargetStepAttribute, SourceStepField> getTargetSourceMapping(); void setTargetSourceMapping( Map<TargetStepAttribute, SourceStepField> targetSourceMapping ); String getTransName(); void setTransName( String transName ); String getFileName(); void setFileName( String fileName ); String getDirectoryPath(); void setDirectoryPath( String directoryPath ); ObjectId getTransObjectId(); void setTransObjectId( ObjectId transObjectId ); @Injection( name = "TRANS_OBJECT_ID" ) void setTransStringObjectId( String transStringObjectId ); ObjectLocationSpecificationMethod getSpecificationMethod(); void setSpecificationMethod( ObjectLocationSpecificationMethod specificationMethod ); @Deprecated static final synchronized TransMeta loadTransformationMeta( MetaInjectMeta mappingMeta, Repository rep,
                                                                     VariableSpace space ); static final synchronized TransMeta loadTransformationMeta( MetaInjectMeta injectMeta, Repository rep,
                                                                     IMetaStore metaStore, VariableSpace space ); @Override List<ResourceReference> getResourceDependencies( TransMeta transMeta, StepMeta stepInfo ); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
                                 ResourceNamingInterface resourceNamingInterface, Repository repository,
                                 IMetaStore metaStore ); @Override boolean excludeFromCopyDistributeVerification(); @Override boolean excludeFromRowLayoutVerification(); String getSourceStepName(); void setSourceStepName( String sourceStepName ); String getTargetFile(); void setTargetFile( String targetFile ); boolean isNoExecution(); void setNoExecution( boolean noExecution ); @Override String[] getReferencedObjectDescriptions(); @Override boolean[] isReferencedObjectEnabled(); @Override String getActiveReferencedObjectDescription(); @Override @Deprecated Object loadReferencedObject( int index, Repository rep, VariableSpace space ); @Override Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ); String getStreamSourceStepname(); void setStreamSourceStepname( String streamSourceStepname ); StepMeta getStreamSourceStep(); void setStreamSourceStep( StepMeta streamSourceStep ); String getStreamTargetStepname(); void setStreamTargetStepname( String streamTargetStepname ); @Override void searchInfoAndTargetSteps( List<StepMeta> steps ); List<MetaInjectOutputField> getSourceOutputFields(); void setSourceOutputFields( List<MetaInjectOutputField> sourceOutputFields ); List<MetaInjectMapping> getMetaInjectMapping(); void setMetaInjectMapping( List<MetaInjectMapping> metaInjectMapping ); void actualizeMetaInjectMapping(); @Override void onStepChange( TransMeta transMeta, StepMeta oldMeta, StepMeta newMeta ); }
MetaInjectMeta extends BaseStepMeta implements StepMetaInterface, StepMetaChangeListenerInterface { @Override public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { TransMeta executorTransMeta = loadTransformationMeta( repository, space ); String proposedNewFilename = executorTransMeta.exportResources( executorTransMeta, definitions, resourceNamingInterface, repository, metaStore ); String newFilename = "${" + Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY + "}/" + proposedNewFilename; executorTransMeta.setFilename( newFilename ); executorTransMeta.setRepositoryDirectory( new RepositoryDirectory() ); fileName = newFilename; return proposedNewFilename; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "MetaInjectMeta.Exception.UnableToLoadTrans", fileName ) ); } } MetaInjectMeta(); @Override Object clone(); @Override void setDefault(); @Override String getXML(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); @Override void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep,
                         VariableSpace space, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr,
                                Trans trans ); @Override StepDataInterface getStepData(); Map<TargetStepAttribute, SourceStepField> getTargetSourceMapping(); void setTargetSourceMapping( Map<TargetStepAttribute, SourceStepField> targetSourceMapping ); String getTransName(); void setTransName( String transName ); String getFileName(); void setFileName( String fileName ); String getDirectoryPath(); void setDirectoryPath( String directoryPath ); ObjectId getTransObjectId(); void setTransObjectId( ObjectId transObjectId ); @Injection( name = "TRANS_OBJECT_ID" ) void setTransStringObjectId( String transStringObjectId ); ObjectLocationSpecificationMethod getSpecificationMethod(); void setSpecificationMethod( ObjectLocationSpecificationMethod specificationMethod ); @Deprecated static final synchronized TransMeta loadTransformationMeta( MetaInjectMeta mappingMeta, Repository rep,
                                                                     VariableSpace space ); static final synchronized TransMeta loadTransformationMeta( MetaInjectMeta injectMeta, Repository rep,
                                                                     IMetaStore metaStore, VariableSpace space ); @Override List<ResourceReference> getResourceDependencies( TransMeta transMeta, StepMeta stepInfo ); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
                                 ResourceNamingInterface resourceNamingInterface, Repository repository,
                                 IMetaStore metaStore ); @Override boolean excludeFromCopyDistributeVerification(); @Override boolean excludeFromRowLayoutVerification(); String getSourceStepName(); void setSourceStepName( String sourceStepName ); String getTargetFile(); void setTargetFile( String targetFile ); boolean isNoExecution(); void setNoExecution( boolean noExecution ); @Override String[] getReferencedObjectDescriptions(); @Override boolean[] isReferencedObjectEnabled(); @Override String getActiveReferencedObjectDescription(); @Override @Deprecated Object loadReferencedObject( int index, Repository rep, VariableSpace space ); @Override Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ); String getStreamSourceStepname(); void setStreamSourceStepname( String streamSourceStepname ); StepMeta getStreamSourceStep(); void setStreamSourceStep( StepMeta streamSourceStep ); String getStreamTargetStepname(); void setStreamTargetStepname( String streamTargetStepname ); @Override void searchInfoAndTargetSteps( List<StepMeta> steps ); List<MetaInjectOutputField> getSourceOutputFields(); void setSourceOutputFields( List<MetaInjectOutputField> sourceOutputFields ); List<MetaInjectMapping> getMetaInjectMapping(); void setMetaInjectMapping( List<MetaInjectMapping> metaInjectMapping ); void actualizeMetaInjectMapping(); @Override void onStepChange( TransMeta transMeta, StepMeta oldMeta, StepMeta newMeta );  }