The following schema fragment specifies the expected content contained within this class.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
path;
-
- /**
- * Gets the value of the path property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set method for the path property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getPath().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link Path }
- *
- *
- */
- public List getPath() {
- if (path == null) {
- path = new ArrayList();
- }
- return this.path;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Decision.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Decision.java
deleted file mode 100644
index 3d7041ca0..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Decision.java
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Decision complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Decision">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Node">
- * <attribute name="innerIndex" type="{http://www.w3.org/2001/XMLSchema}int" default="-1" />
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Decision")
-public class Decision
- extends Node
-{
-
- @XmlAttribute
- protected Integer innerIndex;
-
- /**
- * Gets the value of the innerIndex property.
- *
- * @return
- * possible object is
- * {@link Integer }
- *
- */
- public int getInnerIndex() {
- if (innerIndex == null) {
- return -1;
- } else {
- return innerIndex;
- }
- }
-
- /**
- * Sets the value of the innerIndex property.
- *
- * @param value
- * allowed object is
- * {@link Integer }
- *
- */
- public void setInnerIndex(Integer value) {
- this.innerIndex = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Description.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Description.java
deleted file mode 100644
index 6c0d9a869..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Description.java
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Description complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Description">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="node" type="{http://www.scribble.org/monitor}Node" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Description", propOrder = {
- "node"
-})
-public class Description {
-
- protected List node;
-
- /**
- * Gets the value of the node property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set method for the node property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getNode().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link Node }
- *
- *
- */
- public List getNode() {
- if (node == null) {
- node = new ArrayList();
- }
- return this.node;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Do.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Do.java
deleted file mode 100644
index cbf3742f1..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Do.java
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Do complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Do">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Scope">
- * <sequence>
- * <element name="path" type="{http://www.scribble.org/monitor}Path" maxOccurs="unbounded"/>
- * </sequence>
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Do", propOrder = {
- "path"
-})
-public class Do
- extends Scope
-{
-
- @XmlElement(required = true)
- protected List path;
-
- /**
- * Gets the value of the path property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set method for the path property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getPath().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link Path }
- *
- *
- */
- public List getPath() {
- if (path == null) {
- path = new ArrayList();
- }
- return this.path;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Fork.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Fork.java
deleted file mode 100644
index 26b85b375..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Fork.java
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Fork complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Fork">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Node">
- * <attribute name="condition" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="linkName" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Fork")
-public class Fork
- extends Node
-{
-
- @XmlAttribute
- protected String condition;
- @XmlAttribute
- protected String linkName;
-
- /**
- * Gets the value of the condition property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCondition() {
- return condition;
- }
-
- /**
- * Sets the value of the condition property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCondition(String value) {
- this.condition = value;
- }
-
- /**
- * Gets the value of the linkName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getLinkName() {
- return linkName;
- }
-
- /**
- * Sets the value of the linkName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setLinkName(String value) {
- this.linkName = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Join.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Join.java
deleted file mode 100644
index 865843567..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Join.java
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Join complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Join">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Node">
- * <attribute name="expression" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Join")
-public class Join
- extends Node
-{
-
- @XmlAttribute
- protected String expression;
-
- /**
- * Gets the value of the expression property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getExpression() {
- return expression;
- }
-
- /**
- * Sets the value of the expression property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setExpression(String value) {
- this.expression = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/LinkDeclaration.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/LinkDeclaration.java
deleted file mode 100644
index e6074d6cc..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/LinkDeclaration.java
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for LinkDeclaration complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="LinkDeclaration">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Node">
- * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "LinkDeclaration")
-public class LinkDeclaration
- extends Node
-{
-
- @XmlAttribute
- protected String name;
-
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/MessageNode.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/MessageNode.java
deleted file mode 100644
index 0ab118801..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/MessageNode.java
+++ /dev/null
@@ -1,109 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for MessageNode complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="MessageNode">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Node">
- * <sequence>
- * <element name="messageType" type="{http://www.scribble.org/monitor}MessageType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="operator" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "MessageNode", propOrder = {
- "messageType"
-})
-@XmlSeeAlso({
- SendMessage.class,
- ReceiveMessage.class
-})
-public class MessageNode
- extends Node
-{
-
- protected List messageType;
- @XmlAttribute
- protected String operator;
-
- /**
- * Gets the value of the messageType property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set method for the messageType property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getMessageType().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link MessageType }
- *
- *
- */
- public List getMessageType() {
- if (messageType == null) {
- messageType = new ArrayList();
- }
- return this.messageType;
- }
-
- /**
- * Gets the value of the operator property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getOperator() {
- return operator;
- }
-
- /**
- * Sets the value of the operator property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setOperator(String value) {
- this.operator = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/MessageType.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/MessageType.java
deleted file mode 100644
index abf300faf..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/MessageType.java
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for MessageType complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="MessageType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <attribute name="format" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "MessageType")
-public class MessageType {
-
- @XmlAttribute
- protected String format;
- @XmlAttribute
- protected String value;
-
- /**
- * Gets the value of the format property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getFormat() {
- return format;
- }
-
- /**
- * Sets the value of the format property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setFormat(String value) {
- this.format = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Node.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Node.java
deleted file mode 100644
index 7311c3792..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Node.java
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Node complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Node">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="annotation" type="{http://www.scribble.org/monitor}Annotation" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="nextIndex" type="{http://www.w3.org/2001/XMLSchema}int" default="-1" />
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Node", propOrder = {
- "annotation"
-})
-@XmlSeeAlso({
- LinkDeclaration.class,
- Call.class,
- Parallel.class,
- Join.class,
- MessageNode.class,
- Fork.class,
- Choice.class,
- Decision.class,
- Scope.class
-})
-public class Node {
-
- protected List annotation;
- @XmlAttribute
- protected Integer nextIndex;
-
- /**
- * Gets the value of the annotation property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set method for the annotation property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getAnnotation().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link Annotation }
- *
- *
- */
- public List getAnnotation() {
- if (annotation == null) {
- annotation = new ArrayList();
- }
- return this.annotation;
- }
-
- /**
- * Gets the value of the nextIndex property.
- *
- * @return
- * possible object is
- * {@link Integer }
- *
- */
- public int getNextIndex() {
- if (nextIndex == null) {
- return -1;
- } else {
- return nextIndex;
- }
- }
-
- /**
- * Sets the value of the nextIndex property.
- *
- * @param value
- * allowed object is
- * {@link Integer }
- *
- */
- public void setNextIndex(Integer value) {
- this.nextIndex = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/ObjectFactory.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/ObjectFactory.java
deleted file mode 100644
index 26bfaad13..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/ObjectFactory.java
+++ /dev/null
@@ -1,188 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.scribble.protocol.monitor.model package.
- * An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- private final static QName _Description_QNAME = new QName("http://www.scribble.org/monitor", "description");
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.scribble.protocol.monitor.model
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link MessageType }
- *
- */
- public MessageType createMessageType() {
- return new MessageType();
- }
-
- /**
- * Create an instance of {@link SendMessage }
- *
- */
- public SendMessage createSendMessage() {
- return new SendMessage();
- }
-
- /**
- * Create an instance of {@link Description }
- *
- */
- public Description createDescription() {
- return new Description();
- }
-
- /**
- * Create an instance of {@link Fork }
- *
- */
- public Fork createFork() {
- return new Fork();
- }
-
- /**
- * Create an instance of {@link LinkDeclaration }
- *
- */
- public LinkDeclaration createLinkDeclaration() {
- return new LinkDeclaration();
- }
-
- /**
- * Create an instance of {@link Choice }
- *
- */
- public Choice createChoice() {
- return new Choice();
- }
-
- /**
- * Create an instance of {@link Do }
- *
- */
- public Do createDo() {
- return new Do();
- }
-
- /**
- * Create an instance of {@link MessageNode }
- *
- */
- public MessageNode createMessageNode() {
- return new MessageNode();
- }
-
- /**
- * Create an instance of {@link Join }
- *
- */
- public Join createJoin() {
- return new Join();
- }
-
- /**
- * Create an instance of {@link Parallel }
- *
- */
- public Parallel createParallel() {
- return new Parallel();
- }
-
- /**
- * Create an instance of {@link Annotation }
- *
- */
- public Annotation createAnnotation() {
- return new Annotation();
- }
-
- /**
- * Create an instance of {@link Call }
- *
- */
- public Call createCall() {
- return new Call();
- }
-
- /**
- * Create an instance of {@link Scope }
- *
- */
- public Scope createScope() {
- return new Scope();
- }
-
- /**
- * Create an instance of {@link Node }
- *
- */
- public Node createNode() {
- return new Node();
- }
-
- /**
- * Create an instance of {@link Decision }
- *
- */
- public Decision createDecision() {
- return new Decision();
- }
-
- /**
- * Create an instance of {@link ReceiveMessage }
- *
- */
- public ReceiveMessage createReceiveMessage() {
- return new ReceiveMessage();
- }
-
- /**
- * Create an instance of {@link Path }
- *
- */
- public Path createPath() {
- return new Path();
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link Description }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://www.scribble.org/monitor", name = "description")
- public JAXBElement createDescription(Description value) {
- return new JAXBElement(_Description_QNAME, Description.class, null, value);
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Parallel.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Parallel.java
deleted file mode 100644
index 292d7027e..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Parallel.java
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Parallel complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Parallel">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Node">
- * <sequence>
- * <element name="path" type="{http://www.scribble.org/monitor}Path" maxOccurs="unbounded"/>
- * </sequence>
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Parallel", propOrder = {
- "path"
-})
-public class Parallel
- extends Node
-{
-
- @XmlElement(required = true)
- protected List path;
-
- /**
- * Gets the value of the path property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set method for the path property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getPath().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link Path }
- *
- *
- */
- public List getPath() {
- if (path == null) {
- path = new ArrayList();
- }
- return this.path;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Path.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Path.java
deleted file mode 100644
index 6dd75551b..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Path.java
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Path complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Path">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="annotation" type="{http://www.scribble.org/monitor}Annotation" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="nextIndex" type="{http://www.w3.org/2001/XMLSchema}int" default="-1" />
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Path", propOrder = {
- "annotation"
-})
-public class Path {
-
- protected List annotation;
- @XmlAttribute
- protected Integer nextIndex;
-
- /**
- * Gets the value of the annotation property.
- *
- *
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set method for the annotation property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getAnnotation().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link Annotation }
- *
- *
- */
- public List getAnnotation() {
- if (annotation == null) {
- annotation = new ArrayList();
- }
- return this.annotation;
- }
-
- /**
- * Gets the value of the nextIndex property.
- *
- * @return
- * possible object is
- * {@link Integer }
- *
- */
- public int getNextIndex() {
- if (nextIndex == null) {
- return -1;
- } else {
- return nextIndex;
- }
- }
-
- /**
- * Sets the value of the nextIndex property.
- *
- * @param value
- * allowed object is
- * {@link Integer }
- *
- */
- public void setNextIndex(Integer value) {
- this.nextIndex = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/ReceiveMessage.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/ReceiveMessage.java
deleted file mode 100644
index ee72508ec..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/ReceiveMessage.java
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for ReceiveMessage complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ReceiveMessage">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}MessageNode">
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ReceiveMessage")
-public class ReceiveMessage
- extends MessageNode
-{
-
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Scope.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Scope.java
deleted file mode 100644
index df8e5fbd8..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/Scope.java
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for Scope complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Scope">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}Node">
- * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="innerIndex" type="{http://www.w3.org/2001/XMLSchema}int" default="-1" />
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Scope")
-@XmlSeeAlso({
- Do.class
-})
-public class Scope
- extends Node
-{
-
- @XmlAttribute
- protected String name;
- @XmlAttribute
- protected Integer innerIndex;
-
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
-
- /**
- * Gets the value of the innerIndex property.
- *
- * @return
- * possible object is
- * {@link Integer }
- *
- */
- public int getInnerIndex() {
- if (innerIndex == null) {
- return -1;
- } else {
- return innerIndex;
- }
- }
-
- /**
- * Sets the value of the innerIndex property.
- *
- * @param value
- * allowed object is
- * {@link Integer }
- *
- */
- public void setInnerIndex(Integer value) {
- this.innerIndex = value;
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/SendMessage.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/SendMessage.java
deleted file mode 100644
index b416803e8..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/SendMessage.java
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-
-package org.scribble.protocol.monitor.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for SendMessage complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="SendMessage">
- * <complexContent>
- * <extension base="{http://www.scribble.org/monitor}MessageNode">
- * </extension>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "SendMessage")
-public class SendMessage
- extends MessageNode
-{
-
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/package-info.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/package-info.java
deleted file mode 100644
index 02cd449b1..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/model/package-info.java
+++ /dev/null
@@ -1,9 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.02.06 at 05:22:54 PM GMT
-//
-
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.scribble.org/monitor", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.scribble.protocol.monitor.model;
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/osgi/Activator.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/osgi/Activator.java
deleted file mode 100644
index 62c429150..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/osgi/Activator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2009-11 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor.osgi;
-
-import java.util.Properties;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.scribble.protocol.monitor.DefaultProtocolMonitor;
-import org.scribble.protocol.monitor.ProtocolMonitor;
-
-/**
- * This is the activator.
- *
- */
-public class Activator implements BundleActivator {
-
- /**
- * {@inheritDoc}
- */
- public void start(BundleContext context) throws Exception {
- Properties props = new Properties();
-
- ProtocolMonitor pm=new DefaultProtocolMonitor();
-
- context.registerService(ProtocolMonitor.class.getName(),
- pm, props);
- }
-
- /**
- * {@inheritDoc}
- */
- public void stop(BundleContext context) throws Exception {
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/util/MonitorModelUtil.java b/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/util/MonitorModelUtil.java
deleted file mode 100644
index 31874369f..000000000
--- a/bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/util/MonitorModelUtil.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor.util;
-
-import java.io.IOException;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.scribble.protocol.monitor.model.Description;
-
-/**
- * Monitor model utility functions.
- *
- */
-public final class MonitorModelUtil {
-
- /**
- * Private constructor.
- */
- private MonitorModelUtil() {
- }
-
- /**
- * This method deserialises the model from the input stream.
- *
- * @param is The input stream
- * @return The monitor description
- * @throws IOException Failed to deserialize
- */
- public static Description deserialize(java.io.InputStream is) throws IOException {
- Description ret=null;
-
- try {
- JAXBContext context = JAXBContext.newInstance("org.scribble.protocol.monitor.model",
- MonitorModelUtil.class.getClassLoader());
- Unmarshaller unmarshaller = context.createUnmarshaller();
-
- //note: setting schema to null will turn validator off
- //unmarshaller.setSchema(null);
- Object xmlObject = unmarshaller.unmarshal(is);
-
- if (xmlObject instanceof JAXBElement) {
- ret = (Description)((JAXBElement>)xmlObject).getValue();
- }
-
- } catch (Exception e) {
- throw new IOException("Failed to deserialize description", e);
- }
-
- return (ret);
- }
-
- /**
- * This method serializes the supplied monitor description to the
- * supplied output stream.
- *
- * @param desc The monitoring description
- * @param os The output stream
- * @throws IOException Failed to serialize
- */
- public static void serialize(Description desc, java.io.OutputStream os) throws IOException {
-
- try {
- org.scribble.protocol.monitor.model.ObjectFactory factory=
- new org.scribble.protocol.monitor.model.ObjectFactory();
-
- JAXBContext context = JAXBContext.newInstance(Description.class);
- Marshaller marshaller = context.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
-
- marshaller.marshal(factory.createDescription(desc), os);
- } catch (Exception e) {
- throw new IOException("Failed to serialize description", e);
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/BrokerParticipantTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/BrokerParticipantTest.java
deleted file mode 100644
index 9af4cb3a6..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/BrokerParticipantTest.java
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class BrokerParticipantTest {
-
- private static final String OUT_OF_STOCK_MESSAGE_TYPE = "OutOfStock";
- private static final String INSUFFICIENT_CREDIT_MESSAGE_TYPE = "InsufficientCredit";
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit,
- _Confirmation,
- _OutOfStock,
- }
-
- public Description getBrokerProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(2);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 2
- Choice choice1=new Choice();
- //choice1.setNodeType(Protocol.Node.NodeType.ReceiveChoice);
-
- Path c1=new Path();
- //c1.setId(PurchasingLabel._CreditOk.name());
- c1.setNextIndex(3);
- choice1.getPath().add(c1);
-
- Path c2=new Path();
- //c2.setId(PurchasingLabel._InsufficientCredit.name());
- c2.setNextIndex(10);
- choice1.getPath().add(c2);
-
- pd.getNode().add(choice1);
-
- // 3
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- recvCreditOk.setNextIndex(4);
- pd.getNode().add(recvCreditOk);
-
- // 4
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendOrder.setNextIndex(5);
-
- MessageType mt4=new MessageType();
- mt4.setValue(ORDER_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- // 5
- Choice choice2=new Choice();
- //choice2.setNodeType(Protocol.Node.NodeType.ReceiveChoice);
-
- Path c3=new Path();
- //c3.setId(PurchasingLabel._Confirmation.name());
- c3.setNextIndex(6);
- choice2.getPath().add(c3);
-
- Path c4=new Path();
- //c4.setId(PurchasingLabel._OutOfStock.name());
- c4.setNextIndex(8);
- choice2.getPath().add(c4);
-
- pd.getNode().add(choice2);
-
- // 6
- ReceiveMessage recvConfirmation=new ReceiveMessage();
- //recvConfirmation.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt1a=new MessageType();
- mt1a.setValue(CONFIRMATION_MESSAGE_TYPE);
- recvConfirmation.getMessageType().add(mt1a);
- recvConfirmation.setNextIndex(7);
- pd.getNode().add(recvConfirmation);
-
- // 7
- SendMessage sendConformation=new SendMessage();
- //sendConformation.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt2a=new MessageType();
- mt2a.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendConformation.getMessageType().add(mt2a);
- pd.getNode().add(sendConformation);
-
- // 8
- ReceiveMessage recvOutOfStock=new ReceiveMessage();
- //recvOutOfStock.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt3a=new MessageType();
- mt3a.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- recvOutOfStock.getMessageType().add(mt3a);
- recvOutOfStock.setNextIndex(9);
- pd.getNode().add(recvOutOfStock);
-
- // 9
- SendMessage sendOutOfStock=new SendMessage();
- //sendOutOfStock.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt4a=new MessageType();
- mt4a.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- sendOutOfStock.getMessageType().add(mt4a);
- pd.getNode().add(sendOutOfStock);
-
- // 10
- ReceiveMessage recvInsufficientCredit=new ReceiveMessage();
- //recvInsufficientCredit.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt5=new MessageType();
- mt5.setValue(INSUFFICIENT_CREDIT_MESSAGE_TYPE);
- recvInsufficientCredit.getMessageType().add(mt5);
- recvInsufficientCredit.setNextIndex(11);
- pd.getNode().add(recvInsufficientCredit);
-
- // 11
- ReceiveMessage sendInsufficientCredit=new ReceiveMessage();
- //sendInsufficientCredit.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt6=new MessageType();
- mt6.setValue(INSUFFICIENT_CREDIT_MESSAGE_TYPE);
- sendInsufficientCredit.getMessageType().add(mt6);
- pd.getNode().add(sendInsufficientCredit);
-
- return (pd);
- }
-
- public Description getBrokerWithParticipantProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(2);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 2
- Choice choice1=new Choice();
- //choice1.setNodeType(Protocol.Node.NodeType.ReceiveChoice);
- //choice1.setOtherRole(CREDIT_AGENCY);
-
- Path c1=new Path();
- //c1.setId(PurchasingLabel._CreditOk.name());
- c1.setNextIndex(3);
- choice1.getPath().add(c1);
-
- Path c2=new Path();
- //c2.setId(PurchasingLabel._InsufficientCredit.name());
- c2.setNextIndex(10);
- choice1.getPath().add(c2);
-
- pd.getNode().add(choice1);
-
- // 3
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- recvCreditOk.setNextIndex(4);
- pd.getNode().add(recvCreditOk);
-
- // 4
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendOrder.setNextIndex(5);
-
- MessageType mt4=new MessageType();
- mt4.setValue(ORDER_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- // 5
- Choice choice2=new Choice();
- //choice2.setNodeType(Protocol.Node.NodeType.ReceiveChoice);
- //choice2.setOtherRole(SUPPLIER);
-
- Path c3=new Path();
- //c3.setId(PurchasingLabel._Confirmation.name());
- c3.setNextIndex(6);
- choice2.getPath().add(c3);
-
- Path c4=new Path();
- //c4.setId(PurchasingLabel._OutOfStock.name());
- c4.setNextIndex(8);
- choice2.getPath().add(c4);
-
- pd.getNode().add(choice2);
-
- // 6
- ReceiveMessage recvConfirmation=new ReceiveMessage();
- //recvConfirmation.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt5=new MessageType();
- mt5.setValue(CONFIRMATION_MESSAGE_TYPE);
- recvConfirmation.getMessageType().add(mt5);
- recvConfirmation.setNextIndex(7);
- pd.getNode().add(recvConfirmation);
-
- // 7
- SendMessage sendConfirmation=new SendMessage();
- //sendConfirmation.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt6=new MessageType();
- mt6.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendConfirmation.getMessageType().add(mt6);
- pd.getNode().add(sendConfirmation);
-
- // 8
- ReceiveMessage recvOutOfStock=new ReceiveMessage();
- //recvOutOfStock.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt7=new MessageType();
- mt7.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- recvOutOfStock.getMessageType().add(mt7);
- recvOutOfStock.setNextIndex(9);
- pd.getNode().add(recvOutOfStock);
-
- // 9
- SendMessage sendOutOfStock=new SendMessage();
- //sendOutOfStock.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt8=new MessageType();
- mt8.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- sendOutOfStock.getMessageType().add(mt8);
- pd.getNode().add(sendOutOfStock);
-
- // 10
- ReceiveMessage recvInsufficientCredit=new ReceiveMessage();
- //recvInsufficientCredit.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt9=new MessageType();
- mt9.setValue(INSUFFICIENT_CREDIT_MESSAGE_TYPE);
- recvInsufficientCredit.getMessageType().add(mt9);
- recvInsufficientCredit.setNextIndex(11);
- pd.getNode().add(recvInsufficientCredit);
-
- // 11
- ReceiveMessage sendInsufficientCredit=new ReceiveMessage();
- //sendInsufficientCredit.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt10=new MessageType();
- mt10.setValue(INSUFFICIENT_CREDIT_MESSAGE_TYPE);
- sendInsufficientCredit.getMessageType().add(mt10);
- pd.getNode().add(sendInsufficientCredit);
-
- return (pd);
- }
-
- @Test
- public void testBrokerValidOrderCreditCheckOk() {
- Description pd=getBrokerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testBrokerValidOrderCreditCheckOkLookahead() {
- Description pd=getBrokerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testBrokerInvalidOrderCreditCheckOk() {
- Description pd=getBrokerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-
- @Test
- public void testBrokerValidOrderCreditCheckOkWithParticipant() {
- Description pd=getBrokerWithParticipantProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testBrokerValidOrderCreditCheckOkLookaheadWithParticipant() {
- Description pd=getBrokerWithParticipantProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testBrokerInvalidOrderCreditCheckOkByParticipant() {
- Description pd=getBrokerWithParticipantProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/BuyerParticipantTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/BuyerParticipantTest.java
deleted file mode 100644
index a77c3798e..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/BuyerParticipantTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-
-public class BuyerParticipantTest {
-
- private static final String INSUFFICIENT_CREDIT_MESSAGE_TYPE = "InsufficientCredit";
- private static final String OUT_OF_STOCK_MESSAGE_TYPE = "OutOfStock";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
- private static final String ORDER_MESSAGE_TYPE = "Order";
-
- public enum PurchasingLabel {
- _Confirmation,
- _OutOfStock,
- _InsufficientCredit
- }
-
- public Description getBuyerProtocol() {
- Description pd=new Description();
-
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt1);
- pd.getNode().add(sendOrder);
-
- Choice choice=new Choice();
- //choice.setNodeType(Protocol.Node.NodeType.ReceiveChoice);
-
- Path c1=new Path();
- //c1.setId(PurchasingLabel._Confirmation.name());
- c1.setNextIndex(2);
- choice.getPath().add(c1);
-
- Path c2=new Path();
- //c2.setId(PurchasingLabel._OutOfStock.name());
- c2.setNextIndex(3);
- choice.getPath().add(c2);
-
- Path c3=new Path();
- //c3.setId(PurchasingLabel._InsufficientCredit.name());
- c3.setNextIndex(4);
- choice.getPath().add(c3);
-
- pd.getNode().add(choice);
-
- ReceiveMessage recvConfirmation=new ReceiveMessage();
- //recvConfirmation.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- recvConfirmation.getMessageType().add(mt2);
- pd.getNode().add(recvConfirmation);
-
- ReceiveMessage recvOutOfStock=new ReceiveMessage();
- //recvOutOfStock.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt3=new MessageType();
- mt3.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- recvOutOfStock.getMessageType().add(mt3);
- pd.getNode().add(recvOutOfStock);
-
- ReceiveMessage recvInsufficientCredit=new ReceiveMessage();
- //recvInsufficientCredit.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(INSUFFICIENT_CREDIT_MESSAGE_TYPE);
- recvInsufficientCredit.getMessageType().add(mt4);
- pd.getNode().add(recvInsufficientCredit);
-
- return (pd);
- }
-
- @Test
- public void testBuyerValidOrderConfirmation() {
- Description pd=getBuyerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testBuyerValidOrderConfirmationLookahead() {
- Description pd=getBuyerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testBuyerInvalidOrderConfirmation() {
- Description pd=getBuyerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/CreditAgencyParticipantTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/CreditAgencyParticipantTest.java
deleted file mode 100644
index 6c9f04a48..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/CreditAgencyParticipantTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-
-public class CreditAgencyParticipantTest {
-
- private static final String INSUFFICIENT_CREDIT_MESSAGE_TYPE = "InsufficientCredit";
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit
- }
-
- public Description getCreditAgencyProtocol() {
- Description pd=new Description();
-
- ReceiveMessage recvCreditCheck=new ReceiveMessage();
- //recvCreditCheck.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvCreditCheck.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- recvCreditCheck.getMessageType().add(mt1);
- pd.getNode().add(recvCreditCheck);
-
- Choice choice=new Choice();
- //choice.setNodeType(Protocol.Node.NodeType.SendChoice);
-
- Path c1=new Path();
- //c1.setId(PurchasingLabel._CreditOk.name());
- c1.setNextIndex(2);
- choice.getPath().add(c1);
-
- Path c2=new Path();
- //c2.setId(PurchasingLabel._InsufficientCredit.name());
- c2.setNextIndex(3);
- choice.getPath().add(c2);
-
- pd.getNode().add(choice);
-
- SendMessage sendCreditOk=new SendMessage();
- //sendCreditOk.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_OK_MESSAGE_TYPE);
- sendCreditOk.getMessageType().add(mt2);
- pd.getNode().add(sendCreditOk);
-
- SendMessage sendInsufficientCredit=new SendMessage();
- //sendInsufficientCredit.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt3=new MessageType();
- mt3.setValue(INSUFFICIENT_CREDIT_MESSAGE_TYPE);
- sendInsufficientCredit.getMessageType().add(mt3);
- pd.getNode().add(sendInsufficientCredit);
-
- return (pd);
- }
-
- @Test
- public void testCreditAgencyValidCreditCheckOk() {
- Description pd=getCreditAgencyProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testCreditAgencyValidCreditCheckOkLookahead() {
- Description pd=getCreditAgencyProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("CreditCheck failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("CreditOk failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testCreditAgencyInvalidOrderConfirmation() {
- Description pd=getCreditAgencyProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("CreditCheck failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Second Credit Check should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DefaultMonitorContextTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DefaultMonitorContextTest.java
deleted file mode 100644
index b99fda057..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DefaultMonitorContextTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright 2009-11 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class DefaultMonitorContextTest {
-
- @Test
- public void testLinkTrue() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", Boolean.TRUE);
-
- Boolean result=context.evaluate(session, "X");
-
- if (result == null) {
- fail("Result was null");
- }
-
- if (!result.booleanValue()) {
- fail("Result should be true");
- }
- }
-
- @Test
- public void testLinkFalse() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", Boolean.FALSE);
-
- Boolean result=context.evaluate(session, "X");
-
- if (result == null) {
- fail("Result was null");
- }
-
- if (result.booleanValue()) {
- fail("Result should be false");
- }
- }
-
- @Test
- public void testLinkUnset() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", null);
-
- Boolean result=context.evaluate(session, "X");
-
- if (result != null) {
- fail("Result was NOT null");
- }
- }
-
- @Test
- public void testLinkANDTrueNull() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", null);
- session.setState("Y", Boolean.TRUE);
-
- Boolean result=context.evaluate(session, "X and Y");
-
- if (result != null) {
- fail("Result should be null");
- }
- }
-
- @Test
- public void testLinkANDFalseNull() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", null);
- session.setState("Y", Boolean.FALSE);
-
- Boolean result=context.evaluate(session, "X and Y");
-
- if (result != null) {
- fail("Result should be null");
- }
- }
-
- @Test
- public void testLinkANDTrueFalse() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", Boolean.FALSE);
- session.setState("Y", Boolean.TRUE);
-
- Boolean result=context.evaluate(session, "X and Y");
-
- if (result == null) {
- fail("Result was null");
- }
-
- if (result.booleanValue()) {
- fail("Result should be false");
- }
- }
-
- @Test
- public void testLinkANDTrueTrue() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", Boolean.TRUE);
- session.setState("Y", Boolean.TRUE);
-
- Boolean result=context.evaluate(session, "X and Y");
-
- if (result == null) {
- fail("Result was null");
- }
-
- if (!result.booleanValue()) {
- fail("Result should be true");
- }
- }
-
- @Test
- public void testLinkORTrue1() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", null);
- session.setState("Y", Boolean.TRUE);
-
- Boolean result=context.evaluate(session, "X or Y");
-
- if (result == null) {
- fail("Result was null");
- }
-
- if (!result.booleanValue()) {
- fail("Result should be true");
- }
- }
-
- @Test
- public void testLinkORTrue2() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", Boolean.FALSE);
- session.setState("Y", Boolean.TRUE);
-
- Boolean result=context.evaluate(session, "X or Y");
-
- if (result == null) {
- fail("Result was null");
- }
-
- if (!result.booleanValue()) {
- fail("Result should be true");
- }
- }
-
- @Test
- public void testLinkORNull() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", Boolean.FALSE);
- session.setState("Y", null);
-
- // Result should be null, as still chance that result
- // could become true
- Boolean result=context.evaluate(session, "X or Y");
-
- if (result != null) {
- fail("Result should be null");
- }
- }
-
- @Test
- public void testLinkORFalse() {
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- DefaultSession session=new DefaultSession();
- session.setState("X", Boolean.FALSE);
- session.setState("Y", Boolean.FALSE);
-
- Boolean result=context.evaluate(session, "X or Y");
-
- if (result == null) {
- fail("Result was null");
- }
-
- if (result.booleanValue()) {
- fail("Result should be false");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DefaultSessionTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DefaultSessionTest.java
deleted file mode 100644
index a3b189a14..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DefaultSessionTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright 2009-11 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class DefaultSessionTest {
-
- @Test
- public void testSerializeSimple() {
- DefaultSession session=new DefaultSession();
-
- session.addNodeIndex(1);
- session.addNodeIndex(2);
-
- try {
- java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
- java.io.ObjectOutputStream oos=new java.io.ObjectOutputStream(os);
-
- oos.writeObject(session);
-
- java.io.ByteArrayInputStream is=new java.io.ByteArrayInputStream(os.toByteArray());
-
- java.io.ObjectInputStream ois=new java.io.ObjectInputStream(is);
-
- DefaultSession result=(DefaultSession)ois.readObject();
-
- validateSessions(result, session);
-
- } catch (Exception e) {
- fail("Failed to serialize: "+e);
- }
- }
-
- @Test
- public void testSerializeNested() {
- DefaultSession session=new DefaultSession();
-
- session.addNodeIndex(1);
- session.addNodeIndex(2);
-
- DefaultSession nested1=(DefaultSession)session.createNestedConversation(3);
- nested1.addNodeIndex(4);
-
- session.getNestedConversations().add(nested1);
-
- try {
- java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
- java.io.ObjectOutputStream oos=new java.io.ObjectOutputStream(os);
-
- oos.writeObject(session);
-
- java.io.ByteArrayInputStream is=new java.io.ByteArrayInputStream(os.toByteArray());
-
- java.io.ObjectInputStream ois=new java.io.ObjectInputStream(is);
-
- DefaultSession result=(DefaultSession)ois.readObject();
-
- validateSessions(result, session);
-
- } catch (Exception e) {
- fail("Failed to serialize: "+e);
- }
- }
-
- @Test
- public void testSerializeInterrupt() {
- DefaultSession session=new DefaultSession();
-
- session.addNodeIndex(1);
- session.addNodeIndex(2);
-
- DefaultSession main=(DefaultSession)session.createNestedConversation(6);
-
- DefaultSession interrupt1=(DefaultSession)session.createInterruptConversation(main, 4);
- interrupt1.addNodeIndex(5);
-
- try {
- java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
- java.io.ObjectOutputStream oos=new java.io.ObjectOutputStream(os);
-
- oos.writeObject(session);
-
- java.io.ByteArrayInputStream is=new java.io.ByteArrayInputStream(os.toByteArray());
-
- java.io.ObjectInputStream ois=new java.io.ObjectInputStream(is);
-
- DefaultSession result=(DefaultSession)ois.readObject();
-
- validateSessions(result, session);
-
- } catch (Exception e) {
- fail("Failed to serialize: "+e);
- }
- }
-
- @Test
- public void testSerializeState() {
- DefaultSession session=new DefaultSession();
-
- DefaultSession child=(DefaultSession)session.createNestedConversation(6);
-
- session.setState("state1", null);
- session.setState("state2", "value1");
- child.setState("state3", "value2");
-
- try {
- java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
- java.io.ObjectOutputStream oos=new java.io.ObjectOutputStream(os);
-
- oos.writeObject(session);
-
- java.io.ByteArrayInputStream is=new java.io.ByteArrayInputStream(os.toByteArray());
-
- java.io.ObjectInputStream ois=new java.io.ObjectInputStream(is);
-
- DefaultSession result=(DefaultSession)ois.readObject();
-
- validateSessions(result, session);
-
- if (result.getState("state1") != null) {
- fail("State1 should be null");
- }
-
- if (result.getState("state2") == null) {
- fail("State2 should NOT be null");
- }
-
- if (!result.getState("state2").equals("value1")) {
- fail("State2 value incorrect");
- }
-
- if (result.getNestedConversations().size() != 1) {
- fail("Expecting 1 nested conversation: "+result.getNestedConversations().size());
- }
-
- if (result.getNestedConversations().get(0).getState("state3") == null) {
- fail("State3 should not be null");
- }
-
- if (!result.getNestedConversations().get(0).getState("state3").equals("value2")) {
- fail("State3 value incorrect");
- }
- } catch (Exception e) {
- fail("Failed to serialize: "+e);
- }
- }
-
- protected void validateSessions(DefaultSession result, DefaultSession session) {
-
- if (result.getNumberOfNodeIndexes() != session.getNumberOfNodeIndexes()) {
- fail("Number of node indexes different");
- }
-
- for (int i=0; i < result.getNumberOfNodeIndexes(); i++) {
- if (result.getNodeIndexAt(i) != session.getNodeIndexAt(i)) {
- fail("Node index ["+i+"] is wrong");
- }
- }
-
- if (result.getReturnIndex() != session.getReturnIndex()) {
- fail("Return index different");
- }
-
- if ((result.getParentConversation() != null && session.getParentConversation() == null) ||
- (result.getParentConversation() == null && session.getParentConversation() != null)) {
- fail("Parent conversation not null");
- }
-
- if ((result.getMainConversation() != null && session.getMainConversation() == null) ||
- (result.getMainConversation() == null && session.getMainConversation() != null)) {
- fail("Main conversation not null");
- }
-
- if (result.getNestedConversations().size() != session.getNestedConversations().size()) {
- fail("Nested conversation size different");
- }
-
- for (int i=0; i < result.getNestedConversations().size(); i++) {
- validateSessions((DefaultSession)result.getNestedConversations().get(i),
- (DefaultSession)session.getNestedConversations().get(i));
- }
-
- if (result.getInterruptConversations().size() != session.getInterruptConversations().size()) {
- fail("Interrupt conversation size different");
- }
-
- for (int i=0; i < result.getInterruptConversations().size(); i++) {
- validateSessions((DefaultSession)result.getInterruptConversations().get(i),
- (DefaultSession)session.getInterruptConversations().get(i));
- }
- }
-
- @Test
- public void testSetState() {
- DefaultSession sess=new DefaultSession();
-
- sess.setState("testState", "testValue");
-
- if (sess.getState("testState") == null) {
- fail("State not found");
- }
-
- if (!sess.getState("testState").equals("testValue")) {
- fail("State value not correct");
- }
- }
-
- @Test
- public void testGetStateFromChild() {
- DefaultSession parent=new DefaultSession();
-
- Session child=parent.createNestedConversation(-1);
-
- parent.setState("testState", "testValue");
-
- if (child.getState("testState") == null) {
- fail("State not found");
- }
-
- if (!child.getState("testState").equals("testValue")) {
- fail("State value not correct");
- }
- }
-
- @Test
- public void testSetStateDeclaredInParent() {
- DefaultSession parent=new DefaultSession();
-
- Session child=parent.createNestedConversation(-1);
-
- // Declare var by setting to null in parent
- parent.setState("testState", null);
-
- if (parent.getState("testState") != null) {
- fail("State should be null");
- }
-
- child.setState("testState", "testValue");
-
- if (parent.getState("testState") == null) {
- fail("State should NOT be null");
- }
-
- if (!parent.getState("testState").equals("testValue")) {
- fail("State value not correct");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DoInterruptTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DoInterruptTest.java
deleted file mode 100644
index 57c70d388..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/DoInterruptTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-
-public class DoInterruptTest {
-
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CANCEL_MESSAGE_TYPE = "Cancel";
- private static final String FINISH_MESSAGE_TYPE = "Finish";
-
- public enum PurchasingLabel {
- _Confirmation,
- _OutOfStock
- }
-
- public Description getSellerProtocol() {
- Description pd=new Description();
-
- // 0
- Do tn=new Do();
- pd.getNode().add(tn);
- tn.setNextIndex(4);
- tn.setInnerIndex(1);
-
- Path p=new Path();
- p.setNextIndex(3);
- tn.getPath().add(p);
-
- // 1
- ReceiveMessage recvOrder=new ReceiveMessage();
- recvOrder.setNextIndex(2);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 2
- SendMessage sendConformation=new SendMessage();
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendConformation.getMessageType().add(mt2);
- pd.getNode().add(sendConformation);
-
- // 3
- ReceiveMessage recvCancel=new ReceiveMessage();
-
- MessageType mt3=new MessageType();
- mt3.setValue(CANCEL_MESSAGE_TYPE);
- recvCancel.getMessageType().add(mt3);
- pd.getNode().add(recvCancel);
-
- // 4
- ReceiveMessage recvFinish=new ReceiveMessage();
-
- MessageType mt4=new MessageType();
- mt4.setValue(FINISH_MESSAGE_TYPE);
- recvFinish.getMessageType().add(mt4);
- pd.getNode().add(recvFinish);
-
- return (pd);
- }
-
- @Test
- public void testNoCancel() {
- Description pd=getSellerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(FINISH_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Finish message failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testCancel() {
- Description pd=getSellerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CANCEL_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Cancel failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(FINISH_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Finish message failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ForkJoinTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ForkJoinTest.java
deleted file mode 100644
index 770143837..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ForkJoinTest.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright 2009-12 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class ForkJoinTest {
-
- private static final String OUT_OF_STOCK_MESSAGE_TYPE = "OutOfStock";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String FINISH_MESSAGE_TYPE = "Finish";
-
- public enum PurchasingLabel {
- _Confirmation,
- _OutOfStock
- }
-
- public Description getProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- LinkDeclaration linkdecl=new LinkDeclaration();
- linkdecl.setName("link1");
- linkdecl.setNextIndex(2);
- pd.getNode().add(linkdecl);
-
- // 2
- Parallel parallel=new Parallel();
- parallel.setNextIndex(7);
-
- Path c1=new Path();
- c1.setNextIndex(3);
- parallel.getPath().add(c1);
-
- Path c2=new Path();
- c2.setNextIndex(5);
- parallel.getPath().add(c2);
-
- pd.getNode().add(parallel);
-
- // 3
- SendMessage sendConfirmation=new SendMessage();
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendConfirmation.getMessageType().add(mt2);
- sendConfirmation.setNextIndex(4);
- pd.getNode().add(sendConfirmation);
-
- // 4
- Fork fork=new Fork();
- fork.setLinkName("link1");
- pd.getNode().add(fork);
-
- // 5
- Join join=new Join();
- join.setExpression("link1");
- join.setNextIndex(6);
- pd.getNode().add(join);
-
- // 6
- SendMessage sendOutOfStock=new SendMessage();
-
- MessageType mt3=new MessageType();
- mt3.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- sendOutOfStock.getMessageType().add(mt3);
- pd.getNode().add(sendOutOfStock);
-
- // 7
- SendMessage sendFinish=new SendMessage();
-
- MessageType mt4=new MessageType();
- mt4.setValue(FINISH_MESSAGE_TYPE);
- sendFinish.getMessageType().add(mt4);
- pd.getNode().add(sendFinish);
-
- return (pd);
- }
-
- @Test
- public void testValidCompletion() {
- Description pd=getProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(OUT_OF_STOCK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Out Of Stock failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(FINISH_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Finish message failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
-
- @Test
- public void testValidCompletionAfterOutOfOrderMessage() {
- Description pd=getProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(OUT_OF_STOCK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Out Of Stock should initially fail");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(OUT_OF_STOCK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Out Of Stock failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(FINISH_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Finish message failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/OptionalTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/OptionalTest.java
deleted file mode 100644
index f8b517bf6..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/OptionalTest.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class OptionalTest {
-
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit,
- _Confirmation,
- _OutOfStock,
- }
-
- public Description getSendDecisionProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.SendDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- pd.getNode().add(conditional);
-
- // 2
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvCreditOk.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- public Description getReceiveDecisionProtocol() {
- Description pd=new Description();
-
- // 0
- SendMessage recvOrder=new SendMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.ReceiveDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- pd.getNode().add(conditional);
-
- // 2
- ReceiveMessage sendCreditCheck=new ReceiveMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- SendMessage recvCreditOk=new SendMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvCreditOk.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- ReceiveMessage sendOrder=new ReceiveMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- @Test
- public void testConditionalSendValidOrderCreditCheckOk() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendValidOrderConfirmation() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendValidOrderCreditCheckOkLookahead() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendValidOrderConfirmationLookahead() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendInvalidOrderCreditCheckOk() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderCreditCheckOk() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderConfirmation() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderCreditCheckOkLookahead() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderConfirmationLookahead() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveInvalidOrderCreditCheckOk() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/OptionalWithParticipantTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/OptionalWithParticipantTest.java
deleted file mode 100644
index 7a7c90984..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/OptionalWithParticipantTest.java
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class OptionalWithParticipantTest {
-
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit,
- _Confirmation,
- _OutOfStock,
- }
-
- public Description getSendDecisionProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.SendDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- //conditional.setOtherRole(OTHER_ROLE);
- pd.getNode().add(conditional);
-
- // 2
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvCreditOk.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- public Description getReceiveDecisionProtocol() {
- Description pd=new Description();
-
- // 0
- SendMessage recvOrder=new SendMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.ReceiveDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- //conditional.setOtherRole(OTHER_ROLE);
- pd.getNode().add(conditional);
-
- // 2
- ReceiveMessage sendCreditCheck=new ReceiveMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- SendMessage recvCreditOk=new SendMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvCreditOk.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- ReceiveMessage sendOrder=new ReceiveMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- @Test
- public void testConditionalSendValidOrderCreditCheckOk() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendValidOrderConfirmation() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendValidOrderCreditCheckOkLookahead() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendValidOrderConfirmationLookahead() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalSendInvalidOrderCreditCheckOkByDecision() {
- Description pd=getSendDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderCreditCheckOk() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderConfirmation() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderCreditCheckOkLookahead() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveValidOrderConfirmationLookahead() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testConditionalReceiveInvalidOrderCreditCheckOkByDecision() {
- Description pd=getReceiveDecisionProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ParallelTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ParallelTest.java
deleted file mode 100644
index 08fed43b7..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ParallelTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-
-public class ParallelTest {
-
- private static final String OUT_OF_STOCK_MESSAGE_TYPE = "OutOfStock";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String FINISH_MESSAGE_TYPE = "Finish";
-
- public enum PurchasingLabel {
- _Confirmation,
- _OutOfStock
- }
-
- public Description getSellerProtocol() {
- Description pd=new Description();
-
- ReceiveMessage recvOrder=new ReceiveMessage();
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- Parallel parallel=new Parallel();
- parallel.setNextIndex(4);
-
- Path c1=new Path();
- c1.setNextIndex(2);
- parallel.getPath().add(c1);
-
- Path c2=new Path();
- c2.setNextIndex(3);
- parallel.getPath().add(c2);
-
- pd.getNode().add(parallel);
-
- SendMessage sendConformation=new SendMessage();
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendConformation.getMessageType().add(mt2);
- pd.getNode().add(sendConformation);
-
- SendMessage sendOutOfStock=new SendMessage();
-
- MessageType mt3=new MessageType();
- mt3.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- sendOutOfStock.getMessageType().add(mt3);
- pd.getNode().add(sendOutOfStock);
-
- SendMessage sendFinish=new SendMessage();
-
- MessageType mt4=new MessageType();
- mt4.setValue(FINISH_MESSAGE_TYPE);
- sendFinish.getMessageType().add(mt4);
- pd.getNode().add(sendFinish);
-
- return (pd);
- }
-
- @Test
- public void testValidCompletion() {
- Description pd=getSellerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(OUT_OF_STOCK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Out Of Stock failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(FINISH_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Finish message failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testMissingOutOfStock() {
- Description pd=getSellerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(FINISH_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Finish message should have failed, as parallel should not have completed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ProtocolMonitorAllTests.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ProtocolMonitorAllTests.java
deleted file mode 100644
index d1e1cadf7..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/ProtocolMonitorAllTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( { BrokerParticipantTest.class,
- BuyerParticipantTest.class,
- CreditAgencyParticipantTest.class,
- OptionalTest.class,
- OptionalWithParticipantTest.class,
- RepeatTest.class,
- RepeatWithParticipantTest.class,
- RunTest.class,
- ParallelTest.class,
- RunWithParticipantTest.class,
- SellerParticipantTest.class})
-public class ProtocolMonitorAllTests {
-}
\ No newline at end of file
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RepeatTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RepeatTest.java
deleted file mode 100644
index 6452c6a01..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RepeatTest.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class RepeatTest {
-
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit,
- _Confirmation,
- _OutOfStock,
- }
-
- public Description getSendRepeatProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.SendDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- pd.getNode().add(conditional);
-
- // 2
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvCreditOk.setNextIndex(1);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- public Description getReceiveRepeatProtocol() {
- Description pd=new Description();
-
- // 0
- SendMessage recvOrder=new SendMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.ReceiveDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- pd.getNode().add(conditional);
-
- // 2
- ReceiveMessage sendCreditCheck=new ReceiveMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- SendMessage recvCreditOk=new SendMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvCreditOk.setNextIndex(1);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- ReceiveMessage sendOrder=new ReceiveMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- @Test
- public void testRepeatSendValidOrderCreditCheckOk() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendValidOrderConfirmation() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendValidOrderCreditCheckOkLookahead() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendValidOrderConfirmationLookahead() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendInvalidOrderCreditCheckOk() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Credit ok should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderCreditCheckOk() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderConfirmation() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderCreditCheckOkLookahead() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderConfirmationLookahead() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveInvalidOrderCreditCheckOk() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Credit ok should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RepeatWithParticipantTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RepeatWithParticipantTest.java
deleted file mode 100644
index e001d3854..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RepeatWithParticipantTest.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class RepeatWithParticipantTest {
-
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit,
- _Confirmation,
- _OutOfStock,
- }
-
- public Description getSendRepeatProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.SendDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- //conditional.setOtherRole(OTHER_ROLE);
- pd.getNode().add(conditional);
-
- // 2
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvCreditOk.setNextIndex(1);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- public Description getReceiveRepeatProtocol() {
- Description pd=new Description();
-
- // 0
- SendMessage recvOrder=new SendMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Decision conditional=new Decision();
- //conditional.setNodeType(Protocol.Node.NodeType.ReceiveDecision);
- conditional.setNextIndex(4);
- conditional.setInnerIndex(2);
- //conditional.setOtherRole(OTHER_ROLE);
- pd.getNode().add(conditional);
-
- // 2
- ReceiveMessage sendCreditCheck=new ReceiveMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- sendCreditCheck.setNextIndex(3);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt2);
- pd.getNode().add(sendCreditCheck);
-
- // 3
- SendMessage recvCreditOk=new SendMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvCreditOk.setNextIndex(1);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt3);
- pd.getNode().add(recvCreditOk);
-
- // 4
- ReceiveMessage sendOrder=new ReceiveMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt4);
- pd.getNode().add(sendOrder);
-
- return (pd);
- }
-
- @Test
- public void testRepeatSendValidOrderCreditCheckOk() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendValidOrderConfirmation() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendValidOrderCreditCheckOkLookahead() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendValidOrderConfirmationLookahead() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatSendInvalidOrderCreditCheckOkByDecision() {
- Description pd=getSendRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderCreditCheckOk() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderConfirmation() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderCreditCheckOkLookahead() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveValidOrderConfirmationLookahead() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRepeatReceiveInvalidOrderCreditCheckOkByDecision() {
- Description pd=getReceiveRepeatProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RunTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RunTest.java
deleted file mode 100644
index e35ef7394..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RunTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class RunTest {
-
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit,
- _Confirmation,
- _OutOfStock,
- }
-
- public Description getSendProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Scope run=new Scope();
- //run.setNodeType(Protocol.Node.NodeType.Run);
- run.setNextIndex(2);
- run.setInnerIndex(3);
- pd.getNode().add(run);
-
- // 2
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt2);
- pd.getNode().add(sendOrder);
-
- // 3
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt3);
- pd.getNode().add(sendCreditCheck);
-
- // 4
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt4);
- pd.getNode().add(recvCreditOk);
-
- return (pd);
- }
-
- public Description getReceiveProtocol() {
- Description pd=new Description();
-
- // 0
- SendMessage recvOrder=new SendMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Scope run=new Scope();
- //run.setNodeType(Protocol.Node.NodeType.Run);
- run.setNextIndex(2);
- run.setInnerIndex(3);
- pd.getNode().add(run);
-
- // 2
- ReceiveMessage sendOrder=new ReceiveMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt2);
- pd.getNode().add(sendOrder);
-
- // 3
- ReceiveMessage sendCreditCheck=new ReceiveMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- sendCreditCheck.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt3);
- pd.getNode().add(sendCreditCheck);
-
- // 4
- SendMessage recvCreditOk=new SendMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt4);
- pd.getNode().add(recvCreditOk);
-
- return (pd);
- }
-
- @Test
- public void testRunSendValidOrderCreditCheckOk() {
- Description pd=getSendProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRunSendInvalidOrderCreditCheckOk() {
- Description pd=getSendProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Send Confirmation should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
- @Test
- public void testRunReceiveValidOrderCreditCheckOk() {
- Description pd=getReceiveProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRunReceiveInvalidOrderCreditCheckOk() {
- Description pd=getReceiveProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Receive Confirmation should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RunWithParticipantTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RunWithParticipantTest.java
deleted file mode 100644
index 0aefa1761..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/RunWithParticipantTest.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-public class RunWithParticipantTest {
-
- private static final String CREDIT_OK_MESSAGE_TYPE = "CreditOk";
- private static final String CREDIT_CHECK_MESSAGE_TYPE = "CreditCheck";
- private static final String ORDER_MESSAGE_TYPE = "Order";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
-
- public enum PurchasingLabel {
- _CreditOk,
- _InsufficientCredit,
- _Confirmation,
- _OutOfStock,
- }
-
- public Description getSendProtocol() {
- Description pd=new Description();
-
- // 0
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Scope run=new Scope();
- //run.setNodeType(Protocol.Node.NodeType.Run);
- run.setNextIndex(2);
- run.setInnerIndex(3);
- pd.getNode().add(run);
-
- // 2
- SendMessage sendOrder=new SendMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt2);
- pd.getNode().add(sendOrder);
-
- // 3
- SendMessage sendCreditCheck=new SendMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.SendMessage);
- sendCreditCheck.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt3);
- pd.getNode().add(sendCreditCheck);
-
- // 4
- ReceiveMessage recvCreditOk=new ReceiveMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt4);
- pd.getNode().add(recvCreditOk);
-
- return (pd);
- }
-
- public Description getReceiveProtocol() {
- Description pd=new Description();
-
- // 0
- SendMessage recvOrder=new SendMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.SendMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- // 1
- Scope run=new Scope();
- //run.setNodeType(Protocol.Node.NodeType.Run);
- run.setNextIndex(2);
- run.setInnerIndex(3);
- pd.getNode().add(run);
-
- // 2
- ReceiveMessage sendOrder=new ReceiveMessage();
- //sendOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendOrder.getMessageType().add(mt2);
- pd.getNode().add(sendOrder);
-
- // 3
- ReceiveMessage sendCreditCheck=new ReceiveMessage();
- //sendCreditCheck.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- sendCreditCheck.setNextIndex(4);
-
- MessageType mt3=new MessageType();
- mt3.setValue(CREDIT_CHECK_MESSAGE_TYPE);
- sendCreditCheck.getMessageType().add(mt3);
- pd.getNode().add(sendCreditCheck);
-
- // 4
- SendMessage recvCreditOk=new SendMessage();
- //recvCreditOk.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt4=new MessageType();
- mt4.setValue(CREDIT_OK_MESSAGE_TYPE);
- recvCreditOk.getMessageType().add(mt4);
- pd.getNode().add(recvCreditOk);
-
- return (pd);
- }
-
- @Test
- public void testRunSendValidOrderCreditCheckOk() {
- Description pd=getSendProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRunSendInvalidOrderCreditCheckOkByMissingMessage() {
- Description pd=getSendProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Send Confirmation should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-
- @Test
- public void testRunReceiveValidOrderCreditCheckOk() {
- Description pd=getReceiveProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_OK_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Credit ok failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Receive Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testRunReceiveInvalidOrderCreditCheckOkByMissingMessage() {
- Description pd=getReceiveProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Send Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CREDIT_CHECK_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Credit check failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == true) {
- fail("Receive Confirmation should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-
-}
diff --git a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/SellerParticipantTest.java b/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/SellerParticipantTest.java
deleted file mode 100644
index 10df6fcd5..000000000
--- a/bundles/org.scribble.protocol.monitor/src/test/java/org/scribble/protocol/monitor/SellerParticipantTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.monitor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.scribble.protocol.monitor.model.*;
-
-
-public class SellerParticipantTest {
-
- private static final String OUT_OF_STOCK_MESSAGE_TYPE = "OutOfStock";
- private static final String CONFIRMATION_MESSAGE_TYPE = "Confirmation";
- private static final String ORDER_MESSAGE_TYPE = "Order";
-
- public enum PurchasingLabel {
- _Confirmation,
- _OutOfStock
- }
-
- public Description getSellerProtocol() {
- Description pd=new Description();
-
- ReceiveMessage recvOrder=new ReceiveMessage();
- //recvOrder.setNodeType(Protocol.Node.NodeType.ReceiveMessage);
- recvOrder.setNextIndex(1);
-
- MessageType mt1=new MessageType();
- mt1.setValue(ORDER_MESSAGE_TYPE);
- recvOrder.getMessageType().add(mt1);
- pd.getNode().add(recvOrder);
-
- Choice choice=new Choice();
- //choice.setNodeType(Protocol.Node.NodeType.SendChoice);
-
- Path c1=new Path();
- //c1.setId(PurchasingLabel._Confirmation.name());
- c1.setNextIndex(2);
- choice.getPath().add(c1);
-
- Path c2=new Path();
- //c2.setId(PurchasingLabel._OutOfStock.name());
- c2.setNextIndex(3);
- choice.getPath().add(c2);
-
- pd.getNode().add(choice);
-
- SendMessage sendConformation=new SendMessage();
- //sendConformation.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt2=new MessageType();
- mt2.setValue(CONFIRMATION_MESSAGE_TYPE);
- sendConformation.getMessageType().add(mt2);
- pd.getNode().add(sendConformation);
-
- SendMessage sendOutOfStock=new SendMessage();
- //sendOutOfStock.setNodeType(Protocol.Node.NodeType.SendMessage);
-
- MessageType mt3=new MessageType();
- mt3.setValue(OUT_OF_STOCK_MESSAGE_TYPE);
- sendOutOfStock.getMessageType().add(mt3);
- pd.getNode().add(sendOutOfStock);
-
- return (pd);
- }
-
- @Test
- public void testSellerValidOrderConfirmation() {
- Description pd=getSellerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testSellerValidOrderConfirmationLookahead() {
- Description pd=getSellerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == false) {
- fail("Confirmation failed");
- }
-
- if (conv.isFinished() == false) {
- fail("Conversation should be finished");
- }
- }
-
- @Test
- public void testSellerInvalidOrderConfirmation() {
- Description pd=getSellerProtocol();
-
- // Create Protocol Monitor
- ProtocolMonitor monitor=new DefaultProtocolMonitor();
-
- DefaultMonitorContext context=new DefaultMonitorContext();
-
- Session conv=monitor.createSession(context, pd, DefaultSession.class);
-
- DefaultMessage message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageReceived(context, pd, conv, message).isValid() == false) {
- fail("Order failed");
- }
-
- message=new DefaultMessage();
- message.getTypes().add(ORDER_MESSAGE_TYPE);
-
- if (monitor.messageSent(context, pd, conv, message).isValid() == true) {
- fail("Second order should have failed");
- }
-
- if (conv.isFinished() == true) {
- fail("Conversation should NOT be finished");
- }
- }
-}
diff --git a/bundles/org.scribble.protocol.parser/LICENSE.txt b/bundles/org.scribble.protocol.parser/LICENSE.txt
deleted file mode 100644
index 29f81d812..000000000
--- a/bundles/org.scribble.protocol.parser/LICENSE.txt
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/bundles/org.scribble.protocol.parser/META-INF/MANIFEST.MF b/bundles/org.scribble.protocol.parser/META-INF/MANIFEST.MF
deleted file mode 100644
index 429f5f81a..000000000
--- a/bundles/org.scribble.protocol.parser/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Scribble Protocol Parser
-Bundle-SymbolicName: org.scribble.protocol.parser;singleton:=true
-Bundle-Version: 2.1.0.SNAPSHOT
-Bundle-Vendor: www.scribble.org
-Import-Package: org.osgi.framework;version="1.3.0"
-Export-Package: org.scribble.protocol.parser.antlr
-Bundle-ClassPath: .,
- lib/antlr-3.2.jar,
- src/main/resources/lib/antlr-3.2.jar
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.scribble.protocol,
- org.scribble.common
-Bundle-Activator: org.scribble.protocol.parser.osgi.Activator
diff --git a/bundles/org.scribble.protocol.parser/build.properties b/bundles/org.scribble.protocol.parser/build.properties
deleted file mode 100644
index b844f8dbe..000000000
--- a/bundles/org.scribble.protocol.parser/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-source.. = src/main/java/,\
- target/generated-sources/antlr3/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- src/main/resources/lib/antlr-3.2.jar,\
- OSGI-INF/,\
- LICENSE.txt
-src.includes = target/generated-sources/,\
- src/,\
- pom.xml,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
- OSGI-INF/,\
- LICENSE.txt
-jars.compile.order = .,\
- lib/antlr-3.2.jar
diff --git a/bundles/org.scribble.protocol.parser/pom.xml b/bundles/org.scribble.protocol.parser/pom.xml
deleted file mode 100644
index d07b4a235..000000000
--- a/bundles/org.scribble.protocol.parser/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
- 4.0.0
- org.scribble.bundles
- org.scribble.protocol.parser
- jar
- 2.1.0-SNAPSHOT
- Scribble::Bundles::ProtocolParser
-
-
- org.scribble
- bundles
- 2.1.0-SNAPSHOT
-
-
-
-
- org.scribble.bundles
- org.scribble.common
- ${scribble.bundles.version}
-
-
- org.scribble.bundles
- org.scribble.protocol
- ${scribble.bundles.version}
-
-
- org.osgi
- org.osgi.core
- ${osgi.version}
-
-
- org.antlr
- antlr-runtime
- ${antlr.version}
-
-
- junit
- junit
- test
-
-
-
-
-
-
- org.antlr
- antlr3-maven-plugin
- 3.2
-
-
-
- antlr
-
-
-
-
-
-
-
-
diff --git a/bundles/org.scribble.protocol.parser/src/main/antlr3/org/scribble/protocol/parser/antlr/ScribbleProtocol.g b/bundles/org.scribble.protocol.parser/src/main/antlr3/org/scribble/protocol/parser/antlr/ScribbleProtocol.g
deleted file mode 100644
index 675e47849..000000000
--- a/bundles/org.scribble.protocol.parser/src/main/antlr3/org/scribble/protocol/parser/antlr/ScribbleProtocol.g
+++ /dev/null
@@ -1,197 +0,0 @@
-grammar ScribbleProtocol;
-
-options {
- output=AST;
- backtrack=true;
-}
-
-tokens {
- INTERACTION = 'interaction' ;
- PLUS = '+' ;
- MINUS = '-' ;
- MULT = '*' ;
- DIV = '/' ;
- FULLSTOP = '.' ;
-}
-
-@header {
-package org.scribble.protocol.parser.antlr;
-}
-
-@lexer::header {
-package org.scribble.protocol.parser.antlr;
-}
-
-@members {
- private org.scribble.common.logging.Journal m_journal=null;
- private String m_document=null;
- private boolean m_errorOccurred=false;
-
- public static void main(String[] args) throws Exception {
- ScribbleProtocolLexer lex = new ScribbleProtocolLexer(new ANTLRFileStream(args[0]));
- CommonTokenStream tokens = new CommonTokenStream(lex);
-
- ScribbleProtocolParser parser = new ScribbleProtocolParser(tokens);
-
- ProtocolTreeAdaptor adaptor=new ProtocolTreeAdaptor(null, null);
- adaptor.setParser(parser);
-
- parser.setTreeAdaptor(adaptor);
-
- try {
- ScribbleProtocolParser.description_return r=parser.description();
-
- //CommonTree t=(CommonTree)r.getTree();
-
- //Tree t=(Tree)r.getTree();
-
- //System.out.println(t.toStringTree());
-
- } catch (RecognitionException e) {
- e.printStackTrace();
- }
- }
-
- public void setJournal(org.scribble.common.logging.Journal journal) {
- m_journal = journal;
- }
-
- public void setDocument(String doc) {
- m_document = doc;
- }
-
- public void emitErrorMessage(String mesg) {
- if (m_journal == null) {
- super.emitErrorMessage(mesg);
- } else {
- m_journal.error(ANTLRMessageUtil.getMessageText(mesg),
- ANTLRMessageUtil.getProperties(mesg, m_document));
- }
- m_errorOccurred = true;
- }
-
- public boolean isErrorOccurred() {
- return(m_errorOccurred);
- }
-}
-
-/*------------------------------------------------------------------
- * PARSER RULES
- *------------------------------------------------------------------*/
-
-description: ( ( ANNOTATION )* ( importProtocolStatement | importTypeStatement ) )* ( ANNOTATION )* protocolDef ;
-
-importProtocolStatement: 'import' 'protocol' importProtocolDef ( ','! importProtocolDef )* ';'! ;
-
-importProtocolDef: ID 'from'! StringLiteral;
-
-importTypeStatement: 'import' ( simpleName )? importTypeDef ( ','! importTypeDef )* ( 'from'! StringLiteral )? ';'! ;
-
-importTypeDef: ( dataTypeDef 'as'! )? ID ;
-
-dataTypeDef: StringLiteral ;
-
-simpleName: ID ;
-
-protocolDef: 'protocol'^ protocolName ( 'at' roleName )? ( parameterDefs )? '{'! protocolBlockDef ( ( ANNOTATION )* protocolDef )* '}'! ;
-
-protocolName: ID ;
-
-parameterDefs: '('! parameterDef ( ','! parameterDef )* ')'! ;
-
-parameterDef: ( typeReferenceDef | 'role' ) simpleName ;
-
-protocolBlockDef: activityListDef ;
-
-blockDef: '{'! activityListDef '}'! ;
-
-activityListDef: ( ( ANNOTATION )* activityDef )* ;
-
-activityDef: ( introducesDef | interactionDef | inlineDef | runDef | recursionDef | endDef ) ';'! |
- choiceDef | directedChoiceDef | parallelDef | repeatDef | unorderedDef |
- recBlockDef | globalEscapeDef ;
-
-introducesDef: roleDef 'introduces' roleDef ( ','! roleDef )* ;
-
-roleDef: ID ;
-
-roleName: ID ;
-
-typeReferenceDef: ID ;
-
-interactionSignatureDef: ( typeReferenceDef | ID '('! ( typeReferenceDef ( ','! typeReferenceDef )* )? ')'! ) ;
-
-interactionDef: interactionSignatureDef ( 'from' roleName ( 'to' roleName ( ','! roleName )* )? |
- 'to' roleName ( ','! roleName )* ) ;
-
-choiceDef: 'choice'^ ( 'at' roleName )? blockDef ( 'or' blockDef )* ;
-
-directedChoiceDef: ( 'from' roleName )? ( 'to' roleName ( ','! roleName )* )? '{' ( onMessageDef )+ '}' ;
-
-onMessageDef: interactionSignatureDef ':' activityList ;
-
-activityList: ( ( ANNOTATION )* activityDef )* ;
-
-repeatDef: 'repeat'^ ( 'at' roleName ( ','! roleName )* )? blockDef ;
-
-recBlockDef: 'rec'^ labelName blockDef ;
-
-labelName: ID ;
-
-recursionDef: labelName ;
-
-endDef: 'end'^ ;
-
-runDef: 'run'^ protocolRefDef ( '('! parameter ( ','! parameter )* ')'! )? 'from' roleName ;
-
-protocolRefDef: ID ( 'at' roleName )? ;
-
-declarationName: ID ;
-
-parameter: declarationName ;
-
-inlineDef: 'inline'^ protocolRefDef ( '('! parameter ( ','! parameter )* ')'! )? ;
-
-parallelDef: 'parallel'^ blockDef ( 'and' blockDef )* ;
-
-globalEscapeDef: 'do'^ blockDef ( interruptDef )+ ;
-
-interruptDef: 'interrupt'^ blockDef ;
-
-unorderedDef: 'unordered'^ blockDef ;
-
-
-/*-----------------------------------------------
-TO DO:
-Declaration (variables) possibly - but that may need
-lookahead to avoid conflict with interactions.
--------------------------------------------------*/
-
-expr : term ( ( PLUS | MINUS ) term )* ;
-
-term : factor ( ( MULT | DIV ) factor )* ;
-
-factor : NUMBER ;
-
-
-/*------------------------------------------------------------------
- * LEXER RULES
- *------------------------------------------------------------------*/
-
-ID : ('a'..'z'|'A'..'Z'|'_')('a'..'z'|'A'..'Z'|'0'..'9'|'_')* ;
-
-NUMBER : (DIGIT)+ ;
-
-WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ { $channel = HIDDEN; } ;
-
-fragment DIGIT : '0'..'9' ;
-
-ANNOTATION : '[[' (options {greedy=false;} : .)* ']]' ;
-
-ML_COMMENT
- : '/*' (options {greedy=false;} : .)* '*/' {$channel=HIDDEN;}
- ;
-
-LINE_COMMENT : '//' (options {greedy=false;} : .)* '\n' {$channel=HIDDEN;} ;
-
-StringLiteral: '"' ( ~('\\'|'"') )* '"' ;
diff --git a/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ANTLRMessageUtil.java b/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ANTLRMessageUtil.java
deleted file mode 100644
index 722e0fcab..000000000
--- a/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ANTLRMessageUtil.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2009-10 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.parser.antlr;
-
-import org.scribble.common.logging.Journal;
-
-/**
- * ANTLR message utilities.
- *
- */
-public final class ANTLRMessageUtil {
-
- /**
- * Private constructor.
- */
- private ANTLRMessageUtil() {
- }
-
- /**
- * End location separator.
- */
- private static final char END_LOCATION_SEPARATOR = ' ';
-
- /**
- * Location prefix token.
- */
- private static final String LOCATION_PREFIX_TOKEN = "line ";
-
- /**
- * This method removes the message location prefix.
- *
- * @param mesg The message
- * @return The message with the location information removed
- */
- public static String getMessageText(String mesg) {
- String ret=mesg;
-
- if (mesg != null && mesg.startsWith(LOCATION_PREFIX_TOKEN)) {
- int index=mesg.indexOf(END_LOCATION_SEPARATOR, LOCATION_PREFIX_TOKEN.length());
-
- if (index != -1) {
- ret = mesg.substring(index+1);
- }
- }
-
- return (ret);
- }
-
- /**
- * This method returns the properties.
- *
- * @param mesg The message
- * @param document The document
- * @return The properties
- */
- public static java.util.Map getProperties(String mesg, String document) {
- java.util.Map ret=null;
-
- if (mesg != null && mesg.startsWith(LOCATION_PREFIX_TOKEN)) {
- int index=mesg.indexOf(END_LOCATION_SEPARATOR, LOCATION_PREFIX_TOKEN.length());
-
- if (index != -1) {
- String lineDetails=mesg.substring(LOCATION_PREFIX_TOKEN.length(), index);
-
- String[] nums=lineDetails.split(":");
-
- if (nums != null && nums.length == 2) {
- ret = new java.util.HashMap();
-
- Integer line=Integer.parseInt(nums[0]);
- Integer col=Integer.parseInt(nums[1]);
-
- ret.put(Journal.START_LINE, line);
- ret.put(Journal.START_COLUMN, col);
-
- // Determine the position within the document
- int pos=0;
-
- for (int i=0; pos != -1 && i < line.intValue()-1; i++) {
- pos = document.indexOf("\r\n", pos);
-
- if (pos != -1) {
- pos += 2;
- }
- }
-
- if (pos != -1) {
- pos += col.intValue();
-
- ret.put(Journal.START_POSITION, new Integer(pos));
-
- // Find next whitespace
- int endpos=document.length();
- int nextpos=-1;
-
- for (int j=pos+1; nextpos == -1 && j < endpos; j++) {
- char ch=document.charAt(j);
- if (Character.isWhitespace(ch)) {
- nextpos = j-1;
- }
- }
-
- if (nextpos == -1) {
- nextpos = pos;
- }
-
- ret.put(Journal.END_POSITION, new Integer(nextpos));
- }
- }
- }
- }
-
- return (ret);
- }
-}
diff --git a/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ANTLRProtocolParser.java b/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ANTLRProtocolParser.java
deleted file mode 100644
index 3ca6f993e..000000000
--- a/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ANTLRProtocolParser.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2009 www.scribble.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.parser.antlr;
-
-import java.io.IOException;
-
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.scribble.common.logging.Journal;
-import org.scribble.common.resource.Content;
-import org.scribble.protocol.ProtocolContext;
-import org.scribble.protocol.model.ProtocolModel;
-import org.scribble.protocol.parser.AnnotationProcessor;
-import org.scribble.protocol.parser.ProtocolParser;
-
-/**
- * This class provides the ANTLR implementation of the Protocol Parser
- * interface.
- *
- */
-public class ANTLRProtocolParser implements ProtocolParser {
-
- private AnnotationProcessor _annotationProcessor=null;
-
- /**
- * Default constructor.
- */
- public ANTLRProtocolParser() {
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isSupported(Content content) {
- return (content.hasExtension(org.scribble.protocol.ProtocolDefinitions.PROTOCOL_TYPE));
- }
-
- /**
- * {@inheritDoc}
- */
- public ProtocolModel parse(ProtocolContext context, Content content, Journal journal)
- throws IOException {
- ProtocolModel ret=null;
-
- try {
- java.io.InputStream is=content.getInputStream();
-
- byte[] b=new byte[is.available()];
- is.read(b);
-
- is.close();
-
- String document=new String(b);
-
- ScribbleProtocolLexer lex = new ScribbleProtocolLexer(new ANTLRStringStream(document));
- CommonTokenStream tokens = new CommonTokenStream(lex);
-
- ScribbleProtocolParser parser = new ScribbleProtocolParser(tokens);
-
- ProtocolTreeAdaptor adaptor=new ProtocolTreeAdaptor(_annotationProcessor, journal);
- adaptor.setParser(parser);
-
- parser.setDocument(document);
- parser.setTreeAdaptor(adaptor);
-
- parser.setJournal(journal);
-
- parser.description();
-
- if (!parser.isErrorOccurred()) {
- ret = adaptor.getProtocolModel();
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return (ret);
- }
-
- /**
- * This method sets an annotation processor.
- *
- * @param ap The annotation processor
- */
- public void setAnnotationProcessor(AnnotationProcessor ap) {
- _annotationProcessor = ap;
- }
-}
diff --git a/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ProtocolTreeAdaptor.java b/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ProtocolTreeAdaptor.java
deleted file mode 100644
index c9fcc29d9..000000000
--- a/bundles/org.scribble.protocol.parser/src/main/java/org/scribble/protocol/parser/antlr/ProtocolTreeAdaptor.java
+++ /dev/null
@@ -1,935 +0,0 @@
-/*
- * Copyright 2009-11 www.scribble.org
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.scribble.protocol.parser.antlr;
-
-import java.beans.PropertyDescriptor;
-import java.util.logging.Logger;
-
-import org.antlr.runtime.RecognitionException;
-import org.antlr.runtime.Token;
-import org.antlr.runtime.TokenStream;
-import org.scribble.common.logging.Journal;
-import org.scribble.common.model.Annotation;
-import org.scribble.common.model.DefaultAnnotation;
-import org.scribble.protocol.model.Activity;
-import org.scribble.protocol.model.Block;
-import org.scribble.protocol.model.Choice;
-import org.scribble.protocol.model.DataType;
-import org.scribble.protocol.model.DirectedChoice;
-import org.scribble.protocol.model.Do;
-import org.scribble.protocol.model.End;
-import org.scribble.protocol.model.ImportList;
-import org.scribble.protocol.model.Inline;
-import org.scribble.protocol.model.Interaction;
-import org.scribble.protocol.model.Interrupt;
-import org.scribble.protocol.model.Introduces;
-import org.scribble.protocol.model.MessageSignature;
-import org.scribble.protocol.model.ModelObject;
-import org.scribble.protocol.model.OnMessage;
-import org.scribble.protocol.model.Parallel;
-import org.scribble.protocol.model.Parameter;
-import org.scribble.protocol.model.ParameterDefinition;
-import org.scribble.protocol.model.Protocol;
-import org.scribble.protocol.model.ProtocolImport;
-import org.scribble.protocol.model.ProtocolImportList;
-import org.scribble.protocol.model.ProtocolModel;
-import org.scribble.protocol.model.ProtocolReference;
-import org.scribble.protocol.model.RecBlock;
-import org.scribble.protocol.model.Recursion;
-import org.scribble.protocol.model.Repeat;
-import org.scribble.protocol.model.Role;
-import org.scribble.protocol.model.Run;
-import org.scribble.protocol.model.TypeImport;
-import org.scribble.protocol.model.TypeImportList;
-import org.scribble.protocol.model.TypeReference;
-import org.scribble.protocol.model.Unordered;
-import org.scribble.protocol.parser.AnnotationProcessor;
-
-/**
- * This class provides an implementation of the tree adapter.
- *
- */
-public class ProtocolTreeAdaptor implements org.antlr.runtime.tree.TreeAdaptor {
-
- private static final String ANNOTATIONS = "_annotations";
- private static final String ACTIVITY_RULE_NAME = "activityDef";
- private static final java.util.Map PROPERTY_TOKENS=
- new java.util.HashMap();
- private static final java.util.Map> TOKEN_CLASS=
- new java.util.HashMap>();
- private static final java.util.Map> LIST_CLASS=
- new java.util.HashMap>();
- private static final java.util.Map> PARSER_GROUPING_RULE_CLASS=
- new java.util.HashMap>();
- private static final java.util.List CLEAR_TOKEN_LIST_RULES=
- new java.util.Vector();
- private static final java.util.List TOKENS_TO_IGNORE=
- new java.util.Vector();
- private static final java.util.List STRING_LITERALS=
- new java.util.Vector();
-
- private ScribbleProtocolParser _parser=null;
- private AnnotationProcessor _annotationProcessor=null;
- private Journal _journal=null;
- private Token _currentToken=null;
-
- private ProtocolModel _model=null;
-
- private static final Logger LOG=Logger.getLogger(ProtocolTreeAdaptor.class.getName());
-
- static {
- // The map of root tokens, that begin a grammer
- // rule, and the model class they are associated
- // with
- //m_tokenClass.put("import", ImportList.class);
- TOKEN_CLASS.put("protocol", Protocol.class);
- //m_tokenClass.put("role", RoleList.class);
- TOKEN_CLASS.put("choice", Choice.class);
- TOKEN_CLASS.put("rec", RecBlock.class);
- TOKEN_CLASS.put("parallel", Parallel.class);
- TOKEN_CLASS.put("repeat", Repeat.class);
- TOKEN_CLASS.put("do", Do.class);
- TOKEN_CLASS.put("interrupt", Interrupt.class);
- TOKEN_CLASS.put("run", Run.class);
- TOKEN_CLASS.put("inline", Inline.class);
- TOKEN_CLASS.put("unordered", Unordered.class);
- TOKEN_CLASS.put("end", End.class);
-
- // Clear token list - determines whether prior to processing
- // a list of tokens, the 'current token' should be cleared
- CLEAR_TOKEN_LIST_RULES.add("parameter");
- CLEAR_TOKEN_LIST_RULES.add("dataTypeDef");
- CLEAR_TOKEN_LIST_RULES.add("importTypeStatement");
- CLEAR_TOKEN_LIST_RULES.add("importProtocolDef");
- CLEAR_TOKEN_LIST_RULES.add("introducesDef");
- CLEAR_TOKEN_LIST_RULES.add("directedChoiceDef");
-
- // The list of tokens that should be ignored when processing
- // the children of a parent node
- TOKENS_TO_IGNORE.add("import");
-
- // This may define the model object that should be
- // created after processing the named grammer rule
- PARSER_GROUPING_RULE_CLASS.put("importProtocolStatement", ProtocolImportList.class);
- PARSER_GROUPING_RULE_CLASS.put("importTypeStatement", TypeImportList.class);
- PARSER_GROUPING_RULE_CLASS.put("simpleName", String.class);
- PARSER_GROUPING_RULE_CLASS.put("simpleName", String.class);
- PARSER_GROUPING_RULE_CLASS.put("blockDef", Block.class);
- PARSER_GROUPING_RULE_CLASS.put("protocolBlockDef", Block.class);
- PARSER_GROUPING_RULE_CLASS.put("activityList", Block.class);
- PARSER_GROUPING_RULE_CLASS.put("interactionDef", Interaction.class);
- PARSER_GROUPING_RULE_CLASS.put("interactionSignatureDef", MessageSignature.class);
- PARSER_GROUPING_RULE_CLASS.put("typeReferenceDef", TypeReference.class);
- PARSER_GROUPING_RULE_CLASS.put("protocolName", String.class);
- PARSER_GROUPING_RULE_CLASS.put("roleName", Role.class);
- PARSER_GROUPING_RULE_CLASS.put("roleDef", Role.class);
- PARSER_GROUPING_RULE_CLASS.put("importProtocolDef", ProtocolImport.class);
- PARSER_GROUPING_RULE_CLASS.put("importTypeDef", TypeImport.class);
- PARSER_GROUPING_RULE_CLASS.put("protocolRefDef", ProtocolReference.class);
- PARSER_GROUPING_RULE_CLASS.put("parameter", Parameter.class);
- PARSER_GROUPING_RULE_CLASS.put("inlineProtocolDef", Protocol.class);
- PARSER_GROUPING_RULE_CLASS.put("declarationName", String.class);
- PARSER_GROUPING_RULE_CLASS.put("labelName", String.class);
- PARSER_GROUPING_RULE_CLASS.put("dataTypeDef", DataType.class);
- PARSER_GROUPING_RULE_CLASS.put("recursionDef", Recursion.class);
- PARSER_GROUPING_RULE_CLASS.put("parameterDef", ParameterDefinition.class);
- PARSER_GROUPING_RULE_CLASS.put("introducesDef", Introduces.class);
- PARSER_GROUPING_RULE_CLASS.put("directedChoiceDef", DirectedChoice.class);
- PARSER_GROUPING_RULE_CLASS.put("onMessageDef", OnMessage.class);
-
- // When a particular class has multiple properties of the
- // same type, then a preceding token must be used to
- // determine which property to set. This map provides the
- // mapping between the property name and the token.
- PROPERTY_TOKENS.put("interactionDef:fromRole", "from");
- PROPERTY_TOKENS.put("directedChoiceDef:fromRole", "from");
- PROPERTY_TOKENS.put("choiceDef:role", "at");
- PROPERTY_TOKENS.put("interactionDef:toRoles", "to");
- PROPERTY_TOKENS.put("directedChoiceDef:toRoles", "to");
- PROPERTY_TOKENS.put("parameter:boundName", "");
- PROPERTY_TOKENS.put("parameter:localName", ":=");
- PROPERTY_TOKENS.put("dataTypeDef:details", ""); // Needed to make sure property not used by default
- PROPERTY_TOKENS.put("importTypeStatement:format", "");
- PROPERTY_TOKENS.put("importTypeStatement:location", "from");
- PROPERTY_TOKENS.put("importProtocolDef:name", "");
- PROPERTY_TOKENS.put("importProtocolDef:location", "from");
- PROPERTY_TOKENS.put("introducesDef:introducer", "");
- PROPERTY_TOKENS.put("introducesDef:introducedRoles", "introduces");
-
- // Defines the list element base type associated with a
- // property name
- LIST_CLASS.put("imports", ImportList.class);
- LIST_CLASS.put("contents", Activity.class);
- LIST_CLASS.put("roles", Role.class);
- LIST_CLASS.put("introducedRoles", Role.class);
- LIST_CLASS.put("toRoles", Role.class);
- LIST_CLASS.put("typeImports", TypeImport.class);
- LIST_CLASS.put("protocolImports", ProtocolImport.class);
- LIST_CLASS.put("typeReferences", TypeReference.class);
- LIST_CLASS.put("blocks", Block.class);
- LIST_CLASS.put("paths", Block.class);
- LIST_CLASS.put("nestedProtocols", Protocol.class);
- LIST_CLASS.put("onMessages", OnMessage.class);
- LIST_CLASS.put("interrupts", Interrupt.class);
- LIST_CLASS.put("parameters", Parameter.class);
- LIST_CLASS.put("interactions", Interaction.class);
- LIST_CLASS.put("parameterDefinitions", ParameterDefinition.class);
-
- STRING_LITERALS.add("dataTypeDef:details");
- STRING_LITERALS.add("importTypeStatement:location");
- STRING_LITERALS.add("importProtocolDef:location");
- }
-
-
- /**
- * This is the constructor for the protocol tree adapter.
- *
- * @param ap The annotation processor
- * @param journal The journal
- */
- public ProtocolTreeAdaptor(AnnotationProcessor ap, Journal journal) {
- _annotationProcessor = ap;
- _journal = journal;
- }
-
- /**
- * This method returns the protocol model.
- *
- * @return The protocol model
- */
- public ProtocolModel getProtocolModel() {
- return (_model);
- }
-
- /**
- * This method sets the parser.
- *
- * @param parser The parser
- */
- public void setParser(ScribbleProtocolParser parser) {
- _parser = parser;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object create(Token token) {
- Object ret=token;
-
- Class> cls=TOKEN_CLASS.get(token.getText());
-
- LOG.fine("Token class for '"+token.getText()
- +"' is: "+cls);
-
- if (cls != null) {
- try {
- ret = cls.newInstance();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- if (ret == token && token.getType() != ScribbleProtocolParser.ID) {
- LOG.fine("Set current token="+token);
- _currentToken = token;
- }
-
- // Check if positional information should be set
- adjustLocationInfo(ret, token);
-
- return (ret);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object dupNode(Object arg0) {
- LOG.finest("DUPNODE "+arg0);
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getChildIndex(Object arg0) {
- LOG.finest("GET CHILD INDEX "+arg0);
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getParent(Object arg0) {
- LOG.finest("GET PARENT "+arg0);
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public Token getToken(Object arg0) {
- LOG.finest("GET TOKEN "+arg0);
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getTokenStartIndex(Object arg0) {
- LOG.finest("GET TOKEN START INDEX "+arg0);
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getTokenStopIndex(Object arg0) {
- LOG.finest("GET TOKEN STOP INDEX "+arg0);
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setChildIndex(Object arg0, int arg1) {
- LOG.finest("SET CHILD INDEX "+arg0+" "+arg1);
- }
-
- /**
- * {@inheritDoc}
- */
- public void replaceChildren(Object arg0, int arg1, int arg2, Object arg3) {
- LOG.finest("REPLACE CHILD "+arg0+" "+arg1+" "+arg2+" "+arg3);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setParent(Object arg0, Object arg1) {
- LOG.finest("SET PARENT "+arg0+" "+arg1);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setTokenBoundaries(Object arg0, Token arg1, Token arg2) {
- LOG.finest("SET TOKEN BOUNDARIES "+arg0+" "+arg1+" "+arg2);
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void addChild(Object parent, Object child) {
- boolean added=false;
-
- LOG.fine("Add child: parent="+parent+" child="+child);
-
- // Associate annotations with the protocol model
- if ((parent instanceof ProtocolModel || parent instanceof Protocol)
- && child instanceof Token && ((Token)child).getType()
- == ScribbleProtocolParser.ANNOTATION) {
-
- // Add the annotation to a temporary location associated
- // with the model, until the real target model object is
- // identified
- java.util.List annotations=(java.util.List)
- ((ModelObject)parent).getProperties().get(ANNOTATIONS);
-
- if (annotations == null) {
- annotations = new java.util.Vector();
- ((ModelObject)parent).getProperties().put(ANNOTATIONS, annotations);
- }
-
- String annotation=((Token)child).getText();
- annotation = annotation.substring(2, annotation.length()-2);
-
- annotations.add(annotation);
-
- return;
- }
-
- // Check if child is a list
- if (isNil(child)) {
- java.util.List