use of ml.shifu.shifu.container.meta.MetaGroup in project shifu by ShifuML.
the class ItemMetaGroupTest method testOutput.
@Test
public void testOutput() throws JsonGenerationException, JsonMappingException, IOException {
List<MetaGroup> groupList = new ArrayList<MetaGroup>();
MetaGroup itemGrpA = new MetaGroup();
itemGrpA.setGroup("basic");
List<MetaItem> metaList = new ArrayList<MetaItem>();
MetaItem meta = new MetaItem();
meta.setName("author");
meta.setType("text");
meta.setDirective("input");
meta.setMinLength(1);
metaList.add(meta);
itemGrpA.setMetaList(metaList);
groupList.add(itemGrpA);
MetaGroup itemGrpB = new MetaGroup();
itemGrpB.setGroup("sourceData");
List<MetaItem> metaListB = new ArrayList<MetaItem>();
MetaItem metaB = new MetaItem();
metaB.setName("dataPath");
metaB.setType("text");
metaB.setDirective("input");
metaB.setMinLength(1);
metaListB.add(metaB);
itemGrpB.setMetaList(metaListB);
groupList.add(itemGrpB);
File file = new File("test-meta.json");
jsonMapper.writerWithDefaultPrettyPrinter().writeValue(file, groupList);
MetaGroup[] ga = jsonMapper.readValue(file, MetaGroup[].class);
Assert.assertEquals(groupList.size(), ga.length);
file.deleteOnExit();
}
use of ml.shifu.shifu.container.meta.MetaGroup in project shifu by ShifuML.
the class ItemMetaGroupTest method testReadMetaGroup.
@Test
public void testReadMetaGroup() throws JsonParseException, JsonMappingException, IOException {
File file = new File("src/main/resources/store/ModelConfigMeta.json");
MetaGroup[] ga = jsonMapper.readValue(file, MetaGroup[].class);
Assert.assertEquals(7, ga.length);
}
use of ml.shifu.shifu.container.meta.MetaGroup in project shifu by ShifuML.
the class ItemMetaGroupTest method testCloneMeta.
@Test
public void testCloneMeta() {
MetaGroup group = new MetaGroup();
MetaGroup cloneObj = group.clone();
Assert.assertNull(cloneObj.getGroup());
group.setGroup("testGroup");
List<MetaItem> itemList = new ArrayList<MetaItem>();
MetaItem meta = new MetaItem();
itemList.add(meta);
itemList.add(meta.clone());
itemList.add(meta.clone());
group.setMetaList(itemList);
cloneObj = group.clone();
Assert.assertEquals("testGroup", cloneObj.getGroup());
Assert.assertEquals(3, cloneObj.getMetaList().size());
}