@Test
public void testParseXML() throws Exception {

        // Unused URL
        URL apiUrl = new URL("http://poulpe.heig-vd.ch/scapc2/serviceapi/index.php");
        ConnectionProperties cParams = new ConnectionProperties(apiUrl, null,new File("target/maps"));
        // Read the xml file in test resources
        FileReader inFile = new FileReader(new File(RemoteMapCatalogTest.class.getResource("context.xml").toURI()));
        BufferedReader in = new BufferedReader(inFile);
        XMLInputFactory factory = XMLInputFactory.newInstance();
        
        // Parse Data
        XMLStreamReader parser;
        parser = factory.createXMLStreamReader(in);
        Workspace mapCatalog =
                new Workspace(cParams,
                "default");
        List<RemoteMapContext> context = new ArrayList<RemoteMapContext>();
        mapCatalog.parseXML(context, parser);                        
        parser.close();
        
        assertEquals(context.size(), 2);
        assertEquals(context.get(0).getDescription().getTitle(Locale.ENGLISH), "My custom context");
        assertEquals(context.get(0).getDescription().getAbstract(Locale.ENGLISH), "Some text here.");
        assertEquals(context.get(0).getDate(), Workspace.parseDate("2012.10.12 15:13:29 CEST"));
        assertEquals(context.get(0).getId(), 0);
        assertEquals(context.get(1).getDescription().getDefaultTitle(), "Représentation par diagrammes");
        assertEquals(context.get(1).getDate(), Workspace.parseDate("2012.10.12 15:13:34 CEST"));
        assertEquals(context.get(1).getId(), 1);
}