You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/01/18 23:08:48 UTC
svn commit: r1851656 [5/28] - in /xmlbeans/trunk: ./ external/ lib/
resources/ resources/typeimpl/ resources/typeimpl/org/
resources/typeimpl/org/apache/ resources/typeimpl/org/apache/xmlbeans/
resources/typeimpl/org/apache/xmlbeans/impl/ resources/typ...
Modified: xmlbeans/trunk/test/src/compile/scomp/som/checkin/PartialSOMCheckinTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/compile/scomp/som/checkin/PartialSOMCheckinTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/compile/scomp/som/checkin/PartialSOMCheckinTest.java (original)
+++ xmlbeans/trunk/test/src/compile/scomp/som/checkin/PartialSOMCheckinTest.java Fri Jan 18 23:08:44 2019
@@ -16,30 +16,22 @@
package compile.scomp.som.checkin;
import compile.scomp.som.common.SomTestBase;
-import junit.framework.Assert;
import org.apache.xmlbeans.SchemaTypeSystem;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.impl.tool.Diff;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
-/**
- *
- *
- */
+import static org.junit.Assert.*;
public class PartialSOMCheckinTest extends SomTestBase
{
-
- public PartialSOMCheckinTest(String name)
- {
- super(name);
- }
-
-
+ @Before
public void setUp()
{
// initialize the built in schema type
@@ -67,12 +59,13 @@ public class PartialSOMCheckinTest exten
}
+ @After
public void tearDown()
{
errors.clear();
}
-
+ @Test
public void testAddAttributeAndElements() throws Exception
{
System.out.println("Inside test case testAddAttributeAndElements()");
@@ -84,32 +77,32 @@ public class PartialSOMCheckinTest exten
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.",
+ assertNotNull("Schema Type System created is Null.",
baseSTS);
// the tests - Walk thro the SOM, save, validate against an xml instance
inspectSOM(baseSTS, 1, 1, 1, 0);
// test for recoverable errors
- Assert.assertTrue("No Recovered Errors for Invalid Schema",
+ assertTrue("No Recovered Errors for Invalid Schema",
printRecoveredErrors());
// Test for saving of the PSOM - should not be able to save
- Assert.assertFalse("Partial SOM " + baseSTS.getName() + "Save successful - should fail!",
+ assertFalse("Partial SOM " + baseSTS.getName() + "Save successful - should fail!",
checkPSOMSave(baseSTS));
// instance validation - should fail
- Assert.assertFalse("Validation against instance Success - should fail ",
+ assertFalse("Validation against instance Success - should fail ",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), baseSTS));
// additional validation
- Assert.assertFalse("Attribute found but not expected - 'testAttributeComplex'",
+ assertFalse("Attribute found but not expected - 'testAttributeComplex'",
lookForAttributeInSTS(baseSTS,
"testAttributeComplex"));
- Assert.assertFalse("Element found but not expected 'ComplexTypeElem'",
+ assertFalse("Element found but not expected 'ComplexTypeElem'",
lookForElemInSTS(baseSTS,
"ComplexTypeElem"));
- Assert.assertFalse("Element found but not expected 'SimpleTypeElem'",
+ assertFalse("Element found but not expected 'SimpleTypeElem'",
lookForElemInSTS(baseSTS, "SimpleTypeElem"));
@@ -119,29 +112,29 @@ public class PartialSOMCheckinTest exten
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.",
+ assertNotNull("Schema Type System created is Null.",
modifiedSTS);
// test the PSOM created : walk thro the PSOM, look for # of elements,attributes,types & attribute groups
inspectSOM(modifiedSTS, 3, 2, 1, 0);
// Test for successful saving of the PSOM
- Assert.assertTrue("Valid Partial SOM " + modifiedSTS.getName() + "Save failed",
+ assertTrue("Valid Partial SOM " + modifiedSTS.getName() + "Save failed",
checkPSOMSave(modifiedSTS));
// Look for added attribute(s)/Element(s) by name in the STS
- Assert.assertTrue("Attribute expected, not found 'testAttributeComplex'",
+ assertTrue("Attribute expected, not found 'testAttributeComplex'",
lookForAttributeInSTS(modifiedSTS,
"testAttributeComplex"));
- Assert.assertTrue("Element expected, not found 'ComplexTypeElem'",
+ assertTrue("Element expected, not found 'ComplexTypeElem'",
lookForElemInSTS(modifiedSTS,
"ComplexTypeElem"));
- Assert.assertTrue("Element expected, not found 'SimpleTypeElem'",
+ assertTrue("Element expected, not found 'SimpleTypeElem'",
lookForElemInSTS(modifiedSTS,
"SimpleTypeElem"));
// validate against an xml instance
- Assert.assertTrue("Validation against instance failed ",
+ assertTrue("Validation against instance failed ",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), modifiedSTS));
// Step 3: now creat the Schema Type System with the original XSD again
@@ -150,21 +143,22 @@ public class PartialSOMCheckinTest exten
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
//walk the SOM
inspectSOM(finalSTS, 1, 1, 1, 0);
// Test for saving of the PSOM - should not be able to save
- Assert.assertFalse("Partial SOM " + finalSTS.getName() + "Save successful - should fail!",
+ assertFalse("Partial SOM " + finalSTS.getName() + "Save successful - should fail!",
checkPSOMSave(finalSTS));
// instance validation - should fail
- Assert.assertFalse("Validation against instance Success - should fail ",
+ assertFalse("Validation against instance Success - should fail ",
validateInstance(getTestCaseFile("instance_elemattr.xml"), finalSTS));
}
+ @Test
public void testModifyAttributeAndElements() throws Exception
{
System.out.println("Inside test case testModifyAttributeAndElements()");
@@ -176,17 +170,17 @@ public class PartialSOMCheckinTest exten
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// the tests - Walk thro the SOM, save, validate against an xml instance
inspectSOM(baseSTS, 3, 2, 1, 0);
// validate successful save
- Assert.assertTrue("Valid SOM " + baseSTS.getName() + "Save failed ",
+ assertTrue("Valid SOM " + baseSTS.getName() + "Save failed ",
checkPSOMSave(baseSTS));
// validate against instance successfully
- Assert.assertTrue("Validation against instance Failed ",
+ assertTrue("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), baseSTS));
// Step 2: create a Schema Type System with the new xsd file with modifications to existing schema
@@ -195,29 +189,29 @@ public class PartialSOMCheckinTest exten
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// test for recoverable errors
- Assert.assertTrue("No Recovered Errors for Invalid Schema",
+ assertTrue("No Recovered Errors for Invalid Schema",
printRecoveredErrors());
// test the PSOM created
inspectSOM(modifiedSTS, 2, 2, 1, 0); // walk thro the PSOM, look for # of elements,attributes,types & attribute groups
// Look for a modified attribute(s)/elements by name in the STS
- Assert.assertTrue("Attribute expected, not found 'testAttributeComplex'",
+ assertTrue("Attribute expected, not found 'testAttributeComplex'",
lookForAttributeInSTS(modifiedSTS, "testAttributeComplex"));
- Assert.assertTrue("Element expected, not found 'ComplexTypeElem'",
+ assertTrue("Element expected, not found 'ComplexTypeElem'",
lookForElemInSTS(modifiedSTS, "ComplexTypeElem"));
- Assert.assertFalse("Element expected, not found 'SimpleTypeElem'",
+ assertFalse("Element expected, not found 'SimpleTypeElem'",
lookForElemInSTS(modifiedSTS, "SimpleTypeElem"));
// Test for saving of the PSOM - should not be able to save
- Assert.assertFalse("Partial SOM " + modifiedSTS.getName() + " Save successful- should fail",
+ assertFalse("Partial SOM " + modifiedSTS.getName() + " Save successful- should fail",
checkPSOMSave(modifiedSTS));
// validate against an xml instance - should fail
- Assert.assertFalse("Validation against instance Success - should Fail",
+ assertFalse("Validation against instance Success - should Fail",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), modifiedSTS));
// Step 3: now creat the Schema Type System with the original XSD again
@@ -226,23 +220,24 @@ public class PartialSOMCheckinTest exten
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// walk the PSOM
inspectSOM(finalSTS, 3, 2, 1, 0);
// should be able to save as its a valid SOM
- Assert.assertTrue("Partial SOM " + finalSTS.getName() + "Save failed for complete SOM",
+ assertTrue("Partial SOM " + finalSTS.getName() + "Save failed for complete SOM",
checkPSOMSave(finalSTS));
// validate against instance successfully
- Assert.assertTrue("Validation against instance Failed ",
+ assertTrue("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), finalSTS));
// compare this to the original schema here - the root dir names used to save the PSOMs are the same as the STS names
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
}
+ @Test
public void testDeleteAttributeAndElements() throws Exception
{
System.out.println("Inside test case testDeleteAttributeAndElements()");
@@ -254,17 +249,17 @@ public class PartialSOMCheckinTest exten
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// the tests - Walk thro the SOM, save, validate against an xml instance
inspectSOM(baseSTS, 3, 2, 1, 0);
// validate successful save
- Assert.assertTrue("Valid SOM " + baseSTS.getName() + "Save failed ",
+ assertTrue("Valid SOM " + baseSTS.getName() + "Save failed ",
checkPSOMSave(baseSTS));
// validate against instance successfully
- Assert.assertTrue("Validation against instance Failed ",
+ assertTrue("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), baseSTS));
// Step 2: create a Schema Type System with the new xsd file that has deletions
@@ -273,29 +268,29 @@ public class PartialSOMCheckinTest exten
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// test for recoverable errors
- Assert.assertTrue("No Recovered Errors for Invalid Schema",
+ assertTrue("No Recovered Errors for Invalid Schema",
printRecoveredErrors());
// test the PSOM created
inspectSOM(modifiedSTS, 1, 1, 1, 0); // walk thro the PSOM, look for # of elements,attributes,types & attribute groups
// Test for saving of the PSOM - should not be able to save
- Assert.assertFalse("Invalid PSOM " + modifiedSTS.getName() + " Save successful - Should fail",
+ assertFalse("Invalid PSOM " + modifiedSTS.getName() + " Save successful - Should fail",
checkPSOMSave(modifiedSTS));
// verify types
- Assert.assertFalse("Attribute found but not expected - 'testAttributeComplex'",
+ assertFalse("Attribute found but not expected - 'testAttributeComplex'",
lookForAttributeInSTS(modifiedSTS, "testAttributeComplex"));
- Assert.assertFalse("Element found but not expected 'ComplexTypeElem'",
+ assertFalse("Element found but not expected 'ComplexTypeElem'",
lookForElemInSTS(modifiedSTS, "ComplexTypeElem"));
- Assert.assertFalse("Element found but not expected 'SimpleTypeElem'",
+ assertFalse("Element found but not expected 'SimpleTypeElem'",
lookForElemInSTS(modifiedSTS, "SimpleTypeElem"));
// validate against an xml instance - should fail
- Assert.assertFalse("Validation against success - should Fail ",
+ assertFalse("Validation against success - should Fail ",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), modifiedSTS));
// Step 3: now creat the Schema Type System with the original XSD again
@@ -304,24 +299,25 @@ public class PartialSOMCheckinTest exten
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// walk the SOM
inspectSOM(finalSTS, 3, 2, 1, 0);
// should be able to save as its a valid SOM
- Assert.assertTrue("Partial SOM " + finalSTS.getName() + "Save failed for complete SOM",
+ assertTrue("Partial SOM " + finalSTS.getName() + "Save failed for complete SOM",
checkPSOMSave(finalSTS));
// validate against instance
- Assert.assertTrue("Validation against instance Failed ",
+ assertTrue("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_elemattr_valid.xml"), finalSTS));
// compare this to the original schema here
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
}
+ @Test
public void testAddDataTypes() throws Exception
{
System.out.println("Inside test case testAddDataTypes()");
@@ -332,102 +328,102 @@ public class PartialSOMCheckinTest exten
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// recovearble errors should exist
- Assert.assertTrue("No Recovered Errors for Invalid Schema",
+ assertTrue("No Recovered Errors for Invalid Schema",
printRecoveredErrors());
// Walk thro the SOM (pass #Elems, #Attr, #Types, #AttrGroups)
inspectSOM(baseSTS, 12, 1, 4, 1);
// Test for saving of the PSOM - should not be able to save
- Assert.assertFalse("Partial SOM " + baseSTS.getName() + "Save successful - should fail!",
+ assertFalse("Partial SOM " + baseSTS.getName() + "Save successful - should fail!",
checkPSOMSave(baseSTS));
// instance validation - should fail
- Assert.assertFalse("Validation against instance Success - should fail ",
+ assertFalse("Validation against instance Success - should fail ",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), baseSTS));
// additional validation - check to see if the unresolved references to types are 'anyType'
// validate unresolved types
- Assert.assertEquals("Unresolved Simple Type should be 'anyType'",
+ assertEquals("Unresolved Simple Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testAtomicTypeElem"));
- Assert.assertEquals("Unresolved Simple Type should be 'anyType'",
+ assertEquals("Unresolved Simple Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testUnionTypeElem"));
// moved to detailed PSOMDetailedTest class
//Assert.assertEquals("Unresolved List Type should be 'anySimpleType'", anySimpleType, getElementType(baseSTS, "testListTypeElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testComplexTypeSimpleContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testComplexTypeElementOnlyContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testComplexTypeMixedElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testComplexTypeEmptyElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testChoiceGroupElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(baseSTS, "testAllGroupElem"));
// Step 2 : create an incremental PSOM that is valid by loading datatypes_added.xsd
SchemaTypeSystem modifiedSTS = createNewSTS("datatypes_added.xsd_", baseSTS, "ModifiedSchemaTS", sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// no errors expected to be recovered - should be a valid SOM
- Assert.assertFalse("Valid Schema Type System, Errors recovered",
+ assertFalse("Valid Schema Type System, Errors recovered",
printRecoveredErrors());
// test the PSOM created : walk thro the PSOM, look for # of elements,attributes,types & attribute groups
inspectSOM(modifiedSTS, 13, 1, 15, 1);
// test successful save
- Assert.assertTrue("Valid SOM " + modifiedSTS.getName() + " Save failed",
+ assertTrue("Valid SOM " + modifiedSTS.getName() + " Save failed",
checkPSOMSave(modifiedSTS));
// validate against an xml valid instance - should succeed
- Assert.assertTrue("Validation against instance Failed ",
+ assertTrue("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), modifiedSTS));
// validate against an xml invalid instance - should fail
- Assert.assertFalse("Validation against instance Failed ",
+ assertFalse("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_simple_types_invalid.xml"), modifiedSTS));
// additional validation - check to see if all types are resolved to their respective types
- Assert.assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
+ assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
"attachmentTypes",
getElementType(modifiedSTS, "testAtomicTypeElem"));
- Assert.assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType'",
+ assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType'",
"union.attachmentUnionType",
getElementType(modifiedSTS, "testUnionTypeElem"));
- Assert.assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
+ assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
"attchmentExtensionListTypes",
getElementType(modifiedSTS, "testListTypeElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'headerType'",
+ assertEquals("Unresolved Complex Type should be 'headerType'",
"headerType",
getElementType(modifiedSTS, "testComplexTypeSimpleContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'mailsType'",
+ assertEquals("Unresolved Complex Type should be 'mailsType'",
"mailsType",
getElementType(modifiedSTS, "testComplexTypeElementOnlyContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'mixedContentType'",
+ assertEquals("Unresolved Complex Type should be 'mixedContentType'",
"mixedContentType",
getElementType(modifiedSTS, "testComplexTypeMixedElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'emptyContentType'",
+ assertEquals("Unresolved Complex Type should be 'emptyContentType'",
"emptyContentType",
getElementType(modifiedSTS, "testComplexTypeEmptyElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'choiceGroupType'",
+ assertEquals("Unresolved Complex Type should be 'choiceGroupType'",
"choiceGroupType",
getElementType(modifiedSTS, "testChoiceGroupElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'allGroupType'",
+ assertEquals("Unresolved Complex Type should be 'allGroupType'",
"allGroupType",
getElementType(modifiedSTS, "testAllGroupElem"));
@@ -438,21 +434,22 @@ public class PartialSOMCheckinTest exten
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// test the PSOM created : walk thro the PSOM, look for # of elements,attributes,types & attribute groups
inspectSOM(finalSTS, 12, 1, 4, 1);
// test save failure
- Assert.assertFalse("Partial SOM " + finalSTS.getName() + "Save Success ",
+ assertFalse("Partial SOM " + finalSTS.getName() + "Save Success ",
checkPSOMSave(finalSTS));
// instance validation - should fail
- Assert.assertFalse("Validation against instance Success - should fail ",
+ assertFalse("Validation against instance Success - should fail ",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), finalSTS));
}
+ @Test
public void testDeleteDataTypes() throws Exception
{
System.out.println("Inside test case testDeleteDataTypes()");
@@ -464,48 +461,48 @@ public class PartialSOMCheckinTest exten
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// there should be NO recovearble errors
- Assert.assertEquals("Recovered Errors for Valid Schema", false, printRecoveredErrors());
+ assertEquals("Recovered Errors for Valid Schema", false, printRecoveredErrors());
// the tests - Walk thro the SOM, save, validate against an xml instance
inspectSOM(baseSTS, 13, 1, 15, 1);
// Recovered Errors, Test for saving of the PSOM - should go thro
- Assert.assertTrue("SOM " + baseSTS.getName() + "Save failed!",
+ assertTrue("SOM " + baseSTS.getName() + "Save failed!",
checkPSOMSave(baseSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), baseSTS));
// additional validation - check to see if all types are resolved to their respective types
- Assert.assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
+ assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
"attachmentTypes",
getElementType(baseSTS, "testAtomicTypeElem"));
- Assert.assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType'",
+ assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType'",
"union.attachmentUnionType",
getElementType(baseSTS, "testUnionTypeElem"));
- Assert.assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
+ assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
"attchmentExtensionListTypes",
getElementType(baseSTS, "testListTypeElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'headerType'",
+ assertEquals("Unresolved Complex Type should be 'headerType'",
"headerType",
getElementType(baseSTS, "testComplexTypeSimpleContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'mailsType'",
+ assertEquals("Unresolved Complex Type should be 'mailsType'",
"mailsType",
getElementType(baseSTS, "testComplexTypeElementOnlyContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'mixedContentType'",
+ assertEquals("Unresolved Complex Type should be 'mixedContentType'",
"mixedContentType",
getElementType(baseSTS, "testComplexTypeMixedElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'emptyContentType'",
+ assertEquals("Unresolved Complex Type should be 'emptyContentType'",
"emptyContentType",
getElementType(baseSTS, "testComplexTypeEmptyElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'choiceGroupType'",
+ assertEquals("Unresolved Complex Type should be 'choiceGroupType'",
"choiceGroupType",
getElementType(baseSTS, "testChoiceGroupElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'allGroupType'",
+ assertEquals("Unresolved Complex Type should be 'allGroupType'",
"allGroupType",
getElementType(baseSTS, "testAllGroupElem"));
@@ -515,48 +512,48 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// PSOM - recovered errors are expected
- Assert.assertEquals("Valid Schema Type System, Errors recovered", true, printRecoveredErrors());
+ assertEquals("Valid Schema Type System, Errors recovered", true, printRecoveredErrors());
// test the PSOM created : walk thro the PSOM, look for # of elements,attributes,types & attribute groups
inspectSOM(modifiedSTS, 12, 1, 4, 1);
// Test for saving of the PSOM - should not be able to save
- Assert.assertFalse("PSOM " + modifiedSTS.getName() + " Save should fail",
+ assertFalse("PSOM " + modifiedSTS.getName() + " Save should fail",
checkPSOMSave(modifiedSTS));
// validate unresolved types
- Assert.assertEquals("Unresolved Simple Type should be 'anyType'",
+ assertEquals("Unresolved Simple Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testAtomicTypeElem"));
- Assert.assertEquals("Unresolved Simple Type should be 'anyType'",
+ assertEquals("Unresolved Simple Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testUnionTypeElem"));
// moved to detailed PSOMDetailedTest class
// Assert.assertEquals("Unresolved List Type should be 'anySimpleType'", anySimpleType, getElementType(modifiedSTS, "testListTypeElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testComplexTypeSimpleContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testComplexTypeElementOnlyContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testComplexTypeMixedElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testComplexTypeEmptyElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testChoiceGroupElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'anyType'",
+ assertEquals("Unresolved Complex Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testAllGroupElem"));
// validate against an xml valid instance - should fail
- Assert.assertEquals("Validation against instance should Failed ", false, validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), modifiedSTS));
+ assertEquals("Validation against instance should Failed ", false, validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), modifiedSTS));
// Step 3 : reaload the xsd in Step 1
SchemaTypeSystem finalSTS = createNewSTS("datatypes_added.xsd_",
@@ -565,53 +562,54 @@ public class PartialSOMCheckinTest exten
sBaseSourceName);
// should be able to save as its a valid SOM
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// walk the PSOM
inspectSOM(finalSTS, 13, 1, 15, 1);
// should be able to save as its a valid SOM
- Assert.assertTrue("SOM " + finalSTS.getName() + "Save failed",
+ assertTrue("SOM " + finalSTS.getName() + "Save failed",
checkPSOMSave(finalSTS));
// instance validation - should be fine
- Assert.assertTrue("Validation against instance Failed ",
+ assertTrue("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), finalSTS));
// compare this to the original schema here
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
// additional validation - check to see if all types are resolved to their respective types
- Assert.assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
+ assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
"attachmentTypes",
getElementType(baseSTS, "testAtomicTypeElem"));
- Assert.assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType'",
+ assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType'",
"union.attachmentUnionType",
getElementType(baseSTS, "testUnionTypeElem"));
- Assert.assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
+ assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
"attchmentExtensionListTypes",
getElementType(baseSTS, "testListTypeElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'headerType'",
+ assertEquals("Unresolved Complex Type should be 'headerType'",
"headerType",
getElementType(baseSTS, "testComplexTypeSimpleContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'mailsType'",
+ assertEquals("Unresolved Complex Type should be 'mailsType'",
"mailsType",
getElementType(baseSTS, "testComplexTypeElementOnlyContentElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'mixedContentType'",
+ assertEquals("Unresolved Complex Type should be 'mixedContentType'",
"mixedContentType",
getElementType(baseSTS, "testComplexTypeMixedElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'emptyContentType'",
+ assertEquals("Unresolved Complex Type should be 'emptyContentType'",
"emptyContentType",
getElementType(baseSTS, "testComplexTypeEmptyElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'choiceGroupType'",
+ assertEquals("Unresolved Complex Type should be 'choiceGroupType'",
"choiceGroupType",
getElementType(baseSTS, "testChoiceGroupElem"));
- Assert.assertEquals("Unresolved Complex Type should be 'allGroupType'",
+ assertEquals("Unresolved Complex Type should be 'allGroupType'",
"allGroupType",
getElementType(baseSTS, "testAllGroupElem"));
}
+ @Test
public void testModifyDataTypes() throws Exception
{
System.out.println("Inside test case testModifyDataTypes()");
@@ -622,31 +620,31 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 13, 1, 15, 1);
// Recovered Errors, Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + baseSTS.getName() + "Save failed!",
+ assertTrue("SOM " + baseSTS.getName() + "Save failed!",
checkPSOMSave(baseSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), baseSTS));
// check types before modify
- Assert.assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
+ assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
"attachmentTypes",
getElementType(baseSTS, "testAtomicTypeElem"));
- Assert.assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
+ assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
"attchmentExtensionListTypes",
getElementType(baseSTS, "testListTypeElem"));
- Assert.assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType",
+ assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType",
"union.attachmentUnionType",
getElementType(baseSTS, "testUnionTypeElem"));
@@ -657,17 +655,17 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// test the PSOM created :walk thro the PSOM, look for # of elements,attributes,types & attribute groups
inspectSOM(modifiedSTS, 13, 1, 13, 1);
// Test for saving of the PSOM - should not be able to save
- Assert.assertFalse("PSOM " + modifiedSTS.getName() + " Save should fail",
+ assertFalse("PSOM " + modifiedSTS.getName() + " Save should fail",
checkPSOMSave(modifiedSTS));
// validate unresolved types
- Assert.assertEquals("Unresolved Simple Type - Atomic should be 'anyType'",
+ assertEquals("Unresolved Simple Type - Atomic should be 'anyType'",
anyType,
getElementType(modifiedSTS, "testAtomicTypeElem"));
@@ -676,7 +674,7 @@ public class PartialSOMCheckinTest exten
//Assert.assertEquals("Unresolved Simple Type - Union should be 'anySimpleType'", anySimpleType, getElementType(modifiedSTS, "testUnionTypeElem"));
// validate against an xml valid instance - should fail
- Assert.assertFalse("Validation against instance should Failed ",
+ assertFalse("Validation against instance should Failed ",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), modifiedSTS));
// step 3: reload the original STS
@@ -684,34 +682,35 @@ public class PartialSOMCheckinTest exten
modifiedSTS,
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// walk the SOM
inspectSOM(finalSTS, 13, 1, 15, 1);
// validate successful save
- Assert.assertTrue("SOM " + finalSTS.getName() + "Save failed",
+ assertTrue("SOM " + finalSTS.getName() + "Save failed",
checkPSOMSave(finalSTS)); // should be able to save as its a valid SOM
// validate instance - should validate
- Assert.assertTrue("Validation against instance Failed ",
+ assertTrue("Validation against instance Failed ",
validateInstance(getTestCaseFile("instance_datatypes_valid.xml"), finalSTS));
// check types after modify
- Assert.assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
+ assertEquals("Unresolved Simple Type should be 'attachmentTypes'",
"attachmentTypes",
getElementType(finalSTS, "testAtomicTypeElem"));
- Assert.assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
+ assertEquals("Unresolved List Type should be 'attchmentExtensionListTypes'",
"attchmentExtensionListTypes",
getElementType(finalSTS, "testListTypeElem"));
- Assert.assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType",
+ assertEquals("Unresolved Simple Type should be 'union.attachmentUnionType",
"union.attachmentUnionType",
getElementType(finalSTS, "testUnionTypeElem"));
// compare this to the original schema here
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
}
+ @Test
public void testDeleteDerivedTypes() throws Exception
{
System.out.println("Inside test case testDeleteDerivedTypes()");
@@ -722,58 +721,58 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 13, 0, 14, 0);
// Recovered Errors, Test for saving of the SOM - should go thro
- Assert.assertTrue("Valid SOM " + baseSTS.getName() + "Save failed!",
+ assertTrue("Valid SOM " + baseSTS.getName() + "Save failed!",
checkPSOMSave(baseSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_derived_types_valid.xml"), baseSTS));
// check types before deletion of base types
- Assert.assertEquals("Elem Type should be 'ExtensionBaseType' (base)",
+ assertEquals("Elem Type should be 'ExtensionBaseType' (base)",
"ExtensionBaseType",
getElementType(baseSTS, "ExtensionBaseTypeElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
"ExtensionDerivedComplexContentType",
getElementType(baseSTS, "ExtensionDerivedComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionBaseMixedContentType' (base)",
+ assertEquals("Elem Type should be 'ExtensionBaseMixedContentType' (base)",
"ExtensionBaseMixedContentType",
getElementType(baseSTS, "ExtensionBaseMixedContentTypElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedMixedContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedMixedContentType' (derived)",
"ExtensionDerivedMixedContentType",
getElementType(baseSTS, "ExtensionDerivedMixedContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionSimpleContentBaseType'",
+ assertEquals("Elem Type should be 'RestrictionSimpleContentBaseType'",
"RestrictionSimpleContentBaseType", getElementType(baseSTS, "RestrictionSimpleContentBaseTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionSimpleContentDerivedType'",
+ assertEquals("Elem Type should be 'RestrictionSimpleContentDerivedType'",
"RestrictionSimpleContentDerivedType", getElementType(baseSTS, "RestrictionSimpleContentDerivedTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionBaseComplexContentType'",
+ assertEquals("Elem Type should be 'RestrictionBaseComplexContentType'",
"RestrictionBaseComplexContentType",
getElementType(baseSTS, "RestrictionBaseComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionDerivedComplexContentType'",
+ assertEquals("Elem Type should be 'RestrictionDerivedComplexContentType'",
"RestrictionDerivedComplexContentType",
getElementType(baseSTS, "RestrictionDerivedComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionBaseMixedContentType'",
+ assertEquals("Elem Type should be 'RestrictionBaseMixedContentType'",
"RestrictionBaseMixedContentType", getElementType(baseSTS, "RestrictionBaseMixedContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionDerivedMixedContentType'",
+ assertEquals("Elem Type should be 'RestrictionDerivedMixedContentType'",
"RestrictionDerivedMixedContentType", getElementType(baseSTS, "RestrictionDerivedMixedContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionBaseEmptyContentType'",
+ assertEquals("Elem Type should be 'RestrictionBaseEmptyContentType'",
"RestrictionBaseEmptyContentType", getElementType(baseSTS, "RestrictionBaseEmptyContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionDerivedEmptyContentType'",
+ assertEquals("Elem Type should be 'RestrictionDerivedEmptyContentType'",
"RestrictionDerivedEmptyContentType", getElementType(baseSTS, "RestrictionDerivedEmptyContentTypeElem"));
// Step 2: create invalid PSOM with base type removed
@@ -781,35 +780,35 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// recovearble errors
- Assert.assertTrue("No Recovered Errors for Invalid PSOM",
+ assertTrue("No Recovered Errors for Invalid PSOM",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(modifiedSTS, 13, 0, 9, 0);
// Recovered Errors, Test for saving of the SOM
- Assert.assertEquals("SOM " + modifiedSTS.getName() + "Save Success - should fail!",
+ assertEquals("SOM " + modifiedSTS.getName() + "Save Success - should fail!",
false, checkPSOMSave(modifiedSTS));
// instance validation - should fail
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_derived_types_valid.xml"), modifiedSTS));
// check types - base should be 'anyType'
- Assert.assertEquals("Elem Type should be 'anyType' (base)",
+ assertEquals("Elem Type should be 'anyType' (base)",
anyType,
getElementType(modifiedSTS, "ExtensionBaseTypeElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
"ExtensionDerivedComplexContentType",
getElementType(modifiedSTS, "ExtensionDerivedComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'anyType' (base)",
+ assertEquals("Elem Type should be 'anyType' (base)",
anyType,
getElementType(modifiedSTS, "ExtensionBaseMixedContentTypElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
"ExtensionDerivedMixedContentType",
getElementType(modifiedSTS, "ExtensionDerivedMixedContentTypeElem"));
@@ -820,27 +819,27 @@ public class PartialSOMCheckinTest exten
// getElementType(modifiedSTS, "RestrictionSimpleContentBaseTypeElem"));
//
- Assert.assertEquals("Elem Type should be 'RestrictionSimpleContentDerivedType'",
+ assertEquals("Elem Type should be 'RestrictionSimpleContentDerivedType'",
"RestrictionSimpleContentDerivedType",
getElementType(modifiedSTS, "RestrictionSimpleContentDerivedTypeElem"));
- Assert.assertEquals("Elem Type should be 'anyType'",
+ assertEquals("Elem Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "RestrictionBaseComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionDerivedComplexContentType'",
+ assertEquals("Elem Type should be 'RestrictionDerivedComplexContentType'",
"RestrictionDerivedComplexContentType",
getElementType(modifiedSTS, "RestrictionDerivedComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'anyType'",
+ assertEquals("Elem Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "RestrictionBaseMixedContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionDerivedMixedContentType'",
+ assertEquals("Elem Type should be 'RestrictionDerivedMixedContentType'",
"RestrictionDerivedMixedContentType",
getElementType(modifiedSTS, "RestrictionDerivedMixedContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'anyType'", anyType,
+ assertEquals("Elem Type should be 'anyType'", anyType,
getElementType(modifiedSTS, "RestrictionBaseEmptyContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'RestrictionDerivedEmptyContentType'",
+ assertEquals("Elem Type should be 'RestrictionDerivedEmptyContentType'",
"RestrictionDerivedEmptyContentType", getElementType(modifiedSTS, "RestrictionDerivedEmptyContentTypeElem"));
@@ -849,28 +848,28 @@ public class PartialSOMCheckinTest exten
modifiedSTS,
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(finalSTS, 13, 0, 14, 0);
// Recovered Errors, Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + finalSTS.getName() + "Save failed!",
+ assertTrue("SOM " + finalSTS.getName() + "Save failed!",
checkPSOMSave(finalSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_derived_types_valid.xml"), finalSTS));
// compare this to the original schema here
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
}
-
+ @Test
public void testAddDerivedTypes() throws Exception
{
System.out.println("Inside test case testAddDerivedTypes()");
@@ -881,34 +880,34 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
- Assert.assertTrue("No Recovered Errors for Invalid PSOM",
+ assertTrue("No Recovered Errors for Invalid PSOM",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 13, 0, 9, 0);
// Recovered Errors, Test for saving of the SOM
- Assert.assertFalse("SOM " + baseSTS.getName() + "Save Success - should fail!",
+ assertFalse("SOM " + baseSTS.getName() + "Save Success - should fail!",
checkPSOMSave(baseSTS));
// instance validation - should fail
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_derived_types_valid.xml"), baseSTS));
// check types - base should be 'anyType'
- Assert.assertEquals("Elem Type should be 'anyType' (base)",
+ assertEquals("Elem Type should be 'anyType' (base)",
anyType,
getElementType(baseSTS, "ExtensionBaseTypeElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
"ExtensionDerivedComplexContentType",
getElementType(baseSTS, "ExtensionDerivedComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'anyType' (base)",
+ assertEquals("Elem Type should be 'anyType' (base)",
anyType,
getElementType(baseSTS, "ExtensionBaseMixedContentTypElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
"ExtensionDerivedMixedContentType",
getElementType(baseSTS, "ExtensionDerivedMixedContentTypeElem"));
@@ -917,34 +916,34 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(modifiedSTS, 13, 0, 14, 0);
// Recovered Errors, Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + modifiedSTS.getName() + "Save failed!",
+ assertTrue("SOM " + modifiedSTS.getName() + "Save failed!",
checkPSOMSave(modifiedSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_derived_types_valid.xml"), modifiedSTS));
// check types before deletion of base types
- Assert.assertEquals("Elem Type should be 'ExtensionBaseType' (base)",
+ assertEquals("Elem Type should be 'ExtensionBaseType' (base)",
"ExtensionBaseType",
getElementType(modifiedSTS, "ExtensionBaseTypeElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedComplexContentType' (derived)",
"ExtensionDerivedComplexContentType",
getElementType(modifiedSTS, "ExtensionDerivedComplexContentTypeElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionBaseMixedContentType' (base)",
+ assertEquals("Elem Type should be 'ExtensionBaseMixedContentType' (base)",
"ExtensionBaseMixedContentType",
getElementType(modifiedSTS, "ExtensionBaseMixedContentTypElem"));
- Assert.assertEquals("Elem Type should be 'ExtensionDerivedMixedContentType' (derived)",
+ assertEquals("Elem Type should be 'ExtensionDerivedMixedContentType' (derived)",
"ExtensionDerivedMixedContentType",
getElementType(modifiedSTS, "ExtensionDerivedMixedContentTypeElem"));
@@ -954,7 +953,7 @@ public class PartialSOMCheckinTest exten
//public void testDeleteReusableGroups() throws Exception
//{}
//public void testModifyReusableGroups() throws Exception
-
+ @Test
public void testAddReusableGroups() throws Exception
{
System.out.println("Inside test case testAddReusableGroups()");
@@ -965,29 +964,29 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// recovearble errors
- Assert.assertTrue("Recovered Errors for Valid Schema",
+ assertTrue("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 7, 0, 4, 1);
// Recovered Errors, Test for saving of the SOM - should fail
- Assert.assertFalse("Partial SOM " + baseSTS.getName() + "Save successful - should failed!",
+ assertFalse("Partial SOM " + baseSTS.getName() + "Save successful - should failed!",
checkPSOMSave(baseSTS));
// instance validation - should fail
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), baseSTS));
// verify types
// named model groups
- Assert.assertEquals("Elem Type should be 'ModelGrpType'",
+ assertEquals("Elem Type should be 'ModelGrpType'",
"ModelGrpType",
getElementType(baseSTS, "ModelGrpTypeElem"));
- Assert.assertTrue("Elem Type should be 'AttributeGroup'",
+ assertTrue("Elem Type should be 'AttributeGroup'",
getAttributeGroup(baseSTS, "AttributeGroup"));
// Step 2: create a SOM with valid xsd
@@ -995,34 +994,34 @@ public class PartialSOMCheckinTest exten
baseSTS,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(modifiedSTS, 7, 0, 5, 2);
// Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + modifiedSTS.getName() + "Save failed!",
+ assertTrue("SOM " + modifiedSTS.getName() + "Save failed!",
checkPSOMSave(modifiedSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), modifiedSTS));
// verify named model groups
- Assert.assertEquals("Elem Type should be 'ModelGrpType'",
+ assertEquals("Elem Type should be 'ModelGrpType'",
"ModelGrpType",
getElementType(modifiedSTS, "ModelGrpTypeElem"));
- Assert.assertTrue("Elem Type should be 'AttributeGroup'",
+ assertTrue("Elem Type should be 'AttributeGroup'",
getAttributeGroup(modifiedSTS, "AttributeGroup"));
}
-
+ @Test
public void testAddSubstitutionGroups() throws Exception
{
System.out.println("Inside test case testAddSubstitutionGroups()");
@@ -1033,39 +1032,39 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// errors recovered
- Assert.assertTrue("No Recovered Errors for recovered PSOM",
+ assertTrue("No Recovered Errors for recovered PSOM",
printRecoveredErrors());
// Recovered Errors, Test for saving of the SOM
- Assert.assertFalse("SOM " + baseSTS.getName() + "Save Success - should fail!",
+ assertFalse("SOM " + baseSTS.getName() + "Save Success - should fail!",
checkPSOMSave(baseSTS));
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 7, 0, 4, 1);
// instance validation - should fail
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), baseSTS));
// verify types
- Assert.assertEquals("Elem Type should be 'anyType'",
+ assertEquals("Elem Type should be 'anyType'",
anyType,
getElementType(baseSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'anyType' (Member of Sub. Group)",
+ assertEquals("Elem Type should be 'anyType' (Member of Sub. Group)",
anyType,
getElementType(baseSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType",
getElementType(baseSTS, "SubGrpMemberElem2"));
// named model groups
- Assert.assertEquals("Elem Type should be 'ModelGrpType'",
+ assertEquals("Elem Type should be 'ModelGrpType'",
"ModelGrpType",
getElementType(baseSTS, "ModelGrpTypeElem"));
- Assert.assertTrue("Elem Type should be 'AttributeGroup'",
+ assertTrue("Elem Type should be 'AttributeGroup'",
getAttributeGroup(baseSTS, "AttributeGroup"));
// Step 2: create a valid SOM and add to these
@@ -1073,31 +1072,31 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(modifiedSTS, 7, 0, 5, 2);
// Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + modifiedSTS.getName() + "Save failed!",
+ assertTrue("SOM " + modifiedSTS.getName() + "Save failed!",
checkPSOMSave(modifiedSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), modifiedSTS));
// verify types - substitution groups
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
"SubGrpHeadElemType",
getElementType(modifiedSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
"SubGrpHeadElemType",
getElementType(modifiedSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType",
getElementType(modifiedSTS, "SubGrpMemberElem2"));
@@ -1106,8 +1105,7 @@ public class PartialSOMCheckinTest exten
//Assert.assertEquals("Elem Type should be 'AttributeGroup'", "AttributeGroup", getAttributeGroup(baseSTS,"AttributeGroup"));
}
-
-
+ @Test
public void testDeleteSubstitutionGroups() throws Exception
{
System.out.println("Inside test case testDeleteSubstitutionGroups()");
@@ -1118,31 +1116,31 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 7, 0, 5, 2);
// Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + baseSTS.getName() + "Save failed!",
+ assertTrue("SOM " + baseSTS.getName() + "Save failed!",
checkPSOMSave(baseSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), baseSTS));
// verify types - substitution groups
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
"SubGrpHeadElemType",
getElementType(baseSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
"SubGrpHeadElemType",
getElementType(baseSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType",
getElementType(baseSTS, "SubGrpMemberElem2"));
@@ -1155,38 +1153,38 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
- Assert.assertTrue("Recovered Errors for Valid Schema",
+ assertTrue("Recovered Errors for Valid Schema",
printRecoveredErrors());
// Recovered Errors, Test for saving of the SOM
- Assert.assertFalse("SOM " + modifiedSTS.getName() + "Save Success - should fail!",
+ assertFalse("SOM " + modifiedSTS.getName() + "Save Success - should fail!",
checkPSOMSave(modifiedSTS));
// the tests - Walk thro the valid SOM
inspectSOM(modifiedSTS, 7, 0, 4, 1);
// instance validation - should fail
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), modifiedSTS));
// verify types
- Assert.assertEquals("Elem Type should be 'anyType'",
+ assertEquals("Elem Type should be 'anyType'",
anyType,
getElementType(modifiedSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'anyType' (Member of Sub. Group)",
+ assertEquals("Elem Type should be 'anyType' (Member of Sub. Group)",
anyType,
getElementType(modifiedSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType",
getElementType(modifiedSTS, "SubGrpMemberElem2"));
// named model groups
- Assert.assertEquals("Elem Type should be 'ModelGrpType'",
+ assertEquals("Elem Type should be 'ModelGrpType'",
"ModelGrpType",
getElementType(modifiedSTS, "ModelGrpTypeElem"));
- Assert.assertTrue("Elem Type should be 'AttributeGroup'",
+ assertTrue("Elem Type should be 'AttributeGroup'",
getAttributeGroup(modifiedSTS, "AttributeGroup"));
// step 3: create a PSOM with the original xsd
@@ -1194,25 +1192,25 @@ public class PartialSOMCheckinTest exten
modifiedSTS,
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// Test for saving of the SOM - should go thro
- Assert.assertEquals("SOM " + finalSTS.getName() + "Save failed!",
+ assertEquals("SOM " + finalSTS.getName() + "Save failed!",
true,
checkPSOMSave(finalSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), finalSTS));
// verify types
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
"SubGrpHeadElemType",
getElementType(finalSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
"SubGrpHeadElemType",
getElementType(finalSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType",
getElementType(finalSTS, "SubGrpMemberElem2"));
@@ -1221,9 +1219,10 @@ public class PartialSOMCheckinTest exten
//Assert.assertEquals("Elem Type should be 'AttributeGroup'", "AttributeGroup", getAttributeGroup(baseSTS,"AttributeGroup"));
// compare this to the original schema here
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
}
+ @Test
public void testModifySubstitutionGroups() throws Exception
{
System.out.println("Inside test case testModifySubstitutionGroups()");
@@ -1234,31 +1233,31 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 7, 0, 5, 2);
// Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + baseSTS.getName() + "Save failed!",
+ assertTrue("SOM " + baseSTS.getName() + "Save failed!",
checkPSOMSave(baseSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), baseSTS));
// verify types
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
"SubGrpHeadElemType",
getElementType(baseSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
"SubGrpHeadElemType",
getElementType(baseSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType",
getElementType(baseSTS, "SubGrpMemberElem2"));
@@ -1267,27 +1266,27 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// Recovered Errors, Test for saving of the SOM - still a valid PSOM
- Assert.assertTrue("SOM " + modifiedSTS.getName() + "Save Success - should fail!",
+ assertTrue("SOM " + modifiedSTS.getName() + "Save Success - should fail!",
checkPSOMSave(modifiedSTS));
// the tests - Walk thro the valid SOM
inspectSOM(modifiedSTS, 5, 0, 3, 0);
// instance validation - should fail
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), modifiedSTS));
// verify types
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType2'",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType2'",
"SubGrpHeadElemType2",
getElementType(modifiedSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType2' (derived)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType2' (derived)",
"SubGrpHeadElemType2",
getElementType(modifiedSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType",
getElementType(modifiedSTS, "SubGrpMemberElem2"));
@@ -1296,33 +1295,34 @@ public class PartialSOMCheckinTest exten
modifiedSTS,
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + finalSTS.getName() + "Save failed!",
+ assertTrue("SOM " + finalSTS.getName() + "Save failed!",
checkPSOMSave(finalSTS));
// instance validation - should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_subst_grps_valid.xml"), finalSTS));
// the tests - Walk thro the valid SOM
inspectSOM(finalSTS, 7, 0, 5, 2);
// verify types
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (base)",
"SubGrpHeadElemType",
getElementType(finalSTS, "SubGrpHeadElem"));
- Assert.assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
+ assertEquals("Elem Type should be 'SubGrpHeadElemType' (derived)",
"SubGrpHeadElemType",
getElementType(finalSTS, "SubGrpMemberElem1"));
- Assert.assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
+ assertEquals("Elem Type should be 'ExtensionSubGrpHeadElemType' (base)",
"ExtensionSubGrpHeadElemType", getElementType(finalSTS, "SubGrpMemberElem2"));
// compare this to the original schema here
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
}
+ @Test
public void testModifyIdConstraints() throws Exception
{
System.out.println("Inside test case testModifyIdConstraints()");
@@ -1333,29 +1333,29 @@ public class PartialSOMCheckinTest exten
null,
"BaseSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", baseSTS);
+ assertNotNull("Schema Type System created is Null.", baseSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(baseSTS, 5, 0, 2, 0);
- Assert.assertTrue("Constraint 'uniqueConstraint' should be found",lookForIdentityConstraint(baseSTS,"uniqueConstraint"));
- Assert.assertTrue("Constraint 'keyConstraint' should be found",lookForIdentityConstraint(baseSTS,"keyConstraint"));
- Assert.assertTrue("Constraint 'KeyRefConstraint' should be found",lookForIdentityConstraint(baseSTS,"KeyRefConstraint"));
+ assertTrue("Constraint 'uniqueConstraint' should be found",lookForIdentityConstraint(baseSTS,"uniqueConstraint"));
+ assertTrue("Constraint 'keyConstraint' should be found",lookForIdentityConstraint(baseSTS,"keyConstraint"));
+ assertTrue("Constraint 'KeyRefConstraint' should be found",lookForIdentityConstraint(baseSTS,"KeyRefConstraint"));
// Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + baseSTS.getName() + "Save failed!",
+ assertTrue("SOM " + baseSTS.getName() + "Save failed!",
checkPSOMSave(baseSTS));
// instance validation against valid instance- should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_constraints_valid.xml"), baseSTS));
// validation against instance which violates the Constraints - should fail
- Assert.assertFalse("Validation against invalid should fail",
+ assertFalse("Validation against invalid should fail",
validateInstance(getTestCaseFile("instance_constraints_invalid.xml"), baseSTS));
// Step 2: create an incremental PSOM with the constraint commented out
@@ -1367,28 +1367,28 @@ public class PartialSOMCheckinTest exten
baseSTS,
"ModifiedSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", modifiedSTS);
+ assertNotNull("Schema Type System created is Null.", modifiedSTS);
// recovearble errors
- Assert.assertTrue("Recovered Errors for Valid Schema",
+ assertTrue("Recovered Errors for Valid Schema",
printRecoveredErrors());
// Recovered Errors, Test for saving of the SOM
- Assert.assertFalse("valid PSOM " + modifiedSTS.getName() + "Save failed !",
+ assertFalse("valid PSOM " + modifiedSTS.getName() + "Save failed !",
checkPSOMSave(modifiedSTS));
// the tests - Walk thro the valid SOM
inspectSOM(modifiedSTS, 5, 0, 2, 0);
// instance validation - should fail
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_constraints_valid.xml"), modifiedSTS));
// Invalid instance validation - should fail bcos of Unique constraint definition missing
- Assert.assertFalse("Validation against instance failed",
+ assertFalse("Validation against instance failed",
validateInstance(getTestCaseFile("instance_constraints_invalid.xml"), modifiedSTS));
- Assert.assertFalse("KeyRef 'KeyRefConstraint' should not be resolved",
+ assertFalse("KeyRef 'KeyRefConstraint' should not be resolved",
lookForIdentityConstraint(modifiedSTS, "KeyConstraint"));
// Step 3 : recreate SOM in first step and compare it
@@ -1396,25 +1396,25 @@ public class PartialSOMCheckinTest exten
modifiedSTS,
"FinalSchemaTS",
sBaseSourceName);
- Assert.assertNotNull("Schema Type System created is Null.", finalSTS);
+ assertNotNull("Schema Type System created is Null.", finalSTS);
// there should be NO recovearble errors
- Assert.assertFalse("Recovered Errors for Valid Schema",
+ assertFalse("Recovered Errors for Valid Schema",
printRecoveredErrors());
// the tests - Walk thro the valid SOM
inspectSOM(finalSTS, 5, 0, 2, 0);
// Test for saving of the SOM - should go thro
- Assert.assertTrue("SOM " + finalSTS.getName() + "Save failed!",
+ assertTrue("SOM " + finalSTS.getName() + "Save failed!",
checkPSOMSave(finalSTS));
// instance validation against valid instance- should be ok
- Assert.assertTrue("Validation against instance failed",
+ assertTrue("Validation against instance failed",
validateInstance(getTestCaseFile("instance_constraints_valid.xml"), finalSTS));
// compare this to the original schema here
- Assert.assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
+ assertTrue(compareSavedSOMs("BaseSchemaTS","FinalSchemaTS"));
}
}
Modified: xmlbeans/trunk/test/src/compile/scomp/som/common/SomTestBase.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/compile/scomp/som/common/SomTestBase.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/compile/scomp/som/common/SomTestBase.java (original)
+++ xmlbeans/trunk/test/src/compile/scomp/som/common/SomTestBase.java Fri Jan 18 23:08:44 2019
@@ -28,11 +28,10 @@
*/
package compile.scomp.som.common;
-import compile.scomp.common.CompileCommon;
import compile.scomp.common.CompileTestBase;
-import junit.framework.Assert;
import org.apache.xmlbeans.*;
import org.apache.xmlbeans.impl.tool.Diff;
+import org.junit.Assert;
import javax.xml.namespace.QName;
import java.io.File;
@@ -43,10 +42,9 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-/**
- *
- *
- */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class SomTestBase extends CompileTestBase
{
public static String casesRootDir = XBEAN_CASE_ROOT+ P + "compile" + P + "som" + P;
@@ -61,11 +59,6 @@ public class SomTestBase extends Compile
public static final String anySimpleType = "anySimpleType";
public static final String anyType = "anyType";
- public SomTestBase(String name)
- {
- super(name);
- }
-
public static void inspectSOM(SchemaTypeSystem schematypesys,
int expectedGlobalElems,
int expectedGlobalAttrs,
@@ -126,7 +119,7 @@ public class SomTestBase extends Compile
// # of global attributes
out.println("----- # Global Attributes :" + schematypesys.globalAttributes().length);
- Assert.assertEquals("Incorrect Number of Global Attributes in STS " + schematypesys.getName(), expectedGlobalAttrs, schematypesys.globalAttributes().length);
+ assertEquals("Incorrect Number of Global Attributes in STS " + schematypesys.getName(), expectedGlobalAttrs, schematypesys.globalAttributes().length);
for (int i = 0; i < schematypesys.globalAttributes().length; i++)
{
out.println("\t------> Attr Name :" + schematypesys.globalAttributes()[i].getName());
@@ -135,7 +128,7 @@ public class SomTestBase extends Compile
// # of global elements
out.println("----- # Global Elements :" + schematypesys.globalElements().length);
- Assert.assertEquals("Incorrect Number of Global Elements in STS " + schematypesys.getName(), expectedGlobalElems, schematypesys.globalElements().length);
+ assertEquals("Incorrect Number of Global Elements in STS " + schematypesys.getName(), expectedGlobalElems, schematypesys.globalElements().length);
for (int i = 0; i < schematypesys.globalElements().length; i++)
{
out.println("\t------> Elem Name :" + schematypesys.globalElements()[i].getName());
@@ -144,7 +137,7 @@ public class SomTestBase extends Compile
// # of global Types
out.println("----- # Global Types :" + schematypesys.globalTypes().length);
- Assert.assertEquals("Incorrect Number of Global Types in STS " + schematypesys.getName(), expectedGlobalTypes, schematypesys.globalTypes().length);
+ assertEquals("Incorrect Number of Global Types in STS " + schematypesys.getName(), expectedGlobalTypes, schematypesys.globalTypes().length);
for (int i = 0; i < schematypesys.globalTypes().length; i++)
{
out.println("\t------> TypeName:" + schematypesys.globalTypes()[i].getName());
@@ -152,7 +145,7 @@ public class SomTestBase extends Compile
// # of attribute Groups
out.println("----- # of Attribute Groups :" + schematypesys.attributeGroups().length);
- Assert.assertEquals("Incorrect Number of Attribute Groups in STS " + schematypesys.getName(), expectedAttrGroups, schematypesys.attributeGroups().length);
+ assertEquals("Incorrect Number of Attribute Groups in STS " + schematypesys.getName(), expectedAttrGroups, schematypesys.attributeGroups().length);
for (int i = 0; i < schematypesys.attributeGroups().length; i++)
{
out.println("\t------> Attr Group Name :" + schematypesys.attributeGroups()[i].getName());
@@ -421,7 +414,7 @@ public class SomTestBase extends Compile
{
ioe.getMessage();
ioe.printStackTrace();
- Assert.fail("IOException throw when accessing instance xml file " + instancefile.getAbsoluteFile());
+ fail("IOException throw when accessing instance xml file " + instancefile.getAbsoluteFile());
}
catch (XmlException xme)
{
@@ -438,7 +431,7 @@ public class SomTestBase extends Compile
}
}
System.out.println("END Instance Validation Errors .. .. ..");
- Assert.fail("Instance Validation - Xml Exception caught");
+ fail("Instance Validation - Xml Exception caught");
}
// validation successful
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org