@Test(expected = GraphIOException.class) public void testInvalidGraphFactory() throws Exception { String xml = graphMLDocStart + "<key id=\"d0\" for=\"node\" attr.name=\"color\" attr.type=\"string\">" + "<default>yellow</default>" + "</key>" + "<key id=\"d1\" for=\"edge\" attr.name=\"weight\" attr.type=\"double\"/>" + "<graph id=\"G\" edgedefault=\"undirected\">" + "<node id=\"n0\">" + "<data key=\"d0\">green</data>" + "</node>" + "<node id=\"n1\"/>" + "<node id=\"n2\">" + "<data key=\"d0\">blue</data>" + "</node>" + "<hyperedge id=\"e0\">" + "<endpoint node=\"n0\"/>" + "<endpoint node=\"n1\"/>" + "<endpoint node=\"n2\"/>" + "</hyperedge>" + "</graphml>"; readGraph(xml, new DummyGraphObjectBase.UndirectedSparseGraphFactory(), new DummyVertex.Factory(), new DummyEdge.EdgeFactory(), new DummyEdge.HyperEdgeFactory()); }
@SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse( xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry .getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G)graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse( xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); }
GraphMLReader2 implements
        GraphReader<G, V, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse( xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry .getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G)graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse( xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } }
GraphMLReader2 implements
        GraphReader<G, V, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse( xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry .getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G)graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse( xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } GraphMLReader2(Reader fileReader,
                          Transformer<GraphMetadata, G> graphTransformer,
                          Transformer<NodeMetadata, V> vertexTransformer,
                          Transformer<EdgeMetadata, E> edgeTransformer,
                          Transformer<HyperEdgeMetadata, E> hyperEdgeTransformer); }
GraphMLReader2 implements
        GraphReader<G, V, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse( xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry .getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G)graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse( xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } GraphMLReader2(Reader fileReader,
                          Transformer<GraphMetadata, G> graphTransformer,
                          Transformer<NodeMetadata, V> vertexTransformer,
                          Transformer<EdgeMetadata, E> edgeTransformer,
                          Transformer<HyperEdgeMetadata, E> hyperEdgeTransformer); Transformer<GraphMetadata, G> getGraphTransformer(); Transformer<NodeMetadata, V> getVertexTransformer(); Transformer<EdgeMetadata, E> getEdgeTransformer(); Transformer<HyperEdgeMetadata, E> getHyperEdgeTransformer(); void init(); void close(); GraphMLDocument getGraphMLDocument(); @SuppressWarnings("unchecked") G readGraph(); }
GraphMLReader2 implements
        GraphReader<G, V, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse( xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry .getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G)graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse( xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } GraphMLReader2(Reader fileReader,
                          Transformer<GraphMetadata, G> graphTransformer,
                          Transformer<NodeMetadata, V> vertexTransformer,
                          Transformer<EdgeMetadata, E> edgeTransformer,
                          Transformer<HyperEdgeMetadata, E> hyperEdgeTransformer); Transformer<GraphMetadata, G> getGraphTransformer(); Transformer<NodeMetadata, V> getVertexTransformer(); Transformer<EdgeMetadata, E> getEdgeTransformer(); Transformer<HyperEdgeMetadata, E> getHyperEdgeTransformer(); void init(); void close(); GraphMLDocument getGraphMLDocument(); @SuppressWarnings("unchecked") G readGraph();  }