Author: kelvingoodson
Date: Mon Dec 4 04:12:38 2006
New Revision: 482150
URL: http://svn.apache.org/viewvc?view=rev&rev=482150
Log:
capturing this test case that currently fails due to partial HelperContext
implementation -- introduce into trunk when coding is complete
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/
incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml (with props)
incubator/tuscany/sandbox/kgoodson/moreTests/src/
incubator/tuscany/sandbox/kgoodson/moreTests/src/main/
incubator/tuscany/sandbox/kgoodson/moreTests/src/main/java/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/A.java
(with props)
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/AFactory.java
(with props)
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AFactoryImpl.java
(with props)
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AImpl.java
(with props)
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
(with props)
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def1.xsd
(with props)
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd
(with props)
Added: incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml?view=auto&rev=482150
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml (added)
+++ incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml Mon Dec 4 04:12:38
2006
@@ -0,0 +1,32 @@
+<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>org.apache.tuscany</groupId>
+ <artifactId>kgoodson-sandbox-tests</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Maven Quick Start Archetype</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ <version>2.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Propchange: incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/sandbox/kgoodson/moreTests/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/A.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/A.java?view=auto&rev=482150
==============================================================================
---
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/A.java
(added)
+++
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/A.java
Mon Dec 4 04:12:38 2006
@@ -0,0 +1,52 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.a;
+
+import java.io.Serializable;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>A</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>[EMAIL PROTECTED] com.example.a.A#getSymbol1 <em>Symbol1</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @extends Serializable
+ * @generated
+ */
+public interface A extends Serializable
+{
+ /**
+ * Returns the value of the '<em><b>Symbol1</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Symbol1</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Symbol1</em>' attribute.
+ * @see #setSymbol1(String)
+ * @generated
+ */
+ String getSymbol1();
+
+ /**
+ * Sets the value of the '[EMAIL PROTECTED] com.example.a.A#getSymbol1
<em>Symbol1</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Symbol1</em>' attribute.
+ * @see #getSymbol1()
+ * @generated
+ */
+ void setSymbol1(String value);
+
+} // A
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/A.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/A.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/AFactory.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/AFactory.java?view=auto&rev=482150
==============================================================================
---
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/AFactory.java
(added)
+++
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/AFactory.java
Mon Dec 4 04:12:38 2006
@@ -0,0 +1,37 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.a;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public interface AFactory
+{
+
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ AFactory INSTANCE = com.example.a.impl.AFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>A</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>A</em>'.
+ * @generated
+ */
+ A createA();
+
+} //AFactory
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/AFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/AFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AFactoryImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AFactoryImpl.java?view=auto&rev=482150
==============================================================================
---
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AFactoryImpl.java
(added)
+++
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AFactoryImpl.java
Mon Dec 4 04:12:38 2006
@@ -0,0 +1,189 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.a.impl;
+
+import com.example.a.*;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.SDOFactory;
+
+import org.apache.tuscany.sdo.impl.FactoryBase;
+
+import org.apache.tuscany.sdo.model.ModelFactory;
+
+import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AFactoryImpl extends FactoryBase implements AFactory
+{
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_URI = "http://www.example.com/a";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_PREFIX = "a";
+ public static final int A = 1;
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AFactoryImpl()
+ {
+ super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.example.a");
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DataObject create(int typeNumber)
+ {
+ switch (typeNumber)
+ {
+ case A: return (DataObject)createA();
+ default:
+ return super.create(typeNumber);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public A createA()
+ {
+ AImpl a = new AImpl();
+ return a;
+ }
+
+ // Following creates and initializes SDO metadata for the supported types.
+ protected Type aType = null;
+
+ public Type getA()
+ {
+ return aType;
+ }
+
+
+ private static boolean isInited = false;
+
+ public static AFactoryImpl init()
+ {
+ if (isInited) return
(AFactoryImpl)FactoryBase.getStaticFactory(AFactoryImpl.NAMESPACE_URI);
+ AFactoryImpl theAFactoryImpl = new AFactoryImpl();
+ isInited = true;
+
+ // Initialize simple dependencies
+ SDOUtil.registerStaticTypes(SDOFactory.class);
+ SDOUtil.registerStaticTypes(ModelFactory.class);
+
+ // Create package meta-data objects
+ theAFactoryImpl.createMetaData();
+
+ // Initialize created meta-data
+ theAFactoryImpl.initializeMetaData();
+
+ // Mark meta-data to indicate it can't be changed
+ //theAFactoryImpl.freeze(); //FB do we need to freeze / should we freeze
????
+
+ return theAFactoryImpl;
+ }
+
+ private boolean isCreated = false;
+
+ public void createMetaData()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create types and their properties
+ aType = createType(false, A);
+ createProperty(true, aType, AImpl.SYMBOL1);
+
+ }
+
+ private boolean isInitialized = false;
+
+ public void initializeMetaData()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Obtain other dependent packages
+ ModelFactoryImpl theModelPackageImpl =
(ModelFactoryImpl)FactoryBase.getStaticFactory(ModelFactoryImpl.NAMESPACE_URI);
+ Property property = null;
+
+ // Add supertypes to types
+
+ // Initialize types and properties
+ initializeType(aType, A.class, "A", false);
+ property = (Property)aType.getProperties().get(AImpl.SYMBOL1);
+ initializeProperty(property, theModelPackageImpl.getString(), "symbol1",
null, 1, 1, A.class, false, false, false);
+
+ createXSDMetaData(theModelPackageImpl);
+ }
+
+ protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl)
+ {
+ super.initXSD();
+
+ Property property = null;
+
+ addXSDMapping
+ (aType,
+ new String[]
+ {
+ "name", "A",
+ "kind", "elementOnly"
+ });
+
+ addXSDMapping
+ ((Property)aType.getProperties().get(AImpl.SYMBOL1),
+ new String[]
+ {
+ "kind", "element",
+ "name", "symbol1"
+ });
+
+ property = createGlobalProperty
+ ("elemForDef1",
+ this.getA(),
+ new String[]
+ {
+ "kind", "element",
+ "name", "elemForDef1",
+ "namespace", "##targetNamespace"
+ });
+
+ }
+
+} //AFactoryImpl
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AImpl.java?view=auto&rev=482150
==============================================================================
---
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AImpl.java
(added)
+++
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AImpl.java
Mon Dec 4 04:12:38 2006
@@ -0,0 +1,190 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.a.impl;
+
+import com.example.a.A;
+import com.example.a.AFactory;
+
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.impl.DataObjectBase;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>A</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>[EMAIL PROTECTED] com.example.a.impl.AImpl#getSymbol1
<em>Symbol1</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class AImpl extends DataObjectBase implements A
+{
+ /**
+ * The feature id for the '<em><b>Symbol1</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int SYMBOL1 = 0;
+
+ /**
+ * This represents the number of properties for this type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+
+ public final static int SDO_PROPERTY_COUNT = 1;
+
+ /**
+ * The default value of the '[EMAIL PROTECTED] #getSymbol1()
<em>Symbol1</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSymbol1()
+ * @generated
+ * @ordered
+ */
+ protected static final String SYMBOL1_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '[EMAIL PROTECTED] #getSymbol1()
<em>Symbol1</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSymbol1()
+ * @generated
+ * @ordered
+ */
+ protected String symbol1 = SYMBOL1_DEFAULT_;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Type getType()
+ {
+ return ((AFactoryImpl)AFactory.INSTANCE).getA();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getSymbol1()
+ {
+ return symbol1;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSymbol1(String newSymbol1)
+ {
+ String oldSymbol1 = symbol1;
+ symbol1 = newSymbol1;
+ if (isNotifying())
+ notify(ChangeKind.SET, SYMBOL1, oldSymbol1, symbol1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object get(int propertyIndex, boolean resolve)
+ {
+ switch (propertyIndex)
+ {
+ case SYMBOL1:
+ return getSymbol1();
+ }
+ return super.get(propertyIndex, resolve);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void set(int propertyIndex, Object newValue)
+ {
+ switch (propertyIndex)
+ {
+ case SYMBOL1:
+ setSymbol1((String)newValue);
+ return;
+ }
+ super.set(propertyIndex, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void unset(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case SYMBOL1:
+ setSymbol1(SYMBOL1_DEFAULT_);
+ return;
+ }
+ super.unset(propertyIndex);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isSet(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case SYMBOL1:
+ return SYMBOL1_DEFAULT_ == null ? symbol1 != null :
!SYMBOL1_DEFAULT_.equals(symbol1);
+ }
+ return super.isSet(propertyIndex);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String toString()
+ {
+ if (isProxy(this)) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (symbol1: ");
+ result.append(symbol1);
+ result.append(')');
+ return result.toString();
+ }
+
+} //AImpl
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/com/example/a/impl/AImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java?view=auto&rev=482150
==============================================================================
---
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
(added)
+++
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
Mon Dec 4 04:12:38 2006
@@ -0,0 +1,102 @@
+package org.apache.tuscany.sdo.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import com.example.a.A;
+import com.example.a.AFactory;
+
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.CopyHelper;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.DataHelper;
+import commonj.sdo.helper.EqualityHelper;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+import commonj.sdo.impl.HelperProvider;
+
+public class HelperContextTestCase extends TestCase {
+
+ public void testDefaultHelperContext() {
+ HelperContext defaultHelperContext = HelperProvider.getDefaultContext();
+
+ assertNotNull(defaultHelperContext.getCopyHelper());
+ assertEquals(defaultHelperContext.getCopyHelper(), CopyHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getDataFactory());
+ assertEquals(defaultHelperContext.getDataFactory(), DataFactory.INSTANCE);
+ assertNotNull(defaultHelperContext.getDataHelper());
+ assertEquals(defaultHelperContext.getDataHelper(), DataHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getEqualityHelper());
+ assertEquals(defaultHelperContext.getEqualityHelper(),
EqualityHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getTypeHelper());
+ assertEquals(defaultHelperContext.getTypeHelper(), TypeHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getXMLHelper());
+ assertEquals(defaultHelperContext.getXMLHelper(), XMLHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getXSDHelper());
+ assertEquals(defaultHelperContext.getXSDHelper(), XSDHelper.INSTANCE);
+
+ }
+
+ public void testCreateHelperContext() {
+ HelperContext hc = SDOUtil.createHelperContext();
+ assertNotNull(hc.getCopyHelper());
+ assertNotNull(hc.getDataFactory());
+ assertNotNull(hc.getDataHelper());
+ assertNotNull(hc.getEqualityHelper());
+ assertNotNull(hc.getTypeHelper());
+ assertNotNull(hc.getXMLHelper());
+ assertNotNull(hc.getXSDHelper());
+
+ assertNotSame(hc.getDataFactory(), DataFactory.INSTANCE);
+ assertNotSame(hc.getTypeHelper(), TypeHelper.INSTANCE);
+ assertNotSame(hc.getXMLHelper(), XMLHelper.INSTANCE);
+ assertNotSame(hc.getXSDHelper(), XSDHelper.INSTANCE);
+ // the other "stateless" helpers may be the same as the singletons
+ }
+
+ /**
+ * two schemas load different types for the same namespaces into
+ * different scopes
+ * @throws IOException
+ */
+ public void testCrossScopeInterference() throws IOException
+ {
+ HelperContext hc1 = SDOUtil.createHelperContext();
+ HelperContext hc2 = SDOUtil.createHelperContext();
+
+// URL url = getClass().getResource("/HelperContextTestData/nsa_def1.xsd");
+// InputStream inputStream = url.openStream();
+// hc1.getXSDHelper().define(inputStream, url.toString());
+// inputStream.close();
+
+ SDOUtil.registerStaticTypes(AFactory.class);
+
+ URL url2 = getClass().getResource("/HelperContextTestData/nsa_def2.xsd");
+ InputStream inputStream2 = url2.openStream();
+ hc2.getXSDHelper().define(inputStream2, url2.toString());
+ inputStream2.close();
+
+ DataObject do1 = hc1.getDataFactory().create("http://www.example.com/a",
"A");
+ do1.set("symbol1", "foo");
+ assertTrue(do1 instanceof A);
+
+ DataObject do2 = hc2.getDataFactory().create("http://www.example.com/a",
"A");
+ try {
+ do2.set("symbol1", "should fail");
+ assertTrue("there is scross scope type interference", false);
+ }
+ catch (Exception e) {
+ // good
+ }
+ do2.set("symbol2", "bar");
+ }
+
+}
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def1.xsd
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def1.xsd?view=auto&rev=482150
==============================================================================
---
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def1.xsd
(added)
+++
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def1.xsd
Mon Dec 4 04:12:38 2006
@@ -0,0 +1,30 @@
+<?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 xmlns:a="http://www.example.com/a"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/a">
+
+ <xsd:element name="elemForDef1" type="a:A"/>
+
+ <xsd:complexType name="A">
+ <xsd:sequence>
+ <xsd:element name="symbol1" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def1.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def1.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd?view=auto&rev=482150
==============================================================================
---
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd
(added)
+++
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd
Mon Dec 4 04:12:38 2006
@@ -0,0 +1,30 @@
+<?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 xmlns:a="http://www.example.com/a"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/a">
+
+ <xsd:element name="elemForDef1" type="a:B"/>
+
+ <xsd:complexType name="B">
+ <xsd:sequence>
+ <xsd:element name="symbol2" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/tuscany/sandbox/kgoodson/moreTests/src/test/resources/HelperContextTestData/nsa_def2.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]