[savara-commits] savara SVN: r313 - in trunk/tools: plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 7 11:25:08 EDT 2010


Author: objectiser
Date: 2010-07-07 11:25:08 -0400 (Wed, 07 Jul 2010)
New Revision: 313

Modified:
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java
   trunk/tools/tests/org.jboss.savara.protocol.contract.tests/src/java/org/jboss/savara/protocol/contract/tests/ContractGeneratorTest.java
Log:
Change so that local model supplied - does not require contract generator to perform projection.

Modified: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java	2010-07-07 14:41:13 UTC (rev 312)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java	2010-07-07 15:25:08 UTC (rev 313)
@@ -19,25 +19,21 @@
 
 import org.jboss.savara.contract.model.Contract;
 import org.scribble.conversation.model.Conversation;
-import org.scribble.model.Role;
 
 /**
- * This interface represents the service that generates a contract
- * from a protocol defining the behaviour of multiple interacting roles.
+ * This interface represents the capability that generates a contract
+ * from a protocol associated with a particular interacting role.
  * 
  */
 public interface ContractGenerator {
 
 	/**
-	 * This method generates a contract associated with a supplied protocol
-	 * and optional role. If the protocol represents a local model, then
-	 * the role will be derived from the local model. If the protocol represents
-	 * a global model, then a role must be supplied.
+	 * This method generates a contract associated with a supplied located
+	 * protocol.
 	 * 
 	 * @param cm The protocol
-	 * @param role The optional role
 	 * @return The contract
 	 */
-	public Contract generate(Conversation cm, Role role) throws IllegalArgumentException;
+	public Contract generate(Conversation cm) throws IllegalArgumentException;
 	
 }

Modified: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties	2010-07-07 14:41:13 UTC (rev 312)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties	2010-07-07 15:25:08 UTC (rev 313)
@@ -16,5 +16,5 @@
 # * MA  02110-1301, USA.
 # */
 
-SAVARAPC-00001=Conversation must be supplied
-SAVARAPC-00002=Role has not been defined
+SAVARAPC-00001=Protocol must be supplied
+SAVARAPC-00002=Contract generation requires a protocol that represents the local behaviour associated with a particular role

Modified: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java	2010-07-07 14:41:13 UTC (rev 312)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java	2010-07-07 15:25:08 UTC (rev 313)
@@ -32,16 +32,13 @@
 public class ContractGeneratorImpl implements ContractGenerator {
 
 	/**
-	 * This method generates a contract associated with a supplied protocol
-	 * and optional role. If the protocol represents a local model, then
-	 * the role will be derived from the local model. If the protocol represents
-	 * a global model, then a role must be supplied.
+	 * This method generates a contract associated with a supplied located
+	 * protocol.
 	 * 
 	 * @param cm The protocol
-	 * @param role The optional role
 	 * @return The contract
 	 */
-	public Contract generate(Conversation cm, Role role) throws IllegalArgumentException {
+	public Contract generate(Conversation cm) throws IllegalArgumentException {
 		
 		// Check parameters
 		if (cm == null) {
@@ -50,8 +47,7 @@
 						"org.jboss.savara.protocol.contract.Messages").
 							getString("SAVARAPC-00001"), (Object)null));
 			
-		} else if ((cm.getLocatedName() == null || cm.getLocatedName().getRole() == null) &&
-									role == null) {
+		} else if (cm.getLocatedName() == null || cm.getLocatedName().getRole() == null) {
 			throw new IllegalArgumentException(MessageFormat.format(
 					java.util.PropertyResourceBundle.getBundle(
 						"org.jboss.savara.protocol.contract.Messages").

Modified: trunk/tools/tests/org.jboss.savara.protocol.contract.tests/src/java/org/jboss/savara/protocol/contract/tests/ContractGeneratorTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.protocol.contract.tests/src/java/org/jboss/savara/protocol/contract/tests/ContractGeneratorTest.java	2010-07-07 14:41:13 UTC (rev 312)
+++ trunk/tools/tests/org.jboss.savara.protocol.contract.tests/src/java/org/jboss/savara/protocol/contract/tests/ContractGeneratorTest.java	2010-07-07 15:25:08 UTC (rev 313)
@@ -17,9 +17,8 @@
 		
 		try {
 			Conversation conv=null;
-			Role role=new Role();
 			
-			generator.generate(conv, role);
+			generator.generate(conv);
 			
 			fail("Should have thrown IllegalArgumentException");
 			
@@ -29,18 +28,17 @@
 	}
 
 	@org.junit.Test
-	public void testGenerateRoleNull() {
+	public void testGenerateProtocolNotLocated() {
 		
 		ContractGenerator generator=ContractGeneratorFactory.getContractGenerator();
 		
 		try {
 			Conversation conv=new Conversation();
-			conv.setLocatedName(new LocatedName());
+			LocatedName ln=new LocatedName();
+			conv.setLocatedName(ln);
 			
-			Role role=null;
+			generator.generate(conv);
 			
-			generator.generate(conv, role);
-			
 			fail("Should have thrown IllegalArgumentException");
 			
 		} catch(IllegalArgumentException iae) {
@@ -49,7 +47,7 @@
 	}
 
 	@org.junit.Test
-	public void testGenerateConversationAndRoleNotNull1() {
+	public void testGenerateConversationAndRoleNotNull2() {
 		
 		ContractGenerator generator=ContractGeneratorFactory.getContractGenerator();
 		
@@ -59,31 +57,10 @@
 			ln.setRole(new Role());
 			conv.setLocatedName(ln);
 			
-			Role role=null;
+			generator.generate(conv);
 			
-			generator.generate(conv, role);
-			
 		} catch(IllegalArgumentException iae) {			
 			fail("Should NOT have thrown IllegalArgumentException");
 		}
 	}
-
-	@org.junit.Test
-	public void testGenerateConversationAndRoleNotNull2() {
-		
-		ContractGenerator generator=ContractGeneratorFactory.getContractGenerator();
-		
-		try {
-			Conversation conv=new Conversation();
-			LocatedName ln=new LocatedName();
-			conv.setLocatedName(ln);
-			
-			Role role=new Role();
-			
-			generator.generate(conv, role);
-			
-		} catch(IllegalArgumentException iae) {			
-			fail("Should NOT have thrown IllegalArgumentException");
-		}
-	}
 }



More information about the savara-commits mailing list