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/26 17:40:35 UTC
svn commit: r532781 - in
/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21:
UnderReviewSuite.java tests/api/SequenceAddOpenTest.java
tests/api/SequenceAddTypedTest.java
Author: kelvingoodson
Date: Thu Apr 26 08:40:34 2007
New Revision: 532781
URL: http://svn.apache.org/viewvc?view=rev&rev=532781
Log:
TUSCANY-1235 added tests attached to jira to under review suite -- also temporarily disabled XMLWithoutSchemaTest added in TUSCANYY-1234 since it runs (and fails) very slowly
Added:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java (with props)
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java (with props)
Modified:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.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=532781&r1=532780&r2=532781
==============================================================================
--- 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 Thu Apr 26 08:40:34 2007
@@ -44,7 +44,9 @@
test.sdo21.tests.conversion.StringConversionTest.class,
test.sdo21.tests.general.XMLHelperTest.class,
test.sdo21.tests.xsd.XSDComplexTypeTest.class,
- test.sdo21.tests.api.XMLWithoutSchemaTest.class})
+ /* test.sdo21.tests.api.XMLWithoutSchemaTest.class, *//* temporarily removing since they run very slowly and fails */
+ test.sdo21.tests.api.SequenceAddOpenTest.class,
+ test.sdo21.tests.api.SequenceAddTypedTest.class})
public class UnderReviewSuite {
}
Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java?view=auto&rev=532781
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java Thu Apr 26 08:40:34 2007
@@ -0,0 +1,426 @@
+/*
+ * 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.
+ *
+ * $Rev$ $Date$
+ */
+package test.sdo21.tests.api;
+
+import junit.framework.TestCase;
+import test.sdo21.framework.TestHelper;
+import test.sdo21.CTSSuite;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.DataFactory;
+
+/**
+ * Tests adding objects to a sequence. Note: the tests in this test case must be run sequentially as each test
+ * depends on state from the previous test.
+ */
+public class SequenceAddOpenTest extends TestCase {
+
+ protected TestHelper testHelper;
+ protected DataFactory dataFactory;
+ protected TypeHelper typeHelper;
+ protected DataObject testOpenDataObject;
+
+ public SequenceAddOpenTest(String string) {
+ super(string);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ testHelper = CTSSuite.getTestHelper();
+ dataFactory = testHelper.getDataFactory();
+ typeHelper = testHelper.getTypeHelper();
+
+ // define an open type
+ DataObject typeDef = dataFactory.create( "commonj.sdo", "Type" );
+ typeDef.set( "uri", "http://www.example.com/cts/SequenceAddOpenTest" );
+ typeDef.set( "name", "OpenDataObject" );
+ typeDef.set( "open", true );
+ typeDef.set( "sequenced", true );
+ Type openType = typeHelper.define( typeDef );
+
+ testOpenDataObject = dataFactory.create( openType );
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ * <p/>
+ * boolean add(String propertyName, Object value)
+ */
+ public void testAddBooleanByName() throws Exception {
+
+ //Get a sequence to add to
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Add 3 proprerties
+ testSequence.add("testBoolean1", Boolean.TRUE);
+ testSequence.add("testBoolean2", Boolean.FALSE);
+ testSequence.add("testBoolean3", Boolean.TRUE);
+
+ //Check that the size is reported correctly
+ //with the size of 3.
+ assertEquals(3, testSequence.size());
+
+ //Check the values that were added
+ assertEquals("true", testSequence.getValue(0));
+ assertEquals("false", testSequence.getValue(1));
+ assertEquals("true", testSequence.getValue(2));
+
+ Property prop = testSequence.getProperty(0);
+
+ //OnDemand property should be a string
+ //Checking only the first property
+ assertEquals("testBoolean1", prop.getName());
+ assertEquals("String", prop.getType().getName());
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ * <p/>
+ * boolean add(Property property, Object value)
+ */
+ public void testAddBooleanByProperty() throws Exception {
+
+ DataObject prop = dataFactory.create("commonj.sdo", "Property");
+ prop.set("type", typeHelper.getType("commonj.sdo", "Boolean"));
+ prop.set("name", "testBoolean1");
+
+ Property openProp = typeHelper.defineOpenContentProperty(null, prop);
+ Sequence testSequence = testOpenDataObject.getSequence();
+ testSequence.add(openProp, new Boolean(false));
+ assertEquals("false", testSequence.getValue(0));
+
+ openProp = testSequence.getProperty(0);
+
+ //OnDemand property should be a string
+ //Checking only the first property
+ assertEquals("testBoolean1", openProp.getName());
+ assertEquals("String", openProp.getType().getName());
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ * <p/>
+ * boolean add(int propertyIndex, Object value)
+ */
+ public void testAddBooleanByPropertyIndex() throws Exception {
+
+ Sequence testSequence = testOpenDataObject.getSequence();
+ testSequence.add("testBoolean", new Boolean(true));
+ testSequence.add("testBoolean", new Boolean(false));
+
+ //Actual value to test from sequence
+ testSequence.add(0, new Boolean(false));
+ assertEquals("false", testSequence.getValue(2));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ * <p/>
+ * boolean add(int index, String propertyName, Object value)
+ */
+ public void testAddBooleanByIndexAndPropertyName() throws Exception {
+
+ //Get a sequence from the test fixture DataObject
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ testSequence.add(0, "testBoolean", new Boolean(true));
+ assertEquals("true", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ * <p/>
+ * boolean add(int index, Property property, Object value)
+ */
+ public void testAddBooleanByIndexAndProperty() throws Exception {
+
+ DataObject prop = dataFactory.create("commonj.sdo", "Property");
+ prop.set("type", typeHelper.getType("commonj.sdo", "Boolean"));
+ prop.set("name", "testBoolean");
+
+ Property openProp = typeHelper.defineOpenContentProperty(null, prop);
+ Sequence testSequence = testOpenDataObject.getSequence();
+ testSequence.add(0, openProp, new Boolean(false));
+ assertEquals("false", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ * <p/>
+ * boolean add(int index, int propertyIndex, Object value)
+ */
+ public void testSequenceAddBooleanByIndexAndPropertyIndex() throws Exception {
+
+ Sequence testSequence = testOpenDataObject.getSequence();
+ testSequence.add("testBoolean", new Boolean(true));
+ testSequence.add("testBoolean", new Boolean(false));
+
+ //Actual value to test from sequence
+ testSequence.add(0, 0, new Boolean(false));
+ assertEquals("false", testSequence.getValue(2));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ * <p/>
+ * boolean add(String propertyName, Object value)
+ */
+ public void testAddStringByName() throws Exception {
+
+ //Get a sequence to add to
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ testSequence.add("testString", new String("testString"));
+ assertEquals("testString", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ * <p/>
+ * boolean add(Property property, Object value)
+ */
+ public void testAddStringByProperty() throws Exception {
+
+ DataObject prop = dataFactory.create("commonj.sdo", "Property");
+ prop.set("type", typeHelper.getType("commonj.sdo", "String"));
+ prop.set("name", "testString");
+
+ Property openProp = typeHelper.defineOpenContentProperty(null, prop);
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Actual value to test
+ testSequence.add(openProp, new String("testString"));
+ assertEquals("testString", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ * <p/>
+ * boolean add(int propertyIndex, Object value)
+ */
+ public void testAddStringByPropertyIndex() throws Exception {
+
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Add additional duplicate properties
+ testSequence.add("testString", new String("testString"));
+ testSequence.add("testString", new String("testString1"));
+
+ //Actual value to check
+ testSequence.add(0, new String("testString2"));
+ assertEquals("testString2", testSequence.getValue(2));
+
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ * <p/>
+ * boolean add(int index, String propertyName, Object value)
+ */
+ public void testAddStringByIndexAndPropertyName() throws Exception {
+
+ //Get a sequence from the test fixture DataObject
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Actual value to test
+ testSequence.add(0, "testString", new String("testString"));
+ assertEquals("testString", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ * <p/>
+ * boolean add(int index, Property property, Object value)
+ */
+ public void testAddStringByIndexAndProperty() throws Exception {
+
+ DataObject prop = dataFactory.create("commonj.sdo", "Property");
+ prop.set("type", typeHelper.getType("commonj.sdo", "String"));
+ prop.set("name", "testString");
+
+ Property openProp = typeHelper.defineOpenContentProperty(null, prop);
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Actual value to test
+ testSequence.add(0, openProp, new String("testString"));
+ assertEquals("testString", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ * <p/>
+ * boolean add(int index, int propertyIndex, Object value)
+ */
+ public void testSequenceAddStringByIndexAndPropertyIndex() throws Exception {
+
+ Sequence testSequence = testOpenDataObject.getSequence();
+ testSequence.add("testString", new String("testString1"));
+ testSequence.add("testString", new String("testString2"));
+
+ //Actual value to test from the sequence
+ testSequence.add(0, 0, new String("testString"));
+ assertEquals("testString2", testSequence.getValue(2));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Character
+ * <p/>
+ * boolean add(Character propertyName, Object value)
+ */
+ public void testAddCharacterByName() throws Exception {
+
+ //Get a sequence to add to
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ testSequence.add("testCharacter", new Character('A'));
+ assertEquals("A", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Character
+ * <p/>
+ * boolean add(Property property, Object value)
+ */
+ public void testAddCharacterByProperty() throws Exception {
+
+ DataObject prop = dataFactory.create("commonj.sdo", "Property");
+ prop.set("type", typeHelper.getType("commonj.sdo", "Character"));
+ prop.set("name", "testCharacter");
+
+ Property openProp = typeHelper.defineOpenContentProperty(null, prop);
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Actual value to test
+ testSequence.add(openProp, new Character('A'));
+ assertEquals("A", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Character
+ * <p/>
+ * boolean add(int propertyIndex, Object value)
+ */
+ public void testAddCharacterByPropertyIndex() throws Exception {
+
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Add additional duplicate properties
+ testSequence.add("testCharacter", new Character('A'));
+ testSequence.add("testCharacter", new Character('B'));
+
+ //Actual value to check
+ testSequence.add(0, new Character('C'));
+ assertEquals("C", testSequence.getValue(2));
+
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Character
+ * <p/>
+ * boolean add(int index, Character propertyName, Object value)
+ */
+ public void testAddCharacterByIndexAndPropertyName() throws Exception {
+
+ //Get a sequence from the test fixture DataObject
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Actual value to test
+ testSequence.add(0, "testCharacter", new Character('A'));
+ assertEquals("A", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Character
+ * <p/>
+ * boolean add(int index, Property property, Object value)
+ */
+ public void testAddCharacterByIndexAndProperty() throws Exception {
+
+ DataObject prop = dataFactory.create("commonj.sdo", "Property");
+ prop.set("type", typeHelper.getType("commonj.sdo", "Character"));
+ prop.set("name", "testCharacter");
+
+ Property openProp = typeHelper.defineOpenContentProperty(null, prop);
+ Sequence testSequence = testOpenDataObject.getSequence();
+
+ //Actual value to test
+ testSequence.add(0, openProp, new Character('A'));
+ assertEquals("A", testSequence.getValue(0));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Character
+ * <p/>
+ * boolean add(int index, int propertyIndex, Object value)
+ */
+ public void testSequenceAddCharacterByIndexAndPropertyIndex() throws Exception {
+
+ Sequence testSequence = testOpenDataObject.getSequence();
+ testSequence.add("testCharacter", new Character('A'));
+ testSequence.add("testCharacter", new Character('B'));
+
+ //Actual value to test from the sequence
+ testSequence.add(0, 0, new Character('C'));
+ assertEquals("C", testSequence.getValue(0));
+ assertEquals("A", testSequence.getValue(1));
+ assertEquals("B", testSequence.getValue(2));
+
+ }
+}
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java?view=auto&rev=532781
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java Thu Apr 26 08:40:34 2007
@@ -0,0 +1,593 @@
+/*
+ * 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.
+ *
+ * $Rev$ $Date$
+ */
+package test.sdo21.tests.api;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Sequence;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import test.sdo21.framework.TestHelper;
+import test.sdo21.CTSSuite;
+import junit.framework.TestCase;
+
+public class SequenceAddTypedTest extends TestCase {
+
+ protected String URI = "http://www.example.com/cts/SequenceAddTypedTest";
+
+ protected TestHelper testHelper;
+ protected DataFactory dataFactory;
+ protected TypeHelper typeHelper;
+ protected DataObject testDataObject;
+
+ public SequenceAddTypedTest(String string) throws Exception{
+ super(string);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ testHelper = CTSSuite.getTestHelper();
+ dataFactory = testHelper.getDataFactory();
+ typeHelper = testHelper.getTypeHelper();
+
+ defineDynamicTypes(getName());
+ }
+
+ /**
+ * Helper function to define the types
+ * and also get the test name for use
+ * in the URI to create a seperate xmldoc
+ * for each test case.
+ *
+ * @param testName Name to append to URI
+ */
+
+ protected void defineDynamicTypes(String testName) throws Exception {
+
+ //Setup Open DataObject and enable sequence
+
+
+ String testURI = URI + testName;
+
+ DataObject testRootType = dataFactory.create( "commonj.sdo", "Type" );
+ testRootType.set( "uri" , testURI);
+ testRootType.set( "name", testName);
+ testRootType.set( "sequenced", true );
+
+ DataObject testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testBoolean" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "Boolean" ));
+ testProperty.set( "many", true);
+
+ testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testString" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "String" ));
+ testProperty.set( "many", true);
+
+ testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testCharacter" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "Character" ));
+ testProperty.set( "many", true);
+
+ testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testDate" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "Date" ));
+ testProperty.set( "many", true);
+
+ testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testDateTime" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "DateTime" ));
+ testProperty.set( "many", true);
+
+ testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testDay" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "Day" ));
+ testProperty.set( "many", true);
+
+ testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testDecimal" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "Decimal" ));
+ testProperty.set( "many", true);
+
+ testProperty = testRootType.createDataObject( "property" );
+ testProperty.set( "name", "testDouble" );
+ testProperty.set( "type", typeHelper.getType("commonj.sdo", "Double" ));
+ testProperty.set( "many", true);
+
+ typeHelper.define( testRootType );
+ testDataObject = dataFactory.create( testURI, testName );
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ *
+ * boolean add(String propertyName, Object value)
+ *
+ */
+ public void testAddBooleanByName() throws Exception {
+
+ Boolean testTrue = Boolean.TRUE;
+ Boolean testFalse = Boolean.FALSE;
+
+ //DataObject testBoolean = testDataObject.getDataObject( "testBoolean" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ testSequence.add("testBoolean", Boolean.TRUE);
+ testSequence.add("testBoolean", Boolean.FALSE);
+ testSequence.add("testBoolean", Boolean.TRUE);
+ assertEquals( 3, testSequence.size() );
+
+ //Check the basic value
+ assertTrue(testTrue.equals(testSequence.getValue(0)));
+ assertTrue(testFalse.equals(testSequence.getValue(1)));
+ assertTrue(testTrue.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that they are equal to the types property
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ *
+ * boolean add(Property property, Object value)
+ *
+ */
+ public void testAddBooleanByProperty() throws Exception {
+
+ Boolean testTrue = new Boolean(true);
+ Boolean testFalse = new Boolean(false);
+
+ //DataObject testBoolean = testDataObject.getDataObject( "testBoolean" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( testSequence.size(), 0 );
+
+ Property prop = testDataObject.getInstanceProperty("testBoolean");
+ testSequence.add(prop, new Boolean(true));
+ testSequence.add(prop, new Boolean(false));
+ testSequence.add(prop, new Boolean(true));
+
+ //Check the basic value
+ assertEquals( 3, testSequence.size() );
+
+ assertTrue(testTrue.equals(testSequence.getValue(0)));
+ assertTrue(testFalse.equals(testSequence.getValue(1)));
+ assertTrue(testTrue.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that they are equal to the types property
+
+ prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ *
+ * boolean add(int propertyIndex, Object value)
+ *
+ */
+ public void testAddBooleanByPropertyIndex() throws Exception {
+
+ Boolean testTrue = new Boolean(true);
+ Boolean testFalse = new Boolean(false);
+
+ //DataObject testBoolean = testDataObject.getDataObject( "testBoolean" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ testSequence.add(0, new Boolean(true));
+ testSequence.add(0, new Boolean(false));
+ testSequence.add(0, new Boolean(true));
+
+ //Check the basic value
+ assertEquals(3, testSequence.size());
+ assertTrue(testTrue.equals(testSequence.getValue(0)));
+ assertTrue(testFalse.equals(testSequence.getValue(1)));
+ assertTrue(testTrue.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that they are equal to the types property
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ *
+ * boolean add(int index, String propertyName, Object value)
+ *
+ */
+ public void testAddBooleanByIndexAndPropertyName() throws Exception {
+
+ Boolean testTrue = new Boolean(true);
+ Boolean testFalse = new Boolean(false);
+
+ //DataObject testBoolean = testDataObject.getDataObject( "testBoolean" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ testSequence.add("testBoolean", new Boolean(true));
+ testSequence.add("testBoolean", new Boolean(false));
+ testSequence.add("testBoolean", new Boolean(true));
+
+ testSequence.add(1, "testBoolean", new Boolean(true));
+
+ //Check the basic values
+ assertEquals( 4, testSequence.size() );
+ assertTrue(testTrue.equals(testSequence.getValue(0)));
+ assertTrue(testTrue.equals(testSequence.getValue(1)));
+ assertTrue(testFalse.equals(testSequence.getValue(2)));
+ assertTrue(testTrue.equals(testSequence.getValue(3)));
+
+ //Get the properties and check
+ //that everything is set.
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+
+ }
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ *
+ * boolean add(int index, Property property, Object value)
+ *
+ */
+ public void testAddBooleanByIndexAndProperty() throws Exception {
+
+ Boolean testTrue = new Boolean(true);
+ Boolean testFalse = new Boolean(false);
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ Property prop = testDataObject.getInstanceProperty("testBoolean");
+ testSequence.add(0, prop, new Boolean(true));
+ testSequence.add(1, prop, new Boolean(false));
+ testSequence.add(2, prop, new Boolean(true));
+
+ //Check the basic value
+ assertEquals( 3, testSequence.size() );
+ assertTrue(testTrue.equals(testSequence.getValue(0)));
+ assertTrue(testFalse.equals(testSequence.getValue(1)));
+ assertTrue(testTrue.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that everything is set.
+
+ prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of Boolean
+ *
+ * boolean add(int index, int propertyIndex, Object value)
+ *
+ */
+ public void testAddBooleanByIndexAndPropertyIndex() throws Exception {
+
+ Boolean testTrue = new Boolean(true);
+ Boolean testFalse = new Boolean(false);
+
+ //DataObject testBoolean = testDataObject.getDataObject( "testBoolean" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ testSequence.add(0, 0, new Boolean(true));
+ testSequence.add(1, 0, new Boolean(false));
+ testSequence.add(2, 0, new Boolean(true));
+
+ //Check the basic value
+ assertEquals( 3, testSequence.size() );
+ assertTrue(testTrue.equals(testSequence.getValue(0)));
+ assertTrue(testFalse.equals(testSequence.getValue(1)));
+ assertTrue(testTrue.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that everything is set.
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testBoolean"));
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ *
+ * String add(String propertyName, Object value)
+ *
+ */
+ public void testAddStringByName() throws Exception {
+
+ String testString1 = new String("String1");
+ String testString2 = new String("String2");
+
+ //DataObject testString = testDataObject.getDataObject( "testString" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ testSequence.add("testString", new String("String1"));
+ testSequence.add("testString", new String("String2"));
+ testSequence.add("testString", new String("String1"));
+
+ //Check the basic value
+ assertTrue(testString1.equals(testSequence.getValue(0)));
+ assertTrue(testString2.equals(testSequence.getValue(1)));
+ assertTrue(testString1.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that they are equal to the types property
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ *
+ * String add(Property property, Object value)
+ *
+ */
+ public void testAddStringByProperty() throws Exception {
+
+ String testString1 = new String("String1");
+ String testString2 = new String("String2");
+
+ //DataObject testString = testDataObject.getDataObject( "testString" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ Property prop = testDataObject.getProperty("testString");
+ testSequence.add(prop, new String("String1"));
+ testSequence.add(prop, new String("String2"));
+ testSequence.add(prop, new String("String1"));
+
+ //Check the basic value
+ assertEquals( 3, testSequence.size() );
+
+ assertTrue(testString1.equals(testSequence.getValue(0)));
+ assertTrue(testString2.equals(testSequence.getValue(1)));
+ assertTrue(testString1.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that they are equal to the types property
+
+ prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ *
+ * String add(int propertyIndex, Object value)
+ *
+ */
+ public void testAddStringByPropertyIndex() throws Exception {
+
+ String testString1 = new String("String1");
+ String testString2 = new String("String2");
+
+ //DataObject testString = testDataObject.getDataObject( "testString" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+
+ //For the property index, it should be the
+ //order the types were defined in
+ testSequence.add(1, new String("String1"));
+ testSequence.add(1, new String("String2"));
+ testSequence.add(1, new String("String1"));
+
+ //Check the basic value
+ assertEquals( 3, testSequence.size() );
+ assertTrue(testString1.equals(testSequence.getValue(0)));
+ assertTrue(testString2.equals(testSequence.getValue(1)));
+ assertTrue(testString1.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that they are equal to the types property
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ *
+ * String add(int index, String propertyName, Object value)
+ *
+ */
+ public void testAddStringByIndexAndPropertyName() throws Exception {
+
+ String testString1 = new String("String1");
+ String testString2 = new String("String2");
+
+ //DataObject testString = testDataObject.getDataObject( "testString" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ testSequence.add("testString", new String("String1"));
+ testSequence.add("testString", new String("String2"));
+ testSequence.add("testString", new String("String1"));
+
+ testSequence.add(1, "testString", new String("String1"));
+
+ //Check the basic values
+ assertEquals( 4, testSequence.size() );
+ assertTrue(testString1.equals(testSequence.getValue(0)));
+ assertTrue(testString1.equals(testSequence.getValue(1)));
+ assertTrue(testString2.equals(testSequence.getValue(2)));
+ assertTrue(testString1.equals(testSequence.getValue(3)));
+
+ //Get the properties and check
+ //that everything is set.
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+
+ }
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ *
+ * String add(int index, Property property, Object value)
+ *
+ */
+ public void testAddStringByIndexAndProperty() throws Exception {
+
+ String testString1 = new String("String1");
+ String testString2 = new String("String2");
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ Property prop = testDataObject.getProperty("testString");
+ testSequence.add(0, prop, new String("String1"));
+ testSequence.add(1, prop, new String("String2"));
+ testSequence.add(2, prop, new String("String1"));
+
+ //Check the basic value
+ assertEquals( 3, testSequence.size() );
+ assertTrue(testString1.equals(testSequence.getValue(0)));
+ assertTrue(testString2.equals(testSequence.getValue(1)));
+ assertTrue(testString1.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that everything is set.
+
+ prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+
+ }
+
+ /**
+ * Tests the SDO 2.1 Sequence method for the
+ * java type of String
+ *
+ * String add(int index, int propertyIndex, Object value)
+ *
+ */
+ public void testAddStringByIndexAndPropertyIndex() throws Exception {
+
+ String testString1 = new String("String1");
+ String testString2 = new String("String2");
+
+ //DataObject testString = testDataObject.getDataObject( "testString" );
+
+ Sequence testSequence = testDataObject.getSequence();
+ assertEquals( 0, testSequence.size() );
+
+ testSequence.add(0, 1, new String("String1"));
+ testSequence.add(1, 1, new String("String2"));
+ testSequence.add(2, 1, new String("String1"));
+
+ //Check the basic value
+ assertEquals( 3, testSequence.size() );
+ assertTrue(testString1.equals(testSequence.getValue(0)));
+ assertTrue(testString2.equals(testSequence.getValue(1)));
+ assertTrue(testString1.equals(testSequence.getValue(2)));
+
+ //Get the properties and check
+ //that everything is set.
+
+ Property prop = testSequence.getProperty(0);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(1);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+ prop = testSequence.getProperty(2);
+ assertEquals( prop , testDataObject.getInstanceProperty("testString"));
+
+ }
+}
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org