You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Luciano Resende (JIRA)" <de...@tuscany.apache.org> on 2008/09/09 07:19:44 UTC

[jira] Commented: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

    [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629392#action_12629392 ] 

Luciano Resende commented on TUSCANY-2538:
------------------------------------------

Looks like this patch is breaking various test cases, I could see two patterns on the breakages :

   - Test case was able to call processors.read() and elements would be ignored when processors were not available, this is probably a test case design issue, below is an example and a possible workaround for ReadDocumentTestCase

Index: policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
===================================================================
--- policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java        (revision 693313)
+++ policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java        (working copy)
@@ -63,6 +63,8 @@
     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>();
     private Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
@@ -95,6 +97,7 @@
             monitor = monitorFactory.createMonitor();
             utilities.addUtility(monitorFactory);
         }
+        
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
         staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
@@ -102,7 +105,18 @@
         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) {
@@ -142,6 +156,7 @@
                 break;
             }
         }
+
         urlStream.close();
     }


   - The other issue is when no processor is found (e.g during write), but the model wasn't created by the DefaultUnknownElementProcessor, then the write operation will have cast exception issues. Not sure what's the best solution here, as if we don't know how to write, we would get to the same issue that originated the jira defect, but I think we should at least check before casting.

   - I also think we should enhance the code that generates the DOM for the unknown elements to handle attributes. Note that this is different from TUSCANY-2463 that will handle extended attributes and also create a "DefaultUnknownAttributeProcessor" to handle extended attributes that does not have it's own processor.


> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>            Assignee: Dhaval Chauhan
>             Fix For: Java-SCA-Next
>
>         Attachments: MyComposite.composite, tuscany-TUSCANY-2538.Dhaval.diff, tuscany-TUSCANY-2538_1.Dhaval.diff
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.