Author: objectiser
Date: 2011-02-10 15:00:20 -0500 (Thu, 10 Feb 2011)
New Revision: 648
Added:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMToProtocolParserTest.java
Removed:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMProtocolParserTest.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/cdm/
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/spr/
Modified:
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/Interface.java
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/OneWayRequestMEP.java
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/RequestResponseMEP.java
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/TypeDefinition.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtilTest.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ESBBroker.spr
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PolicyQuote.spr
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PurchaseGoods.spr
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ReqRespFault.spr
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)Broker.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)CreditAgency.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierQuoteEngine.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierTxnProcessor.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)CreditCheckService.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)PolicyQuoteProcessService.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)CreditAgency.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)Store.contract
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ReqRespFault(a)Seller.contract
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/main/java/org/savara/wsdl/generator/impl/WSDLGeneratorImpl.java
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/ProtocolToWSDLGeneratorTest.java
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_Broker_rpc_0.wsdl
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_CreditAgency_rpc_0.wsdl
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierQuoteEngine_rpc_0.wsdl
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierTxnProcessor_rpc_0.wsdl
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_CreditCheckService_rpc_0.wsdl
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_PolicyQuoteProcessService_rpc_0.wsdl
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ReqRespFault_Seller_rpc_0.wsdl
Log:
Pass xsd element/type information through to contract, to enable the generated WSDL to
define the correct attribute on the message part.
Modified:
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -71,7 +71,7 @@
* @param name The name
* @return The annotation, or null if not found
*/
- public static Annotation
getAnnotation(java.util.List<org.scribble.common.model.Annotation> annotations,
+ public static Annotation getAnnotation(java.util.List<? extends
org.scribble.common.model.Annotation> annotations,
String name) {
Annotation ret=null;
@@ -95,7 +95,7 @@
* @param propValue The property value
* @return The annotation, or null if not found
*/
- public static Annotation
getAnnotationWithProperty(java.util.List<org.scribble.common.model.Annotation>
annotations,
+ public static Annotation getAnnotationWithProperty(java.util.List<? extends
org.scribble.common.model.Annotation> annotations,
String name, String propName, Object propValue) {
Annotation ret=null;
@@ -123,7 +123,7 @@
* @param name The name
* @return The annotations with the specified name
*/
- public static java.util.List<Annotation>
getAnnotations(java.util.List<org.scribble.common.model.Annotation> annotations,
+ public static java.util.List<Annotation> getAnnotations(java.util.List<?
extends org.scribble.common.model.Annotation> annotations,
String name) {
java.util.List<Annotation> ret=new java.util.Vector<Annotation>();
Modified:
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/Interface.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/Interface.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/Interface.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -17,6 +17,8 @@
*/
package org.savara.contract.model;
+import org.savara.common.model.annotation.Annotation;
+
/**
* This class represents an interface, as part of a contract.
*
@@ -107,6 +109,10 @@
public String toString() {
StringBuffer buf=new StringBuffer();
+ for (Annotation ann : getAnnotations()) {
+ buf.append("\t[["+ann+"]]\r\n");
+ }
+
buf.append("\tInterface {"+m_namespace+"}"+m_name+"
{\r\n");
for (MessageExchangePattern mep : getMessageExchangePatterns()) {
Modified:
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/OneWayRequestMEP.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/OneWayRequestMEP.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/OneWayRequestMEP.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -17,6 +17,8 @@
*/
package org.savara.contract.model;
+import org.savara.common.model.annotation.Annotation;
+
/**
* This class represents the one-way message exchange pattern.
*/
@@ -31,6 +33,10 @@
public String toString() {
StringBuffer buf=new StringBuffer();
+ for (Annotation ann : getAnnotations()) {
+ buf.append("\t\t[["+ann+"]]\r\n");
+ }
+
buf.append("\t\tOneWayRequestMEP "+getOperation()+"( ");
for (Type t : getTypes()) {
Modified:
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/RequestResponseMEP.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/RequestResponseMEP.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/RequestResponseMEP.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -17,6 +17,8 @@
*/
package org.savara.contract.model;
+import org.savara.common.model.annotation.Annotation;
+
/**
* This class represents the request response message exchange pattern.
*/
@@ -70,6 +72,10 @@
public String toString() {
StringBuffer buf=new StringBuffer();
+ for (Annotation ann : getAnnotations()) {
+ buf.append("\t\t[["+ann+"]]\r\n");
+ }
+
buf.append("\t\tRequestResponseMEP "+getOperation()+"( ");
for (Type t : getTypes()) {
Modified:
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/TypeDefinition.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/TypeDefinition.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/TypeDefinition.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -17,6 +17,8 @@
*/
package org.savara.contract.model;
+import org.savara.common.model.annotation.Annotation;
+
/**
* This class represents a type definition within
*/
@@ -111,7 +113,15 @@
}
public String toString() {
- return("\tTypeDef "+m_name+" type="+m_dataType+
+ StringBuffer buf=new StringBuffer();
+
+ for (Annotation ann : getAnnotations()) {
+ buf.append("\t[["+ann+"]]\r\n");
+ }
+
+ buf.append("\tTypeDef "+m_name+" type="+m_dataType+
" location="+m_location+"
typeSystem="+m_typeSystem+"\r\n");
+
+ return(buf.toString());
}
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -169,11 +169,15 @@
org.pi4soa.common.xml.XMLPrefixResolver resolver=
org.pi4soa.cdl.util.CDLTypeUtil.getPrefixResolver(infoType.getPackage());
String typeName=null;
+ Annotation xsdAnnotation=null;
if (org.pi4soa.common.util.NamesUtil.isSet(infoType.getTypeName())) {
typeName = infoType.getTypeName();
+ xsdAnnotation = new Annotation(AnnotationDefinitions.XSD_TYPE);
+
} else if (org.pi4soa.common.util.NamesUtil.isSet(infoType.getElementName())) {
typeName = infoType.getElementName();
+ xsdAnnotation = new Annotation(AnnotationDefinitions.XSD_ELEMENT);
}
if (typeName != null) {
@@ -199,7 +203,9 @@
if ((tilist.getLocation() == null && location == null) ||
(tilist.getLocation() != null && location != null &&
- tilist.getLocation().equals(location))) {
+ tilist.getLocation().equals(location)) &&
+ AnnotationDefinitions.getAnnotation(tilist.getAnnotations(),
+ xsdAnnotation.getName()) != null) {
til = tilist;
break;
}
@@ -211,6 +217,8 @@
til.setFormat(TypeSystem.XSD);
til.setLocation(location);
+ til.getAnnotations().add(xsdAnnotation);
+
model.getImports().add(til);
}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMProtocolParserTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMProtocolParserTest.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMProtocolParserTest.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,92 +0,0 @@
-package org.savara.pi4soa.cdm.parser;
-
-import static org.junit.Assert.*;
-
-import org.savara.protocol.util.ProtocolServices;
-import org.scribble.common.logging.Journal;
-import org.scribble.protocol.model.ProtocolModel;
-
-public class CDMProtocolParserTest {
-
- public ProtocolModel getModel(String filename, Journal logger) {
- ProtocolModel ret=null;
-
- java.io.InputStream is=
- ClassLoader.getSystemResourceAsStream(filename);
-
- if (is == null) {
- fail("Failed to load protocol '"+filename+"'");
- }
-
- org.scribble.protocol.parser.ProtocolParser parser=
- new org.savara.pi4soa.cdm.parser.CDMProtocolParser();
-
- try {
- ret = parser.parse(is, logger, null);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- return(ret);
- }
-
- public void verify(ProtocolModel model, String sprFile) {
- TestJournal journal=new TestJournal();
-
- org.scribble.protocol.export.text.TextProtocolExporter exporter=
- new org.scribble.protocol.export.text.TextProtocolExporter();
-
- try {
- java.io.ByteArrayOutputStream os=
- new java.io.ByteArrayOutputStream();
-
- exporter.export(model, journal, os);
-
- String spr=new String(os.toByteArray());
-
- spr = spr.replaceAll("\r\n", "\n");
-
- java.io.InputStream is=
- ClassLoader.getSystemResourceAsStream(sprFile);
-
- if (is == null) {
- fail("Failed to load scribble protocol '"+sprFile+"'");
- }
-
- byte[] b=new byte[is.available()];
-
- is.read(b);
-
- String sprText=new String(b);
-
- sprText = sprText.replaceAll("\r\n", "\n");
-
- if (spr.equals(sprText) == false) {
- System.out.println("Derived choreo=\r\n"+spr);
- fail("Protocol derived from choreography:
(len="+spr.length()+")\r\n::"+spr+
- "::\r\n\r\ndoes not match expected:
(len="+sprText.length()+")\r\n::"+sprText+"::");
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- @org.junit.Before
- public void setup() {
- //ProtocolServices.setProtocolProjector(
- // new org.scribble.protocol.projection.impl.ProtocolProjectorImpl());
- }
-
- @org.junit.Test
- public void testParse() {
- TestJournal logger=new TestJournal();
-
- ProtocolModel model=getModel("cdm/PurchaseGoods.cdm", logger);
-
- assertNotNull(model);
-
- assertTrue(logger.getErrorCount() == 0);
-
- verify(model, "spr/PurchaseGoods.spr");
- }
-}
Copied:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMToProtocolParserTest.java
(from rev 644,
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMToProtocolParserTest.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/CDMToProtocolParserTest.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -0,0 +1,213 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.pi4soa.cdm.parser;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import org.scribble.common.logging.CachedJournal;
+import org.savara.pi4soa.cdm.parser.CDMProtocolParser;
+
+public class CDMToProtocolParserTest {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Choreography->Protocol Parser
Tests");
+
+ suite.addTest(new ChoreographyToProtocolTester("ESBBroker"));
+ suite.addTest(new ChoreographyToProtocolTester("PolicyQuote"));
+ suite.addTest(new ChoreographyToProtocolTester("PurchaseGoods"));
+ suite.addTest(new ChoreographyToProtocolTester("ReqRespFault"));
+
+ return suite;
+ }
+
+ protected static class ChoreographyToProtocolTester extends TestCase {
+
+ private String m_name=null;
+
+ /**
+ * This constructor is initialized with the test
+ * name.
+ *
+ * @param name The test name
+ */
+ public ChoreographyToProtocolTester(String name) {
+ super(name);
+ m_name = name;
+ }
+
+ /**
+ * This method runs the test.
+ *
+ * @param result The test result
+ */
+ public void run(TestResult result) {
+ // Setup scribble services
+ //ProtocolServices.setProtocolProjector(
+ // new org.scribble.protocol.projection.impl.ProtocolProjectorImpl());
+
+ // Run test
+ result.startTest(this);
+
+ String filename="testmodels/cdm/"+m_name+".cdm";
+
+ java.io.InputStream is=
+ ClassLoader.getSystemResourceAsStream(filename);
+
+ if (is == null) {
+ result.addError(this,
+ new Throwable("Unable to locate resource: "+filename));
+ } else {
+ CachedJournal journal=new CachedJournal();
+
+ org.scribble.protocol.model.ProtocolModel model=null;
+
+ CDMProtocolParser parser=new CDMProtocolParser();
+
+ try {
+ model = parser.parse(is, journal, null);
+ } catch(Exception e) {
+ result.addError(this, new Throwable("Parsing choreography failed"));
+ }
+
+ if (model == null) {
+ result.addError(this, new Throwable("Model is null"));
+ } else {
+
+ org.scribble.protocol.export.text.TextProtocolExporter exporter=
+ new org.scribble.protocol.export.text.TextProtocolExporter();
+
+ java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
+
+ exporter.export(model, journal, os);
+
+ try {
+ os.close();
+ } catch(Exception e) {
+ fail("Failed to close stream");
+ }
+
+ String str=os.toString();
+
+ checkResults(result, str);
+ }
+ }
+
+ result.endTest(this);
+ }
+
+ /**
+ * This method checks the generated protocol against a
+ * previously stored correct version.
+ *
+ * @param result The test result
+ * @param protocol The protocol
+ */
+ protected void checkResults(TestResult result, String protocol) {
+ boolean f_valid=false;
+
+ String filename="results/protocol/"+m_name+".spr";
+
+ java.io.InputStream is=
+ ClassLoader.getSystemResourceAsStream(filename);
+
+ if (is != null) {
+
+ try {
+ byte[] b=new byte[is.available()];
+
+ is.read(b);
+
+ is.close();
+
+ String orig=new String(b);
+
+ if (orig.equals(protocol) == false) {
+ result.addError(this,
+ new Throwable("Generated protocol does not match stored version"));
+ } else {
+ f_valid = true;
+ }
+ } catch(Exception e) {
+ result.addError(this, e);
+ }
+ } else {
+ result.addError(this,
+ new Throwable("Resulting protocol '"+filename+
+ "' not found for comparison"));
+ }
+
+ if (f_valid == false) {
+ String bpelfile="testmodels/cdm/"+m_name+".cdm";
+
+ java.net.URL url=ClassLoader.getSystemResource(bpelfile);
+
+ if (url != null) {
+ // URL will point to copy of test models in the classes folder, so need
+ // to obtain reference back to source version
+ java.io.File f=null;
+
+ if (url.getFile().indexOf("target/test-classes") != -1) {
+ f = new
java.io.File(url.getFile().replaceFirst("target/test-classes","src/test/resources"));
+ } else if (url.getFile().indexOf("classes") != -1) {
+ f = new
java.io.File(url.getFile().replaceFirst("classes","src/test/resources"));
+ } else if (url.getFile().indexOf("bin") != -1) {
+ f = new
java.io.File(url.getFile().replaceFirst("bin","src/test/resources"));
+ } else {
+ result.addError(this, new Exception("Could not locate results folder to
record expected result"));
+ }
+
+ if (f != null && f.exists()) {
+ f = f.getParentFile().getParentFile().getParentFile();
+
+ java.io.File resultsDir=new java.io.File(f, "results/protocol");
+
+ if (resultsDir.exists() == false) {
+ resultsDir.mkdirs();
+ }
+
+ java.io.File resultFile=new java.io.File(resultsDir,
+ m_name+".generated");
+
+ if (resultFile.exists() == false) {
+ try {
+ java.io.FileOutputStream fos=new java.io.FileOutputStream(resultFile);
+
+ fos.write(protocol.getBytes());
+
+ fos.flush();
+ fos.close();
+
+ } catch(Exception e){
+ result.addError(this, e);
+ }
+ } else {
+ System.err.println("NOTE: Generated output '"+resultFile+
+ "' already exists - not being overwritten");
+ }
+ } else {
+ result.addError(this, new Throwable("Unable to obtain URL for CDM model
source '"+
+ m_name+"': "+url));
+ }
+ }
+ }
+ }
+ }
+}
Deleted:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,214 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.savara.pi4soa.cdm.parser;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.scribble.common.logging.CachedJournal;
-import org.savara.pi4soa.cdm.parser.CDMProtocolParser;
-import org.savara.protocol.util.ProtocolServices;
-
-public class ParserTest {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Choreography->Protocol Parser
Tests");
-
- suite.addTest(new ChoreographyToProtocolTester("ESBBroker"));
- suite.addTest(new ChoreographyToProtocolTester("PolicyQuote"));
- suite.addTest(new ChoreographyToProtocolTester("PurchaseGoods"));
- suite.addTest(new ChoreographyToProtocolTester("ReqRespFault"));
-
- return suite;
- }
-
- protected static class ChoreographyToProtocolTester extends TestCase {
-
- private String m_name=null;
-
- /**
- * This constructor is initialized with the test
- * name.
- *
- * @param name The test name
- */
- public ChoreographyToProtocolTester(String name) {
- super(name);
- m_name = name;
- }
-
- /**
- * This method runs the test.
- *
- * @param result The test result
- */
- public void run(TestResult result) {
- // Setup scribble services
- //ProtocolServices.setProtocolProjector(
- // new org.scribble.protocol.projection.impl.ProtocolProjectorImpl());
-
- // Run test
- result.startTest(this);
-
- String filename="testmodels/cdm/"+m_name+".cdm";
-
- java.io.InputStream is=
- ClassLoader.getSystemResourceAsStream(filename);
-
- if (is == null) {
- result.addError(this,
- new Throwable("Unable to locate resource: "+filename));
- } else {
- CachedJournal journal=new CachedJournal();
-
- org.scribble.protocol.model.ProtocolModel model=null;
-
- CDMProtocolParser parser=new CDMProtocolParser();
-
- try {
- model = parser.parse(is, journal, null);
- } catch(Exception e) {
- result.addError(this, new Throwable("Parsing choreography failed"));
- }
-
- if (model == null) {
- result.addError(this, new Throwable("Model is null"));
- } else {
-
- org.scribble.protocol.export.text.TextProtocolExporter exporter=
- new org.scribble.protocol.export.text.TextProtocolExporter();
-
- java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
-
- exporter.export(model, journal, os);
-
- try {
- os.close();
- } catch(Exception e) {
- fail("Failed to close stream");
- }
-
- String str=os.toString();
-
- checkResults(result, str);
- }
- }
-
- result.endTest(this);
- }
-
- /**
- * This method checks the generated protocol against a
- * previously stored correct version.
- *
- * @param result The test result
- * @param protocol The protocol
- */
- protected void checkResults(TestResult result, String protocol) {
- boolean f_valid=false;
-
- String filename="results/protocol/"+m_name+".spr";
-
- java.io.InputStream is=
- ClassLoader.getSystemResourceAsStream(filename);
-
- if (is != null) {
-
- try {
- byte[] b=new byte[is.available()];
-
- is.read(b);
-
- is.close();
-
- String orig=new String(b);
-
- if (orig.equals(protocol) == false) {
- result.addError(this,
- new Throwable("Generated protocol does not match stored version"));
- } else {
- f_valid = true;
- }
- } catch(Exception e) {
- result.addError(this, e);
- }
- } else {
- result.addError(this,
- new Throwable("Resulting protocol '"+filename+
- "' not found for comparison"));
- }
-
- if (f_valid == false) {
- String bpelfile="testmodels/cdm/"+m_name+".cdm";
-
- java.net.URL url=ClassLoader.getSystemResource(bpelfile);
-
- if (url != null) {
- // URL will point to copy of test models in the classes folder, so need
- // to obtain reference back to source version
- java.io.File f=null;
-
- if (url.getFile().indexOf("target/test-classes") != -1) {
- f = new
java.io.File(url.getFile().replaceFirst("target/test-classes","src/test/resources"));
- } else if (url.getFile().indexOf("classes") != -1) {
- f = new
java.io.File(url.getFile().replaceFirst("classes","src/test/resources"));
- } else if (url.getFile().indexOf("bin") != -1) {
- f = new
java.io.File(url.getFile().replaceFirst("bin","src/test/resources"));
- } else {
- result.addError(this, new Exception("Could not locate results folder to
record expected result"));
- }
-
- if (f != null && f.exists()) {
- f = f.getParentFile().getParentFile().getParentFile();
-
- java.io.File resultsDir=new java.io.File(f, "results/protocol");
-
- if (resultsDir.exists() == false) {
- resultsDir.mkdirs();
- }
-
- java.io.File resultFile=new java.io.File(resultsDir,
- m_name+".generated");
-
- if (resultFile.exists() == false) {
- try {
- java.io.FileOutputStream fos=new java.io.FileOutputStream(resultFile);
-
- fos.write(protocol.getBytes());
-
- fos.flush();
- fos.close();
-
- } catch(Exception e){
- result.addError(this, e);
- }
- } else {
- System.err.println("NOTE: Generated output '"+resultFile+
- "' already exists - not being overwritten");
- }
- } else {
- result.addError(this, new Throwable("Unable to obtain URL for CDM model
source '"+
- m_name+"': "+url));
- }
- }
- }
- }
- }
-}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtilTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtilTest.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtilTest.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -20,9 +20,6 @@
import static org.junit.Assert.*;
import org.pi4soa.cdl.CDLManager;
-import org.savara.protocol.util.ProtocolServices;
-import org.scribble.common.logging.Journal;
-import org.scribble.protocol.model.ProtocolModel;
import org.scribble.protocol.model.Role;
public class ConverterUtilTest {
@@ -32,7 +29,7 @@
org.pi4soa.cdl.Package cdlpack=null;
try {
- cdlpack = CDLManager.load("cdm/ESBBroker.cdm");
+ cdlpack = CDLManager.load("testmodels/cdm/ESBBroker.cdm");
} catch(Exception e) {
e.printStackTrace();
fail("Failed to load choreography: "+e);
@@ -71,7 +68,7 @@
org.pi4soa.cdl.Package cdlpack=null;
try {
- cdlpack = CDLManager.load("cdm/ESBBroker.cdm");
+ cdlpack = CDLManager.load("testmodels/cdm/ESBBroker.cdm");
} catch(Exception e) {
e.printStackTrace();
fail("Failed to load choreography: "+e);
@@ -105,7 +102,7 @@
org.pi4soa.cdl.Package cdlpack=null;
try {
- cdlpack = CDLManager.load("cdm/ESBBroker.cdm");
+ cdlpack = CDLManager.load("testmodels/cdm/ESBBroker.cdm");
} catch(Exception e) {
e.printStackTrace();
fail("Failed to load choreography: "+e);
@@ -139,7 +136,7 @@
org.pi4soa.cdl.Package cdlpack=null;
try {
- cdlpack = CDLManager.load("cdm/ESBBroker.cdm");
+ cdlpack = CDLManager.load("testmodels/cdm/ESBBroker.cdm");
} catch(Exception e) {
e.printStackTrace();
fail("Failed to load choreography: "+e);
@@ -161,7 +158,7 @@
org.pi4soa.cdl.Package cdlpack=null;
try {
- cdlpack = CDLManager.load("cdm/ESBBroker.cdm");
+ cdlpack = CDLManager.load("testmodels/cdm/ESBBroker.cdm");
} catch(Exception e) {
e.printStackTrace();
fail("Failed to load choreography: "+e);
@@ -195,7 +192,7 @@
org.pi4soa.cdl.Package cdlpack=null;
try {
- cdlpack = CDLManager.load("cdm/ESBBroker.cdm");
+ cdlpack = CDLManager.load("testmodels/cdm/ESBBroker.cdm");
} catch(Exception e) {
e.printStackTrace();
fail("Failed to load choreography: "+e);
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ESBBroker.spr
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ESBBroker.spr 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ESBBroker.spr 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,3 +1,4 @@
+[[ XSDElement ]]
import xsd "bookingReference" as BookingReference, "buy" as Buy,
"cancel" as Cancel, "CreditCheckRequest" as CreditInformation,
"CreditCheckInvalid" as CreditInvalid, "CreditCheckOk" as CreditValid,
"enquiry" as Enquiry, "orderConfirmed" as OrderConfirmed,
"orderRejected" as OrderRejected, "quote" as Quote,
"quoteList" as QuoteList, "requestForQuote" as RequestForQuote;
[[ SourceComponent(id=//(a)choreographies.0) ]]
[[
Namespace(name=http://www.pi4soa.org/ESBBroker/Broker,role=Broker) ]]
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PolicyQuote.spr
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PolicyQuote.spr 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PolicyQuote.spr 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,7 +1,13 @@
+[[ XSDElement ]]
import xsd "{http://creditagency.com/creditCheck}creditCheckRequest" as
CreditCheckRequest, "{http://creditagency.com/creditCheck}creditCheckResponse"
as CreditCheckResponse from "http://creditagency.com/creditCheck";
+[[ XSDElement ]]
import xsd "{http://dmv.com/drivingRecord}drivingRecordRequest" as
DrivingRecordRequest, "{http://dmv.com/drivingRecord}drivingRecordResponse" as
DrivingRecordResponse from "http://dmv.com/drivingRecord";
-import xsd "{http://www.w3.org/2001/XMLSchema}string" as IDSSNType,
"{http://www.w3.org/2001/XMLSchema}anyURI" as URITokenType from
"http://www.w3.org/2001/XMLSchema";
+[[ XSDType ]]
+import xsd "{http://www.w3.org/2001/XMLSchema}string" as IDSSNType from
"http://www.w3.org/2001/XMLSchema";
+[[ XSDElement ]]
import xsd "{http://www.example.org/policyQuote}policyQuote" as PolicyQuote,
"{http://www.example.org/policyQuote}policyQuoteFault" as PolicyQuoteFault,
"{http://www.example.org/policyQuote}policyQuoteReply" as PolicyQuoteReply from
"http://www.example.org/policyQuote";
+[[ XSDElement ]]
+import xsd "{http://www.w3.org/2001/XMLSchema}anyURI" as URITokenType from
"http://www.w3.org/2001/XMLSchema";
[[ SourceComponent(id=//(a)choreographies.0) ]]
[[
Namespace(name=http://www.pi4soa.org/PolicyQuote,role=Driver) ]]
[[
Namespace(name=http://creditagency.com/creditCheckService,role=CreditChec... ]]
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PurchaseGoods.spr
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PurchaseGoods.spr 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/PurchaseGoods.spr 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,5 +1,8 @@
+[[ XSDType ]]
import xsd "{http://www.jboss.org/examples/store}BuyConfirmed" as BuyConfirmed,
"{http://www.jboss.org/examples/store}BuyFailed" as BuyFailed,
"{http://www.jboss.org/examples/store}BuyRequest" as BuyRequest from
"http://www.jboss.org/examples/store";
+[[ XSDType ]]
import xsd "{java:org.jboss.savara.examples.purchasing}CreditCheckInvalid" as
CreditCheckInvalid, "{java:org.jboss.savara.examples.purchasing}CreditCheckOk"
as CreditCheckOk,
"{java:org.jboss.savara.examples.purchasing}CreditCheckRequest" as
CreditCheckRequest from "java:org.jboss.savara.examples.purchasing";
+[[ XSDType ]]
import xsd "{http://www.w3.org/2001/XMLSchema}string" as IDType,
"{http://www.w3.org/2001/XMLSchema}anyURI" as URITokenType from
"http://www.w3.org/2001/XMLSchema";
[[ SourceComponent(id=//(a)choreographies.0) ]]
[[
Namespace(name=http://www.jboss.org/savara/examples,role=Buyer) ]]
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ReqRespFault.spr
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ReqRespFault.spr 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/results/protocol/ReqRespFault.spr 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,3 +1,4 @@
+[[ XSDElement ]]
import xsd "CreditCheckRequest" as CreditInformation,
"CreditCheckInvalid" as CreditInvalid, "CreditCheckOk" as
CreditValid;
[[ SourceComponent(id=//(a)choreographies.0) ]]
[[
Namespace(name=http://www.pi4soa.org/ReqRespFault/Buyer,role=Buyer) ]]
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -511,6 +511,14 @@
td.setDataType(ti.getDataType().getDetails());
if (til != null) {
+
+ // Associate annotations from type import list with type definition
+ for (org.scribble.common.model.Annotation ann : til.getAnnotations()) {
+ if (ann instanceof org.savara.common.model.annotation.Annotation) {
+ td.getAnnotations().add((org.savara.common.model.annotation.Annotation)ann);
+ }
+ }
+
td.setTypeSystem(til.getFormat());
if (til.getFormat() != null && TypeSystem.XSD.equals(til.getFormat())
&&
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)Broker.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)Broker.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)Broker.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,9 +1,15 @@
Contract {http://www.pi4soa.org/ESBBroker/Broker}Broker {
+ [[ XSDElement ]]
TypeDef BookingReference type=bookingReference location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef Buy type=buy location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef Cancel type=cancel location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef Enquiry type=enquiry location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef OrderRejected type=orderRejected location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef QuoteList type=quoteList location=null typeSystem=xsd
Interface {http://www.pi4soa.org/ESBBroker/Broker}Broker {
RequestResponseMEP makeEnquiry( Enquiry ) : QuoteList
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)CreditAgency.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)CreditAgency.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)CreditAgency.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,6 +1,9 @@
Contract {http://www.pi4soa.org/ESBBroker/CreditAgency}CreditAgency {
+ [[ XSDElement ]]
TypeDef CreditInformation type=CreditCheckRequest location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef CreditInvalid type=CreditCheckInvalid location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef CreditValid type=CreditCheckOk location=null typeSystem=xsd
Interface {http://www.pi4soa.org/ESBBroker/CreditAgency}CreditAgency {
RequestResponseMEP checkCredit( CreditInformation ) : CreditValid Fault invalidCredit(
CreditInvalid )
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierQuoteEngine.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierQuoteEngine.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierQuoteEngine.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,5 +1,7 @@
Contract {http://www.pi4soa.org/ESBBroker/Supplier}SupplierQuoteEngine {
+ [[ XSDElement ]]
TypeDef Quote type=quote location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef RequestForQuote type=requestForQuote location=null typeSystem=xsd
Interface {http://www.pi4soa.org/ESBBroker/Supplier}SupplierQuoteEngine {
RequestResponseMEP getQuote( RequestForQuote ) : Quote
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierTxnProcessor.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierTxnProcessor.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ESBBroker(a)SupplierTxnProcessor.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,5 +1,7 @@
Contract {http://www.pi4soa.org/ESBBroker/Supplier}SupplierTxnProcessor {
+ [[ XSDElement ]]
TypeDef BookingReference type=bookingReference location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef OrderConfirmed type=orderConfirmed location=null typeSystem=xsd
Interface {http://www.pi4soa.org/ESBBroker/Supplier}SupplierTxnProcessor {
RequestResponseMEP confirm( OrderConfirmed ) : BookingReference
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)CreditCheckService.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)CreditCheckService.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)CreditCheckService.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,6 +1,8 @@
Contract {http://creditagency.com/creditCheckService}CreditCheckService {
Namespace prefix=cred
uri=http://creditagency.com/creditCheck
schemaLocation=schema/creditCheck.xsd
+ [[ XSDElement ]]
TypeDef CreditCheckRequest
type={http://creditagency.com/creditCheck}creditCheckRequest
location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef CreditCheckResponse
type={http://creditagency.com/creditCheck}creditCheckResponse location=null
typeSystem=xsd
Interface {http://creditagency.com/creditCheckService}CreditCheckService {
OneWayRequestMEP label0( )
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)PolicyQuoteProcessService.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)PolicyQuoteProcessService.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PolicyQuote(a)PolicyQuoteProcessService.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,9 +1,13 @@
Contract {http://www.example.org/policyQuoteProcessService}PolicyQuoteProcessService {
Namespace prefix=drv
uri=http://dmv.com/drivingRecord
schemaLocation=schema/drivingRecord.xsd
Namespace prefix=pol
uri=http://www.example.org/policyQuote
schemaLocation=schema/policyQuote.xsd
+ [[ XSDElement ]]
TypeDef DrivingRecordResponse
type={http://dmv.com/drivingRecord}drivingRecordResponse
location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef PolicyQuote
type={http://www.example.org/policyQuote}policyQuote location=null
typeSystem=xsd
+ [[ XSDElement ]]
TypeDef PolicyQuoteFault
type={http://www.example.org/policyQuote}policyQuoteFault
location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef PolicyQuoteReply
type={http://www.example.org/policyQuote}policyQuoteReply
location=null typeSystem=xsd
Interface {http://www.example.org/policyQuoteProcessService}PolicyQuoteProcessService {
RequestResponseMEP receivePolicyQuote( PolicyQuote ) : PolicyQuoteReply Fault
policyQuoteFault( PolicyQuoteFault )
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)CreditAgency.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)CreditAgency.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)CreditAgency.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,7 +1,10 @@
Contract {java:org.jboss.savara.examples.purchasing}CreditAgency {
Namespace prefix=pur uri=java:org.jboss.savara.examples.purchasing schemaLocation=null
+ [[ XSDType ]]
TypeDef CreditCheckInvalid
type={java:org.jboss.savara.examples.purchasing}CreditCheckInvalid location=null
typeSystem=xsd
+ [[ XSDType ]]
TypeDef CreditCheckOk type={java:org.jboss.savara.examples.purchasing}CreditCheckOk
location=null typeSystem=xsd
+ [[ XSDType ]]
TypeDef CreditCheckRequest
type={java:org.jboss.savara.examples.purchasing}CreditCheckRequest location=null
typeSystem=xsd
Interface {java:org.jboss.savara.examples.purchasing}CreditAgency {
RequestResponseMEP checkCredit( CreditCheckRequest ) : CreditCheckOk Fault
CreditCheckFailed( CreditCheckInvalid )
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)Store.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)Store.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/PurchaseGoods(a)Store.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,7 +1,10 @@
Contract {http://www.jboss.org/examples/store}Store {
Namespace prefix=sto
uri=http://www.jboss.org/examples/store schemaLocation=null
+ [[ XSDType ]]
TypeDef BuyConfirmed
type={http://www.jboss.org/examples/store}BuyConfirmed
location=null typeSystem=xsd
+ [[ XSDType ]]
TypeDef BuyFailed
type={http://www.jboss.org/examples/store}BuyFailed location=null
typeSystem=xsd
+ [[ XSDType ]]
TypeDef BuyRequest
type={http://www.jboss.org/examples/store}BuyRequest location=null
typeSystem=xsd
Interface {http://www.jboss.org/examples/store}Store {
RequestResponseMEP buy( BuyRequest ) : BuyConfirmed Fault BuyFailed( BuyFailed )
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ReqRespFault(a)Seller.contract
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ReqRespFault(a)Seller.contract 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/resources/results/contract/ReqRespFault(a)Seller.contract 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,6 +1,9 @@
Contract {http://www.pi4soa.org/ReqRespFault/Seller}Seller {
+ [[ XSDElement ]]
TypeDef CreditInformation type=CreditCheckRequest location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef CreditInvalid type=CreditCheckInvalid location=null typeSystem=xsd
+ [[ XSDElement ]]
TypeDef CreditValid type=CreditCheckOk location=null typeSystem=xsd
Interface {http://www.pi4soa.org/ReqRespFault/Seller}Seller {
RequestResponseMEP checkCredit( CreditInformation ) : CreditValid Fault
insufficientCredit( CreditInvalid )
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/main/java/org/savara/wsdl/generator/impl/WSDLGeneratorImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/main/java/org/savara/wsdl/generator/impl/WSDLGeneratorImpl.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/main/java/org/savara/wsdl/generator/impl/WSDLGeneratorImpl.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -22,9 +22,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.savara.protocol.model.util.PropertyName;
import org.savara.protocol.model.util.TypeSystem;
-import org.savara.protocol.util.ProtocolUtils;
import org.savara.common.model.annotation.AnnotationDefinitions;
import org.savara.contract.model.FaultDetails;
import org.savara.contract.model.Interface;
@@ -528,7 +526,8 @@
Part part=defn.createPart();
part.setName("content");
- if (td.getProperties().containsKey(AnnotationDefinitions.XSD_ELEMENT)) {
+ if (AnnotationDefinitions.getAnnotation(td.getAnnotations(),
+ AnnotationDefinitions.XSD_ELEMENT) != null) {
part.setElementName(qname);
} else {
part.setTypeName(qname);
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/ProtocolToWSDLGeneratorTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/ProtocolToWSDLGeneratorTest.java 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/ProtocolToWSDLGeneratorTest.java 2011-02-10
20:00:20 UTC (rev 648)
@@ -52,7 +52,7 @@
suite.addTest(new ProtocolToWSDLTester("ReqRespFault",
"Buyer"));
suite.addTest(new ProtocolToWSDLTester("ReqRespFault",
"Seller"));
-
+
return suite;
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_Broker_rpc_0.wsdl
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_Broker_rpc_0.wsdl 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_Broker_rpc_0.wsdl 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="Broker"
targetNamespace="http://www.pi4soa.org/ESBBroker/Broker"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.pi4soa.org/ESBBroker/Broker"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="rejectedFault">
- <wsdl:part name="content" type="orderRejected">
+ <wsdl:part name="content" element="orderRejected">
</wsdl:part>
</wsdl:message>
<wsdl:message name="makeEnquiryRequest">
- <wsdl:part name="content" type="enquiry">
+ <wsdl:part name="content" element="enquiry">
</wsdl:part>
</wsdl:message>
<wsdl:message name="buyResponse">
- <wsdl:part name="content" type="bookingReference">
+ <wsdl:part name="content" element="bookingReference">
</wsdl:part>
</wsdl:message>
<wsdl:message name="makeEnquiryResponse">
- <wsdl:part name="content" type="quoteList">
+ <wsdl:part name="content" element="quoteList">
</wsdl:part>
</wsdl:message>
<wsdl:message name="buyRequest">
- <wsdl:part name="content" type="buy">
+ <wsdl:part name="content" element="buy">
</wsdl:part>
</wsdl:message>
<wsdl:message name="cancelRequest">
- <wsdl:part name="content" type="cancel">
+ <wsdl:part name="content" element="cancel">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Broker">
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_CreditAgency_rpc_0.wsdl
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_CreditAgency_rpc_0.wsdl 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_CreditAgency_rpc_0.wsdl 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="CreditAgency"
targetNamespace="http://www.pi4soa.org/ESBBroker/CreditAgency"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.pi4soa.org/ESBBroker/CreditAgency"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="checkCreditResponse">
- <wsdl:part name="content" type="CreditCheckOk">
+ <wsdl:part name="content" element="CreditCheckOk">
</wsdl:part>
</wsdl:message>
<wsdl:message name="checkCreditRequest">
- <wsdl:part name="content" type="CreditCheckRequest">
+ <wsdl:part name="content" element="CreditCheckRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="invalidCreditFault">
- <wsdl:part name="content" type="CreditCheckInvalid">
+ <wsdl:part name="content" element="CreditCheckInvalid">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="CreditAgency">
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierQuoteEngine_rpc_0.wsdl
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierQuoteEngine_rpc_0.wsdl 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierQuoteEngine_rpc_0.wsdl 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="SupplierQuoteEngine"
targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.pi4soa.org/ESBBroker/Supplier"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="getQuoteResponse">
- <wsdl:part name="content" type="quote">
+ <wsdl:part name="content" element="quote">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getQuoteRequest">
- <wsdl:part name="content" type="requestForQuote">
+ <wsdl:part name="content" element="requestForQuote">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="SupplierQuoteEngine">
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierTxnProcessor_rpc_0.wsdl
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierTxnProcessor_rpc_0.wsdl 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ESBBroker_SupplierTxnProcessor_rpc_0.wsdl 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="SupplierTxnProcessor"
targetNamespace="http://www.pi4soa.org/ESBBroker/Supplier"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.pi4soa.org/ESBBroker/Supplier"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="confirmRequest">
- <wsdl:part name="content" type="orderConfirmed">
+ <wsdl:part name="content" element="orderConfirmed">
</wsdl:part>
</wsdl:message>
<wsdl:message name="confirmResponse">
- <wsdl:part name="content" type="bookingReference">
+ <wsdl:part name="content" element="bookingReference">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="SupplierTxnProcessor">
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_CreditCheckService_rpc_0.wsdl
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_CreditCheckService_rpc_0.wsdl 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_CreditCheckService_rpc_0.wsdl 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="CreditCheckService"
targetNamespace="http://creditagency.com/creditCheckService"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://creditagency.com/creditCheckService"
xmlns:cred="http://creditagency.com/creditCheck"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="checkCreditRequest">
- <wsdl:part name="content" type="cred:creditCheckRequest">
+ <wsdl:part name="content"
element="cred:creditCheckRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="checkCreditResponse">
- <wsdl:part name="content" type="cred:creditCheckResponse">
+ <wsdl:part name="content"
element="cred:creditCheckResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="CreditCheckService">
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_PolicyQuoteProcessService_rpc_0.wsdl
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_PolicyQuoteProcessService_rpc_0.wsdl 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/PolicyQuote_PolicyQuoteProcessService_rpc_0.wsdl 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="PolicyQuoteProcessService"
targetNamespace="http://www.example.org/policyQuoteProcessService"
xmlns:drv="http://dmv.com/drivingRecord"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.example.org/policyQuoteProcessService"
xmlns:pol="http://www.example.org/policyQuote"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="policyQuoteFaultFault">
- <wsdl:part name="content" type="pol:policyQuoteFault">
+ <wsdl:part name="content" element="pol:policyQuoteFault">
</wsdl:part>
</wsdl:message>
<wsdl:message name="receivePolicyQuoteResponse">
- <wsdl:part name="content" type="pol:policyQuoteReply">
+ <wsdl:part name="content" element="pol:policyQuoteReply">
</wsdl:part>
</wsdl:message>
<wsdl:message name="receivePolicyQuoteRequest">
- <wsdl:part name="content" type="pol:policyQuote">
+ <wsdl:part name="content" element="pol:policyQuote">
</wsdl:part>
</wsdl:message>
<wsdl:message name="receiveDrivingRecordRequest">
- <wsdl:part name="content"
type="drv:drivingRecordResponse">
+ <wsdl:part name="content"
element="drv:drivingRecordResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="PolicyQuoteProcessService">
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ReqRespFault_Seller_rpc_0.wsdl
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ReqRespFault_Seller_rpc_0.wsdl 2011-02-10
18:11:03 UTC (rev 647)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/resources/results/wsdl/ReqRespFault_Seller_rpc_0.wsdl 2011-02-10
20:00:20 UTC (rev 648)
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="Seller"
targetNamespace="http://www.pi4soa.org/ReqRespFault/Seller"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.pi4soa.org/ReqRespFault/Seller"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="checkCreditRequest">
- <wsdl:part name="content" type="CreditCheckRequest">
+ <wsdl:part name="content" element="CreditCheckRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="checkCreditResponse">
- <wsdl:part name="content" type="CreditCheckOk">
+ <wsdl:part name="content" element="CreditCheckOk">
</wsdl:part>
</wsdl:message>
<wsdl:message name="insufficientCreditFault">
- <wsdl:part name="content" type="CreditCheckInvalid">
+ <wsdl:part name="content" element="CreditCheckInvalid">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Seller">