use of org.eclipse.persistence.sdo.helper.DefaultSchemaLocationResolver in project eclipselink by eclipse-ee4j.
the class DefineAndGenerateAppInfoTestCases method testNullSource.
public void testNullSource() {
InputStream is = getSchemaInputStream(getSchemaToDefine());
List types = xsdHelper.define(is, getSchemaLocation());
compareGeneratedTypes(getControlTypes(), types);
DefaultSchemaLocationResolver resolver = new DefaultSchemaLocationResolver(getMap());
String generatedSchema = ((SDOXSDHelper) xsdHelper).generate(types, resolver);
Type itemsType = typeHelper.getType(getUri(), "Items");
Property itemProp = itemsType.getProperty("item");
String appInfoItemTest = xsdHelper.getAppinfo(itemProp, null);
}
use of org.eclipse.persistence.sdo.helper.DefaultSchemaLocationResolver in project eclipselink by eclipse-ee4j.
the class DefineAndGenerateAppInfoTestCases method testDefineAndGenerate.
@Override
public void testDefineAndGenerate() throws Exception {
InputStream is = getSchemaInputStream(getSchemaToDefine());
List types = xsdHelper.define(is, getSchemaLocation());
compareGeneratedTypes(getControlTypes(), types);
DefaultSchemaLocationResolver resolver = new DefaultSchemaLocationResolver(getMap());
String generatedSchema = ((SDOXSDHelper) xsdHelper).generate(types, resolver);
String controlSchema = getSchema(getControlGeneratedFileName());
log("EXPECTED: \n" + controlSchema);
log("ACTUAL: \n" + generatedSchema);
StringReader reader = new StringReader(generatedSchema);
InputSource inputSource = new InputSource(reader);
Document generatedSchemaDoc = parser.parse(inputSource);
reader.close();
assertSchemaIdentical(getDocument(getControlGeneratedFileName()), generatedSchemaDoc);
}
use of org.eclipse.persistence.sdo.helper.DefaultSchemaLocationResolver in project eclipselink by eclipse-ee4j.
the class DefineAndGenerateWrapperTypeTestCases method testSchemaTypeAsDataObject.
public void testSchemaTypeAsDataObject() throws Exception {
DefaultSchemaLocationResolver resolver = new DefaultSchemaLocationResolver(getMap());
String generatedSchema = ((SDOXSDHelper) xsdHelper).generate(getTypesToGenerateFromForSchemaTypeTest(), resolver);
String controlSchema = getSchema(getControlGeneratedFileName());
log("EXPECTED: \n" + controlSchema);
log("ACTUAL: \n" + generatedSchema);
StringReader reader = new StringReader(generatedSchema);
InputSource inputSource = new InputSource(reader);
Document generatedSchemaDoc = parser.parse(inputSource);
reader.close();
assertSchemaIdentical(getDocument(getControlGeneratedFileName()), generatedSchemaDoc);
}
use of org.eclipse.persistence.sdo.helper.DefaultSchemaLocationResolver in project eclipselink by eclipse-ee4j.
the class DefineAndGenerateWrapperTypeTestCases method testGenerateSchemaRoundTrip.
public void testGenerateSchemaRoundTrip() throws Exception {
DefaultSchemaLocationResolver resolver = new DefaultSchemaLocationResolver(getMap());
FileInputStream is = new FileInputStream(getSchemaToDefine());
List types = xsdHelper.define(is, null);
String generatedSchema = ((SDOXSDHelper) xsdHelper).generate(types, resolver);
String controlSchema = getSchema(getSchemaToDefine());
log("EXPECTED: \n" + controlSchema);
log("ACTUAL: \n" + generatedSchema);
StringReader reader = new StringReader(generatedSchema);
InputSource inputSource = new InputSource(reader);
Document generatedSchemaDoc = parser.parse(inputSource);
reader.close();
assertSchemaIdentical(getDocument(getSchemaToDefine()), generatedSchemaDoc);
}
use of org.eclipse.persistence.sdo.helper.DefaultSchemaLocationResolver in project eclipselink by eclipse-ee4j.
the class DefineAndGenerateBidirectionalTestCases method testDefineAndGenerateUsingSpecMethod.
/**
* This function will define control types programmatically to compare to XSD definition
* by using the standard spec SDODataObject generation method on page
*
* The existing getControlTypes() uses non-public Property constructors
*/
public void testDefineAndGenerateUsingSpecMethod() throws Exception {
boolean useXSD = false;
List types;
DefaultSchemaLocationResolver resolver = new DefaultSchemaLocationResolver(getMap());
if (useXSD) {
// InputStream is = getSchemaInputStream(getSchemaToDefine());
// List types = xsdHelper.define(is, getSchemaLocation());
types = xsdHelper.define(getXSDString(XSD_PATH));
// compareGeneratedTypes(getControlTypesViaSpecMethod(), types);
} else {
registerTypes();
types = getTypesToGenerateFrom();
}
String generatedSchema = ((SDOXSDHelper) xsdHelper).generate(types, resolver);
log(generatedSchema);
try {
// false, types);
root = createRootObject(true, types);
} catch (Exception e) {
// SDOTestCase will currently throw a fail()
fail(e.getMessage());
}
int aRootsize = preOrderTraversalDataObjectList((SDODataObject) root).size();
// assertEquals(4, aRootsize);
// get opposite properties
// check that opposite bidirectional links resolve
// DataObject porderDO = (DataObject)root.get("porder[1]");
assertTrue(writeXML(root, URINAME, COMPANY_TYPENAME, System.out));
// assertXMLIdentical(getDocument(getControlGeneratedFileName()), generatedSchemaDoc);
}
Aggregations