@Test
public void testParseXML() throws Exception {

        // Unused URL
        URL apiUrl = new URL("http://poulpe.heig-vd.ch/scapc2/serviceapi/index.php");
        
        FileReader inFile = new FileReader(new File(RemoteMapCatalogTest.class.getResource("workspaces.xml").toURI()));
        BufferedReader in = new BufferedReader(inFile);
        XMLInputFactory factory = XMLInputFactory.newInstance();
        
        // Parse Data
        XMLStreamReader parser;
        parser = factory.createXMLStreamReader(in);
        RemoteMapCatalog mapCatalog =
                new RemoteMapCatalog(
                new ConnectionProperties(apiUrl, null, new File("target/maps")));
        List<Workspace> workspaces = new ArrayList<Workspace>();                
        mapCatalog.parseXML(workspaces, parser);                        
        parser.close();
        
        assertEquals(workspaces.size(), 4);
        List<String> workspacesNames = new ArrayList<String>();
        for(Workspace workspace : workspaces) {
                workspacesNames.add(workspace.getWorkspaceName());
        }
        assertTrue(workspacesNames.containsAll(
                Arrays.asList("default","toto","titi","tata")));
}