Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/common/Inst2XsdTestBase.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/common/Inst2XsdTestBase.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/common/Inst2XsdTestBase.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/common/Inst2XsdTestBase.java Sun Feb 6 01:51:55 2022 @@ -14,7 +14,6 @@ */ package tools.inst2xsd.common; -import common.Common; import org.apache.xmlbeans.*; import org.apache.xmlbeans.impl.inst2xsd.Inst2Xsd; import org.apache.xmlbeans.impl.inst2xsd.Inst2XsdOptions; @@ -24,38 +23,36 @@ import tools.xml.XmlComparator; import java.util.ArrayList; import java.util.Collection; -import static org.junit.Assert.assertNotNull; +import static common.Common.P; +import static common.Common.XBEAN_CASE_ROOT; +import static org.junit.jupiter.api.Assertions.assertNotNull; -public class Inst2XsdTestBase extends Common { - - public static tools.inst2xsd.common.Inst2XsdCommon common; - private static boolean _verbose = true; - - private static String caseroot = XBEAN_CASE_ROOT; +public final class Inst2XsdTestBase { + private static final String caseroot = XBEAN_CASE_ROOT; //location of files under "cases folder" - private static String miscDir = caseroot + P + "tools"; - private static String inst2xsdDir = miscDir + P + "inst2xsd" + P; - protected static String OPTION_CASES_DIR = inst2xsdDir + P + "options" + P; - protected static String SCHEMA_CASES_DIR = inst2xsdDir + P + "schema" + P; - protected static final String BASEXML = OPTION_CASES_DIR + "base.xml"; - protected static final String EXPBASEXML = OPTION_CASES_DIR + "base0.xsd"; + private static final String miscDir = caseroot + P + "tools"; + private static final String inst2xsdDir = miscDir + P + "inst2xsd" + P; + public static final String OPTION_CASES_DIR = inst2xsdDir + P + "options" + P; + public static String SCHEMA_CASES_DIR = inst2xsdDir + P + "schema" + P; + public static final String BASEXML = OPTION_CASES_DIR + "base.xml"; + public static final String EXPBASEXML = OPTION_CASES_DIR + "base0.xsd"; - protected XmlObject getTypeXml(String val) throws Exception { + public static XmlObject getTypeXml(String val) throws Exception { return XmlObject.Factory.parse(setTypeVal(val)); } - private String setTypeVal(String val) { + private static String setTypeVal(String val) { String base_start = "<a xmlns=\"typeTests\">"; String base_end = "</a>"; return base_start + val + base_end; } - protected XmlObject getAttrTypeXml(String val) throws Exception { + public static XmlObject getAttrTypeXml(String val) throws Exception { return XmlObject.Factory.parse(setAttrVal(val)); } - private String setAttrVal(String val) { + private static String setAttrVal(String val) { String attr_base_end = "\" />"; String attr_base_start = "<a xmlns=\"attrTests\" a=\""; return attr_base_start + val + attr_base_end; @@ -63,7 +60,7 @@ public class Inst2XsdTestBase extends Co //attribute testing methods - private String getAttrTypeXmlVenetian(String type) { + private static String getAttrTypeXmlVenetian(String type) { return "<schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" " + "targetNamespace=\"attrTests\" xmlns=\"http://www.w3.org/2001/XMLSchema\">" + "<element name=\"a\" type=\"att:aType\" xmlns:att=\"attrTests\"/>" + @@ -75,7 +72,7 @@ public class Inst2XsdTestBase extends Co "</simpleContent></complexType></schema>"; } - private String getAttrTypeXmlRDandSS(String type) { + private static String getAttrTypeXmlRDandSS(String type) { return "<schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" " + "targetNamespace=\"attrTests\" xmlns=\"http://www.w3.org/2001/XMLSchema\">" + "<element name=\"a\">" + @@ -88,57 +85,48 @@ public class Inst2XsdTestBase extends Co "</complexType></element></schema>"; } - protected void runAttrTypeChecking(XmlObject act, String expType) throws Exception { - - log("=== Venetian options ==="); + public static void runAttrTypeChecking(XmlObject act, String expType) throws Exception { runAttrTypeChecking(act, expType, Inst2XsdCommon.getVenetianOptions()); - log("=== Russian options ==="); runAttrTypeChecking(act, expType, Inst2XsdCommon.getRussianOptions()); - log("=== Salami options ==="); runAttrTypeChecking(act, expType, Inst2XsdCommon.getSalamiOptions()); - log("=== Default options ==="); runAttrTypeChecking(act, expType, Inst2XsdCommon.getDefaultInstOptions()); } - private void runAttrTypeChecking(XmlObject act, String expType, Inst2XsdOptions opt) throws Exception { + private static void runAttrTypeChecking(XmlObject act, String expType, Inst2XsdOptions opt) throws Exception { SchemaDocument[] venetian = (SchemaDocument[]) runInst2Xsd(act, opt); checkLength(venetian, 1); if (opt.getDesign() == Inst2XsdOptions.DESIGN_RUSSIAN_DOLL || - opt.getDesign() == Inst2XsdOptions.DESIGN_SALAMI_SLICE) + opt.getDesign() == Inst2XsdOptions.DESIGN_SALAMI_SLICE) { compare(venetian[0], XmlObject.Factory.parse(getAttrTypeXmlRDandSS(expType))); - else if (opt.getDesign() == Inst2XsdOptions.DESIGN_VENETIAN_BLIND) + } else if (opt.getDesign() == Inst2XsdOptions.DESIGN_VENETIAN_BLIND) { compare(venetian[0], XmlObject.Factory.parse(getAttrTypeXmlVenetian(expType))); - else + } else { throw new Exception("Design style was not found"); + } checkInstance(venetian, new XmlObject[]{act}); } //element value test methods - protected void runTypeChecking(XmlObject act, String expType) throws Exception { - log("=== Venetian options ==="); - runTypeChecking(act, expType, Inst2XsdCommon.getVenetianOptions()); - log("=== Russian options ==="); - runTypeChecking(act, expType, Inst2XsdCommon.getRussianOptions()); - log("=== Salami options ==="); - runTypeChecking(act, expType, Inst2XsdCommon.getSalamiOptions()); - log("=== Default options ==="); - runTypeChecking(act, expType, Inst2XsdCommon.getDefaultInstOptions()); - } - - - private void runTypeChecking(XmlObject act, String expType, Inst2XsdOptions opt) throws Exception { - SchemaDocument[] venetian = (SchemaDocument[]) runInst2Xsd(act, opt); - checkLength(venetian, 1); - log("actual: " + act); - log("expType: " + expType); - checkInstance(venetian, new XmlObject[]{act}); - compare(venetian[0], XmlObject.Factory.parse(getExpTypeXml(expType))); + public static void runTypeChecking(XmlObject act, String expType) throws Exception { + Inst2XsdOptions[] opts = { + Inst2XsdCommon.getVenetianOptions(), + Inst2XsdCommon.getRussianOptions(), + Inst2XsdCommon.getSalamiOptions(), + Inst2XsdCommon.getDefaultInstOptions() + }; + + for (Inst2XsdOptions opt : opts) { + SchemaDocument[] doc = (SchemaDocument[]) runInst2Xsd(act, opt); + checkLength(doc, 1); + checkInstance(doc, new XmlObject[]{act}); + compare(doc[0], XmlObject.Factory.parse(getExpTypeXml(expType))); + } } - private String getExpTypeXml(String type) { + private static String getExpTypeXml(String type) { return "<xs:schema attributeFormDefault=\"unqualified\" " + "elementFormDefault=\"qualified\" targetNamespace=\"typeTests\"" + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" >" + @@ -148,117 +136,115 @@ public class Inst2XsdTestBase extends Co } //type coercion/LCD test methods - protected void runLCDTypeCheckTest(String val1, String val2, String expType) throws Exception { - log("=== Venetian options ==="); + public static void runLCDTypeCheckTest(String val1, String val2, String expType) throws Exception { runLCDTypeChecking(val1, val2, expType, Inst2XsdCommon.getVenetianOptions()); - log("=== Russian options ==="); runLCDTypeChecking(val1, val2, expType, Inst2XsdCommon.getRussianOptions()); - log("=== Salami options ==="); runLCDTypeChecking(val1, val2, expType, Inst2XsdCommon.getSalamiOptions()); - log("=== Default options ==="); runLCDTypeChecking(val1, val2, expType, Inst2XsdCommon.getDefaultInstOptions()); } - private void runLCDTypeChecking(String val1, String val2, String expType, Inst2XsdOptions opt) throws Exception { + private static void runLCDTypeChecking(String val1, String val2, String expType, Inst2XsdOptions opt) throws Exception { XmlObject act = getTypeCoerceXml(val1, val2); SchemaDocument[] venetian = (SchemaDocument[]) runInst2Xsd(act, opt); checkLength(venetian, 1); - log("instance: " + act); - log("expType: " + expType); checkInstance(venetian, new XmlObject[]{act}); - if (opt.getDesign() == Inst2XsdOptions.DESIGN_VENETIAN_BLIND) + if (opt.getDesign() == Inst2XsdOptions.DESIGN_VENETIAN_BLIND) { compare(venetian[0], getExpLCDXml_vb(expType)); - else if (opt.getDesign() == Inst2XsdOptions.DESIGN_SALAMI_SLICE) + } else if (opt.getDesign() == Inst2XsdOptions.DESIGN_SALAMI_SLICE) { compare(venetian[0], getExpLCDXml_ss(expType)); - else if (opt.getDesign() == Inst2XsdOptions.DESIGN_RUSSIAN_DOLL) + } else if (opt.getDesign() == Inst2XsdOptions.DESIGN_RUSSIAN_DOLL) { compare(venetian[0], getExpLCDXml_rd(expType)); - else + } else { compare(venetian[0], getExpLCDXml_vb(expType)); + } } - private String getTypeCoerceXmlString(String val1, String val2) { + private static String getTypeCoerceXmlString(String val1, String val2) { return "<a xmlns=\"typeCoercion\">" + " <b c=\"" + val1 + "\">" + val1 + "</b>" + " <b c=\"" + val2 + "\">" + val2 + "</b>" + "</a>"; } - private XmlObject getTypeCoerceXml(String val1, String val2) throws XmlException { + private static XmlObject getTypeCoerceXml(String val1, String val2) throws XmlException { return XmlObject.Factory.parse(getTypeCoerceXmlString(val1, val2)); } - private XmlObject getExpLCDXml_vb(String type) throws XmlException { - return XmlObject.Factory.parse("<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"typeCoercion\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + - " <xs:element name=\"a\" type=\"typ:aType\" xmlns:typ=\"typeCoercion\"/>\n" + - " <xs:complexType name=\"aType\">\n" + - " <xs:sequence>\n" + - " <xs:element type=\"typ:bType\" name=\"b\" maxOccurs=\"unbounded\" minOccurs=\"0\" xmlns:typ=\"typeCoercion\"/>\n" + - " </xs:sequence>\n" + - " </xs:complexType>\n" + - " <xs:complexType name=\"bType\">\n" + - " <xs:simpleContent>\n" + - " <xs:extension base=\"xs:" + type + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + - " <xs:attribute type=\"xs:" + type + "\" name=\"c\" use=\"optional\"/>\n" + - " </xs:extension>\n" + - " </xs:simpleContent>\n" + - " </xs:complexType>\n" + - "</xs:schema>"); - } - - private XmlObject getExpLCDXml_ss(String type) throws XmlException { - return XmlObject.Factory.parse("<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"typeCoercion\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + - " <xs:element name=\"b\">\n" + - " <xs:complexType>\n" + - " <xs:simpleContent>\n" + - " <xs:extension base=\"xs:" + type + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + - " <xs:attribute type=\"xs:" + type + "\" name=\"c\" use=\"optional\"/>\n" + - " </xs:extension>\n" + - " </xs:simpleContent>\n" + - " </xs:complexType>\n" + - " </xs:element>\n" + - " <xs:element name=\"a\">\n" + - " <xs:complexType>\n" + - " <xs:sequence>\n" + - " <xs:element ref=\"typ:b\" maxOccurs=\"unbounded\" minOccurs=\"0\" xmlns:typ=\"typeCoercion\"/>\n" + - " </xs:sequence>\n" + - " </xs:complexType>\n" + - " </xs:element>\n" + - "</xs:schema>"); - } - - private XmlObject getExpLCDXml_rd(String type) throws XmlException { - return XmlObject.Factory.parse("<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"typeCoercion\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + - " <xs:element name=\"a\">\n" + - " <xs:complexType>\n" + - " <xs:sequence>\n" + - " <xs:element name=\"b\" maxOccurs=\"unbounded\" minOccurs=\"0\">\n" + - " <xs:complexType>\n" + - " <xs:simpleContent>\n" + - " <xs:extension base=\"xs:" + type + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + - " <xs:attribute type=\"xs:" + type + "\" name=\"c\" use=\"optional\"/>\n" + - " </xs:extension>\n" + - " </xs:simpleContent>\n" + - " </xs:complexType>\n" + - " </xs:element>\n" + - " </xs:sequence>\n" + - " </xs:complexType>\n" + - " </xs:element>\n" + - "</xs:schema>"); + private static XmlObject getExpLCDXml_vb(String type) throws XmlException { + return XmlObject.Factory.parse( + "<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"typeCoercion\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + + " <xs:element name=\"a\" type=\"typ:aType\" xmlns:typ=\"typeCoercion\"/>\n" + + " <xs:complexType name=\"aType\">\n" + + " <xs:sequence>\n" + + " <xs:element type=\"typ:bType\" name=\"b\" maxOccurs=\"unbounded\" minOccurs=\"0\" xmlns:typ=\"typeCoercion\"/>\n" + + " </xs:sequence>\n" + + " </xs:complexType>\n" + + " <xs:complexType name=\"bType\">\n" + + " <xs:simpleContent>\n" + + " <xs:extension base=\"xs:" + type + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + + " <xs:attribute type=\"xs:" + type + "\" name=\"c\" use=\"optional\"/>\n" + + " </xs:extension>\n" + + " </xs:simpleContent>\n" + + " </xs:complexType>\n" + + "</xs:schema>"); + } + + private static XmlObject getExpLCDXml_ss(String type) throws XmlException { + return XmlObject.Factory.parse( + "<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"typeCoercion\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + + " <xs:element name=\"b\">\n" + + " <xs:complexType>\n" + + " <xs:simpleContent>\n" + + " <xs:extension base=\"xs:" + type + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + + " <xs:attribute type=\"xs:" + type + "\" name=\"c\" use=\"optional\"/>\n" + + " </xs:extension>\n" + + " </xs:simpleContent>\n" + + " </xs:complexType>\n" + + " </xs:element>\n" + + " <xs:element name=\"a\">\n" + + " <xs:complexType>\n" + + " <xs:sequence>\n" + + " <xs:element ref=\"typ:b\" maxOccurs=\"unbounded\" minOccurs=\"0\" xmlns:typ=\"typeCoercion\"/>\n" + + " </xs:sequence>\n" + + " </xs:complexType>\n" + + " </xs:element>\n" + + "</xs:schema>"); + } + + private static XmlObject getExpLCDXml_rd(String type) throws XmlException { + return XmlObject.Factory.parse( + "<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"typeCoercion\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + + " <xs:element name=\"a\">\n" + + " <xs:complexType>\n" + + " <xs:sequence>\n" + + " <xs:element name=\"b\" maxOccurs=\"unbounded\" minOccurs=\"0\">\n" + + " <xs:complexType>\n" + + " <xs:simpleContent>\n" + + " <xs:extension base=\"xs:" + type + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + + " <xs:attribute type=\"xs:" + type + "\" name=\"c\" use=\"optional\"/>\n" + + " </xs:extension>\n" + + " </xs:simpleContent>\n" + + " </xs:complexType>\n" + + " </xs:element>\n" + + " </xs:sequence>\n" + + " </xs:complexType>\n" + + " </xs:element>\n" + + "</xs:schema>"); } - protected static XmlObject[] runInst2Xsd(XmlObject inst, Inst2XsdOptions options) { + public static XmlObject[] runInst2Xsd(XmlObject inst, Inst2XsdOptions options) { return Inst2Xsd.inst2xsd(new XmlObject[]{inst}, options); } - protected static XmlObject[] runInst2Xsd(XmlObject[] inst, Inst2XsdOptions options) { + public static XmlObject[] runInst2Xsd(XmlObject[] inst, Inst2XsdOptions options) { return Inst2Xsd.inst2xsd(inst, options); } - protected static SchemaDocument[] getSchemaDoc(XmlObject[] inst) throws XmlException { + public static SchemaDocument[] getSchemaDoc(XmlObject[] inst) throws XmlException { SchemaDocument[] docs = new SchemaDocument[inst.length]; for (int i = 0; i < docs.length; i++) { docs[i] = SchemaDocument.Factory.parse(inst[i].xmlText()); @@ -267,28 +253,22 @@ public class Inst2XsdTestBase extends Co } - protected static void runSchemaBuild(XmlObject inst, Inst2XsdOptions opts, XmlObject exp) throws Exception { + public static void runSchemaBuild(XmlObject inst, Inst2XsdOptions opts, XmlObject exp) throws Exception { XmlObject[] genSchema = runInst2Xsd(inst, opts); - log(genSchema); checkInstanceToAll(genSchema, inst, exp); checkLength(genSchema, 1); compare(genSchema[0], exp); - } - protected static void runSchemaBuild(XmlObject inst, Inst2XsdOptions opts, XmlObject[] exp) throws XmlException { + public static void runSchemaBuild(XmlObject inst, Inst2XsdOptions opts, XmlObject[] exp) throws XmlException { XmlObject[] genSchema = runInst2Xsd(inst, opts); - log(genSchema); checkInstanceToAll(genSchema, new XmlObject[]{inst}, exp); checkLength(genSchema, exp.length); compare(genSchema, exp); - } //TODO: Make this error narrowed - protected static void checkLength(Object[] obj, int val) throws XmlException { - log("Length = " + obj.length + " exp: " + val); - + public static void checkLength(Object[] obj, int val) throws XmlException { if (obj.length < val) { throw new XmlException("Actual was smaller than expected"); } else if (obj.length > val) { @@ -315,31 +295,10 @@ public class Inst2XsdTestBase extends Co act.xmlText(Inst2XsdCommon.getXmlOptions()), exp.xmlText(Inst2XsdCommon.getXmlOptions())); if (diag.hasMessage()) { - log("Expected: \n" + exp.xmlText(Inst2XsdCommon.getXmlOptions())); - log("Actual: \n" + act.xmlText(Inst2XsdCommon.getXmlOptions())); throw new XmlException("Xml Comparison Failed:\n" + diag.toString()); } } - public static void log(XmlObject[] doc) { - if (_verbose) { - for (int i = 0; i < doc.length; i++) { - log("Schema[" + i + "] - " + doc[i].xmlText(Inst2XsdCommon.getXmlOptions())); - } - } - } - - public static void log(String msg) { - if (_verbose) - System.out.println(msg); - } - - public static void log(XmlObject obj) { - if (_verbose) - System.out.println(obj.xmlText(Inst2XsdCommon.getXmlOptions())); - } - - private static void checkInstanceToAll(XmlObject[] actSchemaDoc, XmlObject inst, XmlObject expSchemas) throws Exception { checkInstanceToAll(getSchemaDoc(actSchemaDoc), new XmlObject[]{inst}, getSchemaDoc(new XmlObject[]{expSchemas})); @@ -352,14 +311,8 @@ public class Inst2XsdTestBase extends Co private static void checkInstanceToAll(SchemaDocument[] actSchemaDoc, XmlObject[] inst, SchemaDocument[] expSchemas) throws XmlException { - log("-= Comparing Actual to instance=-"); - if (checkInstance(actSchemaDoc, inst)) - log("-= Instance validated actual =-"); - - log("-= Comparing Expected to instance=-"); - if (checkInstance(expSchemas, inst)) - log("-= Instance validated Expected =-"); - + checkInstance(actSchemaDoc, inst); + checkInstance(expSchemas, inst); } private static boolean checkInstance(SchemaDocument[] sDocs, XmlObject[] inst) throws XmlException { @@ -386,7 +339,9 @@ public class Inst2XsdTestBase extends Co e.printStackTrace(System.out); } System.out.println("Schema invalid"); - for (Object compError : compErrors) System.out.println(compError); + for (Object compError : compErrors) { + System.out.println(compError); + } return false; } @@ -413,9 +368,9 @@ public class Inst2XsdTestBase extends Co System.out.println(instance + " NOT valid. "); System.out.println(" Document type not found."); result = false; - } else if (xobj.validate(new XmlOptions().setErrorListener(errors))) + } else if (xobj.validate(new XmlOptions().setErrorListener(errors))) { System.out.println("Instance[" + i + "] valid."); - else { + } else { System.out.println("Instance[" + i + "] NOT valid."); for (Object error : errors) { System.out.println(" " + error);
Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/ComplexDetailedTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/ComplexDetailedTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/ComplexDetailedTest.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/ComplexDetailedTest.java Sun Feb 6 01:51:55 2022 @@ -16,83 +16,77 @@ package tools.inst2xsd.detailed; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.impl.inst2xsd.Inst2XsdOptions; -import org.junit.Ignore; -import org.junit.Test; -import tools.inst2xsd.common.Inst2XsdTestBase; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import java.io.File; -@Ignore -public class ComplexDetailedTest extends Inst2XsdTestBase { +import static common.Common.P; +import static org.apache.xmlbeans.impl.inst2xsd.Inst2XsdOptions.*; +import static tools.inst2xsd.common.Inst2XsdCommon.*; +import static tools.inst2xsd.common.Inst2XsdTestBase.SCHEMA_CASES_DIR; +import static tools.inst2xsd.common.Inst2XsdTestBase.runSchemaBuild; + +@Disabled +public class ComplexDetailedTest { @Test - public void test_complex_enum() throws Exception { + void test_complex_enum() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum2_rd0.xsd"))); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum2_vb0.xsd"))); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum2_ss0.xsd"))); + runSchemaBuild(inst, getRussianOptions(), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum2_rd0.xsd"))); + runSchemaBuild(inst, getVenetianOptions(), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum2_vb0.xsd"))); + runSchemaBuild(inst, getSalamiOptions(), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum2_ss0.xsd"))); } @Test - public void test_complex_enum_never() throws Exception { + void test_complex_enum_never() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum.xml")); - Inst2XsdOptions opts = common.getVenetianOptions(); - opts.setUseEnumerations(opts.ENUMERATION_NEVER); - log("-= Never Enum Options =-"); + Inst2XsdOptions opts = getVenetianOptions(); + opts.setUseEnumerations(ENUMERATION_NEVER); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum_vb_eN0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum_vb_eN0.xsd"))); - opts = null; - opts = common.getVenetianOptions(); - opts.setSimpleContentTypes(opts.SIMPLE_CONTENT_TYPES_STRING); - log("-= SCS Options =-"); + opts = getVenetianOptions(); + opts.setSimpleContentTypes(SIMPLE_CONTENT_TYPES_STRING); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum_vb_scs_enum0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enum_vb_scs_enum0.xsd"))); } @Test - public void test_complex_qname_enum() throws Exception { + void test_complex_qname_enum() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enumQName.xml")); - Inst2XsdOptions opts = common.getVenetianOptions(); - log("-= Enum Options =-"); + Inst2XsdOptions opts = getVenetianOptions(); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enumQName_vb_enum0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enumQName_vb_enum0.xsd"))); - log("-= Enum Options =-"); - opts.setUseEnumerations(opts.ENUMERATION_NEVER); + opts.setUseEnumerations(ENUMERATION_NEVER); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enumQName_vb_eN0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "enumQName_vb_eN0.xsd"))); } @Test - public void test_complex_nestedNSArray() throws Exception { + void test_complex_nestedNSArray() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedNSArray.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getRussianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_rd0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_rd1.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_rd2.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_rd3.xsd")) }); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getVenetianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_vb0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_vb1.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_vb2.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_vb3.xsd")) }); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), new XmlObject[]{ + runSchemaBuild(inst, getSalamiOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_ss0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_ss1.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "nestedNSArray" + P + "nestedArray_ss2.xsd")), @@ -101,99 +95,87 @@ public class ComplexDetailedTest extends } @Test - public void test_example_po() throws Exception { + void test_example_po() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po.xml")); - log("-= Russian Options =-"); - Inst2XsdOptions rdEN = common.getRussianOptions(); - rdEN.setUseEnumerations(rdEN.ENUMERATION_NEVER); + Inst2XsdOptions rdEN = getRussianOptions(); + rdEN.setUseEnumerations(ENUMERATION_NEVER); runSchemaBuild(inst, rdEN, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_rd_eN0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_rd_eN0.xsd"))); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb0.xsd"))); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_ss0.xsd"))); + runSchemaBuild(inst, getVenetianOptions(), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb0.xsd"))); + runSchemaBuild(inst, getSalamiOptions(), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_ss0.xsd"))); - Inst2XsdOptions opts = common.getVenetianOptions(); - opts.setUseEnumerations(opts.ENUMERATION_NEVER); - log("-= Venetian Never Enum Options =-"); + Inst2XsdOptions opts = getVenetianOptions(); + opts.setUseEnumerations(ENUMERATION_NEVER); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb_eN0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb_eN0.xsd"))); - opts.setDesign(opts.DESIGN_SALAMI_SLICE); - log("-= Salami Never Enum Options =-"); + opts.setDesign(DESIGN_SALAMI_SLICE); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_ss_eN0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_ss_eN0.xsd"))); - opts.setDesign(opts.DESIGN_VENETIAN_BLIND); - opts.setSimpleContentTypes(opts.SIMPLE_CONTENT_TYPES_STRING); - opts.setUseEnumerations(opts.ENUMERATION_NEVER); - log("-= Venetian Never Enum SimpleContentString Options =-"); + opts.setDesign(DESIGN_VENETIAN_BLIND); + opts.setSimpleContentTypes(SIMPLE_CONTENT_TYPES_STRING); + opts.setUseEnumerations(ENUMERATION_NEVER); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb_scs0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb_scs0.xsd"))); opts = null; - opts = common.getVenetianOptions(); - opts.setSimpleContentTypes(opts.SIMPLE_CONTENT_TYPES_STRING); - log("-= Venetian SimpleContentString with Enum Options =-"); + opts = getVenetianOptions(); + opts.setSimpleContentTypes(SIMPLE_CONTENT_TYPES_STRING); runSchemaBuild(inst, opts, - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb_scs_enum0.xsd"))); + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "po" + P + "po_vb_scs_enum0.xsd"))); } /** * java.lang.IllegalStateException: Not on a container */ @Test - public void test_complex_attrenum() throws Exception { - XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr"+P+"attrenum.xml")); + void test_complex_attrenum() throws Exception { + XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), - new XmlObject[]{ - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd0.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd1.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd2.xsd")) - }); - - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), - new XmlObject[]{ - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb0.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb1.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb2.xsd")) - }); - - - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), - new XmlObject[]{ - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_ss0.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_ss1.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_ss2.xsd")) - }); - - log("-= Russian enum Options =-"); - Inst2XsdOptions opts = common.getRussianOptions(); - opts.setUseEnumerations(opts.ENUMERATION_NEVER); - runSchemaBuild(inst, opts, - new XmlObject[]{ - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd_enum0.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd_enum1.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd_enum2.xsd")) - }); + runSchemaBuild(inst, getRussianOptions(), + new XmlObject[]{ + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd0.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd1.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd2.xsd")) + }); + + runSchemaBuild(inst, getVenetianOptions(), + new XmlObject[]{ + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb0.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb1.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb2.xsd")) + }); + + + runSchemaBuild(inst, getSalamiOptions(), + new XmlObject[]{ + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_ss0.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_ss1.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_ss2.xsd")) + }); + + Inst2XsdOptions opts = getRussianOptions(); + opts.setUseEnumerations(ENUMERATION_NEVER); + runSchemaBuild(inst, opts, + new XmlObject[]{ + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd_enum0.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd_enum1.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_rd_enum2.xsd")) + }); - log("-= Venetian enum Options =-"); opts = null; - opts = common.getVenetianOptions(); - opts.setUseEnumerations(opts.ENUMERATION_NEVER); + opts = getVenetianOptions(); + opts.setUseEnumerations(ENUMERATION_NEVER); runSchemaBuild(inst, opts, - new XmlObject[]{ - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb_enum0.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb_enum1.xsd")), - XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb_enum2.xsd")) - }); + new XmlObject[]{ + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb_enum0.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb_enum1.xsd")), + XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "complex" + P + "enum" + P + "attr" + P + "attrenum_vb_enum2.xsd")) + }); } } Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/DetailedLCDTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/DetailedLCDTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/DetailedLCDTest.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/DetailedLCDTest.java Sun Feb 6 01:51:55 2022 @@ -14,13 +14,13 @@ */ package tools.inst2xsd.detailed; -import org.junit.Ignore; -import org.junit.Test; -import tools.inst2xsd.common.Inst2XsdTestBase; -import org.apache.xmlbeans.XmlObject; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Ignore -public class DetailedLCDTest extends Inst2XsdTestBase { +import static tools.inst2xsd.common.Inst2XsdTestBase.runLCDTypeCheckTest; + +@Disabled +public class DetailedLCDTest { // List of precedence for smart simple primitive type determination // byte, short, int, long, integer, float, double, decimal, @@ -67,17 +67,15 @@ public class DetailedLCDTest extends Ins } */ @Test - public void test_lcd_anyuri() throws Exception { - runLCDTypeCheckTest("abc", - "http://www.math.uio.no/faq/compression-faq/part1.html", "string"); - runLCDTypeCheckTest("http://www.math.uio.no/faq/compression-faq/part1.html", - "http://www.example.com/doc.html#ID5", "anyURI"); + void test_lcd_anyuri() throws Exception { + runLCDTypeCheckTest("abc", "http://www.math.uio.no/faq/compression-faq/part1.html", "string"); + runLCDTypeCheckTest("http://www.math.uio.no/faq/compression-faq/part1.html", "http://www.example.com/doc.html#ID5", "anyURI"); runLCDTypeCheckTest("123", "www.math.uio.no/faq/compression-faq/part1.html", "string"); //runLCDTypeCheckTest("ftp://ftp.is.co.za/rfc/rfc1808.txt", "gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles", "anyURI"); } @Test - public void test_lcd_byte() throws Exception { + void test_lcd_byte() throws Exception { runLCDTypeCheckTest("122", "123", "byte"); runLCDTypeCheckTest("-1", "+100", "byte"); runLCDTypeCheckTest("0", "-1", "byte"); @@ -104,7 +102,7 @@ public class DetailedLCDTest extends Ins } @Test - public void test_lcd_short() throws Exception { + void test_lcd_short() throws Exception { runLCDTypeCheckTest("32767","-129", "short"); runLCDTypeCheckTest("-32768","128", "short"); runLCDTypeCheckTest("3000","3000", "short"); @@ -128,7 +126,7 @@ public class DetailedLCDTest extends Ins } @Test - public void test_lcd_int() throws Exception { + void test_lcd_int() throws Exception { runLCDTypeCheckTest("32768","39000", "int"); runLCDTypeCheckTest("32768","32768", "int"); runLCDTypeCheckTest("-39000","-32769", "int"); @@ -153,7 +151,7 @@ public class DetailedLCDTest extends Ins } @Test - public void test_lcd_long() throws Exception { + void test_lcd_long() throws Exception { runLCDTypeCheckTest("-9223372036854775808","2147483648", "long"); runLCDTypeCheckTest("-9223372036854775808","-2147483649", "long"); runLCDTypeCheckTest("-2150000000","-2150000000", "long"); @@ -172,7 +170,7 @@ public class DetailedLCDTest extends Ins } @Test - public void test_lcd_integer() throws Exception { + void test_lcd_integer() throws Exception { runLCDTypeCheckTest("9223372036854775808","9300000000000000000", "integer"); runLCDTypeCheckTest("9223372036854775808","-9300000000000000000", "integer"); runLCDTypeCheckTest("9223372036854775808","-9223372036854775809", "integer"); @@ -187,7 +185,7 @@ public class DetailedLCDTest extends Ins } @Test - public void test_lcd_float() throws Exception { + void test_lcd_float() throws Exception { runLCDTypeCheckTest("+100000.00","12.78e-2", "float"); runLCDTypeCheckTest("+100000.00","1267.43233E12", "float"); runLCDTypeCheckTest("12","-1E4", "float"); @@ -233,13 +231,13 @@ public class DetailedLCDTest extends Ins //} @Test - public void test_lcd_date() throws Exception { + void test_lcd_date() throws Exception { runLCDTypeCheckTest("abc", "1999-05-31", "string"); runLCDTypeCheckTest("1999-06-15","1999-05-31", "date"); } @Test - public void test_lcd_dateTime() throws Exception { + void test_lcd_dateTime() throws Exception { runLCDTypeCheckTest("abc", "1999-05-31T13:20:00-05:00", "string"); runLCDTypeCheckTest("1999-05-31T13:20:00-08:00","1999-05-31T13:20:00-05:00", "dateTime"); runLCDTypeCheckTest("1999-05-31T13:20:00-06:00","2000-03-04T20:00:00Z", "dateTime"); @@ -247,7 +245,7 @@ public class DetailedLCDTest extends Ins } @Test - public void test_lcd_time() throws Exception { + void test_lcd_time() throws Exception { runLCDTypeCheckTest("abc", "13:20:00-05:00", "string"); runLCDTypeCheckTest("00:00:00","13:20:00-05:00", "time"); runLCDTypeCheckTest("13:20:00Z","00:00:00", "time"); Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedAttrTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedAttrTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedAttrTest.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedAttrTest.java Sun Feb 6 01:51:55 2022 @@ -14,11 +14,13 @@ */ package tools.inst2xsd.detailed; -import org.junit.Test; -import tools.inst2xsd.common.Inst2XsdTestBase; import org.apache.xmlbeans.XmlObject; +import org.junit.jupiter.api.Test; -public class Inst2XsdDetailedAttrTest extends Inst2XsdTestBase { +import static tools.inst2xsd.common.Inst2XsdTestBase.getAttrTypeXml; +import static tools.inst2xsd.common.Inst2XsdTestBase.runAttrTypeChecking; + +public class Inst2XsdDetailedAttrTest { // List of precedence for smart simple primitive type determination // byte, short, int, long, integer, float, double, decimal, @@ -70,7 +72,7 @@ public class Inst2XsdDetailedAttrTest ex //} @Test - public void test_attranyuri() throws Exception { + void test_attranyuri() throws Exception { runAttrTypeChecking(getAttrTypeXml("http://www.math.uio.no/faq/compression-faq/part1.html"), "anyURI"); runAttrTypeChecking(getAttrTypeXml("http://www.example.com/doc.html#ID5"), "anyURI"); runAttrTypeChecking(getAttrTypeXml("www.math.uio.no/faq/compression-faq/part1.html"), "anyURI"); @@ -87,7 +89,7 @@ public class Inst2XsdDetailedAttrTest ex * true, false are strings */ @Test - public void test_attrboolean() throws Exception { + void test_attrboolean() throws Exception { runAttrTypeChecking(getAttrTypeXml("true"), "string"); runAttrTypeChecking(getAttrTypeXml("false"), "string"); @@ -96,7 +98,7 @@ public class Inst2XsdDetailedAttrTest ex } @Test - public void test_attrQName() throws Exception { + void test_attrQName() throws Exception { XmlObject xsdString = XmlObject.Factory.parse("<a xmlns=\"attrTests\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" a=\"xsd:string\"></a>"); Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedOptionsTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedOptionsTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedOptionsTest.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedOptionsTest.java Sun Feb 6 01:51:55 2022 @@ -18,22 +18,24 @@ import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.impl.inst2xsd.Inst2Xsd; import org.apache.xmlbeans.impl.inst2xsd.Inst2XsdOptions; import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument; -import org.junit.Ignore; -import org.junit.Test; -import tools.inst2xsd.common.Inst2XsdTestBase; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tools.inst2xsd.common.Inst2XsdCommon; import java.io.File; -public class Inst2XsdDetailedOptionsTest extends Inst2XsdTestBase { +import static tools.inst2xsd.common.Inst2XsdCommon.*; +import static tools.inst2xsd.common.Inst2XsdTestBase.*; + +public class Inst2XsdDetailedOptionsTest { @Test - public void test_simpleContentString_Russian() throws Exception { - Inst2XsdOptions opt = common.getRussianOptions(); + void test_simpleContentString_Russian() throws Exception { + Inst2XsdOptions opt = getRussianOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "rd", @@ -42,22 +44,19 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_rd_scs0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - @Ignore + @Disabled public void test_simpleContentString_Salami() throws Exception { - Inst2XsdOptions opt = common.getSalamiOptions(); + Inst2XsdOptions opt = getSalamiOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "ss", @@ -66,20 +65,17 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_ss_scs0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - public void test_simpleContentString_Venetian() throws Exception { - Inst2XsdOptions opt = common.getVenetianOptions(); + void test_simpleContentString_Venetian() throws Exception { + Inst2XsdOptions opt = getVenetianOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "vb", @@ -89,20 +85,17 @@ public class Inst2XsdDetailedOptionsTest BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_vb_scs0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - public void test_simpleContentSmart_Russian() throws Exception { - Inst2XsdOptions opt = common.getRussianOptions(); + void test_simpleContentSmart_Russian() throws Exception { + Inst2XsdOptions opt = getRussianOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_SMART); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "rd", @@ -111,21 +104,18 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_rd0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - @Ignore + @Disabled public void test_simpleContentSmart_Salami() throws Exception { - Inst2XsdOptions opt = common.getSalamiOptions(); + Inst2XsdOptions opt = getSalamiOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_SMART); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "ss", @@ -134,20 +124,17 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_ss0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - public void test_simpleContentSmart_Venetian() throws Exception { - Inst2XsdOptions opt = common.getVenetianOptions(); + void test_simpleContentSmart_Venetian() throws Exception { + Inst2XsdOptions opt = getVenetianOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_SMART); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "vb", @@ -156,21 +143,18 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_vb0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - public void test_simpleContentSmart_NeverEnum_Russian() throws Exception { - Inst2XsdOptions opt = common.getRussianOptions(); + void test_simpleContentSmart_NeverEnum_Russian() throws Exception { + Inst2XsdOptions opt = getRussianOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_SMART); opt.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "rd", @@ -180,22 +164,19 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_rd_eN0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - @Ignore + @Disabled public void test_simpleContentSmart_NeverEnum_Salami() throws Exception { - Inst2XsdOptions opt = common.getSalamiOptions(); + Inst2XsdOptions opt = getSalamiOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_SMART); opt.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "ss", @@ -205,21 +186,18 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_ss_eN0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - public void test_simpleContentSmart_NeverEnum_Venetian() throws Exception { - Inst2XsdOptions opt = common.getVenetianOptions(); + void test_simpleContentSmart_NeverEnum_Venetian() throws Exception { + Inst2XsdOptions opt = getVenetianOptions(); opt.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_SMART); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "vb", @@ -229,21 +207,18 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_vb_eN0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - public void test_simpleContentString_NeverEnum_Russian() throws Exception { - Inst2XsdOptions opt = common.getRussianOptions(); + void test_simpleContentString_NeverEnum_Russian() throws Exception { + Inst2XsdOptions opt = getRussianOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); opt.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "rd", @@ -253,22 +228,19 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_rd_scs_eN0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - @Ignore + @Disabled public void test_simpleContentString_NeverEnum_Salami() throws Exception { - Inst2XsdOptions opt = common.getSalamiOptions(); + Inst2XsdOptions opt = getSalamiOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); opt.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "ss", @@ -278,21 +250,18 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_ss_scs_eN0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } @Test - public void test_simpleContentString_NeverEnum_Venetian() throws Exception { - Inst2XsdOptions opt = common.getVenetianOptions(); + void test_simpleContentString_NeverEnum_Venetian() throws Exception { + Inst2XsdOptions opt = getVenetianOptions(); opt.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); - XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); + XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, opt); checkLength(api, 1); - log(api); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "vb", @@ -302,23 +271,21 @@ public class Inst2XsdDetailedOptionsTest "-outPrefix", "base", BASEXML}); XmlObject cmdLine = XmlObject.Factory.parse(new File(EXPBASEXML)); - log("Compare: Command Line to API"); compare(api[0], cmdLine); XmlObject exp = XmlObject.Factory.parse(new File(OPTION_CASES_DIR + "base_vb_scs_eN0.xsd")); - log("Compare: Expected to API"); compare(api[0], exp); } //TODO: move to checkin - cursor issue @Test - public void test_simpleContentSmart() throws Exception { - Inst2XsdOptions opt = common.getDefaultInstOptions(); + void test_simpleContentSmart() throws Exception { + Inst2XsdOptions opt = getDefaultInstOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_SMART); - SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(common.base), opt)); + SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(Inst2XsdCommon.base), opt)); checkLength(sDoc, 1); - XmlObject exp = XmlObject.Factory.parse(common.base_expected_venetian, common.getXmlOptions()); + XmlObject exp = XmlObject.Factory.parse(Inst2XsdCommon.base_expected_venetian, getXmlOptions()); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-simple-content-types", "smart", "-outDir", OPTION_CASES_DIR, @@ -333,12 +300,12 @@ public class Inst2XsdDetailedOptionsTest //TODO: move to checkin - cursor issue @Test - public void test_neverEnum() throws Exception { - Inst2XsdOptions opt = common.getVenetianOptions(); + void test_neverEnum() throws Exception { + Inst2XsdOptions opt = getVenetianOptions(); opt.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); - SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(common.base), opt)); + SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(Inst2XsdCommon.base), opt)); checkLength(sDoc, 1); - XmlObject exp = XmlObject.Factory.parse(common.base_expected_venetian, common.getXmlOptions()); + XmlObject exp = XmlObject.Factory.parse(Inst2XsdCommon.base_expected_venetian, getXmlOptions()); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-enumerations", "never", "-outDir", OPTION_CASES_DIR, @@ -352,10 +319,10 @@ public class Inst2XsdDetailedOptionsTest //TODO: move to checkin - cursor issue @Test - public void test_simpleContentString() throws Exception { - Inst2XsdOptions opt = common.getDefaultInstOptions(); + void test_simpleContentString() throws Exception { + Inst2XsdOptions opt = getDefaultInstOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); - SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(common.base), opt)); + SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(Inst2XsdCommon.base), opt)); checkLength(sDoc, 1); String stringContent = "<xs:schema attributeFormDefault =\"unqualified\" elementFormDefault=\"qualified\" " + @@ -385,7 +352,7 @@ public class Inst2XsdDetailedOptionsTest "</xs:sequence>" + "</xs:complexType>" + "</xs:schema>"; - XmlObject exp = XmlObject.Factory.parse(stringContent, common.getXmlOptions()); + XmlObject exp = XmlObject.Factory.parse(stringContent, getXmlOptions()); compare(sDoc[0], exp); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-simple-content-types", "string", @@ -400,12 +367,12 @@ public class Inst2XsdDetailedOptionsTest //TODO: move to checkin - cursor issue @Test - public void test_RussianDesign() throws Exception { - SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(common.base), - common.getRussianOptions())); + void test_RussianDesign() throws Exception { + SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(Inst2XsdCommon.base), + getRussianOptions())); checkLength(sDoc, 1); - XmlObject exp = XmlObject.Factory.parse(common.base_expected_russian, common.getXmlOptions()); + XmlObject exp = XmlObject.Factory.parse(Inst2XsdCommon.base_expected_russian, getXmlOptions()); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "rd", "-outDir", OPTION_CASES_DIR, @@ -419,14 +386,14 @@ public class Inst2XsdDetailedOptionsTest //TODO: move to checkin - cursor issue @Test - @Ignore + @Disabled public void test_SalamiDesign() throws Exception { - SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(common.base), - common.getSalamiOptions())); + SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(XmlObject.Factory.parse(Inst2XsdCommon.base), + getSalamiOptions())); checkLength(sDoc, 1); - XmlObject exp = XmlObject.Factory.parse(common.base_expected_salami, common.getXmlOptions()); + XmlObject exp = XmlObject.Factory.parse(Inst2XsdCommon.base_expected_salami, getXmlOptions()); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "ss", "-outDir", OPTION_CASES_DIR, @@ -439,11 +406,11 @@ public class Inst2XsdDetailedOptionsTest //TODO: move to checkin - cursor issue @Test - public void test_VenetianDesign() throws Exception { - SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, - common.getVenetianOptions())); + void test_VenetianDesign() throws Exception { + SchemaDocument[] sDoc = getSchemaDoc(runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(Inst2XsdCommon.base)}, + getVenetianOptions())); checkLength(sDoc, 1); - XmlObject exp = XmlObject.Factory.parse(common.base_expected_venetian, common.getXmlOptions()); + XmlObject exp = XmlObject.Factory.parse(Inst2XsdCommon.base_expected_venetian, getXmlOptions()); Inst2Xsd.main(new String[]{"-validate", "-verbose", "-design", "vb", "-outDir", OPTION_CASES_DIR, Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTest.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTest.java Sun Feb 6 01:51:55 2022 @@ -16,67 +16,63 @@ package tools.inst2xsd.detailed; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.impl.inst2xsd.Inst2XsdOptions; -import org.junit.Ignore; -import org.junit.Test; -import tools.inst2xsd.common.Inst2XsdTestBase; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import java.io.File; -@Ignore -public class Inst2XsdDetailedTest extends Inst2XsdTestBase { +import static common.Common.P; +import static tools.inst2xsd.common.Inst2XsdCommon.*; +import static tools.inst2xsd.common.Inst2XsdTestBase.SCHEMA_CASES_DIR; +import static tools.inst2xsd.common.Inst2XsdTestBase.runSchemaBuild; + +@Disabled +public class Inst2XsdDetailedTest { //TODO: move to checkin @Test - public void test_ns_duplicate_salami() throws Exception { + void test_ns_duplicate_salami() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "namespaces" + P + "duplicatedNS.xml")); - log("-= Salami =-"); - runSchemaBuild(inst, common.getSalamiOptions(), + runSchemaBuild(inst, getSalamiOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "namespaces" + P + "duplicatedNS_ss0.xsd"))); } //TODO: move to checkin @Test - public void test_ns_duplicate_venetian() throws Exception { + void test_ns_duplicate_venetian() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "namespaces" + P + "duplicatedNS.xml")); - log("-= venetian =-"); - runSchemaBuild(inst, common.getVenetianOptions(), + runSchemaBuild(inst, getVenetianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "namespaces" + P + "duplicatedNS_vb0.xsd"))); } //TODO: move to checkin QName:bug @Test - public void test_examples_xmlnews() throws Exception { + void test_examples_xmlnews() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xmlnews.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), + runSchemaBuild(inst, getRussianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xmlnews_rd0.xsd"))); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), + runSchemaBuild(inst, getVenetianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xmlnews_vb0.xsd"))); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), + runSchemaBuild(inst, getSalamiOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xmlnews_ss0.xsd"))); } //TODO: move to checkin QName:bug @Test - public void test_examples_slashdotrdf() throws Exception { + void test_examples_slashdotrdf() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "slashdot.rdf.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getRussianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "slashdotrdf_rd0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "slashdotrdf_rd1.xsd")), }); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getVenetianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "slashdotrdf_vb0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "slashdotrdf_vb1.xsd")), }); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), new XmlObject[]{ + runSchemaBuild(inst, getSalamiOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "slashdotrdf_ss0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "slashdotrdf_ss1.xsd")), }); @@ -84,21 +80,18 @@ public class Inst2XsdDetailedTest extend //TODO: move to checkin QName:bug @Test - public void test_examples_xsl() throws Exception { + void test_examples_xsl() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xsl_example.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getRussianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xsl_rd0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xsl_rd1.xsd")), }); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getVenetianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xsl_vb0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xsl_vb1.xsd")), }); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), new XmlObject[]{ + runSchemaBuild(inst, getSalamiOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xsl_ss0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "xsl_ss1.xsd")), }); @@ -106,81 +99,69 @@ public class Inst2XsdDetailedTest extend //TODO: move to checkin QName:bug @Test - public void test_examples_rss092() throws Exception { + void test_examples_rss092() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "sampleRss092.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), + runSchemaBuild(inst, getRussianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "sampleRss092_rd0.xsd"))); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), + runSchemaBuild(inst, getVenetianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "sampleRss092_vb0.xsd"))); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), + runSchemaBuild(inst, getSalamiOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "examples" + P + "sampleRss092_ss0.xsd"))); } @Test - public void test_types_comments() throws Exception { + void test_types_comments() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "comments.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), + runSchemaBuild(inst, getRussianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "comments_rd0.xsd"))); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), + runSchemaBuild(inst, getVenetianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "comments_vb0.xsd"))); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), + runSchemaBuild(inst, getSalamiOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "comments_ss0.xsd"))); } @Test - public void test_types_commentschoice() throws Exception { + void test_types_commentschoice() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "commentschoice.xml")); - Inst2XsdOptions opts = common.getRussianOptions(); + Inst2XsdOptions opts = getRussianOptions(); opts.setUseEnumerations(Inst2XsdOptions.ENUMERATION_NEVER); - log("-= Russian Options =-"); runSchemaBuild(inst, opts, XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "commentschoice_eNrd0.xsd"))); opts.setDesign(Inst2XsdOptions.DESIGN_VENETIAN_BLIND); - log("-= Venetian Options =-"); runSchemaBuild(inst, opts, XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "commentschoice_eNvb0.xsd"))); opts.setDesign(Inst2XsdOptions.DESIGN_SALAMI_SLICE); - log("-= Salami Options =-"); runSchemaBuild(inst, opts, XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "commentschoice_eNss0.xsd"))); } /** This case fails validation because comment is not recognized */ @Test - public void test_types_innercomment() throws Exception { + void test_types_innercomment() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "innercomment.xml")); - runSchemaBuild(inst, common.getVenetianOptions(), + runSchemaBuild(inst, getVenetianOptions(), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "innercomment_vb0.xsd"))); } @Test - public void test_types_nillable() throws Exception { + void test_types_nillable() throws Exception { XmlObject inst = XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "xsinil.xml")); - log("-= Russian Options =-"); - runSchemaBuild(inst, common.getRussianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getRussianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "xsinil_rd0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "xsinil_rd1.xsd")) }); - log("-= Venetian Options =-"); - runSchemaBuild(inst, common.getVenetianOptions(), new XmlObject[]{ + runSchemaBuild(inst, getVenetianOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "xsinil_vb0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "xsinil_vb1.xsd")) }); - log("-= Salami Options =-"); - runSchemaBuild(inst, common.getSalamiOptions(), new XmlObject[]{ + runSchemaBuild(inst, getSalamiOptions(), new XmlObject[]{ XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "xsinil_ss0.xsd")), XmlObject.Factory.parse(new File(SCHEMA_CASES_DIR + "types" + P + "xsinil_ss1.xsd")) }); Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTypeTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTypeTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTypeTest.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdDetailedTypeTest.java Sun Feb 6 01:51:55 2022 @@ -15,10 +15,12 @@ package tools.inst2xsd.detailed; import org.apache.xmlbeans.XmlObject; -import org.junit.Test; -import tools.inst2xsd.common.Inst2XsdTestBase; +import org.junit.jupiter.api.Test; -public class Inst2XsdDetailedTypeTest extends Inst2XsdTestBase { +import static tools.inst2xsd.common.Inst2XsdTestBase.getTypeXml; +import static tools.inst2xsd.common.Inst2XsdTestBase.runTypeChecking; + +public class Inst2XsdDetailedTypeTest { // List of precedence for smart simple primitive type determination // byte, short, int, long, integer, float, double, decimal, @@ -65,7 +67,7 @@ public class Inst2XsdDetailedTypeTest ex //} @Test - public void test_anyuri() throws Exception { + void test_anyuri() throws Exception { runTypeChecking(getTypeXml("http://www.math.uio.no/faq/compression-faq/part1.html"), "anyURI"); runTypeChecking(getTypeXml("http://www.example.com/doc.html#ID5"), "anyURI"); runTypeChecking(getTypeXml("www.math.uio.no/faq/compression-faq/part1.html"), "anyURI"); @@ -85,7 +87,7 @@ public class Inst2XsdDetailedTypeTest ex * */ @Test - public void test_boolean() throws Exception { + void test_boolean() throws Exception { //runTypeChecking(getTypeXml("true"), "boolean"); //runTypeChecking(getTypeXml("false"), "boolean"); runTypeChecking(getTypeXml("true"), "string"); @@ -94,7 +96,7 @@ public class Inst2XsdDetailedTypeTest ex } @Test - public void test_QName() throws Exception { + void test_QName() throws Exception { XmlObject xsdString = XmlObject.Factory.parse("<a xmlns=\"typeTests\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" >xsd:string</a>"); XmlObject xsiint = XmlObject.Factory.parse("<a xmlns=\"typeTests\" " + Modified: xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdMiscTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdMiscTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdMiscTest.java (original) +++ xmlbeans/trunk/src/test/java/tools/inst2xsd/detailed/Inst2XsdMiscTest.java Sun Feb 6 01:51:55 2022 @@ -18,12 +18,14 @@ import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.impl.inst2xsd.Inst2Xsd; import org.apache.xmlbeans.impl.inst2xsd.Inst2XsdOptions; import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument; -import org.junit.Test; -import tools.inst2xsd.common.Inst2XsdTestBase; +import org.junit.jupiter.api.Test; import java.io.FileReader; -public class Inst2XsdMiscTest extends Inst2XsdTestBase { +import static tools.inst2xsd.common.Inst2XsdCommon.getDefaultInstOptions; +import static tools.inst2xsd.common.Inst2XsdTestBase.*; + +public class Inst2XsdMiscTest { public static final String EXPBASEXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"baseNamespace\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + @@ -54,32 +56,28 @@ public class Inst2XsdMiscTest extends In "</xs:schema>"; @Test - public void test_usingReader() throws Exception { + void test_usingReader() throws Exception { FileReader[] fReader = new FileReader[]{new FileReader(BASEXML)}; - SchemaDocument[] doc = Inst2Xsd.inst2xsd( fReader, common.getDefaultInstOptions()); + SchemaDocument[] doc = Inst2Xsd.inst2xsd( fReader, getDefaultInstOptions()); checkLength(doc, 1); - log(doc[0]); - log(XmlObject.Factory.parse(EXPBASEXML)); compare(doc[0],XmlObject.Factory.parse(EXPBASEXML) ); } @Test - public void test_nulloptions() throws Exception { + void test_nulloptions() throws Exception { FileReader[] fReader = new FileReader[]{new FileReader(BASEXML)}; SchemaDocument[] doc = Inst2Xsd.inst2xsd(fReader, null); checkLength(doc, 1); - log(doc[0]); compare(doc[0], XmlObject.Factory.parse(EXPBASEXML)); } @Test - public void test_notverboseoptions() throws Exception { + void test_notverboseoptions() throws Exception { FileReader[] fReader = new FileReader[]{new FileReader(BASEXML)}; - Inst2XsdOptions opts = common.getDefaultInstOptions(); + Inst2XsdOptions opts = getDefaultInstOptions(); opts.setVerbose(false); SchemaDocument[] doc = Inst2Xsd.inst2xsd(fReader, opts); checkLength(doc, 1); - log(doc[0]); compare(doc[0], XmlObject.Factory.parse(EXPBASEXML)); } @@ -125,7 +123,7 @@ public class Inst2XsdMiscTest extends In /* public void test_simpleContentString_Salami() throws Exception { - Inst2XsdOptions opt = common.getSalamiOptions(); + Inst2XsdOptions opt = getSalamiOptions(); opt.setSimpleContentTypes(Inst2XsdOptions.SIMPLE_CONTENT_TYPES_STRING); XmlObject[] api = runInst2Xsd(new XmlObject[]{XmlObject.Factory.parse(common.base)}, opt); checkLength(api, 1); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
