@Test public void testDataNodeToElementCopiesAttributesToJobEntryCopyAndJobEntry() throws KettleException { IUnifiedRepository mockUnifiedRepository = mock( IUnifiedRepository.class ); JobDelegate jobDelegate = new JobDelegate( mockPurRepository, mockUnifiedRepository ); DataNode mockDataNode = mock( DataNode.class ); DataNode entriesNode = addSubnode( mockDataNode, JobDelegate.NODE_ENTRIES ); DataNode copyNode = mock( DataNode.class ); setNodes( entriesNode, JobDelegate.PROP_NR_JOB_ENTRY_COPIES, Arrays.asList( copyNode ) ); DataNode nodeCustom = addSubnode( copyNode, JobDelegate.NODE_CUSTOM ); DataNode notesNode = addSubnode( mockDataNode, JobDelegate.NODE_NOTES ); DataNode hopsNode = addSubnode( mockDataNode, JobDelegate.NODE_HOPS ); DataNode paramsNode = addSubnode( mockDataNode, JobDelegate.NODE_PARAMETERS ); DataNode groupsNode = addSubnode( copyNode, AttributesMapUtil.NODE_ATTRIBUTE_GROUPS ); DataNode groupNode = mock( DataNode.class ); setNodes( groupsNode, null, Arrays.asList( groupNode ) ); JobMeta mockJobMeta = mock( JobMeta.class ); JobLogTable mockJobLogTable = mock( JobLogTable.class ); List<JobEntryCopy> jobCopies = new ArrayList<JobEntryCopy>(); DataProperty mockDataProperty = mock( DataProperty.class ); List<DataProperty> dataProperties = Arrays.asList( mockDataProperty ); setProperty( mockDataNode, JobDelegate.PROP_JOB_STATUS, 0L ); setProperty( mockDataNode, JobDelegate.PROP_USE_BATCH_ID, false ); setProperty( mockDataNode, JobDelegate.PROP_PASS_BATCH_ID, false ); setProperty( mockDataNode, JobDelegate.PROP_USE_LOGFIELD, false ); setProperty( copyNode, JobDelegate.PROP_JOBENTRY_TYPE, "WRITE_TO_LOG" ); when( copyNode.getId() ).thenReturn( "COPYNODE_ID" ); setProperty( copyNode, JobDelegate.PROP_NR, 0L ); setProperty( copyNode, JobDelegate.PROP_GUI_LOCATION_X, 0L ); setProperty( copyNode, JobDelegate.PROP_GUI_LOCATION_Y, 0L ); setProperty( copyNode, JobDelegate.PROP_GUI_DRAW, false ); setProperty( copyNode, JobDelegate.PROP_PARALLEL, false ); setProperty( nodeCustom, "logmessage_#_0", (String) null ); setNodes( notesNode, JobDelegate.PROP_NR_NOTES, Arrays.<DataNode> asList() ); setNodes( hopsNode, JobDelegate.PROP_NR_HOPS, Arrays.<DataNode> asList() ); setProperty( paramsNode, JobDelegate.PROP_NR_PARAMETERS, 0L ); when( mockJobMeta.getJobCopies() ).thenReturn( jobCopies ); when( mockJobMeta.getJobLogTable() ).thenReturn( mockJobLogTable ); when( groupNode.getName() ).thenReturn( "GROUP_NODE_NAME" ); when( groupNode.getProperties() ).thenReturn( dataProperties ); when( mockDataProperty.getName() ).thenReturn( "MOCK_PROPERTY" ); when( mockDataProperty.getString() ).thenReturn( "MOCK_VALUE" ); jobDelegate.dataNodeToElement( mockDataNode, mockJobMeta ); assertEquals( jobCopies.get( 0 ).getAttributesMap(), ( (JobEntryBase) jobCopies.get( 0 ).getEntry() ) .getAttributesMap() ); }
public RepositoryElementInterface dataNodeToElement( final DataNode rootNode ) throws KettleException { JobMeta jobMeta = new JobMeta(); dataNodeToElement( rootNode, jobMeta ); return jobMeta; }
JobDelegate extends AbstractDelegate implements ISharedObjectsTransformer, java.io.Serializable { public RepositoryElementInterface dataNodeToElement( final DataNode rootNode ) throws KettleException { JobMeta jobMeta = new JobMeta(); dataNodeToElement( rootNode, jobMeta ); return jobMeta; } }
JobDelegate extends AbstractDelegate implements ISharedObjectsTransformer, java.io.Serializable { public RepositoryElementInterface dataNodeToElement( final DataNode rootNode ) throws KettleException { JobMeta jobMeta = new JobMeta(); dataNodeToElement( rootNode, jobMeta ); return jobMeta; } JobDelegate( final Repository repo, final IUnifiedRepository pur ); }
JobDelegate extends AbstractDelegate implements ISharedObjectsTransformer, java.io.Serializable { public RepositoryElementInterface dataNodeToElement( final DataNode rootNode ) throws KettleException { JobMeta jobMeta = new JobMeta(); dataNodeToElement( rootNode, jobMeta ); return jobMeta; } JobDelegate( final Repository repo, final IUnifiedRepository pur ); @SuppressWarnings( "unchecked" ) SharedObjects loadSharedObjects( final RepositoryElementInterface element,
      final Map<RepositoryObjectType, List<? extends SharedObjectInterface>> sharedObjectsByType ); void saveSharedObjects( final RepositoryElementInterface element, final String versionComment ); RepositoryElementInterface dataNodeToElement( final DataNode rootNode ); void dataNodeToElement( final DataNode rootNode, final RepositoryElementInterface element ); DataNode elementToDataNode( final RepositoryElementInterface element ); }
JobDelegate extends AbstractDelegate implements ISharedObjectsTransformer, java.io.Serializable { public RepositoryElementInterface dataNodeToElement( final DataNode rootNode ) throws KettleException { JobMeta jobMeta = new JobMeta(); dataNodeToElement( rootNode, jobMeta ); return jobMeta; } JobDelegate( final Repository repo, final IUnifiedRepository pur ); @SuppressWarnings( "unchecked" ) SharedObjects loadSharedObjects( final RepositoryElementInterface element,
      final Map<RepositoryObjectType, List<? extends SharedObjectInterface>> sharedObjectsByType ); void saveSharedObjects( final RepositoryElementInterface element, final String versionComment ); RepositoryElementInterface dataNodeToElement( final DataNode rootNode ); void dataNodeToElement( final DataNode rootNode, final RepositoryElementInterface element ); DataNode elementToDataNode( final RepositoryElementInterface element ); static final String PROP_USE_LOGFIELD; static final String PROP_PASS_BATCH_ID; static final String PROP_USE_BATCH_ID; static final String PROP_JOB_STATUS; static final String NODE_PARAMETERS; static final String PROP_NR_PARAMETERS; static final String PROP_NR_HOPS; static final String NODE_HOPS; static final String NODE_CUSTOM; static final String PROP_JOBENTRY_TYPE; static final String PROP_PARALLEL; static final String PROP_GUI_DRAW; static final String PROP_GUI_LOCATION_Y; static final String PROP_GUI_LOCATION_X; static final String PROP_NR; static final String PROP_NR_JOB_ENTRY_COPIES; static final String PROP_NR_NOTES; static final String NODE_NOTES; static final String NODE_ENTRIES; }