[jboss-svn-commits] JBL Code SVN: r10101 - labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 9 15:32:15 EST 2007


Author: mark.little at jboss.com
Date: 2007-03-09 15:32:15 -0500 (Fri, 09 Mar 2007)
New Revision: 10101

Added:
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/StateUnitTest.java
Log:
http://jira.jboss.com/jira/browse/JBESB-349

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/RegistryUtilUnitTest.java	2007-03-09 20:32:15 UTC (rev 10101)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.listeners;
+
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.services.registry.RegistryException;
+
+import junit.framework.TestCase;
+
+public class RegistryUtilUnitTest extends TestCase
+{
+	public void testRegistryUtil () throws Exception
+	{
+		RegistryUtil.getEprManager();
+		HTTPEpr epr = new HTTPEpr("http://foo.bar");
+		ConfigTree tree = new ConfigTree("test");
+		
+		tree.setAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG, "eprmanager");
+		tree.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, "test");
+		
+		RegistryUtil.register(tree, epr);
+		RegistryUtil.unregister("eprmanager", "test", epr);
+		
+		boolean exception = false;
+		
+		try
+		{
+			// case difference is deliberate!
+			
+			RegistryUtil.getEprs("eprmanager", "test");
+		}
+		catch (RegistryException ex)
+		{
+			exception = true;
+		}
+		
+		if (!exception)
+			fail();
+		
+		RegistryUtil.register(tree, epr);
+		
+		try
+		{
+			// case difference is deliberate!
+			
+			RegistryUtil.getEprs("eprManager", "test");
+		}
+		catch (RegistryException ex)
+		{
+			fail();
+		}
+		
+		RegistryUtil.unregister("eprmanager", "test", epr);
+		
+		exception = false;
+		
+		try
+		{
+			// case difference is deliberate!
+			
+			RegistryUtil.getEprs("foobar", "test");
+		}
+		catch (RegistryException ex)
+		{
+			exception = true;
+		}
+		
+		if (!exception)
+			fail();
+		
+		tree.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, "");
+		
+		try
+		{
+			RegistryUtil.register(tree, epr);
+			
+			fail();
+		}
+		catch (RegistryException ex)
+		{
+		}
+	}
+	
+}

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/StateUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/StateUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/StateUnitTest.java	2007-03-09 20:32:15 UTC (rev 10101)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.listeners;
+
+import junit.framework.TestCase;
+
+public class StateUnitTest extends TestCase
+{
+	public void testState () throws Exception
+	{
+		State s = State.Uninitialised;
+		
+		if (!s.isGettingReady())
+			fail();
+		
+		s = State.Shutting_down;
+		
+		if (s.isGettingReady())
+			fail();
+	}
+	
+}




More information about the jboss-svn-commits mailing list