JdbcConnectorServiceXmlParser extends AbstractXmlParser { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (!NAMESPACE.equals(uri)) { return; } ElementType.getTypeFromName(localName).startElement(stack, attributes); }  @Override String getNamespaceUri(); @Override void startElement(String uri, String localName, String qName, Attributes attributes); @Override void endElement(String uri, String localName, String qName); static final String NAMESPACE; }
@Test public void startElementCreatesJdbcServiceConfiguration() throws Exception { JdbcConnectorServiceXmlParser parser = new JdbcConnectorServiceXmlParser(); stack.push(regionCreation); parser.setStack(stack); parser.startElement(NAMESPACE, JDBC_MAPPING.getTypeName(), null, attributes); assertThat(stack.pop()).isInstanceOf(RegionMapping.class); }
@Test public void startElementWithWrongUriDoesNothing() throws Exception { JdbcConnectorServiceXmlParser parser = new JdbcConnectorServiceXmlParser(); stack.push(regionCreation); parser.setStack(stack); parser.startElement("wrongNamespace", JDBC_MAPPING.getTypeName(), null, attributes); assertThat(stack.pop()).isEqualTo(regionCreation); }