public void testFindAllVariablesTest() { XMLFileSemanticAnnotationFactoryImpl factory = new XMLFileSemanticAnnotationFactoryImpl(); // factory.setDeploymentFile("testdata//bpel.xml"); // factory.setBPELFile("testdata//SyncHelloWorld.bpel"); // // factory.setWSDLFile("testdata/SyncHelloWorld.wsdl"); // // factory.setXSDFile("testdata/SyncHelloWorld.xsd"); factory.setDeploymentFile("testdata//annotationInBPELFile//bpel.xml"); factory.setBPELFile("testdata//annotationInBPELFile//SyncHelloWorld.bpel"); factory.setProcessType(OracleLiteProcess.class); List<Variable> variableList = factory.findAllVariables(); XMLOutputter outputter = new XMLOutputter(); if (variableList != null) { for (Variable v : variableList) { try { outputter.output(v.getAnnotationElement(), System.out); System.out.println("\n"); } catch (IOException e) { e.printStackTrace(); } } } }
public void testFindAllVariablesFromProcessTest() throws SQLException, ClassNotFoundException, IOException, WSDLException, JDOMException, org.apache.woden.WSDLException { //// XMLFileSemanticAnnotationFactoryImpl factory = new XMLFileSemanticAnnotationFactoryImpl(); //// //// factory.setDeploymentFile("testdata//bpel.xml"); //// factory.setBPELFile("testdata//SyncHelloWorld.bpel"); // //// // factory.setWSDLFile("testdata/SyncHelloWorld.wsdl"); // //// // factory.setXSDFile("testdata/SyncHelloWorld.xsd"); // // factory.setProcessType(OracleLiteProcess.class); OracleLiteProcess process = new OracleLiteProcess(); // process.setDeploymentFilePath("testdata//bpel.xml"); // process.setBPELFilePath("testdata//SyncHelloWorld.bpel"); process.setDeploymentFilePath("testdata//annotationInBPELFile//bpel.xml"); process.setBPELFilePath("testdata//annotationInBPELFile//SyncHelloWorld.bpel"); process.readVariables(); List<Variable> variableList = process.getVariables(); XMLOutputter outputter = new XMLOutputter(); if (variableList != null) { for (Variable v : variableList) { try { outputter.output(v.getAnnotationElement(), System.out); System.out.println("\n"); } catch (IOException e) { e.printStackTrace(); } } } }
public void testgetAllAnnotations() { // Element element = new Element("variable"); // element.addContent("<variable name=\"inputVariable\" // messageType=\"client:SyncHelloWorldRequestMessage\"><message // name=\"SyncHelloWorldRequestMessage\"><part name=\"payload\" // element=\"{http://xmlns.oracle.com/SyncHelloWorld}SyncHelloWorldProcessRequest\"><element // xmlns=\"http://www.w3.org/2001/XMLSchema\" // name=\"SyncHelloWorldProcessRequest\"><complexType><sequence><element name=\"input\" // type=\"string\" /></sequence></complexType></element></part></message></variable>\""); /* * String variableString = * "<variable name=\"inputVariable\" messageType=\"client:SyncHelloWorldRequestMessage\">" * + "<message name=\"SyncHelloWorldRequestMessage\">" + * "<part name=\"payload\" element=\"{http://xmlns.oracle.com/SyncHelloWorld}SyncHelloWorldProcessRequest\">" * + * "<element xmlns=\"http://www.w3.org/2001/XMLSchema\" name=\"SyncHelloWorldProcessRequest\">" * + "<complexType>" + "<sequence>" + * "<element name=\"input\" type=\"string\" />" + "</sequence>" + * "</complexType>" + "</element>" + "</part>" + "</message>" + * "</variable>"; */ String variableString = "<variable name=\"inputVariable\" messageType=\"client:RentalProcessRequestMessage\">" + "<message name=\"RentalProcessRequestMessage\">" + "<part name=\"payload\" element=\"{http:////xmlns.oracle.com//RentalProcess}RentalProcessProcessRequest\">" + "<element xmlns=\"http:////www.w3.org//2001//XMLSchema\" name=\"RentalProcessProcessRequest\" >" + "<complexType name=\"rentalType\">" + "<sequence>" + "<element xmlns=\"http:////www.hotzenplotz.org//2001//isht\"" + " xmlns:sawsdl=\"http:////www.w3.org//ns//sawsdl\" " + " xmlns:bia=\"http:////www.ipvs.uni-stuttgart.de\" " + " name=\"rentalID\" " + " type=\"string\" " + " sawsdl:modelReference=\"http:////localhost:8080//OWLBuergerInformation.owl#Gender\" " + " bia:modelType=\"OWL\" " + " sawsdl:liftingSchemaMapping=\"testSheet.xsl\"/> " + " <element xmlns=\"http:////www.hotzenplotz.org//2001//isht\" " + " name=\"customer\">" + " <complextype name=\"customerType\">" + " <sequence>" + " <element name=\"CID\" " + " type=\"string\" />" + " </sequence>" + " </complextype>" + " </element>" + " <element " + " xmlns=\"http:////www.w3.org//2001//XMLSchema\" " + " xmlns:sawsdl=\"http://www.w3.org/ns/sawsdl\" " + " xmlns:bia=\"http://www.ipvs.uni-stuttgart.de\" " + " name=\"bybie\" " + " type=\"string\" " + " sawsdl:modelReference=\"http://BIA-Project.org/2007/Order#buyer\"" + " bia:modelType=\"WSMO\" />" + " </sequence>" + " </complexType>" + " </element>" + " </part>" + " </message>" + "</variable>"; SAXBuilder sb = new SAXBuilder(); Document doc = null; try { doc = sb.build(new StringReader(variableString)); } catch (JDOMException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } // XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); // try { // outputter.output(doc.getRootElement(), System.out); // } catch (IOException e) { // e.printStackTrace(); // } // System.out.println("\n"); XMLFileSemanticAnnotationFactoryImpl factory = new XMLFileSemanticAnnotationFactoryImpl(); // HashMap<String, String> namespaceNames = // new HashMap<String, String>(); Variable var = new Variable(); var.setAnnotationElement(doc.getRootElement()); List<? extends SemanticAnnotationImpl> annList = factory.getAllAnnotationsInVariable(var); // for (Map.Entry<String, String> entry : namespaceNames.entrySet()) { // // System.out.println("NamespaceName: " + entry.getKey() // + " NamespaceValue: " + entry.getValue()); // } for (SemanticAnnotationImpl ann : annList) { ((XMLFileSemanticAnnotationImpl) ann).dump(); // ann.dump(); } }