Search in sources :

Example 6 with ImportColumnGroup

use of com.google.refine.importers.tree.ImportColumnGroup in project OpenRefine by OpenRefine.

the class XmlImportUtilitiesTests method SetUp.

@BeforeMethod
public void SetUp() {
    SUT = new XmlImportUtilitiesStub();
    project = new Project();
    columnGroup = new ImportColumnGroup();
    record = new ImportRecord();
}
Also used : Project(com.google.refine.model.Project) ImportColumnGroup(com.google.refine.importers.tree.ImportColumnGroup) ImportRecord(com.google.refine.importers.tree.ImportRecord) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 7 with ImportColumnGroup

use of com.google.refine.importers.tree.ImportColumnGroup in project OpenRefine by OpenRefine.

the class XmlImportUtilitiesTests method importXmlWithVaryingStructureTest.

@Test
public void importXmlWithVaryingStructureTest() {
    loadData(XmlImporterTests.getSampleWithVaryingStructure());
    String[] recordPath = new String[] { "library", "book" };
    XmlImportUtilitiesStub.importTreeData(createXmlParser(), project, recordPath, columnGroup, -1, new ImportParameters(false, true, false));
    log(project);
    assertProjectCreated(project, 0, 6);
    Assert.assertEquals(project.rows.get(0).cells.size(), 4);
    Assert.assertEquals(project.rows.get(5).cells.size(), 5);
    Assert.assertEquals(columnGroup.subgroups.size(), 1);
    Assert.assertEquals(columnGroup.name, "");
    ImportColumnGroup book = columnGroup.subgroups.get("book");
    Assert.assertNotNull(book);
    Assert.assertEquals(book.columns.size(), 1);
    Assert.assertEquals(book.subgroups.size(), 4);
    Assert.assertNotNull(book.subgroups.get("author"));
    Assert.assertEquals(book.subgroups.get("author").columns.size(), 1);
    Assert.assertNotNull(book.subgroups.get("title"));
    Assert.assertNotNull(book.subgroups.get("publish_date"));
    Assert.assertNotNull(book.subgroups.get("genre"));
}
Also used : ImportColumnGroup(com.google.refine.importers.tree.ImportColumnGroup) ImportParameters(com.google.refine.importers.tree.ImportParameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) RefineTest(com.google.refine.tests.RefineTest)

Aggregations

ImportColumnGroup (com.google.refine.importers.tree.ImportColumnGroup)7 IOException (java.io.IOException)4 RefineTest (com.google.refine.tests.RefineTest)3 BeforeTest (org.testng.annotations.BeforeTest)3 Test (org.testng.annotations.Test)3 ImportParameters (com.google.refine.importers.tree.ImportParameters)2 ArrayList (java.util.ArrayList)2 ImportColumn (com.google.refine.importers.tree.ImportColumn)1 ImportRecord (com.google.refine.importers.tree.ImportRecord)1 TreeReaderException (com.google.refine.importers.tree.TreeReaderException)1 Project (com.google.refine.model.Project)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 BeforeMethod (org.testng.annotations.BeforeMethod)1