@Test public void testAddRemoveJobEntryCopySetUnsetParent() throws Exception { JobEntryCopy jobEntryCopy = mock( JobEntryCopy.class ); jobMeta.addJobEntry( jobEntryCopy ); jobMeta.removeJobEntry( 0 ); verify( jobEntryCopy, times( 1 ) ).setParentJobMeta( jobMeta ); verify( jobEntryCopy, times( 1 ) ).setParentJobMeta( null ); }
@Test public void testLookupRepositoryReferences() throws Exception { jobMeta.clear(); JobEntryTrans jobEntryMock = mock( JobEntryTrans.class ); when( jobEntryMock.hasRepositoryReferences() ).thenReturn( true ); JobEntryTrans brokenJobEntryMock = mock( JobEntryTrans.class ); when( brokenJobEntryMock.hasRepositoryReferences() ).thenReturn( true ); doThrow( mock( IdNotFoundException.class ) ).when( brokenJobEntryMock ).lookupRepositoryReferences( any( Repository.class ) ); JobEntryCopy jobEntryCopy1 = mock( JobEntryCopy.class ); when( jobEntryCopy1.getEntry() ).thenReturn( jobEntryMock ); jobMeta.addJobEntry( 0, jobEntryCopy1 ); JobEntryCopy jobEntryCopy2 = mock( JobEntryCopy.class ); when( jobEntryCopy2.getEntry() ).thenReturn( brokenJobEntryMock ); jobMeta.addJobEntry( 1, jobEntryCopy2 ); JobEntryCopy jobEntryCopy3 = mock( JobEntryCopy.class ); when( jobEntryCopy3.getEntry() ).thenReturn( jobEntryMock ); jobMeta.addJobEntry( 2, jobEntryCopy3 ); try { jobMeta.lookupRepositoryReferences( mock( Repository.class ) ); fail( "no exception for broken entry" ); } catch ( LookupReferencesException e ) { // ok } verify( jobEntryMock, times( 2 ) ).lookupRepositoryReferences( any( Repository.class ) ); }
@Before public void setUp() throws Exception { job = new Job( null, new JobMeta() ); entry = new JobEntryFolderIsEmpty(); job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) ); entry.setParentJob( job ); JobMeta mockJobMeta = mock( JobMeta.class ); entry.setParentJobMeta( mockJobMeta ); job.setStopped( false ); File dir = Files.createTempDirectory( "dir", new FileAttribute<?>[0] ).toFile(); dir.deleteOnExit(); emptyDir = dir.getPath(); dir = Files.createTempDirectory( "dir", new FileAttribute<?>[0] ).toFile(); dir.deleteOnExit(); nonEmptyDir = dir.getPath(); File file = File.createTempFile( "existingFile", "ext", dir ); file.deleteOnExit(); }
@Before public void setUp() throws Exception { job = new Job( null, new JobMeta() ); entry = new JobEntryFilesExist(); job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) ); entry.setParentJob( job ); JobMeta mockJobMeta = mock( JobMeta.class ); entry.setParentJobMeta( mockJobMeta ); job.setStopped( false ); existingFile1 = TestUtils.createRamFile( getClass().getSimpleName() + "/existingFile1.ext", entry ); existingFile2 = TestUtils.createRamFile( getClass().getSimpleName() + "/existingFile2.ext", entry ); }
@Test public void shouldUseCoordinatesOfItsStepsAndNotesWhenCalculatingMinimumPoint() { Point jobEntryPoint = new Point( 500, 500 ); Point notePadMetaPoint = new Point( 400, 400 ); JobEntryCopy jobEntryCopy = mock( JobEntryCopy.class ); when( jobEntryCopy.getLocation() ).thenReturn( jobEntryPoint ); NotePadMeta notePadMeta = mock( NotePadMeta.class ); when( notePadMeta.getLocation() ).thenReturn( notePadMetaPoint ); // empty Job return 0 coordinate point Point point = jobMeta.getMinimum(); assertEquals( 0, point.x ); assertEquals( 0, point.y ); // when Job contains a single step or note, then jobMeta should return coordinates of it, subtracting borders jobMeta.addJobEntry( 0, jobEntryCopy ); Point actualStepPoint = jobMeta.getMinimum(); assertEquals( jobEntryPoint.x - JobMeta.BORDER_INDENT, actualStepPoint.x ); assertEquals( jobEntryPoint.y - JobMeta.BORDER_INDENT, actualStepPoint.y ); // when Job contains step or notes, then jobMeta should return minimal coordinates of them, subtracting borders jobMeta.addNote( notePadMeta ); Point stepPoint = jobMeta.getMinimum(); assertEquals( notePadMetaPoint.x - JobMeta.BORDER_INDENT, stepPoint.x ); assertEquals( notePadMetaPoint.y - JobMeta.BORDER_INDENT, stepPoint.y ); }
jge.setLocation( 50, 50 ); jge.setNr( 0 ); jobMeta.addJobEntry( jge ); jge.setLocation( 50, 50 ); jge.setNr( 0 ); jobMeta.addJobEntry( jge ); spoon.addUndoNew( jobMeta, new JobEntryCopy[] { jge }, new int[] { jobMeta.indexOfJobEntry( jge ) } ); spoon.refreshGraph();
@Before public void setUp() { Job parentJob = new Job( null, new JobMeta() ); jobEntry = spy( new JobEntryColumnsExist( "" ) ); parentJob.getJobMeta().addJobEntry( new JobEntryCopy( jobEntry ) ); parentJob.setStopped( false ); jobEntry.setParentJob( parentJob ); parentJob.setLogLevel( LogLevel.NOTHING ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); jobEntry.setDatabase( dbMeta ); db = spy( new Database( jobEntry, dbMeta ) ); jobEntry.setParentJob( parentJob ); jobEntry.setTablename( TABLENAME ); jobEntry.setArguments( COLUMNS ); jobEntry.setSchemaname( SCHEMANAME ); }
@Before public void setUp() throws Exception { job = new Job( null, new JobMeta() ); entry = new JobEntrySetVariables(); job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) ); entry.setParentJob( job ); job.setStopped( false ); }
public void dupeJobEntry( JobMeta jobMeta, JobEntryCopy jobEntry ) { if ( jobEntry == null ) { return; } if ( jobEntry.isStart() ) { MessageBox mb = new MessageBox( spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "Spoon.Dialog.OnlyUseStartOnce.Message" ) ); mb.setText( BaseMessages.getString( PKG, "Spoon.Dialog.OnlyUseStartOnce.Title" ) ); mb.open(); return; } JobEntryCopy dupejge = (JobEntryCopy) jobEntry.clone(); dupejge.setNr( jobMeta.findUnusedNr( dupejge.getName() ) ); if ( dupejge.isDrawn() ) { Point p = jobEntry.getLocation(); dupejge.setLocation( p.x + 10, p.y + 10 ); } jobMeta.addJobEntry( dupejge ); spoon.refreshGraph(); spoon.refreshTree(); spoon.setShellText(); }
@Before public void setUp() throws Exception { MockDriver.registerInstance(); Job job = new Job( null, new JobMeta() ); entry = new JobEntryEvalTableContent(); job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) ); entry.setParentJob( job ); job.setStopped( false ); DatabaseMeta dbMeta = new DatabaseMeta(); dbMeta.setDatabaseType( "mock-db" ); entry.setDatabase( dbMeta ); }
jobMeta.addJobEntry( entries[i] ); position[i] = jobMeta.indexOfJobEntry( entries[i] );
@Before public void setUp() throws Exception { job = new Job( null, new JobMeta() ); entry = new MockedJobEntryFTP(); job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) ); entry.setParentJob( job ); job.setStopped( false ); entry.setServerName( "some.server" ); entry.setUserName( "anonymous" ); entry.setFtpDirectory( "." ); entry.setWildcard( "robots.txt" ); entry.setBinaryMode( false ); entry.setSuccessCondition( "success_if_no_errors" ); existingDir = TestUtils.createTempDir(); }
start.setLocation( new Point( location.x, location.y ) ); start.setDrawn(); jobMeta.addJobEntry( start ); jecsql.setLocation( new Point( location.x, location.y ) ); jecsql.setDrawn(); jobMeta.addJobEntry( jecsql ); location.x += 400; jectrans.setLocation( new Point( location.x, location.y ) ); jobMeta.addJobEntry( jectrans );
jobMeta.addJobEntry( newjge ); spoon.addUndoNew( jobMeta, new JobEntryCopy[] { newjge }, new int[] { jobMeta .indexOfJobEntry( newjge ) } );
if ( idx < 0 ) { if ( jec.getName() != null && jec.getName().length() > 0 ) { jobMeta.addJobEntry( jec );
int[] idx = transAction.getCurrentIndex(); for ( int i = 0; i < idx.length; i++ ) { jobMeta.addJobEntry( idx[i], si[i] );
idx = transAction.getCurrentIndex(); for ( int i = 0; i < ce.length; i++ ) { jobMeta.addJobEntry( idx[i], ce[i] );
startEntry.setLocation( 100, 100 ); jobMeta.addJobEntry( startEntry ); writeToLogEntry.setLocation( 200, 100 ); jobMeta.addJobEntry( writeToLogEntry ); successEntry.setLocation( 400, 100 ); jobMeta.addJobEntry( successEntry ); abortEntry.setLocation( 400, 300 ); jobMeta.addJobEntry( abortEntry );