public SDOType getRootSDOType() {
    SDOType type = new SDOType("http://testing", "myRoot");
    type.setOpen(true);
    type.setAbstract(false);
    SDOProperty prop = new SDOProperty(aHelperContext);
    prop.setName("name");
    prop.setType(SDOConstants.SDO_STRING);
    prop.setContainingType(type);
    type.addDeclaredProperty(prop);

    SDOProperty prop2 = new SDOProperty(aHelperContext);
    prop2.setName("child");
    prop2.setType(typeHelper.getType("http://testing", "firstChildType"));
    prop2.setContainment(true);
    prop2.setContainingType(type);
    type.addDeclaredProperty(prop2);

    SDOProperty prop3 = new SDOProperty(aHelperContext);
    prop3.setName("child2");
    prop3.setType(typeHelper.getType("http://testing", "firstChildType"));
    prop3.setContainment(true);
    prop3.setContainingType(type);
    type.addDeclaredProperty(prop3);

    SDOProperty prop4 = new SDOProperty(aHelperContext);
    prop4.setName("nullTypeProp");
    // we were omitting setting the Type on purpose here - we don't need it - just add anything
    prop4.setType(SDOConstants.SDO_BOOLEAN);

    prop4.setContainingType(type);
    type.addDeclaredProperty(prop4);

    ((SDOTypeHelper) typeHelper).addType(type);
    return type;
  }
  // purpose: detach a dataobject from one tree and set it to another tree, see changesummary doc.
  // issue number 9
  public void testIsModifiedMoveDataObjectFromOneTreeToAnother() {
    changeSummary.beginLogging();

    SDOType changeSummaryType =
        (SDOType) typeHelper.getType(SDOConstants.SDO_URL, SDOConstants.CHANGESUMMARY);
    SDOType dataObjectType =
        (SDOType) typeHelper.getType(SDOConstants.SDO_URL, SDOConstants.DATAOBJECT);

    SDODataObject o; // = new SDODataObject();
    SDOType ty = new SDOType("newTypeUri", "newType");
    ty.setOpen(true);
    SDOProperty p = new SDOProperty(aHelperContext);
    p.setName("new Property");
    p.setContainment(true);
    p.setType(dataObjectType);
    ty.addDeclaredProperty(p);
    SDOProperty p1 = new SDOProperty(aHelperContext);
    p1.setName("new Property ChangeSummary");
    p1.setContainment(false);
    p1.setType(changeSummaryType);
    ty.addDeclaredProperty(p1);

    o = (SDODataObject) dataFactory.create(ty);
    o.getChangeSummary().beginLogging();

    containedDataObject.detach();
    assertDetached(containedDataObject, changeSummary, true); // container and cs will not be set

    o.set(p, containedDataObject);

    assertCreated(containedDataObject, o.getChangeSummary());
    assertModified(o, o.getChangeSummary());
    assertDetached(containedDataObject, changeSummary, false); // container and cs will be set
    assertModified(root, changeSummary);
  }
  public List getControlTypes() {
    List types = new ArrayList();
    String uri = "http://www.example.org";

    Type stringType = typeHelper.getType("commonj.sdo", "String");
    Type byteType = typeHelper.getType("commonj.sdo", "Bytes");

    SDOType employeeSDOType = new SDOType(uri, "EmployeeType");
    employeeSDOType.setInstanceClassName("defaultPackage.EmployeeType");
    SDOProperty prop = new SDOProperty(aHelperContext);
    prop.setName("id");
    prop.setType(stringType);
    // prop.setAttribute(false);
    // prop.setElement(true);
    prop.setInstanceProperty(SDOConstants.XMLELEMENT_PROPERTY, Boolean.TRUE);
    prop.setXsd(true);
    prop.setXsdLocalName("id");
    prop.setContainment(true);
    employeeSDOType.addDeclaredProperty(prop);

    SDOProperty prop2 = new SDOProperty(aHelperContext);
    prop2.setName("name");
    prop2.setType(stringType);
    // prop2.setAttribute(false);
    // prop2.setElement(true);
    prop2.setInstanceProperty(SDOConstants.XMLELEMENT_PROPERTY, Boolean.TRUE);
    prop2.setXsd(true);
    prop2.setXsdLocalName("name");
    prop2.setContainment(true);
    employeeSDOType.addDeclaredProperty(prop2);

    SDOProperty prop3 = new SDOProperty(aHelperContext);
    prop3.setName("photo");
    prop3.setType(byteType);
    // prop3.setAttribute(false);
    // prop3.setElement(true);
    prop3.setInstanceProperty(SDOConstants.XMLELEMENT_PROPERTY, Boolean.TRUE);
    prop3.setXsd(true);
    prop3.setXsdLocalName("photo");
    prop3.setContainment(true);
    prop3.setXsdType(XMLConstants.BASE_64_BINARY_QNAME);

    prop3.setInstanceProperty(SDOConstants.MIME_TYPE_PROPERTY, "image/jpeg");
    employeeSDOType.addDeclaredProperty(prop3);
    types.add(employeeSDOType);
    return types;
  }
 // 17. purpose: getBigDecimal with bytes property
 public void testGetDecimalFromBytes() {
   SDOProperty property = (SDOProperty) dataObject.getInstanceProperty(PROPERTY_NAME);
   property.setType(SDOConstants.SDO_BYTES);
   dataObject.set(property, new String("abcd").getBytes());
   try {
     dataObject.getBigDecimal(property);
     fail("ClassCastException should be thrown.");
   } catch (ClassCastException e) {
   }
 }
  // 20. purpose: getBigInteger with Defined integer Property
  public void testGetIntegerConversionFromDefinedIntegerProperty() {
    // dataObject's type add int property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_INTEGER);

    BigInteger bi = new BigInteger("12");
    dataObject.setBigInteger(property, bi); // add it to instance list

    this.assertEquals(bi, dataObject.getBigInteger(property));
  }
 // 3. purpose: getBigInteger with character property
 public void testGetIntegerFromCharacter() {
   SDOProperty property = (SDOProperty) dataObject.getInstanceProperty(PROPERTY_NAME);
   property.setType(SDOConstants.SDO_CHARACTER);
   dataObject.set(property, 'd');
   try {
     dataObject.getBigInteger(property);
     fail("ClassCastException should be thrown.");
   } catch (ClassCastException e) {
   }
 }
 // 1. purpose: getBigInteger with boolean property
 public void testGetIntegerFromBoolean() {
   SDOProperty property = (SDOProperty) dataObject.getInstanceProperty(PROPERTY_NAME);
   property.setType(SDOConstants.SDO_BOOLEAN);
   dataObject.set(property, true);
   try {
     BigInteger bigIntegerValue = dataObject.getBigInteger(property);
     assertEquals(1, bigIntegerValue);
   } catch (ClassCastException e) {
   }
 }
  // 6. purpose: getBigInteger with Undefined Double Property
  public void testGetIntegerConversionFromUnDefinedDoubleProperty() {
    SDOProperty property = new SDOProperty(aHelperContext);
    property.setName(PROPERTY_NAME);
    property.setType(SDOConstants.SDO_DOUBLE);

    try {
      dataObject.getBigInteger(property);
      fail("IllegalArgumentException should be thrown.");
    } catch (IllegalArgumentException e) {
    }
  }
  // 22. purpose: getBigInteger with date property
  public void testGetIntegerFromDate() {
    SDOProperty property = (SDOProperty) dataObject.getInstanceProperty(PROPERTY_NAME);
    property.setType(SDOConstants.SDO_DATE);

    dataObject.set(property, Calendar.getInstance().getTime());
    try {
      dataObject.getBigInteger(property);
      fail("ClassCastException should be thrown.");
    } catch (ClassCastException e) {
    }
  }
  // 9. purpose: getBigInteger with Defined int Property
  public void testGetIntegerConversionFromDefinedIntProperty() {
    // dataObject's type add int property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_INT);

    int in = 12;
    BigInteger bd = new BigInteger(String.valueOf(in));
    dataObject.setInt(property, in); // add it to instance list

    this.assertEquals(bd, dataObject.getBigInteger(property));
  }
  // 14. purpose: getBigInteger with Defined String Property
  public void testGetgetIntegerConversionFromDefinedStringProperty() {
    // dataObject's type add int property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_STRING);

    String str = "12";
    BigInteger bd = new BigInteger(str);
    dataObject.setString(property, str); // add it to instance list

    this.assertEquals(bd, dataObject.getBigInteger(property));
  }
  // 11. purpose: getBigInteger with Defined long Property
  public void testGetIntegerConversionFromDefinedLongProperty() {
    // dataObject's type add short property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_LONG);

    long lg = 12;
    BigInteger bd = new BigInteger(String.valueOf(lg));
    dataObject.setLong(property, lg); // add it to instance list

    this.assertEquals(bd, dataObject.getBigInteger(property));
  }
  public SDOType getFirstChildType() {
    SDOType type = new SDOType("http://testing", "firstChildType");
    type.setOpen(true);
    type.setAbstract(false);

    SDOProperty prop = new SDOProperty(aHelperContext);
    prop.setName("name");
    prop.setType(SDOConstants.SDO_STRING);
    prop.setContainingType(type);
    type.addDeclaredProperty(prop);

    SDOProperty prop2 = new SDOProperty(aHelperContext);
    prop2.setName("child");
    prop2.setType(typeHelper.getType("http://testing", "secondChildType"));
    prop2.setContainment(true);
    prop2.setContainingType(type);
    type.addDeclaredProperty(prop2);

    ((SDOTypeHelper) typeHelper).addType(type);
    return type;
  }
  // 5. purpose: getBigInteger with Defined Double Property
  public void testGetIntegerConversionFromDefinedDoubleProperty() {
    // dataObject's type add boolean property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_DOUBLE);

    double db = 12;
    int il = (int) db;
    BigInteger bd = new BigInteger(String.valueOf(il));
    dataObject.setDouble(property, db); // add it to instance list

    this.assertEquals(bd, dataObject.getBigInteger(property));
  }
  // 7. purpose: getBigInteger with Defined float Property
  public void testGetIntegerConversionFromDefinedFloatProperty() {
    // dataObject's type add float property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_FLOAT);

    float fl = 12;
    int il = (int) fl;
    BigInteger bd = new BigInteger(String.valueOf(il));
    dataObject.setFloat(property, fl); // add it to instance list

    this.assertEquals(bd, dataObject.getBigInteger(property));
  }
  // 18. purpose: getBigInteger with Defined Decimal Property
  public void testGetIntegerConversionFromDefinedDecimalProperty() {
    // dataObject's type add int property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_DECIMAL);

    int db = 12;
    BigDecimal bd = new BigDecimal(db);
    BigInteger bd_ = new BigInteger(String.valueOf(bd));
    dataObject.setBigDecimal(property, bd); // add it to instance list

    this.assertEquals(bd_, dataObject.getBigInteger(property));
  }
  // 16. purpose: getBigInteger with Defined Bytes Property !! OX Pro    !!
  public void testGetIntegerConversionFromDefinedBytesProperty() {
    // dataObject's type add boolean property
    SDOProperty property = ((SDOProperty) type.getProperty(PROPERTY_NAME));
    property.setType(SDOConstants.SDO_BYTES);

    byte[] b = {12, 13};
    BigInteger bin = new BigInteger(b);

    dataObject.setBytes(property, b); // add it to instance list

    this.assertEquals(bin, dataObject.getBigInteger(property));
  }
  public void
      testGetBooleanConversionWithPathFromDefinedBooleanPropertyEqualSignBracketInPathDotSet() {
    SDOProperty prop = (SDOProperty) dataObject_c0.getType().getProperty("test");
    prop.setType(SDOConstants.SDO_INT);
    Integer bb = new Integer(12);

    // List b = new ArrayList();
    // dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
    dataObject_a.setInt(propertyTest + "test", bb.intValue());

    this.assertEquals(bb.intValue(), dataObject_a.getInt(propertyTest + "test"));
  }
  // 2. purpose: getBigInteger with byte property
  public void testGetIntegerFromByte() {
    SDOProperty property = (SDOProperty) dataObject.getInstanceProperty(PROPERTY_NAME);
    property.setType(SDOConstants.SDO_BYTE);

    byte theByte = 10;
    dataObject.set(property, theByte);
    try {
      BigInteger value = dataObject.getBigInteger(property);
      BigInteger control = new BigInteger("10");
      assertEquals(control, value);
      // TODO: conversion not supported by sdo spec but is supported by TopLink
    } catch (ClassCastException e) {
    }
  }
 // 13. purpose: getBigInteger with Undefined short Property
 public void testGetIntegerConversionFromUnDefinedShortProperty() {
   ((SDOType) dataObject.getType()).setOpen(true);
   SDOProperty property = new SDOProperty(aHelperContext);
   property.setName(PROPERTY_NAME);
   property.setType(SDOConstants.SDO_SHORT);
   short shortValue = 2;
   dataObject.set(property, shortValue);
   try {
     BigInteger value = dataObject.getBigInteger(property);
     BigInteger controlValue = new BigInteger("2");
     assertEquals(controlValue, value);
     // TODO: conversion not supported by sdo spec but is supported by TopLink
   } catch (ClassCastException e) {
   }
 }
  // purpose: after logging, dataobject create dataobject
  public void testIsModifiedFactory() {
    changeSummary.beginLogging();
    SDODataObject o; // = new SDODataObject();
    SDOType ty = new SDOType("newTypeUri", "newType");
    ty.setOpen(true);
    SDOProperty p = new SDOProperty(aHelperContext);
    p.setName("new Property");
    p.setContainment(false);
    p.setType(SDOConstants.SDO_STRING);
    ty.addDeclaredProperty(p);

    o = (SDODataObject) root.createDataObject(rootProperty, ty);

    assertCreated(o, changeSummary);
  }
  public void testSetGetDataObjectWithQueryPath() {
    SDOProperty property_c1_object = new SDOProperty(aHelperContext);
    property_c1_object.setName("PName-c1");
    property_c1_object.setContainment(true);
    property_c1_object.setMany(true);
    property_c1_object.setType(SDOConstants.SDO_INT);

    type_c0.addDeclaredProperty(property_c1_object);

    Integer b = new Integer(12);

    dataObject_a.setInt("PName-a0/PName-b0[number='1']/PName-c1.0", b.intValue());

    this.assertEquals(
        b.intValue(), dataObject_a.getInt("PName-a0/PName-b0[number='1']/PName-c1.0"));
  }
  // purpose: opencontent properties
  public void testGetIntConversionFromDefinedPropertyWithPath() {
    SDOProperty property_c1_object = ((SDOProperty) dataObject_c1.getInstanceProperty("PName-c1"));
    property_c1_object.setType(SDOConstants.SDO_INT);

    // type_c0.addDeclaredProperty(property_c1_object);
    List objects = new ArrayList();
    Integer b = new Integer(12);
    Integer bb = new Integer(2);
    objects.add(b);
    objects.add(bb);

    dataObject_c1.set(property_c1_object, objects); // add it to instance list

    this.assertEquals(
        bb.intValue(), dataObject_a.getInt("PName-a0/PName-b0[number='1']/PName-c1.1"));
  }
  public void setUp() { // set up as a/b/c
    super.setUp();

    type_a = new SDOType(URINAME, TYPENAME_A);
    type_b = new SDOType(URINAME, TYPENAME_B);
    type_c = new SDOType(URINAME, TYPENAME_C);
    type_c_bNotSDODataOject = new SDOType(URINAME, TYPENAME_C);
    type_a_bNotSDODataOject = new SDOType(URINAME, TYPENAME_A);
    type_b_bNotSDODataOject = new SDOType(URINAME, TYPENAME_B);

    property_a = new SDOProperty(aHelperContext);
    property_a.setContainment(true);
    property_a.setName(PROPERTY_NAME_A);
    property_a.setType(type_b);
    type_a.addDeclaredProperty(property_a);
    dataObject_a = (SDODataObject) dataFactory.create(type_a);

    property_b = new SDOProperty(aHelperContext);
    property_b.setContainment(true);
    property_b.setMany(true);
    property_b.setType(type_c);
    property_b.setName(PROPERTY_NAME_B);
    type_b.addDeclaredProperty(property_b);
    dataObject_b = (SDODataObject) dataFactory.create(type_b);

    dataObject_c = (SDODataObject) dataFactory.create(type_c);
    dataObject_a.set(property_a, dataObject_b); // a dataobject's a property has value b dataobject
    List objects = new ArrayList();
    objects.add(dataObject_c);
    dataObject_b.set(property_b, objects); // b dataobject's b property has value c dataobject

    property_a_bNotSDODataOject = new SDOProperty(aHelperContext);
    property_a_bNotSDODataOject.setName(PROPERTY_NAME_A);
    property_a_bNotSDODataOject.setType(type_b_bNotSDODataOject);
    type_a_bNotSDODataOject.addDeclaredProperty(property_a_bNotSDODataOject);
    dataObject_a_bNotSDODataOject = (SDODataObject) dataFactory.create(type_a_bNotSDODataOject);

    property_b_bNotSDODataOject = new SDOProperty(aHelperContext);
    property_b_bNotSDODataOject.setName(PROPERTY_NAME_B);
    property_b_bNotSDODataOject.setType(SDOConstants.SDO_STRING);
    type_b_bNotSDODataOject.addDeclaredProperty(property_b_bNotSDODataOject);
    dataObject_b_bNotSDODataOject = (SDODataObject) dataFactory.create(type_b_bNotSDODataOject);

    dataObject_c_bNotSDODataOject = (SDODataObject) dataFactory.create(type_c_bNotSDODataOject);
    dataObject_a_bNotSDODataOject.set(
        property_a_bNotSDODataOject,
        dataObject_b_bNotSDODataOject); // a dataobject's a property has value b dataobject
    dataObject_b_bNotSDODataOject.set(
        property_b_bNotSDODataOject, "test"); // b dataobject's b property has value c dataobject

    /*List basTypes_a = new ArrayList();
    basTypes_a.add(type_b);
    basTypes_a.add(type_c);

    List basTypes_b = new ArrayList();
    basTypes_b.add(type_c);

    type_a.setBaseTypes(basTypes_a);
    type_b.setBaseTypes(basTypes_b);*/
    type_a_pathLength_1 = new SDOType(URINAME, TYPENAME_A);
    property_a_pathLength_1 = new SDOProperty(aHelperContext);
    property_a_pathLength_1.setName(PROPERTY_NAME_A_LENGTH_1);
    type_a_pathLength_1.addDeclaredProperty(property_a_pathLength_1);

    dataObject_a_pathLength_1 = (SDODataObject) dataFactory.create(type_a_pathLength_1);
  }