diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-15 16:31:03 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-15 16:31:03 +0000 |
commit | db0b393ee18e88e7f4b97d901828afdd7669a551 (patch) | |
tree | 65438d83abbfa25faf94655c6b93a73b8efaed45 /java/sca/modules/policy-xml | |
parent | d4fb0612c60909ff940e02a9cc7186b2b375ca2b (diff) |
TUSCANY-2538 - Adding default processor to handle unknown contents in composite file
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@695536 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/policy-xml')
-rw-r--r-- | java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java index 60de55a0d9..c9fad18157 100644 --- a/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java +++ b/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java @@ -62,6 +62,8 @@ public class ReadDocumentTestCase extends TestCase { private ModelResolver resolver; private StAXArtifactProcessor<Object> staxProcessor; private Monitor monitor; + + private static final QName elementToProcess = new QName("http://www.osoa.org/xmlns/sca/1.0", "implementationType"); private Map<QName, Intent> intentTable = new Hashtable<QName, Intent>(); private Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>(); @@ -98,11 +100,20 @@ public class ReadDocumentTestCase extends TestCase { StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor); staxProcessors.addArtifactProcessor(new TestPolicyProcessor()); - + URL url = getClass().getResource("test_definitions.xml"); InputStream urlStream = url.openStream(); XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream); reader.next(); + + //position on the right element qname to get processed + while(reader.hasNext()) { + reader.next(); + int event = reader.getEventType(); + if(event == START_ELEMENT && reader.getName().equals(elementToProcess)) { + break; + } + } while ( true ) { int event = reader.getEventType(); switch (event) { |