Author: kelvingoodson
Date: Thu Aug 30 06:10:29 2007
New Revision: 571157

URL: http://svn.apache.org/viewvc?rev=571157&view=rev
Log:
TUSCANY-1399 first test case using sdo plugin

Added:
    incubator/tuscany/java/sdo/toolsTest/
    incubator/tuscany/java/sdo/toolsTest/pom.xml
    incubator/tuscany/java/sdo/toolsTest/src/
    incubator/tuscany/java/sdo/toolsTest/src/main/
    incubator/tuscany/java/sdo/toolsTest/src/main/java/
    incubator/tuscany/java/sdo/toolsTest/src/main/java/org/
    incubator/tuscany/java/sdo/toolsTest/src/main/java/org/apache/
    incubator/tuscany/java/sdo/toolsTest/src/main/java/org/apache/tuscany/
    incubator/tuscany/java/sdo/toolsTest/src/main/java/org/apache/tuscany/sdo/
    incubator/tuscany/java/sdo/toolsTest/src/main/resources/
    incubator/tuscany/java/sdo/toolsTest/src/main/resources/simple.xsd
    incubator/tuscany/java/sdo/toolsTest/src/test/
    incubator/tuscany/java/sdo/toolsTest/src/test/java/
    incubator/tuscany/java/sdo/toolsTest/src/test/java/org/
    incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/
    incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/tuscany/
    incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/tuscany/sdo/
    
incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/tuscany/sdo/SimpleStaticTestCase.java
Modified:
    incubator/tuscany/java/sdo/pom.xml

Modified: incubator/tuscany/java/sdo/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/pom.xml?rev=571157&r1=571156&r2=571157&view=diff
==============================================================================
--- incubator/tuscany/java/sdo/pom.xml (original)
+++ incubator/tuscany/java/sdo/pom.xml Thu Aug 30 06:10:29 2007
@@ -92,6 +92,7 @@
                 <module>tools</module>
                 <module>plugin</module>
                 <module>sample</module>
+                <module>toolsTest</module>
             </modules>
         </profile>
 

Added: incubator/tuscany/java/sdo/toolsTest/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/toolsTest/pom.xml?rev=571157&view=auto
==============================================================================
--- incubator/tuscany/java/sdo/toolsTest/pom.xml (added)
+++ incubator/tuscany/java/sdo/toolsTest/pom.xml Thu Aug 30 06:10:29 2007
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<!--
+ * 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.
+-->
+<project>
+    <parent>
+        <artifactId>tuscany-sdo</artifactId>
+        <groupId>org.apache.tuscany.sdo</groupId>
+        <version>1.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.tuscany.sdo</groupId>
+    <artifactId>toolsTest</artifactId>
+    <name>Test the SDO Generator Tools and Tool Outputs</name>
+
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.tuscany.sdo</groupId>
+                <artifactId>tuscany-sdo-impl</artifactId>
+                <version>${sdo.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.tuscany.sdo</groupId>
+                <artifactId>tuscany-sdo-lib</artifactId>
+                <version>${sdo.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.tuscany.sdo</groupId>
+                <artifactId>tuscany-sdo-tools</artifactId>
+                <version>${sdo.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>3.8.1</version>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.tuscany.sdo</groupId>
+                <artifactId>tuscany-sdo-plugin</artifactId>
+                <version>${sdo.version}</version>
+                <executions>
+                    <execution>
+                        <id>simple</id>
+                        <configuration>
+                            
<schemaFile>${basedir}/src/main/resources/simple.xsd</schemaFile>
+                            <noNotification>true</noNotification>
+                            <noUnsettable>true</noUnsettable>
+                        </configuration>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
\ No newline at end of file

Added: incubator/tuscany/java/sdo/toolsTest/src/main/resources/simple.xsd
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/toolsTest/src/main/resources/simple.xsd?rev=571157&view=auto
==============================================================================
--- incubator/tuscany/java/sdo/toolsTest/src/main/resources/simple.xsd (added)
+++ incubator/tuscany/java/sdo/toolsTest/src/main/resources/simple.xsd Thu Aug 
30 06:10:29 2007
@@ -0,0 +1,41 @@
+<?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:sequence>
+   </xsd:complexType>
+
+</xsd:schema>

Added: 
incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/tuscany/sdo/SimpleStaticTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/tuscany/sdo/SimpleStaticTestCase.java?rev=571157&view=auto
==============================================================================
--- 
incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/tuscany/sdo/SimpleStaticTestCase.java
 (added)
+++ 
incubator/tuscany/java/sdo/toolsTest/src/test/java/org/apache/tuscany/sdo/SimpleStaticTestCase.java
 Thu Aug 30 06:10:29 2007
@@ -0,0 +1,86 @@
+/**
+ *
+ *  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.math.BigDecimal;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import com.example.simple.Quote;
+import com.example.simple.SimpleFactory;
+import com.example.simple.impl.SimpleFactoryImpl;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+
+
+public class SimpleStaticTestCase extends TestCase
+{
+  
+  HelperContext scope;
+  /**
+   * Simple Static SDO 2 test.
+   */
+  public void testSimpleStatic()
+  {
+    try
+    {
+      SimpleFactory.INSTANCE.register(scope);
+      // System.out.println(SimpleFactoryImpl.PATTERN_VERSION);
+      
+      //Quote quote = (Quote)DataFactory.INSTANCE.create(Quote.class);
+      Quote quote = SimpleFactory.INSTANCE.createQuote();
+      
+      quote.setSymbol("fbnt");
+      quote.setCompanyName("FlyByNightTechnology");
+      quote.setPrice(new BigDecimal("1000.0"));
+      quote.setOpen1(new BigDecimal("1000.0"));
+      quote.setHigh(new BigDecimal("1000.0"));
+      quote.setLow(new BigDecimal("1000.0"));
+      quote.setVolume(1000);
+      quote.setChange1(1000);
+
+      //Quote child = (Quote)((DataObject)quote).createDataObject(8);
+      Quote child = SimpleFactory.INSTANCE.createQuote();
+      quote.getQuotes().add(child);
+      child.setPrice(new BigDecimal("2000.0"));
+
+      scope.getXMLHelper().save((DataObject)quote, 
"http://www.example.com/simple";, "stockQuote", System.out);
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+  }
+
+  protected void setUp() throws Exception {
+    scope = SDOUtil.createHelperContext();
+    super.setUp();
+  }
+  
+  protected void tearDown() throws Exception {
+       super.tearDown();
+  }
+
+  
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to