[NETBEANS-54] Modules review xml.schema.model - no external library - checked Rat report: excluded test-data from rat (no IP value), covered zip files contains simple XSD samples as groups - disable tests that fail because referenced files were not donated - skimmed through module, did not notice additional problems
Project: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/commit/51ea9c01 Tree: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/tree/51ea9c01 Diff: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/diff/51ea9c01 Branch: refs/heads/master Commit: 51ea9c0115738d6659e3e484e168e0f3d4988c53 Parents: ae66687 Author: Matthias Bläsing <[email protected]> Authored: Sat Oct 7 12:15:02 2017 +0200 Committer: Matthias Bläsing <[email protected]> Committed: Wed Oct 11 19:04:54 2017 +0200 ---------------------------------------------------------------------- nbbuild/build.xml | 4 + .../xml/schema/model/SchemaRefCacheTest.java | 3 +- .../xml/schema/model/impl/MultiFileTest.java | 147 +++++++++---------- .../model/impl/SchemaComponentImplTest.java | 91 ++++++------ .../xml/schema/model/impl/xdm/CutPasteTest.java | 116 +++++++-------- .../xml/schema/model/impl/xdm/SyncTest.java | 43 +++--- .../model/visitor/FindUsageVisitorTest.java | 13 +- 7 files changed, 211 insertions(+), 206 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/51ea9c01/nbbuild/build.xml ---------------------------------------------------------------------- diff --git a/nbbuild/build.xml b/nbbuild/build.xml index a9a0c59..9bf1d06 100644 --- a/nbbuild/build.xml +++ b/nbbuild/build.xml @@ -1991,6 +1991,10 @@ It is possible to use -Ddebug.port=3234 -Ddebug.pause=y to start the system in d <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.xml" /> <!-- test data --> <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.dtd" /> <!-- test data --> <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.txt" /> <!-- test data --> + <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/**/*.xsd" /> <!-- test data --> + <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/*.xml" /> <!-- test data --> + <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/*.zip" /> <!-- test data --> + <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/dummyProject/nbproject/private/tmpfile" /> <!-- test data --> <exclude name="xml.text/src/org/netbeans/modules/xml/text/resources/DTDExample" /> <!-- GUI sample file to demonstrate syntax highlighting --> <exclude name="xml.text/src/org/netbeans/modules/xml/text/resources/XMLExample" /> <!-- GUI sample file to demonstrate syntax highlighting --> <exclude name="xml.text/test/qa-functional/src/org/netbeans/modules/xml/text/**/data/**" /> <!-- test data --> http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/51ea9c01/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/SchemaRefCacheTest.java ---------------------------------------------------------------------- diff --git a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/SchemaRefCacheTest.java b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/SchemaRefCacheTest.java index 2f492c4..3ba848a 100644 --- a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/SchemaRefCacheTest.java +++ b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/SchemaRefCacheTest.java @@ -76,7 +76,8 @@ public class SchemaRefCacheTest extends TestCase { suite.addTest(new SchemaRefCacheTest("testRedefinedTargetNamespaceChanged")); // NOI18N suite.addTest(new SchemaRefCacheTest("testImportedTargetNamespaceDeleted")); // NOI18N suite.addTest(new SchemaRefCacheTest("testDetachedSchemaGarbageCollected")); // NOI18N - suite.addTest(new SchemaRefCacheTest("testCacheContainsRelevantComponents")); // NOI18N +// Disabled as referenced files were partly not donated by oracle to apache +// suite.addTest(new SchemaRefCacheTest("testCacheContainsRelevantComponents")); // NOI18N return suite; } http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/51ea9c01/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/MultiFileTest.java ---------------------------------------------------------------------- diff --git a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/MultiFileTest.java b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/MultiFileTest.java index 9395877..be7cc00 100644 --- a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/MultiFileTest.java +++ b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/MultiFileTest.java @@ -40,78 +40,77 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; /** - * - * @author Administrator + * Disabled as referenced files were partly not donated by oracle to apache */ -public class MultiFileTest extends TestCase { - - private static String TEST_XSD = "resources/OrgChart.xsd"; - - public MultiFileTest(String testName) { - super(testName); - } - - protected void setUp() throws Exception { - } - - protected void tearDown() throws Exception { - TestCatalogModel.getDefault().clearDocumentPool(); - } - - public void testGetImportedModelSources() throws Exception { - if ( ! NamespaceLocation.ADDRESS.getResourceFile().exists() ) { - NamespaceLocation.ADDRESS.refreshResourceFile(); - } - SchemaModel sm = TestCatalogModel.getDefault().getSchemaModel(NamespaceLocation.ORGCHART); - // get imported model sources - SchemaImpl schema = (SchemaImpl)sm.getSchema(); - Collection<Import> importedModelSources = new LinkedList<Import>(schema.getImports()); - assertEquals("should be six imports", 6 ,importedModelSources.size()); - Iterator<Import> itr = importedModelSources.iterator(); - while(itr.hasNext()) { - Import i = itr.next(); - try { - SchemaModel sm2 = i.resolveReferencedModel(); - } catch (CatalogModelException ex) { - itr.remove(); - } - } - assertEquals("only two imports are reachable", 1,importedModelSources.size()); - - ModelSource importedModelSource = importedModelSources.iterator().next().resolveReferencedModel().getModelSource(); - assertEquals("address.xsd",((FileObject)importedModelSource.getLookup().lookup(FileObject.class)).getNameExt()); - // get imported model - ModelSource testImportedModelSource = TestCatalogModel.getDefault().createTestModelSource((FileObject) importedModelSource.getLookup().lookup(FileObject.class), false); - SchemaModel sm1 = SchemaModelFactory.getDefault().getModel(testImportedModelSource); - assertNotNull(sm1); - assertEquals("http://www.altova.com/IPO",sm1.getSchema().getTargetNamespace()); - } - - public void testGetIncludedModelSources() throws Exception { - // get the model for OrgChart.xsd - URL orgChartUrl = getClass().getResource("../resources/ipo.xsd"); - File orgChartFile = new File(orgChartUrl.toURI()); - FileObject orgChartFileObj = FileUtil.toFileObject(orgChartFile); - //ModelSource localTestModelSource = new TestModelSource(orgChartFileObj,false); - ModelSource testModelSource = TestCatalogModel.getDefault().createTestModelSource(orgChartFileObj, false); - SchemaModel sm = SchemaModelFactory.getDefault().getModel(testModelSource); - - //register address.xsd with relative location (this is to be done only once - URL addressUrl = getClass().getResource("../resources/address.xsd"); - TestCatalogModel.getDefault().addURI(new URI("address.xsd"),addressUrl.toURI()); - - // get included model sources - SchemaImpl schema = (SchemaImpl)sm.getSchema(); - Collection<Include> includedModelSources = schema.getIncludes(); - assertEquals(1,includedModelSources.size()); - - ModelSource importedModelSource = includedModelSources.iterator().next().resolveReferencedModel().getModelSource(); - assertEquals("address.xsd",((FileObject)importedModelSource.getLookup().lookup(FileObject.class)).getNameExt()); - - // get included model - ModelSource testImportedModelSource = TestCatalogModel.getDefault().createTestModelSource((FileObject) importedModelSource.getLookup().lookup(FileObject.class), false); - SchemaModel sm1 = SchemaModelFactory.getDefault().getModel(testImportedModelSource); - assertNotNull(sm1); - assertEquals(schema.getTargetNamespace(),sm1.getSchema().getTargetNamespace()); - } -} +//public class MultiFileTest extends TestCase { +// +// private static String TEST_XSD = "resources/OrgChart.xsd"; +// +// public MultiFileTest(String testName) { +// super(testName); +// } +// +// protected void setUp() throws Exception { +// } +// +// protected void tearDown() throws Exception { +// TestCatalogModel.getDefault().clearDocumentPool(); +// } +// +// public void testGetImportedModelSources() throws Exception { +// if ( ! NamespaceLocation.ADDRESS.getResourceFile().exists() ) { +// NamespaceLocation.ADDRESS.refreshResourceFile(); +// } +// SchemaModel sm = TestCatalogModel.getDefault().getSchemaModel(NamespaceLocation.ORGCHART); +// // get imported model sources +// SchemaImpl schema = (SchemaImpl)sm.getSchema(); +// Collection<Import> importedModelSources = new LinkedList<Import>(schema.getImports()); +// assertEquals("should be six imports", 6 ,importedModelSources.size()); +// Iterator<Import> itr = importedModelSources.iterator(); +// while(itr.hasNext()) { +// Import i = itr.next(); +// try { +// SchemaModel sm2 = i.resolveReferencedModel(); +// } catch (CatalogModelException ex) { +// itr.remove(); +// } +// } +// assertEquals("only two imports are reachable", 1,importedModelSources.size()); +// +// ModelSource importedModelSource = importedModelSources.iterator().next().resolveReferencedModel().getModelSource(); +// assertEquals("address.xsd",((FileObject)importedModelSource.getLookup().lookup(FileObject.class)).getNameExt()); +// // get imported model +// ModelSource testImportedModelSource = TestCatalogModel.getDefault().createTestModelSource((FileObject) importedModelSource.getLookup().lookup(FileObject.class), false); +// SchemaModel sm1 = SchemaModelFactory.getDefault().getModel(testImportedModelSource); +// assertNotNull(sm1); +// assertEquals("http://www.altova.com/IPO",sm1.getSchema().getTargetNamespace()); +// } +// +// public void testGetIncludedModelSources() throws Exception { +// // get the model for OrgChart.xsd +// URL orgChartUrl = getClass().getResource("../resources/ipo.xsd"); +// File orgChartFile = new File(orgChartUrl.toURI()); +// FileObject orgChartFileObj = FileUtil.toFileObject(orgChartFile); +// //ModelSource localTestModelSource = new TestModelSource(orgChartFileObj,false); +// ModelSource testModelSource = TestCatalogModel.getDefault().createTestModelSource(orgChartFileObj, false); +// SchemaModel sm = SchemaModelFactory.getDefault().getModel(testModelSource); +// +// //register address.xsd with relative location (this is to be done only once +// URL addressUrl = getClass().getResource("../resources/address.xsd"); +// TestCatalogModel.getDefault().addURI(new URI("address.xsd"),addressUrl.toURI()); +// +// // get included model sources +// SchemaImpl schema = (SchemaImpl)sm.getSchema(); +// Collection<Include> includedModelSources = schema.getIncludes(); +// assertEquals(1,includedModelSources.size()); +// +// ModelSource importedModelSource = includedModelSources.iterator().next().resolveReferencedModel().getModelSource(); +// assertEquals("address.xsd",((FileObject)importedModelSource.getLookup().lookup(FileObject.class)).getNameExt()); +// +// // get included model +// ModelSource testImportedModelSource = TestCatalogModel.getDefault().createTestModelSource((FileObject) importedModelSource.getLookup().lookup(FileObject.class), false); +// SchemaModel sm1 = SchemaModelFactory.getDefault().getModel(testImportedModelSource); +// assertNotNull(sm1); +// assertEquals(schema.getTargetNamespace(),sm1.getSchema().getTargetNamespace()); +// } +//} http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/51ea9c01/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/SchemaComponentImplTest.java ---------------------------------------------------------------------- diff --git a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/SchemaComponentImplTest.java b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/SchemaComponentImplTest.java index d32d56d..4a6fd88 100644 --- a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/SchemaComponentImplTest.java +++ b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/SchemaComponentImplTest.java @@ -133,51 +133,52 @@ public class SchemaComponentImplTest extends TestCase { assertNotNull("only one annotation should be present", ann); } - public void testSetGlobalReference() throws Exception { - SchemaModel mod = Util.loadSchemaModel("resources/ipo.xsd"); - Schema schema = mod.getSchema(); - SchemaComponentFactory fact = mod.getFactory(); - - mod.startTransaction(); - GlobalAttributeGroup gap = fact.createGlobalAttributeGroup(); - schema.addAttributeGroup(gap); - gap.setName("myAttrGroup2"); - LocalAttribute ga = fact.createLocalAttribute(); - gap.addLocalAttribute(ga); - ga.setName("ga"); - GlobalSimpleType gst = FindSchemaComponentFromDOM.find( - GlobalSimpleType.class, schema, "/schema/simpleType[@name='Sku']"); - ga.setType(ga.createReferenceTo(gst, GlobalSimpleType.class)); - - mod.endTransaction(); - - String v = ((AbstractDocumentComponent)ga).getPeer().getAttribute("type"); - assertEquals("ref should have prefix", "ipo:Sku", v); - - mod.startTransaction(); - /* - <complexType name="myCT"> - <sequence> - <simpleType name="productName" type="xsd:string"/> - <attributeGroup ref="ipo:myAttrGroup2"/> - </complexType> - */ - GlobalComplexType gct = fact.createGlobalComplexType(); - schema.addComplexType(gct); - gct.setName("myCT"); - Sequence seq = Util.createSequence(mod, gct); - LocalElement le = Util.createLocalElement(mod, seq, "productName", 0); - le.setType(le.createReferenceTo(Util.getPrimitiveType("string"), GlobalSimpleType.class)); - - AttributeGroupReference agr = fact.createAttributeGroupReference(); - gct.addAttributeGroupReference(agr); - agr.setGroup(agr.createReferenceTo(gap, GlobalAttributeGroup.class)); - - mod.endTransaction(); - - v = ((AbstractDocumentComponent)agr).getPeer().getAttribute("ref"); - assertEquals("ref should have prefix", "ipo:myAttrGroup2", v); - } +// Disabled as referenced files were partly not donated by oracle to apache +// public void testSetGlobalReference() throws Exception { +// SchemaModel mod = Util.loadSchemaModel("resources/ipo.xsd"); +// Schema schema = mod.getSchema(); +// SchemaComponentFactory fact = mod.getFactory(); +// +// mod.startTransaction(); +// GlobalAttributeGroup gap = fact.createGlobalAttributeGroup(); +// schema.addAttributeGroup(gap); +// gap.setName("myAttrGroup2"); +// LocalAttribute ga = fact.createLocalAttribute(); +// gap.addLocalAttribute(ga); +// ga.setName("ga"); +// GlobalSimpleType gst = FindSchemaComponentFromDOM.find( +// GlobalSimpleType.class, schema, "/schema/simpleType[@name='Sku']"); +// ga.setType(ga.createReferenceTo(gst, GlobalSimpleType.class)); +// +// mod.endTransaction(); +// +// String v = ((AbstractDocumentComponent)ga).getPeer().getAttribute("type"); +// assertEquals("ref should have prefix", "ipo:Sku", v); +// +// mod.startTransaction(); +// /* +// <complexType name="myCT"> +// <sequence> +// <simpleType name="productName" type="xsd:string"/> +// <attributeGroup ref="ipo:myAttrGroup2"/> +// </complexType> +// */ +// GlobalComplexType gct = fact.createGlobalComplexType(); +// schema.addComplexType(gct); +// gct.setName("myCT"); +// Sequence seq = Util.createSequence(mod, gct); +// LocalElement le = Util.createLocalElement(mod, seq, "productName", 0); +// le.setType(le.createReferenceTo(Util.getPrimitiveType("string"), GlobalSimpleType.class)); +// +// AttributeGroupReference agr = fact.createAttributeGroupReference(); +// gct.addAttributeGroupReference(agr); +// agr.setGroup(agr.createReferenceTo(gap, GlobalAttributeGroup.class)); +// +// mod.endTransaction(); +// +// v = ((AbstractDocumentComponent)agr).getPeer().getAttribute("ref"); +// assertEquals("ref should have prefix", "ipo:myAttrGroup2", v); +// } public void testSetAndGetID() throws Exception { assertNull("id attribute is optional", schema.getId()); http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/51ea9c01/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/CutPasteTest.java ---------------------------------------------------------------------- diff --git a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/CutPasteTest.java b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/CutPasteTest.java index 0325a24..f4aae0a 100644 --- a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/CutPasteTest.java +++ b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/CutPasteTest.java @@ -113,65 +113,63 @@ public class CutPasteTest extends TestCase { ((NodeImpl)leti.getPeer()).getId()!=((NodeImpl)le2.getPeer()).getId()); } - /** - * testMultipleDnDAndUndo - */ - public void testMultipleDnDAndUndo() throws Exception { - SchemaModel model = Util.loadSchemaModel("resources/PO_copypasteundoSequence.xsd"); - UndoManager um = new UndoManager(); - model.addUndoableEditListener(um); - - Sequence seq = (Sequence)Util.findComponent( - model.getSchema(), - "/schema/complexType[@name='PurchaseOrderType']/sequence"); - assert(seq != null); - LocalElement shipTo = (LocalElement)Util.findComponent( - model.getSchema(), - "/schema/complexType[@name='PurchaseOrderType']/" + - "sequence/element[@name='shipTo']"); - assert(shipTo != null); - ElementReference comment = (ElementReference)Util.findComponent( - model.getSchema(), - "/schema/complexType[@name='PurchaseOrderType']/" + - "sequence/element[@ref='comment']"); - assert(comment != null); - - assertEquals(4, seq.getChildren().size()); - LocalElement copy_shipTo = (LocalElement) shipTo.copy(seq); - model.startTransaction(); - seq.removeContent(shipTo); - seq.addContent(copy_shipTo, 3); - model.endTransaction(); - assertEquals(4, seq.getChildren().size()); - - um.undo(); - assertEquals(4, seq.getChildren().size()); - - seq = (Sequence)Util.findComponent( - model.getSchema(), - "/schema/complexType[@name='PurchaseOrderType']/sequence"); - assert(seq != null); - shipTo = (LocalElement)Util.findComponent( - model.getSchema(), - "/schema/complexType[@name='PurchaseOrderType']/" + - "sequence/element[@name='shipTo']"); - assert(shipTo != null); - comment = (ElementReference)Util.findComponent( - model.getSchema(), - "/schema/complexType[@name='PurchaseOrderType']/" + - "sequence/element[@ref='comment']"); - assert(comment != null); - - ElementReference copy_comment = (ElementReference) comment.copy(seq); - model.startTransaction(); - seq.removeContent(comment); - seq.addContent(copy_comment, 1); - model.endTransaction(); - assertEquals(4, seq.getChildren().size()); - - um.undo(); - assertEquals(4, seq.getChildren().size()); - } +// Disabled as referenced files were partly not donated by oracle to apache +// public void testMultipleDnDAndUndo() throws Exception { +// SchemaModel model = Util.loadSchemaModel("resources/PO_copypasteundoSequence.xsd"); +// UndoManager um = new UndoManager(); +// model.addUndoableEditListener(um); +// +// Sequence seq = (Sequence)Util.findComponent( +// model.getSchema(), +// "/schema/complexType[@name='PurchaseOrderType']/sequence"); +// assert(seq != null); +// LocalElement shipTo = (LocalElement)Util.findComponent( +// model.getSchema(), +// "/schema/complexType[@name='PurchaseOrderType']/" + +// "sequence/element[@name='shipTo']"); +// assert(shipTo != null); +// ElementReference comment = (ElementReference)Util.findComponent( +// model.getSchema(), +// "/schema/complexType[@name='PurchaseOrderType']/" + +// "sequence/element[@ref='comment']"); +// assert(comment != null); +// +// assertEquals(4, seq.getChildren().size()); +// LocalElement copy_shipTo = (LocalElement) shipTo.copy(seq); +// model.startTransaction(); +// seq.removeContent(shipTo); +// seq.addContent(copy_shipTo, 3); +// model.endTransaction(); +// assertEquals(4, seq.getChildren().size()); +// +// um.undo(); +// assertEquals(4, seq.getChildren().size()); +// +// seq = (Sequence)Util.findComponent( +// model.getSchema(), +// "/schema/complexType[@name='PurchaseOrderType']/sequence"); +// assert(seq != null); +// shipTo = (LocalElement)Util.findComponent( +// model.getSchema(), +// "/schema/complexType[@name='PurchaseOrderType']/" + +// "sequence/element[@name='shipTo']"); +// assert(shipTo != null); +// comment = (ElementReference)Util.findComponent( +// model.getSchema(), +// "/schema/complexType[@name='PurchaseOrderType']/" + +// "sequence/element[@ref='comment']"); +// assert(comment != null); +// +// ElementReference copy_comment = (ElementReference) comment.copy(seq); +// model.startTransaction(); +// seq.removeContent(comment); +// seq.addContent(copy_comment, 1); +// model.endTransaction(); +// assertEquals(4, seq.getChildren().size()); +// +// um.undo(); +// assertEquals(4, seq.getChildren().size()); +// } private Document sd; private SchemaModel model; http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/51ea9c01/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/SyncTest.java ---------------------------------------------------------------------- diff --git a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/SyncTest.java b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/SyncTest.java index 039fba2..f77f530 100644 --- a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/SyncTest.java +++ b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/SyncTest.java @@ -532,27 +532,28 @@ public class SyncTest extends TestCase { assertEquals(3, seqChildren.size()); } - public void testUndoSequenceCopy() throws Exception { - SchemaModel model = Util.loadSchemaModel("resources/PO_copypasteundoSequence.xsd"); - UndoManager um = new UndoManager(); - model.addUndoableEditListener(um); - - GlobalComplexType gct = (GlobalComplexType)Util.findComponent( - model.getSchema(), "/schema/complexType[@name='Items']"); - Sequence seq1 = (Sequence) Util.findComponent( - model.getSchema(), "/schema/complexType[@name='USAddress']/sequence"); - assertEquals(1, gct.getDefinition().getChildren().size()); - assertEquals(5, seq1.getChildren().size()); - - Sequence seq2 = (Sequence) seq1.copy(gct); - model.startTransaction(); - gct.setDefinition(seq2); - model.endTransaction(); - assertEquals(5, gct.getDefinition().getChildren().size()); - - um.undo(); - assertEquals(1, gct.getDefinition().getChildren().size()); - } +// Disabled as referenced files were partly not donated by oracle to apache +// public void testUndoSequenceCopy() throws Exception { +// SchemaModel model = Util.loadSchemaModel("resources/PO_copypasteundoSequence.xsd"); +// UndoManager um = new UndoManager(); +// model.addUndoableEditListener(um); +// +// GlobalComplexType gct = (GlobalComplexType)Util.findComponent( +// model.getSchema(), "/schema/complexType[@name='Items']"); +// Sequence seq1 = (Sequence) Util.findComponent( +// model.getSchema(), "/schema/complexType[@name='USAddress']/sequence"); +// assertEquals(1, gct.getDefinition().getChildren().size()); +// assertEquals(5, seq1.getChildren().size()); +// +// Sequence seq2 = (Sequence) seq1.copy(gct); +// model.startTransaction(); +// gct.setDefinition(seq2); +// model.endTransaction(); +// assertEquals(5, gct.getDefinition().getChildren().size()); +// +// um.undo(); +// assertEquals(1, gct.getDefinition().getChildren().size()); +// } public void testSyncAnnotationRemoveId() throws Exception { SchemaModel model = Util.loadSchemaModel("resources/loanApplication_id.xsd"); http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/51ea9c01/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/visitor/FindUsageVisitorTest.java ---------------------------------------------------------------------- diff --git a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/visitor/FindUsageVisitorTest.java b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/visitor/FindUsageVisitorTest.java index df7001c..3352cb9 100644 --- a/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/visitor/FindUsageVisitorTest.java +++ b/xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/visitor/FindUsageVisitorTest.java @@ -100,12 +100,13 @@ public class FindUsageVisitorTest extends TestCase { return suite; } - public void testFindPath() throws Exception { - setUp1(); - this.assertEquals(49, findUsageCountForItem(global_element)); - this.assertEquals(3, findUsageCountForItem(global_type)); - this.assertEquals(4, findUsageCountForItem(global_attribute_group)); - } +// Disabled as referenced files were partly not donated by oracle to apache +// public void testFindPath() throws Exception { +// setUp1(); +// this.assertEquals(49, findUsageCountForItem(global_element)); +// this.assertEquals(3, findUsageCountForItem(global_type)); +// this.assertEquals(4, findUsageCountForItem(global_attribute_group)); +// } public int findUsageCountForItem(NamedReferenceable<SchemaComponent> ref) { long startTime = System.currentTimeMillis();
