@Override protected AbstractNotificationOperation getNextOperation(final IWsdlModelRoot modelRoot) throws Exception { if (inlineNSCommand == null) { final ISchema containingSchema = findSingleSchema(modelRoot, "http://namespace1"); final Collection<ISchema> allReferredSchemas = containingSchema.getAllReferredSchemas(); ISchema schemaToInline = null; for (final ISchema iSchema : allReferredSchemas) { if (XSD1_NS.equals(iSchema.getNamespace())) { schemaToInline = iSchema; break; } } inlineNSCommand = new InlineNamespaceCompositeCommand(modelRoot, schemaToInline); return inlineNSCommand; } if (setTypeCommand == null) { final IElement attribute = getStructureType3(modelRoot).getElements("Attribute2").iterator().next(); final ISchema schema2 = findSingleSchema(modelRoot, "http://namespace3"); final IType typeToBeSet = schema2.getType(false, "SimpleType2"); setTypeCommand = new SetElementTypeCommand(attribute, typeToBeSet); return setTypeCommand; } return null; }
@Override protected AbstractNotificationOperation getOperation(IXSDModelRoot modelRoot) throws Exception { ISchema mySchema = modelRoot.getSchema(); int numberOfImports = 0; for (XSDSchemaContent content : mySchema.getComponent().getContents()) { if (content instanceof XSDImport && ((XSDImport) content).getNamespace().equals("http://example.com/MySchema1")) { numberOfImports++; } } assertEquals(1, numberOfImports); ISchema mySchema1_2 = this.getXSDModelRoot(mySchema1_2File).getSchema(); AbstractType sch2Element1 = (AbstractType) mySchema1_2.getType(true, "Sch2Element1"); ImportSchemaCommand command = new ImportSchemaCommand( (IXSDModelRoot) mySchema.getModelRoot(), (Schema) mySchema, sch2Element1); return command; }
// custom for this test. When ever it is first initiated :) private IStructureType getStructureType3(final IWsdlModelRoot modelRoot) { final ISchema schema = findSingleSchema(modelRoot, "http://namespace1"); return (StructureType) schema.getType(false, "StructureType3"); }