[overlord-commits] Overlord SVN: r108 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Thu Jul 3 06:13:24 EDT 2008


Author: objectiser
Date: 2008-07-03 06:13:24 -0400 (Thu, 03 Jul 2008)
New Revision: 108

Added:
   cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java
Log:
Validation unit tests for RetrieveSessionAction.

Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java	2008-07-03 10:13:24 UTC (rev 108)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.tools.overlord.jbossesb.model.actions;
+
+import junit.framework.TestCase;
+
+public class RetrieveSessionActionTest extends TestCase {
+
+	public void testValidateFirstAction() {
+		TestESBService service=new TestESBService();
+
+		java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+		props.put("identities", "");
+				
+		org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+		
+		UnsupportedAction unsupported=new UnsupportedAction(service, null);
+		
+		RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
+		
+		service.getActions().add(action);
+		service.getActions().add(unsupported);
+		
+		TestModelListener l=new TestModelListener();
+		
+		action.validate(l);
+		
+		if (l.isValid() == false) {
+			fail(l.invalidMessage());
+		}
+	}
+
+	public void testValidateNotFirstAction() {
+		TestESBService service=new TestESBService();
+
+		java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+		props.put("identities", "");
+				
+		org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+		
+		UnsupportedAction unsupported=new UnsupportedAction(service, null);
+		
+		RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
+		
+		service.getActions().add(unsupported);
+		service.getActions().add(action);
+		
+		TestModelListener l=new TestModelListener();
+		
+		l.addExpectedError(org.scribble.util.MessageUtil.format(
+						java.util.PropertyResourceBundle.getBundle(
+						"org.jboss.tools.overlord.jbossesb.model.actions.Messages"),
+							"_MUST_BE_FIRST_ACTION",
+							new String[]{"RetrieveSession"}));
+		
+		action.validate(l);
+		
+		if (l.isValid() == false) {
+			fail(l.invalidMessage());
+		}
+	}
+	
+	public void testValidateNoIdentities() {
+		TestESBService service=new TestESBService();
+
+		java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+		
+		org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+		
+		RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
+		
+		service.getActions().add(action);
+		
+		TestModelListener l=new TestModelListener();
+		
+		l.addExpectedError(org.scribble.util.MessageUtil.format(
+				java.util.PropertyResourceBundle.getBundle(
+						"org.jboss.tools.overlord.jbossesb.model.Messages"),
+							"_NOT_SPECIFIED_PROPERTY",
+							new String[]{"identities"}));
+		
+		action.validate(l);
+		
+		if (l.isValid() == false) {
+			fail(l.invalidMessage());
+		}
+	}
+}




More information about the overlord-commits mailing list