[jboss-svn-commits] JBL Code SVN: r10111 - 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
Sat Mar 10 10:13:50 EST 2007


Author: mark.little at jboss.com
Date: 2007-03-10 10:13:50 -0500 (Sat, 10 Mar 2007)
New Revision: 10111

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

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/LifecycleUtilUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/LifecycleUtilUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/LifecycleUtilUnitTest.java	2007-03-10 15:13:50 UTC (rev 10111)
@@ -0,0 +1,78 @@
+/*
+ * 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 java.io.File;
+import java.io.FileInputStream;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
+
+import junit.framework.TestCase;
+
+public class LifecycleUtilUnitTest extends TestCase
+{
+	public void testLifecycleUtil () throws Exception
+	{
+		boolean exception = false;
+		
+		try
+		{
+			LifecycleUtil.getListeners("foobar");
+		}
+		catch (IllegalArgumentException ex)
+		{
+			exception = true;
+		}
+		
+		if (!exception)
+			fail();
+		
+		try
+		{
+			String configFile = getClass().getResource("listenerFile.xml").getFile();
+			FileInputStream input = new FileInputStream(configFile);
+			byte[] data = new byte[input.available()];
+			
+			input.read(data);
+
+			ParamRepositoryFactory.getInstance().add("test", new String(data));
+			
+			LifecycleUtil.getListeners("test");
+		}
+		catch (IllegalArgumentException ex)
+		{
+			ex.printStackTrace();
+			
+			fail();
+		}
+		
+		ConfigTree test = new ConfigTree("test");
+		
+		test.setAttribute(ListenerTagNames.GATEWAY_CLASS_TAG, "org.jboss.soa.esb.listeners.gateway.FileGatewayListener");
+	
+		LifecycleUtil.getGateways(test);
+		LifecycleUtil.getGateways("test");
+	}
+	
+}

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/StandAloneBootStrapperUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/StandAloneBootStrapperUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/StandAloneBootStrapperUnitTest.java	2007-03-10 15:13:50 UTC (rev 10111)
@@ -0,0 +1,88 @@
+/*
+ * 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.ConfigurationException;
+
+import junit.framework.TestCase;
+
+public class StandAloneBootStrapperUnitTest extends TestCase
+{
+	public void testBoostrapper () throws Exception
+	{
+		String[] args = new String[0];
+		
+		try
+		{
+			StandAloneBootStrapper.main(args);
+			fail();
+		}
+		catch (Exception ex)
+		{
+		}
+		
+		args = new String[2];
+		
+		args[0] = "gatewayExample.xml";
+		args[1] = "5";
+		
+		try
+		{
+			StandAloneBootStrapper.main(args);
+			
+			fail();
+		}
+		catch (ConfigurationException ex)
+		{
+		}
+		
+		args[1] = "abc";
+		
+		try
+		{
+			StandAloneBootStrapper.main(args);			
+			fail();
+		}
+		catch (Exception ex)
+		{
+		}
+		
+		args[0] = "install/conf/jbossesb.xml";
+		args[1] = "5";
+		
+		try
+		{
+			StandAloneBootStrapper.main(args);		
+			fail();
+		}
+		catch (ConfigurationException ex)
+		{
+		}
+
+		StandAloneBootStrapper bootstrapper = new StandAloneBootStrapper("install/conf/jbossesb.xml", "etc/schemas/xml/jbossesb-1.0.xsd");
+		
+		bootstrapper.requestEnd();
+		bootstrapper.runAfter();
+	}
+	
+}




More information about the jboss-svn-commits mailing list