summaryrefslogtreecommitdiffstats
path: root/sandbox/kgoodson/events/play/src
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/kgoodson/events/play/src
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/kgoodson/events/play/src')
-rw-r--r--sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java13
-rw-r--r--sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java41
-rw-r--r--sandbox/kgoodson/events/play/src/test/resources/simple.xsd41
3 files changed, 95 insertions, 0 deletions
diff --git a/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java b/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java
new file mode 100644
index 0000000000..909713dfc4
--- /dev/null
+++ b/sandbox/kgoodson/events/play/src/main/java/com/example/ComExampleObserver.java
@@ -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");
+
+ }
+
+}
diff --git a/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java b/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java
new file mode 100644
index 0000000000..09aec7f046
--- /dev/null
+++ b/sandbox/kgoodson/events/play/src/test/java/com/example/TestChanges.java
@@ -0,0 +1,41 @@
+package com.example;
+
+
+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");
+ }
+}
diff --git a/sandbox/kgoodson/events/play/src/test/resources/simple.xsd b/sandbox/kgoodson/events/play/src/test/resources/simple.xsd
new file mode 100644
index 0000000000..3beb0ca496
--- /dev/null
+++ b/sandbox/kgoodson/events/play/src/test/resources/simple.xsd
@@ -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>