Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PDI-14419] - Table Input Step - Insert data from step - writes to ot…
…her table input steps - set ioMeta = null for clones to prevent sharing its instance among all clones - add a test
- Loading branch information
Andrey Khayrutdinov
committed
Oct 20, 2015
1 parent
513e009
commit 9dae9ae
Showing
2 changed files
with
71 additions
and
2 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
63 changes: 63 additions & 0 deletions
63
engine/test-src/org/pentaho/di/trans/step/BaseStepMetaCloningTest.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,63 @@ | |||
/*! ****************************************************************************** | |||
* | |||
* 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.trans.step; | |||
|
|||
import org.junit.Test; | |||
import org.pentaho.di.core.database.Database; | |||
import org.pentaho.di.repository.Repository; | |||
|
|||
import static org.junit.Assert.*; | |||
import static org.mockito.Mockito.mock; | |||
|
|||
/** | |||
* @author Andrey Khayrutdinov | |||
*/ | |||
public class BaseStepMetaCloningTest { | |||
|
|||
@Test | |||
public void cloningKeepsAllExceptIoMeta() throws Exception { | |||
final Database db1 = mock( Database.class ); | |||
final Database db2 = mock( Database.class ); | |||
final Repository repository = mock( Repository.class ); | |||
final StepMeta stepMeta = mock( StepMeta.class ); | |||
|
|||
BaseStepMeta meta = new BaseStepMeta(); | |||
meta.setChanged( true ); | |||
meta.databases = new Database[] { db1, db2 }; | |||
meta.ioMeta = new StepIOMeta( true, false, false, false, false, false ); | |||
meta.repository = repository; | |||
meta.parentStepMeta = stepMeta; | |||
|
|||
BaseStepMeta clone = (BaseStepMeta) meta.clone(); | |||
assertTrue( clone.hasChanged() ); | |||
|
|||
// is it OK ? | |||
assertTrue( clone.databases == meta.databases ); | |||
assertArrayEquals( meta.databases, clone.databases ); | |||
|
|||
assertEquals( meta.repository, clone.repository ); | |||
assertEquals( meta.parentStepMeta, clone.parentStepMeta ); | |||
|
|||
assertNull( clone.ioMeta ); | |||
} | |||
} |