tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r572438 - in /incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services: ContributionMetadataDocumentProcessorTestCase.java ContributionMetadataDocumentProcessorTestCaseFIXME.java
Date Mon, 03 Sep 2007 22:23:42 GMT
Author: lresende
Date: Mon Sep  3 15:23:40 2007
New Revision: 572438

URL: http://svn.apache.org/viewvc?rev=572438&view=rev
Log:
Fixing ContributionMetadataDocumentProcessor testcase 

Added:
    incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java
      - copied, changed from r572431, incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCaseFIXME.java
Removed:
    incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCaseFIXME.java

Copied: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java
(from r572431, incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCaseFIXME.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java?p2=incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java&p1=incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCaseFIXME.java&r1=572431&r2=572438&rev=572438&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCaseFIXME.java
(original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java
Mon Sep  3 15:23:40 2007
@@ -19,66 +19,75 @@
 
 package org.apache.tuscany.sca.contribution.services;
 
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
 import junit.framework.TestCase;
 
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionMetadataProcessor;
+
 /**
  * @version $Rev$ $Date$
  */
-//FIXME Why is this test case all commented out? 
-public class ContributionMetadataDocumentProcessorTestCaseFIXME extends TestCase {
 
-//    private static final String VALID_XML =
-//        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-//            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-//            + "<deployable composite=\"ns:Composite1\"/>"
-//            + "<deployable composite=\"ns:Composite2\"/>"
-//            + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
-//            + "<export namespace=\"http://ns1\"/>"
-//            + "</contribution>";
-//
-//    private static final String INVALID_XML =
-//        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-//            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-//            + "<deployable composite=\"ns:Composite1\"/>"
-//            + "<deployable composite=\"ns3:Composite1\"/>"
-//            + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
-//            + "<export namespace=\"http://ns1\"/>"
-//            + "</contribution>";
+public class ContributionMetadataDocumentProcessorTestCase extends TestCase {
 
-//    private XMLInputFactory xmlFactory;
+    private static final String VALID_XML =
+        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
+            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+            + "<deployable composite=\"ns:Composite1\"/>"
+            + "<deployable composite=\"ns:Composite2\"/>"
+            + "</contribution>";
+
+    private static final String INVALID_XML =
+        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
+            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+            + "<deployable composite=\"ns:Composite1\"/>"
+            + "<deployable/>"
+            + "</contribution>";
+    private XMLInputFactory xmlFactory;
 
     @Override
     protected void setUp() throws Exception {
-//        xmlFactory = XMLInputFactory.newInstance();
+        xmlFactory = XMLInputFactory.newInstance();
     }
 
     public void testLoad() throws Exception {
-//        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-//
-//        ContributionFactory factory = new ContributionFactoryImpl();
-//        ContributionMetadataLoaderImpl loader = 
-//            new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
-//        Contribution contribution = factory.createContribution();
-//        contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
-//        loader.load(contribution, reader);
-//        assertNotNull(contribution);
-//        assertEquals(1, contribution.getImports().size());
-//        assertEquals(1, contribution.getExports().size());
-//        assertEquals(2, contribution.getDeployables().size());
-    }
+        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+        ContributionFactory contributionFactory = new ContributionFactoryImpl();
+        ContributionMetadataProcessor loader = 
+            new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
+        Contribution contribution = contributionFactory.createContribution();
+        contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
+        contribution = loader.read(reader);
+        assertNotNull(contribution);
+        assertEquals(2, contribution.getDeployables().size());
+  }
 
     public void testLoadInvalid() throws Exception {
-//        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-//        ContributionFactory factory = new ContributionFactoryImpl();
-//        ContributionMetadataLoaderImpl loader = 
-//            new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
-//        Contribution contribution = factory.createContribution();
-//        contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
-//        try {
-//            loader.load(contribution, reader);
-//            fail("InvalidException should have been thrown");
-//        } catch (InvalidValueException e) {
-//            assertTrue(true);
-//        }
+        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+        ContributionFactory contributionFactory = new ContributionFactoryImpl();
+        ContributionMetadataProcessor loader = 
+            new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
+        Contribution contribution = contributionFactory.createContribution();
+        contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
+        try {
+            loader.read(reader);
+            fail("InvalidException should have been thrown");
+        } catch (ContributionReadException e) {
+            assertTrue(true);
+        }
     }    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message