@Test public void testAllocate() { final int size = 100; setSessionVariableMeta.allocate(size); assertAllocate(size, setSessionVariableMeta.getFieldName()); assertAllocate(size, setSessionVariableMeta.getVariableName()); assertAllocate(size, setSessionVariableMeta.getDefaultValue()); }
@Test public void testGetXML() { setSessionVariableMeta.allocate(1); setSessionVariableMeta.setFieldName(new String[] {"fn"}); final String xml = setSessionVariableMeta.getXML(); assertNotNull(xml); assertTrue(xml.contains("fields")); assertTrue(xml.contains("field")); assertTrue(xml.contains("name")); assertTrue(xml.contains("variable")); assertTrue(xml.contains("default_value")); assertTrue(xml.contains("use_formatting")); }
@Test public void testSaveRep() throws Exception { final Repository rep = mock(Repository.class); final IMetaStore metaStore = mock(IMetaStore.class); final ObjectId id_step = mock(ObjectId.class); final ObjectId id_transformation = mock(ObjectId.class); setSessionVariableMeta.allocate(1); setSessionVariableMeta.setFieldName(new String[] {"fn"}); setSessionVariableMeta.saveRep(rep, metaStore, id_transformation, id_step); verify(rep, times(3)) .saveStepAttribute(eq(id_transformation), eq(id_step), anyInt(), anyString(), anyString()); verify(rep) .saveStepAttribute(eq(id_transformation), eq(id_step), anyInt(), anyString(), anyBoolean()); }
@Test public void testCheck() { List remarks = mock(List.class); TransMeta transMeta = mock(TransMeta.class); StepMeta stepMeta = mock(StepMeta.class); RowMetaInterface prev = mock(RowMetaInterface.class); String[] input = new String[1]; String[] output = new String[1]; RowMetaInterface info = mock(RowMetaInterface.class); VariableSpace space = mock(VariableSpace.class); Repository repository = mock(Repository.class); IMetaStore metaStore = mock(IMetaStore.class); setSessionVariableMeta.allocate(1); setSessionVariableMeta.check( remarks, transMeta, stepMeta, prev, input, output, info, space, repository, metaStore); verify(remarks, times(2)).add(any(CheckResultInterface.class)); }