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/04/17 15:17:34 UTC
svn commit: r529593 - in
/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21:
UnderReviewSuite.java tests/xsd/XSDBaseTestCase.java
tests/xsd/XSDChoiceTest.java
Author: kelvingoodson
Date: Tue Apr 17 06:17:34 2007
New Revision: 529593
URL: http://svn.apache.org/viewvc?view=rev&rev=529593
Log:
TUSCANY-1209 applied Andy's patch and added the updated tests to the UnderReview suite.
Modified:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDChoiceTest.java
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java?view=diff&rev=529593&r1=529592&r2=529593
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java Tue Apr 17 06:17:34 2007
@@ -35,12 +35,15 @@
* <LI>{@link test.sdo21.paramatizedTests.conversion.TypeConversionTest}
* <LI>{@link test.sdo21.tests.general.XMLHelperTest}
* <LI>{@link test.sdo21.tests.scenarios.DataObjectListTest}
+ * <LI>{@link test.sdo21.tests.xsd.XSDChoiceTest}
* </UL>
*/
@RunWith(Suite.class)
@Suite.SuiteClasses( {test.sdo21.paramatizedTests.CTSParamatizedSuite.class,
test.sdo21.paramatizedTests.conversion.TypeConversionTest.class,
- test.sdo21.tests.general.XMLHelperTest.class, test.sdo21.tests.scenarios.DataObjectListTest.class})
+ test.sdo21.tests.general.XMLHelperTest.class,
+ test.sdo21.tests.scenarios.DataObjectListTest.class,
+ test.sdo21.tests.xsd.XSDChoiceTest.class})
public class UnderReviewSuite {
}
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java?view=diff&rev=529593&r1=529592&r2=529593
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java Tue Apr 17 06:17:34 2007
@@ -35,70 +35,83 @@
import commonj.sdo.Property;
import test.sdo21.CTSSuite;
import test.sdo21.framework.TestHelper;
+import org.junit.Before;
+import static org.junit.Assert.*;
/**
* Base class for all XSD tests.
*/
-public class XSDBaseTestCase extends TestCase {
+public class XSDBaseTestCase {
- protected static TestHelper testHelper;
+ protected TestHelper testHelper;
+ protected XSDHelper xsdHelper;
+ protected TypeHelper typeHelper;
+ protected DataFactory dataFactory;
+
+ @Before
+ public void setUp() throws Exception {
+ testHelper = CTSSuite.getTestHelper();
+ xsdHelper = testHelper.getXSDHelper();
+ typeHelper = testHelper.getTypeHelper();
+ dataFactory = testHelper.getDataFactory();
+ }
+ /**
+ * Parse an XSD file.
+ */
+ protected List define(String filename) throws IOException {
+
+ URL url = getClass().getResource(filename);
+ if (url == null) {
+ throw new RuntimeException("Could not locate " + filename);
+ }
+ InputStream inputStream = url.openStream();
+ XSDHelper xsdHelper = testHelper.getXSDHelper();
+ List typeList = xsdHelper.define(inputStream, url.toString());
+ inputStream.close();
+ return typeList;
+ }
- protected void setUp() throws Exception {
- testHelper = CTSSuite.getTestHelper();
- }
-
- protected final XSDHelper xsdHelper = XSDHelper.INSTANCE;
- protected final TypeHelper typeHelper = TypeHelper.INSTANCE;
- protected final DataFactory dataFactory = DataFactory.INSTANCE;
-
- public XSDBaseTestCase(String string) {
- super(string);
- }
-
- /**
- * Parse an XSD file.
- */
- protected List define(String filename) throws IOException {
-
-
- URL url = getClass().getResource( filename );
- InputStream inputStream = url.openStream();
- XSDHelper xsdHelper = testHelper.getXSDHelper();
- List typeList = xsdHelper.define(inputStream, url.toString());
- inputStream.close();
- return typeList;
- }
-
- protected void assertBaseTypeExists(Type type, String baseTypeName) {
- boolean found = false;
- Iterator iter = type.getBaseTypes().iterator();
- while (!found && iter.hasNext()) {
- String s = (String) iter.next();
- if (s.equals(baseTypeName)) {
- found = true;
- }
+ protected void assertBaseTypeExists(Type type, String baseTypeName) {
+ boolean found = false;
+ Iterator iter = type.getBaseTypes().iterator();
+ while (!found && iter.hasNext()) {
+ String s = (String) iter.next();
+ if (s.equals(baseTypeName)) {
+ found = true;
+ }
+ }
+ if (!found) {
+ fail("Type '" + type.getName() + "' should have base type '" + baseTypeName + "'");
+ }
}
- if (!found) {
- fail("Type '" + type.getName() + "' should have base type '" + baseTypeName + "'");
+
+ protected void assertPropertyExists(Type type, String propertyName, String propertyType, boolean isContainment, boolean isMany) {
+ Property p = type.getProperty(propertyName);
+ assertNotNull("property '" + propertyName + "'", p);
+ assertEquals("propertyType", propertyType, p.getType().getName());
+ assertEquals("isContainment", isContainment, p.isContainment());
+ assertEquals("isMany", isMany, p.isMany());
}
- }
- protected void assertPropertyExists(Type type, String propertyName, String propertyType, boolean isContainment, boolean isMany) {
- Property p = type.getProperty(propertyName);
- assertNotNull( "property '" + propertyName + "'", p );
- assertEquals( "propertyType", propertyType, p.getType().getName());
- assertEquals( "isContainment", isContainment, p.isContainment());
- assertEquals( "isMany", isMany, p.isMany());
- }
-
- protected void assertPropertyExists(Type type, String propertyName, String propertyType, boolean isContainment, boolean isMany, boolean isNullable) {
- Property p = type.getProperty(propertyName);
- assertNotNull( "property '" + propertyName + "'", p );
- assertEquals( "propertyType", propertyType, p.getType().getName());
- assertEquals( "isContainment", isContainment, p.isContainment());
- assertEquals( "isMany", isMany, p.isMany());
- assertEquals( "isNullable", isNullable, p.isNullable());
- }
+ protected void assertPropertyExists(Type type, String propertyName, String propertyType, boolean isContainment, boolean isMany, boolean isNullable) {
+ Property p = type.getProperty(propertyName);
+ assertNotNull("property '" + propertyName + "'", p);
+ assertEquals("propertyType", propertyType, p.getType().getName());
+ assertEquals("isContainment", isContainment, p.isContainment());
+ assertEquals("isMany", isMany, p.isMany());
+ assertEquals("isNullable", isNullable, p.isNullable());
+ }
+ public Type getType(List types, String name) {
+ Iterator it = types.iterator();
+ while (it.hasNext()) {
+ Type t = (Type) it.next();
+ if (t.getName().equals(name)) {
+ return t;
+ }
+ }
+ return null;
+ }
+
}
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDChoiceTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDChoiceTest.java?view=diff&rev=529593&r1=529592&r2=529593
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDChoiceTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDChoiceTest.java Tue Apr 17 06:17:34 2007
@@ -19,21 +19,18 @@
*/
package test.sdo21.tests.xsd;
-import junit.framework.Test;
-
import java.util.List;
import commonj.sdo.Type;
+import org.junit.Test;
+import static org.junit.Assert.*;
public class XSDChoiceTest extends XSDBaseTestCase {
- public XSDChoiceTest(String title) {
- super(title);
- }
-
/**
* @throws Exception if an exception occurs
*/
+ @Test
public void testTC224_Choice() throws Exception
{
// load the schema and obtain TypeList
@@ -68,6 +65,7 @@
/**
* @throws Exception if an exception occurs
*/
+ @Test
public void testTC225_Choice() throws Exception
{
// load the schema and obtain TypeList
@@ -102,6 +100,7 @@
/**
* @throws Exception if an exception occurs
*/
+ @Test
public void testTC226_Choice() throws Exception
{
// load the schema and obtain TypeList
@@ -136,6 +135,7 @@
/**
* @throws Exception if an exception occurs
*/
+ @Test
public void testTC227_Choice() throws Exception
{
// load the schema and obtain TypeList
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org