Renamed XmlReader classes to XMLReader classes
This commit is contained in:
@@ -40,7 +40,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
public abstract class AbstractStaxXmlReaderTestCase {
|
||||
public abstract class AbstractStaxXMLReaderTestCase {
|
||||
|
||||
protected static XMLInputFactory inputFactory;
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class AbstractStaxXmlReaderTestCase {
|
||||
standardReader.parse(new InputSource(createTestInputStream()));
|
||||
contentHandlerControl.replay();
|
||||
|
||||
AbstractStaxXmlReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class AbstractStaxXmlReaderTestCase {
|
||||
standardReader.parse(new InputSource(createTestInputStream()));
|
||||
contentHandlerControl.replay();
|
||||
|
||||
AbstractStaxXmlReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class AbstractStaxXmlReaderTestCase {
|
||||
standardReader.parse(new InputSource(createTestInputStream()));
|
||||
contentHandlerControl.replay();
|
||||
|
||||
AbstractStaxXmlReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", false);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
|
||||
@@ -136,14 +136,14 @@ public abstract class AbstractStaxXmlReaderTestCase {
|
||||
inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences", Boolean.FALSE);
|
||||
inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities", Boolean.FALSE);
|
||||
|
||||
AbstractStaxXmlReader staxXmlReader = createStaxXmlReader(testLexicalHandlerXml.getInputStream());
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(testLexicalHandlerXml.getInputStream());
|
||||
|
||||
staxXmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", lexicalHandler);
|
||||
staxXmlReader.parse(new InputSource());
|
||||
lexicalHandlerControl.verify();
|
||||
}
|
||||
|
||||
protected abstract AbstractStaxXmlReader createStaxXmlReader(InputStream inputStream) throws XMLStreamException;
|
||||
protected abstract AbstractStaxXMLReader createStaxXmlReader(InputStream inputStream) throws XMLStreamException;
|
||||
|
||||
/** Easymock <code>ArgumentMatcher</code> implementation that matches SAX arguments. */
|
||||
protected static class SaxArgumentMatcher extends AbstractMatcher {
|
||||
|
||||
@@ -27,20 +27,20 @@ import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
public class StaxEventXmlReaderTest extends AbstractStaxXmlReaderTestCase {
|
||||
public class StaxEventXMLReaderTest extends AbstractStaxXMLReaderTestCase {
|
||||
|
||||
public static final String CONTENT = "<root xmlns='http://springframework.org/spring-ws'><child/></root>";
|
||||
|
||||
@Override
|
||||
protected AbstractStaxXmlReader createStaxXmlReader(InputStream inputStream) throws XMLStreamException {
|
||||
return new StaxEventXmlReader(inputFactory.createXMLEventReader(inputStream));
|
||||
protected AbstractStaxXMLReader createStaxXmlReader(InputStream inputStream) throws XMLStreamException {
|
||||
return new StaxEventXMLReader(inputFactory.createXMLEventReader(inputStream));
|
||||
}
|
||||
|
||||
public void testPartial() throws Exception {
|
||||
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||
XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(CONTENT));
|
||||
eventReader.nextTag(); // skip to root
|
||||
StaxEventXmlReader xmlReader = new StaxEventXmlReader(eventReader);
|
||||
StaxEventXMLReader xmlReader = new StaxEventXMLReader(eventReader);
|
||||
|
||||
MockControl mockControl = MockControl.createStrictControl(ContentHandler.class);
|
||||
mockControl.setDefaultMatcher(new SaxArgumentMatcher());
|
||||
|
||||
@@ -30,13 +30,13 @@ import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
public class StaxStreamXmlReaderTest extends AbstractStaxXmlReaderTestCase {
|
||||
public class StaxStreamXMLReaderTest extends AbstractStaxXMLReaderTestCase {
|
||||
|
||||
public static final String CONTENT = "<root xmlns='http://springframework.org/spring-ws'><child/></root>";
|
||||
|
||||
@Override
|
||||
protected AbstractStaxXmlReader createStaxXmlReader(InputStream inputStream) throws XMLStreamException {
|
||||
return new StaxStreamXmlReader(inputFactory.createXMLStreamReader(inputStream));
|
||||
protected AbstractStaxXMLReader createStaxXmlReader(InputStream inputStream) throws XMLStreamException {
|
||||
return new StaxStreamXMLReader(inputFactory.createXMLStreamReader(inputStream));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -49,7 +49,7 @@ public class StaxStreamXmlReaderTest extends AbstractStaxXmlReaderTestCase {
|
||||
streamReader.nextTag(); // skip to child
|
||||
assertEquals("Invalid element", new QName("http://springframework.org/spring-ws", "child"),
|
||||
streamReader.getName());
|
||||
StaxStreamXmlReader xmlReader = new StaxStreamXmlReader(streamReader);
|
||||
StaxStreamXMLReader xmlReader = new StaxStreamXMLReader(streamReader);
|
||||
|
||||
MockControl mockControl = MockControl.createStrictControl(ContentHandler.class);
|
||||
mockControl.setDefaultMatcher(new SaxArgumentMatcher());
|
||||
|
||||
Reference in New Issue
Block a user