Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ivan Nikolaichuk
authored and
Ivan Nikolaichuk
committed
Dec 9, 2015
1 parent
1189012
commit 79e9f3d
Showing
2 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/*! ****************************************************************************** | ||
* | ||
* Pentaho Data Integration | ||
* | ||
* Copyright (C) 2002-2015 by Pentaho : http://www.pentaho.com | ||
* | ||
******************************************************************************* | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
******************************************************************************/ | ||
|
||
package org.pentaho.di.job; | ||
|
||
import org.junit.Test; | ||
import org.pentaho.di.core.database.Database; | ||
import org.pentaho.di.core.database.DatabaseMeta; | ||
import org.pentaho.di.core.exception.KettleException; | ||
import org.pentaho.di.core.logging.JobEntryLogTable; | ||
import org.pentaho.di.core.variables.VariableSpace; | ||
import org.pentaho.di.trans.HasDatabasesInterface; | ||
|
||
import static org.mockito.Matchers.any; | ||
import static org.mockito.Mockito.*; | ||
|
||
public class JobTest { | ||
|
||
@Test | ||
public void recordsCleanUpMethodIsCalled() throws KettleException { | ||
Database mockedDataBase = mock( Database.class ); | ||
Job job = mock( Job.class ); | ||
|
||
JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault( mock( VariableSpace.class ), mock( HasDatabasesInterface.class ) ); | ||
jobEntryLogTable.setConnectionName( "connection" ); | ||
|
||
JobMeta jobMeta = new JobMeta( ); | ||
jobMeta.setJobEntryLogTable( jobEntryLogTable ); | ||
|
||
when( job.createDataBase( any( DatabaseMeta.class ) ) ).thenReturn( mockedDataBase ); | ||
when( job.getJobMeta() ).thenReturn( jobMeta ); | ||
doCallRealMethod().when( job ).writeJobEntryLogInformation(); | ||
|
||
job.writeJobEntryLogInformation(); | ||
|
||
verify( mockedDataBase ).cleanupLogRecords( jobEntryLogTable ); | ||
} | ||
} |