[jboss-svn-commits] JBL Code SVN: r12058 - in labs/jbossesb/workspace/dbevenius: qa/junit/src/org/jboss/soa/esb/actions and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue May 22 04:03:59 EDT 2007
Author: beve
Date: 2007-05-22 04:03:59 -0400 (Tue, 22 May 2007)
New Revision: 12058
Removed:
labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.java
labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.xml
Modified:
labs/jbossesb/workspace/dbevenius/integration-build.xml
Log:
Merge from main 12031:12057
Modified: labs/jbossesb/workspace/dbevenius/integration-build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/integration-build.xml 2007-05-22 07:04:47 UTC (rev 12057)
+++ labs/jbossesb/workspace/dbevenius/integration-build.xml 2007-05-22 08:03:59 UTC (rev 12058)
@@ -4,7 +4,7 @@
<target name="integration" description="Run Continuous Integration." depends="clean-jms, clean">
<ant dir="product">
<target name="integration"/>
- <target name="dist"/>
+ <target name="artifacts"/>
<target name="instr-report"/>
</ant>
<ant dir="qa" target="ci-test"/>
Deleted: labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.java 2007-05-22 07:04:47 UTC (rev 12057)
+++ labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.java 2007-05-22 08:03:59 UTC (rev 12058)
@@ -1,277 +0,0 @@
-/*
- * 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.actions;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.InputStream;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.MalformedEPRException;
-import org.jboss.soa.esb.couriers.Courier;
-import org.jboss.soa.esb.couriers.CourierException;
-import org.jboss.soa.esb.couriers.CourierFactory;
-import org.jboss.soa.esb.listeners.StandAloneBootStrapper;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.services.registry.Registry;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.RegistryFactory;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Testing the Content Based Router.
- *
- * @author <a href="mailto:kurt.stam at redhat.com">Kurt Stam</a>
- * @author <a href="mailto:schifest at heuristica.com.ar">Esteban</a>
- * @since Version 4.0
- *
- */
-public class ContentBasedRouterTest
-{
- private static Logger logger = Logger.getLogger(ContentBasedRouterTest.class);
-
- private static StandAloneBootStrapper _boot = null;
-
- private static String mDbDriver;
-
- private static String mDbUrl;
-
- private static String mDbUsername;
-
- private static String mDbPassword;
-
- private static final String SERVICE_CATEGORY_NAME = "MessageRouting";
-
- private static final String SERVICE_NAME = "ContentBasedRoutingService";
-
- /**
- * Testing the Content Based Router.
- */
- @Test
- public void sendMessages()
- {
- try
- {
- sendMessage("First Message");
- // The second time the rulesEngine should be primed.
- sendMessage("Second Message");
- }
- catch (RegistryException re)
- {
- re.printStackTrace();
- assertTrue(false);
- }
- catch (CourierException ce)
- {
- ce.printStackTrace();
- assertTrue(false);
- }
- catch (MalformedEPRException me)
- {
- me.printStackTrace();
- assertTrue(false);
- }
- }
-
- /**
- * Sends a message to the CbrJmsQueueListener.
- *
- * @param body -
- * a String containing the body of the message.
- * @throws RegistryException
- * @throws CourierException
- * @throws MalformedEPRException
- */
-
- private static void sendMessage(String body) throws RegistryException, CourierException, MalformedEPRException
- {
- Message msg = MessageFactory.getInstance().getMessage();
- msg.getBody().setByteArray(body.getBytes());
-
- Registry registry = RegistryFactory.getRegistry();
- Collection<EPR> eprs = registry.findEPRs(SERVICE_CATEGORY_NAME,
- SERVICE_NAME);
- for (Iterator<EPR> eprIterator = eprs.iterator(); eprIterator.hasNext();)
- {
- // Just use the first EPR in the list.
- EPR epr = eprIterator.next();
- Courier courier = CourierFactory.getCourier(epr);
- courier.deliver(msg);
- break;
- }
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(ContentBasedRouterTest.class);
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- try
- {
- DOMConfigurator.configure(TestEnvironmentUtil.getUserDir("product",
- "../product")
- + "etc/test/resources/log4j.xml");
- TestEnvironmentUtil.setESBPropertiesFileToUse("product",
- "../product");
- // Set the juddi properties file in System so juddi will pick it up
- // later and use the test values.
- String juddiPropertiesFile = "/org/jboss/soa/esb/services/registry/juddi-qatest.properties";
- System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
- // Read this properties file to get the db connection string
- Properties props = new Properties();
- InputStream inStream = Class.class
- .getResourceAsStream(juddiPropertiesFile);
- props.load(inStream);
- mDbDriver = props.getProperty("juddi.jdbcDriver");
- mDbUrl = props.getProperty("juddi.jdbcUrl");
- mDbUsername = props.getProperty("juddi.jdbcUsername");
- mDbPassword = props.getProperty("juddi.jdbcPassword");
-
- String database = "not tested yet";
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
- {
- database = "hsqldb";
- // Bring up hsql on default port 9001
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir(
- "product", "../product")
- + "build/hsqltestdb", "juddi");
- }
- else if ("com.mysql.jdbc.Driver".equals(mDbDriver))
- {
- database = "mysql";
- } // add and test your own database..
-
- // Get the registry-schema create scripts
- String sqlDir = TestEnvironmentUtil.getUserDir("product",
- "../product")
- + "install/jUDDI-registry/sql/" + database + "/";
- // Drop what is there now, if exists. We want to start fresh.
- String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir
- + "drop_database.sql"));
- String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir
- + "create_database.sql"));
- String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir
- + "insert_publishers.sql"));
-
- try
- {
- Class.forName(mDbDriver);
- }
- catch (Exception e)
- {
- System.out.println("ERROR: failed to load " + database
- + " JDBC driver.");
- e.printStackTrace();
- return;
- }
- java.sql.Connection con = DriverManager.getConnection(mDbUrl,
- mDbUsername, mDbPassword);
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the juddi-schema");
- stmnt.execute(sqlCreateCmd);
- System.out.println("Adding the jbossesb publisher");
- stmnt.execute(sqlInsertPubCmd);
-
- // Now we can bring up the ContentBasedRouter
- String deploymentConfigFile = TestEnvironmentUtil.getUserDir("qa")
- + "junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.xml";
- String validationFileName = TestEnvironmentUtil.getUserDir(
- "product", "../product")
- + "etc/schemas/xml/jbossesb-1.0.1.xsd";
- // Make sure this file exists
- File validationFile = new File(validationFileName);
- if (!validationFile.exists())
- {
- System.err.println("Validation file "
- + validationFile.getAbsolutePath() + " does not exist");
- assertTrue(false);
- }
- _boot = new StandAloneBootStrapper(deploymentConfigFile,
- validationFileName);
-
- logger
- .info("Testing to see if we can instantiate and start ListenerManager");
- }
- catch (Throwable e)
- {
- e.printStackTrace();
- System.out
- .println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
-
- }
-
- /**
- * Shutdown the database
- *
- * @throws Exception
- */
- @AfterClass
- public static void runAfterAllTests() throws Exception
- {
- Thread.sleep(2000);
- // Increase Sleep for debugging
- _boot.requestEnd();
- // Give the esb time to finish
- Thread.sleep(2000);
- // Cleaning up the generated files
- String listenerConfigFile = TestEnvironmentUtil.getUserDir("qa")
- + "junit/src/org/jboss/soa/esb/actions/jbossesb-listener.xml";
- File listenerFile = new File(listenerConfigFile);
- if (listenerFile.exists())
- listenerFile.delete();
- String gatewayConfigFile = TestEnvironmentUtil.getUserDir("qa")
- + "junit/src/org/jboss/soa/esb/actions/jbossesb-gateway.xml";
- File gatewayFile = new File(gatewayConfigFile);
- if (gatewayFile.exists())
- gatewayFile.delete();
-
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
- {
- HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
- }
- }
-
-}
Deleted: labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.xml 2007-05-22 07:04:47 UTC (rev 12057)
+++ labs/jbossesb/workspace/dbevenius/qa/junit/src/org/jboss/soa/esb/actions/ContentBasedRouterTest.xml 2007-05-22 08:03:59 UTC (rev 12058)
@@ -1,59 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
-parameterReloadSecs="10">
-
- <!-- for activemq use:
- jndi-context-factory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
- jndi-URL="tcp://localhost:61616" -->
-
- <!-- for mq series use:
- jndi-context-factory="com.ibm.mq.jms.context.WMQInitialContextFactory"
- jndi-URL="dev37:1414/SYSTEM.DEF.SVRCONN" -->
-
- <!-- for jbossmq use:
- jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
- jndi-URL="localhost" -->
-
-
- <providers>
- <jms-provider name="localhost"
- connection-factory="ConnectionFactory"
- jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
- jndi-URL="localhost" >
-
- <jms-bus busid="QueueA">
- <jms-message-filter
- dest-type="QUEUE"
- dest-name="queue/A"
- selector="service='CBRouting-SerializableOrXml'"
- />
- </jms-bus>
- </jms-provider>
- </providers>
- <services>
- <service
- category="MessageRouting"
- name="ContentBasedRoutingService"
- description="CBR Listener">
- <listeners>
- <jms-listener name="XPathContentBasedRouter"
- busidref="QueueA"
- maxThreads="1">
- </jms-listener>
- </listeners>
- <actions>
- <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="Hello Content Based Router" />
- </action>
- <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
- <property name="ruleSet" value="JBossESBRules.drl"/>
- <property name="ruleReload" value="true"/>
- <property name="destinations">
- <route-to destination-name="xml-destination-nodelivery" service-category="category01" service-name="jbossesbtest1" />
- <route-to destination-name="serialized-destination-nodelivery" service-category="category02" service-name="jbossesbtest2" />
- </property>
- </action>
- </actions>
- </service>
- </services>
-</jbossesb>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list