diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-23 14:44:33 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-23 14:44:33 +0000 |
commit | 0d01ae7c048afc0d978394d4a6508273abac55e2 (patch) | |
tree | 98b6d44e9a0cab49b53713359095782c10001758 /sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src | |
parent | 85720a9d400a037b67d93f8e8e84381a2295b276 (diff) |
Close the output writer before reading from it.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1052293 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java index 8a4768cd9e..c165fcd94a 100644 --- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java +++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java @@ -29,7 +29,9 @@ import java.io.InputStream; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.DefaultContributionFactory; @@ -77,8 +79,15 @@ public class ReadWriteTestCase { public void testReadWrite() throws Exception { final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite"); final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx); + System.out.println("Composite : " + c.getURI()); + for (Component component : c.getComponents()){ + System.out.println(" Component : " + component.getName()); + } final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - xproc.write(c, xof.createXMLStreamWriter(bos), ctx); + XMLStreamWriter writer = xof.createXMLStreamWriter(bos); + xproc.write(c, writer, ctx); + writer.close(); + System.out.println("Written XML = " + bos.toString()); assertTrue(bos.toString().contains("class=\"sample.WelloTest\"")); } } |