You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2006/12/04 10:56:56 UTC

svn commit: r482120 - in /incubator/tuscany/java/sdo/impl/src/test: java/org/apache/tuscany/sdo/test/AllTests.java java/org/apache/tuscany/sdo/test/DotNameTest.java resources/dotNames.xsd

Author: kelvingoodson
Date: Mon Dec  4 01:56:53 2006
New Revision: 482120

URL: http://svn.apache.org/viewvc?view=rev&rev=482120
Log:
TUSCANY 935 -- Committing modified and maven disabled test case only at this point.  See my comment in the JIRA


Added:
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DotNameTest.java   (with props)
    incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd   (with props)
Modified:
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java

Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java?view=diff&rev=482120&r1=482119&r2=482120
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java (original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java Mon Dec  4 01:56:53 2006
@@ -1,7 +1,8 @@
 package org.apache.tuscany.sdo.test;
+import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-public class AllTests {
+public class AllTests extends TestCase {
 	
 	
   public static TestSuite suite() {
@@ -9,6 +10,8 @@
         TestSuite suite = new TestSuite();
       
         // suite.addTestSuite(ChangeSummaryOnDataObjectTestCase.class);
+        suite.addTestSuite(DotNameTest.class);
+
         suite.addTestSuite(ChangeSummaryTestCase.class);
         suite.addTestSuite(CrossScopeCopyTestCase.class);
         suite.addTestSuite(DataTypeBaseTypeTestCase.class);
@@ -28,6 +31,9 @@
         suite.addTestSuite(XMLStreamHelperTestCase.class);
         suite.addTestSuite(XPathTestCase.class);
         suite.addTestSuite(XSDHelperTestCase.class);
+        
+        suite.addTestSuite(DotNameTest.class);
+
 
         return suite;
     }

Added: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DotNameTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DotNameTest.java?view=auto&rev=482120
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DotNameTest.java (added)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DotNameTest.java Mon Dec  4 01:56:53 2006
@@ -0,0 +1,79 @@
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.test;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import junit.framework.TestCase;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XSDHelper;
+
+
+public class DotNameTest extends TestCase {
+    private final String TEST_MODEL = "/dotNames.xsd";
+    private final String TEST_NAMESPACE = "http://www.example.com/simple";
+    private HelperContext hc;
+    private TypeHelper th;
+    private DataFactory df;
+
+    /**
+     * Simple Dynamic SDO 2 test.
+     */
+    public void testDynamic() throws IOException {
+        Type quoteType = th.getType(TEST_NAMESPACE, "Quote");
+        DataObject quote = df.create(quoteType);
+
+
+        quote.getList("property.2.1").add(TEST_NAMESPACE);
+        assertTrue(quote.isSet("property.2.1"));
+        assertSame(quote.get("property.2.1.0"), TEST_NAMESPACE);
+        quote.getList("foo.bar").add(TEST_NAMESPACE);
+        assertTrue(quote.isSet("foo.bar"));
+        assertSame(quote.get("foo.bar.0"), TEST_NAMESPACE);
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // Populate the meta data for the test (Stock Quote) model
+        URL url = getClass().getResource(TEST_MODEL);
+        hc = SDOUtil.createHelperContext();
+        th = hc.getTypeHelper();
+        df = hc.getDataFactory();
+        
+        InputStream inputStream = url.openStream();
+        hc.getXSDHelper().define(inputStream, url.toString());
+        inputStream.close();
+        
+
+    }
+
+}
\ No newline at end of file

Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DotNameTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DotNameTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd?view=auto&rev=482120
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd (added)
+++ incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd Mon Dec  4 01:56:53 2006
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.    
+ -->
+<xsd:schema 
+  targetNamespace="http://www.example.com/simple"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+  xmlns:simple="http://www.example.com/simple"> 
+  
+   <xsd:element name="stockQuote" type="simple:Quote"/>
+
+   <xsd:complexType name="Quote">
+       <xsd:sequence>
+          <xsd:element name="symbol" type="xsd:string"/>
+          <xsd:element name="companyName" type="xsd:string"/>
+          <xsd:element name="price" type="xsd:decimal"/>
+          <xsd:element name="open1" type="xsd:decimal"/>
+          <xsd:element name="high" type="xsd:decimal"/>
+          <xsd:element name="low" type="xsd:decimal"/>
+          <xsd:element name="volume" type="xsd:double"/>
+          <xsd:element name="change1" type="xsd:double"/>
+          <xsd:element name="quotes" type="simple:Quote" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element name="property.2.1" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element name="foo.bar" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+       </xsd:sequence>
+   </xsd:complexType>
+
+</xsd:schema>

Propchange: incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sdo/impl/src/test/resources/dotNames.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml



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