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 2007/09/04 15:50:33 UTC

svn commit: r572685 - in /incubator/tuscany/sandbox/kgoodson/events/play: ./ src/ src/main/ src/main/java/ src/main/java/com/ src/main/java/com/example/ src/test/ src/test/java/ src/test/java/com/ src/test/java/com/example/ src/test/resources/

Author: kelvingoodson
Date: Tue Sep  4 06:50:32 2007
New Revision: 572685

URL: http://svn.apache.org/viewvc?rev=572685&view=rev
Log:
test out event infra

Added:
    incubator/tuscany/sandbox/kgoodson/events/play/
    incubator/tuscany/sandbox/kgoodson/events/play/pom.xml
    incubator/tuscany/sandbox/kgoodson/events/play/src/
    incubator/tuscany/sandbox/kgoodson/events/play/src/main/
    incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/
    incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/com/
    incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/com/example/
    incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java
    incubator/tuscany/sandbox/kgoodson/events/play/src/test/
    incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/
    incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/com/
    incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/com/example/
    incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java
    incubator/tuscany/sandbox/kgoodson/events/play/src/test/resources/
    incubator/tuscany/sandbox/kgoodson/events/play/src/test/resources/simple.xsd

Added: incubator/tuscany/sandbox/kgoodson/events/play/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/play/pom.xml?rev=572685&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/play/pom.xml (added)
+++ incubator/tuscany/sandbox/kgoodson/events/play/pom.xml Tue Sep  4 06:50:32 2007
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>com.example</groupId>
+  <artifactId>play</artifactId>
+  <packaging>jar</packaging>
+  <version>kgoodson_sandbox</version>
+  <name>play</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.apache.tuscany.sdo</groupId>
+      <artifactId>tuscany-sdo-lib</artifactId>
+      <version>kgoodson-sandbox</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tuscany.sdo</groupId>
+      <artifactId>tuscany-sdo-impl</artifactId>
+      <version>kgoodson-sandbox</version>
+    </dependency> 
+    <dependency>
+      <groupId>org.apache.tuscany.sdo</groupId>
+      <artifactId>tuscany-sdo-api-r2.1</artifactId>
+      <version>1.0-incubating-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>

Added: incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java?rev=572685&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java (added)
+++ incubator/tuscany/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java Tue Sep  4 06:50:32 2007
@@ -0,0 +1,13 @@
+package com.example;
+
+import org.apache.tuscany.sdo.api.Event;
+import org.apache.tuscany.sdo.api.ListenerBase;
+
+public class ComExampleObserver extends ListenerBase {
+
+  public void eventNotification(Event e) {
+    System.out.println("Hi I changed");
+
+  }
+
+}

Added: incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java?rev=572685&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java (added)
+++ incubator/tuscany/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java Tue Sep  4 06:50:32 2007
@@ -0,0 +1,41 @@
+package test;
+
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+import junit.framework.TestCase;
+
+
+import com.example.ComExampleObserver;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+public class TestChanges extends TestCase {
+  
+  HelperContext scope;
+  private final String TEST_MODEL = "/simple.xsd";
+
+
+  public void setUp() throws Exception {
+    scope = SDOUtil.createHelperContext();
+    URL url = getClass().getResource(TEST_MODEL);
+    InputStream inputStream = url.openStream();
+    scope.getXSDHelper().define(inputStream, url.toString());
+    inputStream.close();
+
+  }
+
+  public void tearDown() throws Exception {
+  }
+  
+  public void testChange1()
+  {
+    DataObject quote = scope.getDataFactory().create("http://www.example.com/simple", "Quote");
+    SDOUtil.addChangeListener(quote, new ComExampleObserver());
+    
+    quote.setString("symbol","foo");
+  }
+}

Added: incubator/tuscany/sandbox/kgoodson/events/play/src/test/resources/simple.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/play/src/test/resources/simple.xsd?rev=572685&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/play/src/test/resources/simple.xsd (added)
+++ incubator/tuscany/sandbox/kgoodson/events/play/src/test/resources/simple.xsd Tue Sep  4 06:50:32 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>



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