use of org.pentaho.di.trans.steps.loadsave.MemoryRepository in project pentaho-kettle by pentaho.
the class UnivariateStatsMetaFunctionTest method testRepoConstructor.
@Test
public void testRepoConstructor() throws ParseException, KettleException, IOException {
String jsString = IOUtils.toString(UnivariateStatsMetaTest.class.getClassLoader().getResourceAsStream("org/pentaho/di/trans/steps/univariatestats/trueValuesUnivariateStatsMetaFunctionNode.json"));
Repository repo = new MemoryRepository(jsString);
UnivariateStatsMetaFunction function = new UnivariateStatsMetaFunction(repo, new StringObjectId("test"), 0);
assertEquals("test", function.getSourceFieldName());
assertTrue(function.getCalcN());
assertTrue(function.getCalcMean());
assertTrue(function.getCalcStdDev());
assertTrue(function.getCalcMin());
assertTrue(function.getCalcMax());
assertTrue(function.getCalcMedian());
assertEquals(0.5, function.getCalcPercentile(), 0);
assertTrue(function.getInterpolatePercentile());
jsString = IOUtils.toString(UnivariateStatsMetaTest.class.getClassLoader().getResourceAsStream("org/pentaho/di/trans/steps/univariatestats/falseValuesUnivariateStatsMetaFunctionNode.json"));
repo = new MemoryRepository(jsString);
function = new UnivariateStatsMetaFunction(repo, new StringObjectId("test"), 0);
assertTrue(Utils.isEmpty(function.getSourceFieldName()));
assertFalse(function.getCalcN());
assertFalse(function.getCalcMean());
assertFalse(function.getCalcStdDev());
assertFalse(function.getCalcMin());
assertFalse(function.getCalcMax());
assertFalse(function.getCalcMedian());
assertEquals(-1.0, function.getCalcPercentile(), 0);
assertFalse(function.getInterpolatePercentile());
}
use of org.pentaho.di.trans.steps.loadsave.MemoryRepository in project pentaho-kettle by pentaho.
the class TableOutputMetaTest method testReadRep.
/**
* @see
* <a href=http://jira.pentaho.com/browse/BACKLOG-377>http://jira.pentaho.com/browse/BACKLOG-377</a>
* @throws KettleException
*/
@Test
public void testReadRep() throws KettleException {
// check variable
String commitSize = "${test}";
Repository rep = new MemoryRepository();
rep.saveStepAttribute(null, null, "commit", commitSize);
TableOutputMeta tableOutputMeta = new TableOutputMeta();
tableOutputMeta.readRep(rep, metaStore, null, databases);
assertEquals(commitSize, tableOutputMeta.getCommitSize());
// check integer size
int commitSizeInt = 1;
Repository rep2 = new MemoryRepository();
rep2.saveStepAttribute(null, null, "commit", commitSizeInt);
TableOutputMeta tableOutputMeta2 = new TableOutputMeta();
tableOutputMeta2.readRep(rep2, metaStore, null, databases);
assertEquals(String.valueOf(commitSizeInt), tableOutputMeta2.getCommitSize());
}
use of org.pentaho.di.trans.steps.loadsave.MemoryRepository in project pentaho-kettle by pentaho.
the class LoadSaveTester method testRepoRoundTrip.
public void testRepoRoundTrip() throws KettleException {
T metaToSave = createMeta();
Map<String, FieldLoadSaveValidator<?>> validatorMap = createValidatorMapAndInvokeSetters(repoAttributes, metaToSave);
T metaLoaded = createMeta();
Repository rep = new MemoryRepository();
metaToSave.saveRep(rep, null, null);
metaLoaded.loadRep(rep, null);
validateLoadedMeta(repoAttributes, validatorMap, metaToSave, metaLoaded);
}
use of org.pentaho.di.trans.steps.loadsave.MemoryRepository in project pentaho-kettle by pentaho.
the class RowGeneratorMetaTest method setUp.
@Before
public void setUp() throws KettleException {
rep = new MemoryRepository();
id_step = new StringObjectId("aStringObjectID");
rep.saveStepAttribute(new StringObjectId("transId"), id_step, rowGeneratorRowLimitCode, launchVariable);
}
use of org.pentaho.di.trans.steps.loadsave.MemoryRepository in project pentaho-kettle by pentaho.
the class LoadSaveTester method testRepoRoundTrip.
@SuppressWarnings("deprecation")
public void testRepoRoundTrip() throws KettleException {
T metaToSave = createMeta();
if (initializer != null) {
initializer.modify(metaToSave);
}
Map<String, FieldLoadSaveValidator<?>> validatorMap = createValidatorMapAndInvokeSetters(repoAttributes, metaToSave);
T metaLoaded = createMeta();
Repository rep = new MemoryRepository();
metaToSave.saveRep(rep, null, null);
metaLoaded.loadRep(rep, null, null, databases, null);
validateLoadedMeta(repoAttributes, validatorMap, metaToSave, metaLoaded);
}
Aggregations