blob: a2c55d3bf6f7a5a5bcac15911bb2a1ea38cde59e [file] [log] [blame]
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.testing.sdo.helper.xsdhelper.defineandgenerate;
import commonj.sdo.Property;
import commonj.sdo.Type;
import java.util.ArrayList;
import java.util.List;
import junit.textui.TestRunner;
import org.eclipse.persistence.sdo.SDOConstants;
import org.eclipse.persistence.sdo.SDOProperty;
import org.eclipse.persistence.sdo.SDOType;
public class DefineAndGenerateWithSDOImportsTestCases extends XSDHelperDefineAndGenerateTestCases {
public DefineAndGenerateWithSDOImportsTestCases(String name) {
super(name);
}
@Override
public String getControlGeneratedFileName() {
return "org/eclipse/persistence/testing/sdo/schemas/SimpleWithSDOImports.xsd";
}
@Override
public String getSchemaToDefine() {
return "org/eclipse/persistence/testing/sdo/schemas/SimpleWithSDOImports.xsd";
}
public static void main(String[] args) {
TestRunner.run(DefineAndGenerateWithSDOImportsTestCases.class);
}
@Override
public List getControlTypes() {
List types = new ArrayList();
String uri = "my.uri";
Type stringType = typeHelper.getType("commonj.sdo", "String");
SDOProperty xmlDataTypeProperty = (SDOProperty) typeHelper.getOpenContentProperty(SDOConstants.SDOXML_URL, SDOConstants.SDOXML_DATATYPE);
/****Customer TYPE*****/
//Customer TYPE
SDOType customerType = new SDOType(uri, "CustomerType");
customerType.setDataType(false);
customerType.setInstanceClassName("aPackage.CustomerType");
SDOProperty fNameProp = new SDOProperty(aHelperContext);
fNameProp.setName("firstName");
fNameProp.setXsd(true);
fNameProp.setXsdLocalName("firstName");
fNameProp.setType(stringType);
SDOProperty lNameProp = new SDOProperty(aHelperContext);
lNameProp.setName("lastName");
lNameProp.setXsd(true);
lNameProp.setXsdLocalName("lastName");
lNameProp.setType(stringType);
SDOProperty idProp = new SDOProperty(aHelperContext);
idProp.setName("id");
idProp.setXsd(true);
idProp.setXsdLocalName("id");
idProp.setInstanceProperty(xmlDataTypeProperty, SDOConstants.SDO_INTEGER);
idProp.setType(SDOConstants.SDO_INTEGER);
customerType.addDeclaredProperty(fNameProp);
customerType.addDeclaredProperty(lNameProp);
customerType.addDeclaredProperty(idProp);
types.add(customerType);
return types;
}
}