@Test
    public void testNews1() throws Exception {
        VespaXMLFeedReader parser = new VespaXMLFeedReader("src/test/vespaxmlparser/testalltypes.xml", manager);
        FeedOperation op = parser.read();

        assertTrue(FeedOperation.Type.INVALID != op.getType());
        Document doc = op.getDocumentPut().getDocument();
        assertEquals(new StringFieldValue("testUrl"), doc.getFieldValue("url"));
        assertEquals(new StringFieldValue("testTitle"), doc.getFieldValue("title"));
        assertEquals(new IntegerFieldValue(1), doc.getFieldValue("last_downloaded"));
        assertEquals(new LongFieldValue(2), doc.getFieldValue("value_long"));
        assertEquals("foobar", Utf8.toString(((Raw)doc.getFieldValue("value_raw")).getByteBuffer()));

        Array strArr = (Array)doc.getFieldValue("stringarr");
        assertEquals(new StringFieldValue("stringarrItem1"), strArr.get(0));
        assertEquals(new StringFieldValue("stringarrItem2"), strArr.get(1));

        Array intArr = (Array)doc.getFieldValue("intarr");
        assertEquals(new IntegerFieldValue(-1311224359), intArr.get(0));
        assertEquals(new IntegerFieldValue(-1311224358), intArr.get(1));
        assertEquals(new IntegerFieldValue(-1), intArr.get(2));
        assertEquals(new IntegerFieldValue(-2147483648), intArr.get(3));

        Array longArr = (Array)doc.getFieldValue("longarr");
        assertEquals(new LongFieldValue(5L), longArr.get(0));
        assertEquals(new LongFieldValue(6L), longArr.get(1));

        Array byteArr = (Array)doc.getFieldValue("bytearr");
        assertEquals(new ByteFieldValue(7), byteArr.get(0));
        assertEquals(new ByteFieldValue(8), byteArr.get(1));

        Array floatArr = (Array)doc.getFieldValue("floatarr");
        assertEquals(new FloatFieldValue(9.0f), floatArr.get(0));
        assertEquals(new FloatFieldValue(10.0f), floatArr.get(1));

        WeightedSet intWset = (WeightedSet)doc.getFieldValue("weightedsetint");
        assertEquals(Integer.valueOf(11), intWset.get(new IntegerFieldValue(11)));
        assertEquals(Integer.valueOf(12), intWset.get(new IntegerFieldValue(12)));

        WeightedSet strWset = (WeightedSet)doc.getFieldValue("weightedsetstring");
        assertEquals(Integer.valueOf(13), strWset.get(new StringFieldValue("string13")));
        assertEquals(Integer.valueOf(14), strWset.get(new StringFieldValue("string14")));

        MapFieldValue strMap = (MapFieldValue)doc.getFieldValue("stringmap");
        assertEquals(new StringFieldValue("slovakia"), strMap.get(new StringFieldValue("italia")));
        assertEquals(new StringFieldValue("japan"), strMap.get(new StringFieldValue("danmark")));
        assertEquals(new StringFieldValue("new zealand"), strMap.get(new StringFieldValue("paraguay")));

        Struct struct = (Struct)doc.getFieldValue("structfield");
        assertEquals(new StringFieldValue("star wars"), struct.getFieldValue("title"));
        assertEquals(new StringFieldValue("dummy"), struct.getFieldValue("structfield"));

        List structArr = (List)doc.getFieldValue("structarr");
        assertEquals(2, structArr.size());
        assertEquals(new StringFieldValue("title1"), ((Struct)structArr.get(0)).getFieldValue("title"));
        assertEquals(new StringFieldValue("title2"), ((Struct)structArr.get(1)).getFieldValue("title"));
        assertEquals(new StringFieldValue("value1"),
                     ((MapFieldValue)((Struct)structArr.get(0)).getFieldValue("mymap")).get(
                             new StringFieldValue("key1")));
        assertEquals(new StringFieldValue("value2"),
                     ((MapFieldValue)((Struct)structArr.get(0)).getFieldValue("mymap")).get(
                             new StringFieldValue("key2")));
        assertEquals(new StringFieldValue("value1.1"),
                     ((MapFieldValue)((Struct)structArr.get(1)).getFieldValue("mymap")).get(
                             new StringFieldValue("key1.1")));
        assertEquals(new StringFieldValue("value1.2"),
                     ((MapFieldValue)((Struct)structArr.get(1)).getFieldValue("mymap")).get(
                             new StringFieldValue("key1.2")));

        MapFieldValue arrMap = (MapFieldValue)doc.getFieldValue("arrmap");
        assertEquals(2, arrMap.size());
        Array arr = (Array)arrMap.get(new StringFieldValue("foo"));
        assertEquals(3, arr.size());
        assertEquals(new StringFieldValue("hei1"), arr.get(0));
        assertEquals(new StringFieldValue("hei2"), arr.get(1));
        assertEquals(new StringFieldValue("hei3"), arr.get(2));
        arr = (Array)arrMap.get(new StringFieldValue("bar"));
        assertEquals(3, arr.size());
        assertEquals(new StringFieldValue("hei4"), arr.get(0));
        assertEquals(new StringFieldValue("hei5"), arr.get(1));
        assertEquals(new StringFieldValue("hei6"), arr.get(2));
    }
Simple test case for Vespa XML parser.

@author sveina
document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java