[jboss-svn-commits] JBL Code SVN: r16082 - in labs/jbossesb/workspace/dbevenius/redeliver: product/docs and 17 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 26 07:44:44 EDT 2007
Author: beve
Date: 2007-10-26 07:44:43 -0400 (Fri, 26 Oct 2007)
New Revision: 16082
Added:
labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingConstants.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/resources/JBossESBRulesNoMatch.drl
Removed:
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml
Modified:
labs/jbossesb/workspace/dbevenius/redeliver/
labs/jbossesb/workspace/dbevenius/redeliver/product/docs/AdministrationGuide.odt
labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java
labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java
labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/build.xml
labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/readme.txt
labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/CheckMessageStoreAction.java
labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/test/SendEsbMessage.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessagePersister.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessageRedeliverer.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/resources/message-store-ds.xml
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/MessageFilter.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java
labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java
labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/InvokerAction.java
labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/OperationsCollectorAction.java
labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerAction.java
labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/FilerAction.java
Log:
Merge from main
Property changes on: labs/jbossesb/workspace/dbevenius/redeliver
___________________________________________________________________
Name: svnmerge-integrated
- /labs/jbossesb/trunk:1-16066
+ /labs/jbossesb/trunk:1-16081
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/docs/AdministrationGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -1,5 +1,6 @@
package org.jboss.soa.esb.addressing.util;
+import org.jboss.soa.esb.addressing.Call;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.message.Message;
@@ -30,35 +31,38 @@
public class DefaultFaultTo
{
- /**
- * Get the FaultTo EPR on this address. If it is not set, then try to return
- * the From EPR. If that is not set, then return null.
- *
- * @param message
- * the message to work on.
- * @return the FaultTo EPR, or ReplyTo, or the From EPR, or null, in that order.
- */
- public static final EPR getFaultToAddress (Message message)
+ /**
+ * Initialise the message as a reply to the specified call details.
+ * @param message The reply message.
+ * @param callDetails The call details used to generate the reply.
+ * @return true if the message was initialised, false otherwise.
+ */
+ public static boolean initialiseReply(final Message message, final Call callDetails)
{
- if (message == null)
- return null;
-
- try
+ return DefaultReplyTo.initialiseReply(message, callDetails, getFaultTo(callDetails)) ;
+ }
+
+ /**
+ * Get the appropriate faultTo address..
+ * @param callDetails The call details used to generate the reply.
+ * @return The faultTo address or null if none set.
+ */
+ static EPR getFaultTo(final Call callDetails)
+ {
+ if (callDetails == null)
{
- if (message.getHeader().getCall().getFaultTo() != null)
- return message.getHeader().getCall().getFaultTo();
- else if (message.getHeader().getCall().getReplyTo() != null)
- return message.getHeader().getCall().getReplyTo();
- else
- return message.getHeader().getCall().getFrom();
+ return null ;
}
- catch (final NullPointerException e)
+
+ final EPR faultTo = callDetails.getFaultTo() ;
+ if (faultTo != null)
{
- // OK, it's not set... return null...
+ return faultTo ;
}
-
- return null;
+ else
+ {
+ return DefaultReplyTo.getReplyTo(callDetails) ;
+ }
}
-
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -9,6 +9,7 @@
import org.jboss.internal.soa.esb.addressing.eprs.DefaultJdbcReplyToEpr;
import org.jboss.internal.soa.esb.addressing.eprs.DefaultJmsReplyToEpr;
import org.jboss.internal.soa.esb.addressing.eprs.DefaultSftpReplyToEpr;
+import org.jboss.soa.esb.addressing.Call;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.addressing.eprs.FTPEpr;
@@ -95,31 +96,62 @@
}
/**
- * Get the ReplyTo EPR on this address. If it is not set, then try to return
- * the From EPR. If that is not set, then return null.
- *
- * @param message
- * the message to work on.
- * @return the ReplyTo EPR, or the From EPR, or null, in that order.
- */
-
- public static final EPR getReplyToAddress (Message message)
+ * Initialise the message as a reply to the specified call details.
+ * @param message The reply message.
+ * @param callDetails The call details used to generate the reply.
+ * @return true if the message was initialised, false otherwise.
+ */
+ public static boolean initialiseReply(final Message message, final Call callDetails)
{
- if (message == null)
- return null;
-
- try
+ return initialiseReply(message, callDetails, getReplyTo(callDetails)) ;
+ }
+
+ /**
+ * Get the appropriate replyTo address..
+ * @param callDetails The call details used to generate the reply.
+ * @return The replyTo address or null if none set.
+ */
+ static EPR getReplyTo(final Call callDetails)
+ {
+ if (callDetails == null)
{
- if (message.getHeader().getCall().getReplyTo() != null)
- return message.getHeader().getCall().getReplyTo();
- else
- return message.getHeader().getCall().getFrom();
+ return null ;
}
- catch (final NullPointerException e)
+
+ final EPR replyTo = callDetails.getReplyTo() ;
+ if (replyTo != null)
{
- // OK, it's not set... return null...
+ return replyTo ;
}
-
- return null;
+ else
+ {
+ return callDetails.getFrom() ;
+ }
}
+
+ /**
+ * Initialise the message as a reply to the specified call details.
+ * @param message The reply message.
+ * @param callDetails The call details used to generate the reply.
+ * @param toEPR The target EPR for the message.
+ * @return true if the message was initialised, false otherwise.
+ */
+ static boolean initialiseReply(final Message message, final Call callDetails,
+ final EPR toEPR)
+ {
+ if ((message == null) || (callDetails == null) || (toEPR == null))
+ {
+ return false ;
+ }
+
+ final Call replyCallDetails = message.getHeader().getCall() ;
+ replyCallDetails.setTo(toEPR) ;
+ replyCallDetails.setFrom(callDetails.getTo()) ;
+ replyCallDetails.setReplyTo(null) ;
+ replyCallDetails.setFaultTo(null) ;
+ replyCallDetails.setRelatesTo(callDetails.getMessageID()) ;
+ replyCallDetails.setMessageID(null) ;
+
+ return true ;
+ }
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -61,8 +61,8 @@
*/
public class ServiceInvoker {
- private static final String INTERNAL_SERVICE_CATEGORY = "JBossESB-Internal";
- private static final String DEAD_LETTER_SERVICE_NAME = "DeadLetterService";
+ public static final String INTERNAL_SERVICE_CATEGORY = "JBossESB-Internal";
+ public static final String DEAD_LETTER_SERVICE_NAME = "DeadLetterService";
public static final String DELIVER_TO = "org.jboss.soa.esb.deliver.to";
/**
@@ -96,7 +96,7 @@
/**
* Dead letter Service
*/
- private static final Service dlqService = new Service(INTERNAL_SERVICE_CATEGORY, DEAD_LETTER_SERVICE_NAME);
+ public static final Service dlqService = new Service(INTERNAL_SERVICE_CATEGORY, DEAD_LETTER_SERVICE_NAME);
/**
* Public constructor.
*
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingConstants.java (from rev 16081, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingConstants.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingConstants.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingConstants.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,38 @@
+/*
+ * 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.message;
+
+/**
+ * Action Processing Constants.
+ */
+public class ActionProcessingConstants
+{
+ /**
+ * Used to store the call details of the received message when a response cannot be sent.
+ */
+ public static final String PROPERTY_FAILURE_CALL_DETAILS = "org.jboss.soa.esb.failure.call" ;
+ /**
+ * Used to store the response type when the response cannot be sent.
+ */
+ public static final String PROPERTY_FAILURE_RESPONSE_TYPE = "org.jboss.soa.esb.failure.responseType" ;
+}
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -43,7 +43,8 @@
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.message.errors.Factory;
import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.message.Properties;
+import org.jboss.soa.esb.services.persistence.MessageStore;
import org.jboss.soa.esb.util.ClassUtil;
import java.util.ArrayList;
@@ -121,7 +122,7 @@
{
LOGGER.debug("Registering action class " + actionClassTag);
}
- final Class actionClass;
+ final Class<?> actionClass;
try
{
actionClass = ClassUtil.forName(actionClassTag, getClass());
@@ -246,10 +247,10 @@
*/
public boolean process(final Message message)
{
- final EPR faultToAddress = DefaultFaultTo.getFaultToAddress(message);
long start = System.nanoTime();
serviceMessageCounter.incrementTotalCount();
- final EPR fromAddress = message.getHeader().getCall().getTo() ;
+ final Call callDetails = new Call() ;
+ callDetails.copy(message.getHeader().getCall()) ;
if (active.get())
{
@@ -260,7 +261,6 @@
final int numProcessors = processors.length;
final Message[] messages = new Message[numProcessors];
- final EPR replyToAddress = DefaultReplyTo.getReplyToAddress(message);
Message currentMessage = message;
@@ -302,14 +302,14 @@
if (fault.getFaultMessage() == null)
{
- faultTo(fromAddress, faultToAddress, Factory.createErrorMessage(Factory.PROCESSING_ERROR, message, ex));
+ faultTo(callDetails, Factory.createErrorMessage(Factory.PROCESSING_ERROR, message, ex));
}
else
- faultTo(fromAddress, faultToAddress, fault.getFaultMessage());
+ faultTo(callDetails, fault.getFaultMessage());
}
else if (!throwRuntime)
{
- faultTo(fromAddress, faultToAddress, Factory.createErrorMessage(Factory.UNEXPECTED_ERROR, message, ex));
+ faultTo(callDetails, Factory.createErrorMessage(Factory.UNEXPECTED_ERROR, message, ex));
}
long procTime = System.nanoTime() - start;
@@ -329,9 +329,9 @@
}
// Reply...
- if ((currentMessage != null) && (replyToAddress != null))
+ if (currentMessage != null)
{
- replyTo(fromAddress, replyToAddress, currentMessage);
+ replyTo(callDetails, currentMessage);
}
notifySuccess(messages);
@@ -344,7 +344,7 @@
{
LOGGER.debug("pipeline process disabled for message: "+message.getHeader());
- faultTo(fromAddress, faultToAddress, Factory.createErrorMessage(Factory.NOT_ENABLED, message, null));
+ faultTo(callDetails, Factory.createErrorMessage(Factory.NOT_ENABLED, message, null));
long procTime = System.nanoTime() - start;
DeliveryObservableLogger.getInstance().logMessage(new MessageStatusBean(procTime, message,
MessageStatusBean.MESSAGE_FAILED));
@@ -371,72 +371,79 @@
return transactional ;
}
- /**
+ /**
* Send the reply.
*
- * @param fromAddress
- * the EPR to which the original message was sent.
- * @param replyToAddress
- * the EPR to target if one is not defined in the message.
+ * @param callDetails
+ * the call details for the original request.
* @param message
* the message.
*/
- private void replyTo(EPR fromAddress, EPR replyToAddress, Message message)
+ private void replyTo(final Call callDetails, final Message message)
{
- EPR replyToEPR = DefaultReplyTo.getReplyToAddress(message);
-
- if (replyToEPR != null) {
- replyToAddress = replyToEPR;
- }
-
- if (replyToAddress == null)
+ if (!DefaultReplyTo.initialiseReply(message, callDetails))
{
- LOGGER.warn("No reply to address defined for reply message! "+message.getHeader());
- }
+ LOGGER.warn("No reply to address defined for reply message! " + callDetails);
+ sendToDLQ(callDetails, message, MessageType.reply) ;
+ }
else
{
- final Call call = message.getHeader().getCall() ;
- call.setFrom(fromAddress) ;
- call.setReplyTo(null) ;
- call.setFaultTo(null) ;
-
- messageTo(replyToAddress, message, MessageType.reply);
+ final EPR replyToEPR = message.getHeader().getCall().getTo() ;
+ messageTo(replyToEPR, message, MessageType.reply);
}
}
- /**
+ /**
* Send the fault message to the EPR.
*
- * @param fromAddress
- * the EPR to which the original message was sent.
+ * @param callDetails
+ * the call details for the original request.
* @param faultToAddress
* the EPR to target if one is not set in the message.
* @param message
* the message.
*/
- private void faultTo(EPR fromAddress, EPR faultToAddress, Message message)
+ private void faultTo(final Call callDetails, final Message message)
{
- EPR faultToEPR = DefaultFaultTo.getFaultToAddress(message);
-
- if (faultToEPR != null) {
- faultToAddress = faultToEPR;
- }
-
- if (faultToAddress == null)
+ if (!DefaultFaultTo.initialiseReply(message, callDetails))
{
- LOGGER.warn("No fault address defined for fault message! "+message.getHeader());
- }
+ LOGGER.warn("No fault address defined for fault message! " + callDetails);
+ sendToDLQ(callDetails, message, MessageType.fault) ;
+ }
else
{
- final Call call = message.getHeader().getCall() ;
- call.setFrom(fromAddress) ;
- call.setReplyTo(null) ;
- call.setFaultTo(null) ;
+ final EPR faultToEPR = message.getHeader().getCall().getTo() ;
+ messageTo(faultToEPR, message, MessageType.fault);
+ }
+ }
+
+ /**
+ * Sent the message to the DLQ service.
+ * @param callDetails The original call details.
+ * @param message The response message.
+ * @param messageType The response type.
+ */
+ private void sendToDLQ(final Call callDetails, final Message message,
+ final MessageType messageType)
+ {
+ final Properties properties = message.getProperties() ;
+ properties.setProperty(MessageStore.CLASSIFICATION, MessageStore.CLASSIFICATION_DLQ);
+ properties.setProperty(ActionProcessingConstants.PROPERTY_FAILURE_CALL_DETAILS, callDetails.toString()) ;
+ properties.setProperty(ActionProcessingConstants.PROPERTY_FAILURE_RESPONSE_TYPE, messageType.name()) ;
- messageTo(faultToAddress, message, MessageType.fault);
- }
+ try
+ {
+ final ServiceInvoker serviceInvoker = new ServiceInvoker(ServiceInvoker.dlqService) ;
+
+ serviceInvoker.deliverAsync(message) ;
+ }
+ catch (final MessageDeliverException mde)
+ {
+ LOGGER.warn("Failed to send response failure to DLQ service") ;
+ LOGGER.debug("Failed to send response failure to DLQ service", mde) ;
+ }
}
private static enum MessageType {
@@ -476,7 +483,7 @@
}
}
- /**
+ /**
* Handle the destruction of the pipeline from the specified position.
*
* @param initialPosition
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/build.xml 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/build.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -8,6 +8,10 @@
<!-- Import the base Ant build script... -->
<import file="../conf/base-build.xml"/>
+ <target name="run">
+ <echo>This quickstart no longer supports standalone execution</echo>
+ </target>
+
<target name="runtest" depends="compile"
description="sends a JMS message to queue/quickstart_messagestore_Request_gw">
<echo>Runs Test JMS Sender</echo>
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/readme.txt 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/readme.txt 2007-10-26 11:44:43 UTC (rev 16082)
@@ -21,17 +21,6 @@
Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
and a more detailed descripton of the different ways to run the quickstarts.
-To Run standalone mode:
-=======================
- 1. In a command terminal window in the quickstart folder type
- 'ant deploy-jms-dests'.
- 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
- 3. Open another command terminal window in this folder ("Window2"), type
- 'ant runtest'.
- 4. Switch back to "Window1" to see the output from the ESB
- 5. When finished, interrupt the ESB using Ctrl-C and, in this folder
- ("Window1"), type 'ant undeploy-jms-dests'.
-
To Run '.esb' archive mode:
===========================
1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/CheckMessageStoreAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/CheckMessageStoreAction.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/CheckMessageStoreAction.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -66,8 +66,7 @@
Message message = messageStore.getMessage((URI) originalMessage.getProperties().getProperty(MessageStore.MESSAGE_URI));
//Print out the content of the message
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
- System.out.println("Body (from the stored message): "
- + new String(message.getBody().getByteArray()));
+ System.out.println("Body (from the stored message): " + message.getBody().get()) ;
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
}
catch (final MessageStoreException mse)
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/test/SendEsbMessage.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/samples/quickstarts/messagestore/src/org/jboss/soa/esb/samples/quickstart/messagestore/test/SendEsbMessage.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -57,7 +57,7 @@
esbMessage.getHeader().setCall(call);
// set body contents with args[2], and send
- esbMessage.getBody().setByteArray(args[2].getBytes());
+ esbMessage.getBody().add(args[2]);
new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessagePersister.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessagePersister.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessagePersister.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -33,7 +33,6 @@
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.Configurable;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.persistence.MessageStore;
@@ -74,7 +73,7 @@
} catch (MessageStoreException mse) {
log.error("Could not store message.", mse);
}
- return message;
+ return null;
}
/* (non-Javadoc)
* @see org.jboss.soa.esb.actions.ActionLifecycle#initialise()
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessageRedeliverer.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessageRedeliverer.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/java/org/jboss/soa/esb/actions/MessageRedeliverer.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -79,6 +79,6 @@
} catch (MessageStoreException mse) {
log.error("Could not obtain messages.", mse);
}
- return message;
+ return null;
}
}
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/resources/message-store-ds.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/resources/message-store-ds.xml 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbossesb/src/main/resources/message-store-ds.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -3,11 +3,11 @@
<datasources>
<local-tx-datasource>
<jndi-name>JBossESBDS</jndi-name>
- <!-- use for in-process db
- <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}JBossESBDS</connection-url>
- -->
- <!-- use for server mode (over tcp) -->
+ <!-- use for in-process db -->
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}jbossesb</connection-url>
+ <!-- use for server mode (over tcp)
<connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:9001/</connection-url>
+ -->
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>sa</user-name>
<password></password>
@@ -15,20 +15,15 @@
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>0</idle-timeout-minutes>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
- <!-- use for in-process db
- <depends>jboss:service=Hypersonic,database=JBossESBDS</depends>
- -->
- <!-- use for server mode (over tcp) -->
<depends>jboss:service=Hypersonic,database=jbossesb</depends>
</local-tx-datasource>
- <!-- use for in-process db
+ <!-- use for in-process db -->
<mbean code="org.jboss.jdbc.HypersonicDatabase"
- name="jboss:service=Hypersonic,database=JBossESBDS">
- <attribute name="Database">JBossESBDS</attribute>
+ name="jboss:service=Hypersonic,database=jbossesb">
+ <attribute name="Database">jbossesb</attribute>
<attribute name="InProcessMode">true</attribute>
</mbean>
- -->
- <!-- use for server mode (over tcp) -->
+ <!-- use for server mode (over tcp)
<mbean code="org.jboss.internal.soa.esb.dependencies.HypersonicDatabase"
name="jboss:service=Hypersonic,database=jbossesb">
<attribute name="Port">9001</attribute>
@@ -38,4 +33,5 @@
<attribute name="Trace">false</attribute>
<attribute name="No_system_exit">true</attribute>
</mbean>
+ -->
</datasources>
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -59,8 +59,6 @@
public static final String DEFAULT_CBR_CLASS = "org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter";
- private static final String INTERNAL_SERVICE_CATEGORY = "JBossESB-Internal";
- private static final String DEAD_LETTER_SERVICE_NAME = "DeadLetterService";
ServiceInvoker dlQueueInvoker;
public ContentBasedWiretap(ConfigTree config)
@@ -73,17 +71,15 @@
_cbr.setConfigTree(config);
_mapper = new ObjectMapper(config);
try {
- dlQueueInvoker = new ServiceInvoker(INTERNAL_SERVICE_CATEGORY, DEAD_LETTER_SERVICE_NAME);
+ dlQueueInvoker = new ServiceInvoker(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME);
} catch (MessageDeliverException e) {
new MessageRouterException(e);
}
}
public void initialise() {
- if (messageMulticaster.getRecipientCount() == 0) {
- // some classes don't need to worry about this anyway.
-
- _logger.debug("Missing or empty destination list - This action class won't have any effect");
+ if (messageMulticaster.getRecipientCount() == 0) {
+ _logger.info("Missing or empty destination list - This action class won't have any effect");
}
}
@@ -96,70 +92,64 @@
* @return Message
* @throws ActionProcessingException
*/
- public Message process(Message message) throws ActionProcessingException {
+ public Message process(Message message) throws ActionProcessingException
+ {
try {
- routeMessage(message);
-
- return message;
+ List<Service> outgoingDestinations = executeRules(message);
+ if (outgoingDestinations.size()==0) {
+ String error = "No rule destination(s) "+ _destinations.keySet() + " were matched, "
+ + ". Please fix your configuration and/or routing rules.";
+ _logger.error(error);
+ try {
+ _logger.debug("Sending message to the DeadLetterService");
+ dlQueueInvoker.deliverAsync(message);
+ throw new ActionProcessingException(error);
+ } catch (MessageDeliverException e) {
+ throw new MessageRouterException("Failed to deliver message to Dead Letter Channel.", e);
+ }
+ } else {
+ routeMessage(message, outgoingDestinations);
+ }
+ } catch (MessageRouterException e) {
+ throw new ActionProcessingException(e);
}
- catch (MessageRouterException mre) {
- throw new ActionProcessingException(mre.getMessage(), mre);
- }
+ return message;
}
-
- protected void noDestinations() {
- // nothing by default
- }
-
- protected void invalidRuleConfiguration(Message message,
- List<String> destinations) throws MessageRouterException {
- _logger
- .error("The rule destination(s) "
- + destinations
- + " was not found in the destination names in the configuration "
- + _destinations.keySet()
- + ". Please fix your configuration.");
-
+
+ protected List<Service> executeRules(Message message)
+ throws MessageRouterException
+ {
+ List<Service> outgoingDestinations = new ArrayList<Service>();
try {
- dlQueueInvoker.deliverAsync(message);
- } catch (MessageDeliverException e) {
- throw new MessageRouterException("Failed to deliver message to Dead Letter Channel.", e);
- }
- }
-
- protected final void routeMessage(Message message)
- throws MessageRouterException {
- try {
List<Object> objectList = _mapper.createObjectList(message,
_messagePathList);
List<String> destinations = _cbr.route(_ruleSet, _ruleLanguage,
_ruleReload, message, objectList);
- List<Service> outgoingDestinations = new ArrayList<Service>();
for (String destination : destinations) {
if (_destinations.containsKey(destination)) {
outgoingDestinations.add(_destinations.get(destination));
+ } else {
+ throw new MessageRouterException("Destination " + destination + " does not exist your configuration");
}
}
- if (outgoingDestinations.size() > 0) {
- try {
- messageMulticaster.sendToSubset(message, outgoingDestinations);
- } catch (RegistryException e) {
- throw new MessageRouterException(e);
- } catch (MessageDeliverException e) {
- throw new MessageRouterException(e);
- }
- } else {
- noDestinations();
-
- if (destinations.size() > 0) {
- invalidRuleConfiguration(message, destinations);
- }
- }
} catch (ObjectMappingException ome) {
throw new MessageRouterException(ome);
}
+ return outgoingDestinations;
}
+ protected final void routeMessage(Message message, List<Service> outgoingDestinations)
+ throws MessageRouterException
+ {
+ try {
+ messageMulticaster.sendToSubset(message, outgoingDestinations);
+ } catch (RegistryException e) {
+ throw new MessageRouterException(e);
+ } catch (MessageDeliverException e) {
+ throw new MessageRouterException(e);
+ }
+ }
+
/**
* Reading the piece of configTree specific to the CBR, and setting the
* configuration.
@@ -170,7 +160,7 @@
if (_config.getAttribute(ListenerTagNames.RULE_SET_TAG) == null) {
_logger.error("Required attribute " + ListenerTagNames.RULE_SET_TAG
+ " not found in " + _config.getName() + ".");
- throw new ConfigurationException("Required attribute"
+ throw new ConfigurationException("Required attribute "
+ ListenerTagNames.RULE_SET_TAG + " not found.");
} else {
_ruleSet = _config.getAttribute(ListenerTagNames.RULE_SET_TAG);
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/MessageFilter.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/MessageFilter.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/MessageFilter.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -31,6 +31,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Service;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.registry.RegistryException;
@@ -61,8 +62,13 @@
{
try
{
-
- routeMessage(message);
+ List<Service> outgoingDestinations = executeRules(message);
+
+ if (outgoingDestinations.size()==0) {
+ log.debug("No destinations where matched, the Message is filtered");
+ } else {
+ routeMessage(message, outgoingDestinations);
+ }
}
catch (MessageRouterException mre)
{
@@ -72,15 +78,6 @@
return null;
}
- protected void noDestinations ()
- {
- log
- .debug("No destinations where found, the Message is filtered");
- }
- protected void invalidRuleConfiguration (Message message,
- List<String> destinations) throws MessageRouterException
- {
- // do nothing
- }
+
}
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules)
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions)
Deleted: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -1,142 +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.internal.soa.esb.services.jbrules.actions;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.actions.ContentBasedRouter;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test the jBPM command interpreter class
- *
- * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
- */
-
-
-public class ContentBasedRouterUnitTest
-{
- static Logger _logger = Logger.getLogger(ContentBasedRouterUnitTest.class);
- static Message message = null;
-
- private static EPR epr1;
- private static EPR epr2;
- private static EPR epr3;
- private static MockCourier courier1;
- private static MockCourier courier2;
- private static MockCourier courier3;
-
- private static ConfigTree[] actions;
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(ContentBasedRouterUnitTest.class);
- }
-
-
- @BeforeClass
- public static void before() throws Exception {
- MockCourierFactory.install();
- MockRegistry.install();
-
- epr1 = new EPR(new URI("test1"));
- epr2 = new EPR(new URI("test2"));
- epr3 = new EPR(new URI("DLS"));
- courier1 = new MockCourier(true);
- courier2 = new MockCourier(true);
- courier3 = new MockCourier(true);
-
- MockRegistry.register("test", "java", epr1, courier1);
- MockRegistry.register("test", "xml", epr2, courier2);
- MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
-
- message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add(("Hello CBR"));
-
- InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", ContentBasedRouterUnitTest.class);
- String xml = FileUtil.readStream(in);
- actions = ConfigTree.fromXml(xml).getChildren("action");
- }
-
- @Test
- public void wrongDestinationName()
- {
- try {
- ContentBasedRouter cbr = new ContentBasedRouter(actions[0]);
- cbr.process(message);
- //the config is wrong so we should error here, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- /* As it can't send the message to the DLS the log should say:
- ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
- ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
- */
- assertTrue(true);
- }
- }
-
- @Test
- public void correctDestinationName()
- {
- try {
- ContentBasedRouter cbr = new ContentBasedRouter(actions[1]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message
- assertNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-
- @Test
- public void noDestinationMatches()
- {
- try {
- ContentBasedRouter cbr = new ContentBasedRouter(actions[2]);
- cbr.process(message);
- //no destination matches, expecting error, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- assertTrue(true);
- }
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,142 @@
+/*
+ * 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.internal.soa.esb.services.jbrules.actions;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.actions.ContentBasedRouter;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test the jBPM command interpreter class
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
+ */
+
+
+public class ContentBasedRouterUnitTest
+{
+ static Logger _logger = Logger.getLogger(ContentBasedRouterUnitTest.class);
+ static Message message = null;
+
+ private static EPR epr1;
+ private static EPR epr2;
+ private static EPR epr3;
+ private static MockCourier courier1;
+ private static MockCourier courier2;
+ private static MockCourier courier3;
+
+ private static ConfigTree[] actions;
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ContentBasedRouterUnitTest.class);
+ }
+
+
+ @BeforeClass
+ public static void before() throws Exception {
+ MockCourierFactory.install();
+ MockRegistry.install();
+
+ epr1 = new EPR(new URI("test1"));
+ epr2 = new EPR(new URI("test2"));
+ epr3 = new EPR(new URI("DLS"));
+ courier1 = new MockCourier(true);
+ courier2 = new MockCourier(true);
+ courier3 = new MockCourier(true);
+
+ MockRegistry.register("test", "java", epr1, courier1);
+ MockRegistry.register("test", "xml", epr2, courier2);
+ MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
+
+ message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add(("Hello CBR"));
+
+ InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", ContentBasedRouterUnitTest.class);
+ String xml = FileUtil.readStream(in);
+ actions = ConfigTree.fromXml(xml).getChildren("action");
+ }
+
+ @Test
+ public void wrongDestinationName()
+ {
+ try {
+ ContentBasedRouter cbr = new ContentBasedRouter(actions[0]);
+ cbr.process(message);
+ //the config is wrong so we should error here, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ /* As it can't send the message to the DLS the log should say:
+ ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
+ ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
+ */
+ assertTrue(true);
+ }
+ }
+
+ @Test
+ public void correctDestinationName()
+ {
+ try {
+ ContentBasedRouter cbr = new ContentBasedRouter(actions[1]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message
+ assertNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void noDestinationMatches()
+ {
+ try {
+ ContentBasedRouter cbr = new ContentBasedRouter(actions[2]);
+ cbr.process(message);
+ //no destination matches, expecting error, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -1,23 +0,0 @@
-<testActions>
- <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="WrongDestinion"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized" service-category="test" service-name="java" />
- <route-to destination-name="xml" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="Correct"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="MyType"
- ruleSet="JBossESBRulesNoMatch.drl"
- >
- <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
-</testActions>
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedRouterUnitTest.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,23 @@
+<testActions>
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="WrongDestinion"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized" service-category="test" service-name="java" />
+ <route-to destination-name="xml" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="Correct"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="MyType"
+ ruleSet="JBossESBRulesNoMatch.drl"
+ >
+ <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+</testActions>
Deleted: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -1,142 +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.internal.soa.esb.services.jbrules.actions;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.actions.ContentBasedWiretap;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test the jBPM command interpreter class
- *
- * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
- */
-
-
-public class ContentBasedWiretapUnitTest
-{
- static Logger _logger = Logger.getLogger(ContentBasedWiretapUnitTest.class);
- static Message message = null;
-
- private static EPR epr1;
- private static EPR epr2;
- private static EPR epr3;
- private static MockCourier courier1;
- private static MockCourier courier2;
- private static MockCourier courier3;
-
- private static ConfigTree[] actions;
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(ContentBasedWiretapUnitTest.class);
- }
-
-
- @BeforeClass
- public static void before() throws Exception {
- MockCourierFactory.install();
- MockRegistry.install();
-
- epr1 = new EPR(new URI("test1"));
- epr2 = new EPR(new URI("test2"));
- epr3 = new EPR(new URI("DLS"));
- courier1 = new MockCourier(true);
- courier2 = new MockCourier(true);
- courier3 = new MockCourier(true);
-
- MockRegistry.register("test", "java", epr1, courier1);
- MockRegistry.register("test", "xml", epr2, courier2);
- MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
-
- message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add(("Hello CBR"));
-
- InputStream in = ClassUtil.getResourceAsStream("ContentBasedWiretapUnitTest.xml", ContentBasedWiretapUnitTest.class);
- String xml = FileUtil.readStream(in);
- actions = ConfigTree.fromXml(xml).getChildren("action");
- }
-
- @Test
- public void wrongDestinationName()
- {
- try {
- ContentBasedWiretap cbr = new ContentBasedWiretap(actions[0]);
- cbr.process(message);
- //the config is wrong so we should error here, no message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- /* As it can't send the message to the DLS the log should say:
- ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
- ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
- */
- assertTrue(true);
- }
- }
-
- @Test
- public void correctDestinationName()
- {
- try {
- ContentBasedWiretap cbr = new ContentBasedWiretap(actions[1]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message
- assertNotNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-
- @Test
- public void noDestinationMatches()
- {
- try {
- ContentBasedWiretap cbr = new ContentBasedWiretap(actions[2]);
- cbr.process(message);
- //no destination matches, expecting error, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- assertTrue(true);
- }
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,142 @@
+/*
+ * 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.internal.soa.esb.services.jbrules.actions;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.actions.ContentBasedWiretap;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test the jBPM command interpreter class
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
+ */
+
+
+public class ContentBasedWiretapUnitTest
+{
+ static Logger _logger = Logger.getLogger(ContentBasedWiretapUnitTest.class);
+ static Message message = null;
+
+ private static EPR epr1;
+ private static EPR epr2;
+ private static EPR epr3;
+ private static MockCourier courier1;
+ private static MockCourier courier2;
+ private static MockCourier courier3;
+
+ private static ConfigTree[] actions;
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ContentBasedWiretapUnitTest.class);
+ }
+
+
+ @BeforeClass
+ public static void before() throws Exception {
+ MockCourierFactory.install();
+ MockRegistry.install();
+
+ epr1 = new EPR(new URI("test1"));
+ epr2 = new EPR(new URI("test2"));
+ epr3 = new EPR(new URI("DLS"));
+ courier1 = new MockCourier(true);
+ courier2 = new MockCourier(true);
+ courier3 = new MockCourier(true);
+
+ MockRegistry.register("test", "java", epr1, courier1);
+ MockRegistry.register("test", "xml", epr2, courier2);
+ MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
+
+ message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add(("Hello CBR"));
+
+ InputStream in = ClassUtil.getResourceAsStream("ContentBasedWiretapUnitTest.xml", ContentBasedWiretapUnitTest.class);
+ String xml = FileUtil.readStream(in);
+ actions = ConfigTree.fromXml(xml).getChildren("action");
+ }
+
+ @Test
+ public void wrongDestinationName()
+ {
+ try {
+ ContentBasedWiretap cbr = new ContentBasedWiretap(actions[0]);
+ cbr.process(message);
+ //the config is wrong so we should error here, no message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ /* As it can't send the message to the DLS the log should say:
+ ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
+ ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
+ */
+ assertTrue(true);
+ }
+ }
+
+ @Test
+ public void correctDestinationName()
+ {
+ try {
+ ContentBasedWiretap cbr = new ContentBasedWiretap(actions[1]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message
+ assertNotNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void noDestinationMatches()
+ {
+ try {
+ ContentBasedWiretap cbr = new ContentBasedWiretap(actions[2]);
+ cbr.process(message);
+ //no destination matches, expecting error, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -1,23 +0,0 @@
-<testActions>
- <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="WrongDestinion"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized" service-category="test" service-name="java" />
- <route-to destination-name="xml" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="Correct"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="MyType"
- ruleSet="JBossESBRulesNoMatch.drl"
- >
- <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
-</testActions>
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/ContentBasedWiretapUnitTest.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,23 @@
+<testActions>
+ <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="WrongDestinion"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized" service-category="test" service-name="java" />
+ <route-to destination-name="xml" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="Correct"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="MyType"
+ ruleSet="JBossESBRulesNoMatch.drl"
+ >
+ <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+</testActions>
Deleted: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -1,142 +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.internal.soa.esb.services.jbrules.actions;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.actions.MessageFilter;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test the jBPM command interpreter class
- *
- * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
- */
-
-
-public class MessageFilterUnitTest
-{
- static Logger _logger = Logger.getLogger(MessageFilterUnitTest.class);
- static Message message = null;
-
- private static EPR epr1;
- private static EPR epr2;
- private static EPR epr3;
- private static MockCourier courier1;
- private static MockCourier courier2;
- private static MockCourier courier3;
-
- private static ConfigTree[] actions;
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(MessageFilterUnitTest.class);
- }
-
-
- @BeforeClass
- public static void before() throws Exception {
- MockCourierFactory.install();
- MockRegistry.install();
-
- epr1 = new EPR(new URI("test1"));
- epr2 = new EPR(new URI("test2"));
- epr3 = new EPR(new URI("DLS"));
- courier1 = new MockCourier(true);
- courier2 = new MockCourier(true);
- courier3 = new MockCourier(true);
-
- MockRegistry.register("test", "java", epr1, courier1);
- MockRegistry.register("test", "xml", epr2, courier2);
- MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
-
- message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add(("Hello CBR"));
-
- InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", MessageFilterUnitTest.class);
- String xml = FileUtil.readStream(in);
- actions = ConfigTree.fromXml(xml).getChildren("action");
- }
-
- @Test
- public void wrongDestinationName()
- {
- try {
- MessageFilter cbr = new MessageFilter(actions[0]);
- cbr.process(message);
- //the config is wrong so we should error here, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- /* As it can't send the message to the DLS the log should say:
- ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
- ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
- */
- assertTrue(true);
- }
- }
-
- @Test
- public void correctDestinationName()
- {
- try {
- MessageFilter cbr = new MessageFilter(actions[1]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message
- assertNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-
- @Test
- public void noDestinationMatches()
- {
- try {
- MessageFilter cbr = new MessageFilter(actions[2]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message, message should be filtered with no errors.
- assertNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,142 @@
+/*
+ * 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.internal.soa.esb.services.jbrules.actions;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.actions.MessageFilter;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test the jBPM command interpreter class
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
+ */
+
+
+public class MessageFilterUnitTest
+{
+ static Logger _logger = Logger.getLogger(MessageFilterUnitTest.class);
+ static Message message = null;
+
+ private static EPR epr1;
+ private static EPR epr2;
+ private static EPR epr3;
+ private static MockCourier courier1;
+ private static MockCourier courier2;
+ private static MockCourier courier3;
+
+ private static ConfigTree[] actions;
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(MessageFilterUnitTest.class);
+ }
+
+
+ @BeforeClass
+ public static void before() throws Exception {
+ MockCourierFactory.install();
+ MockRegistry.install();
+
+ epr1 = new EPR(new URI("test1"));
+ epr2 = new EPR(new URI("test2"));
+ epr3 = new EPR(new URI("DLS"));
+ courier1 = new MockCourier(true);
+ courier2 = new MockCourier(true);
+ courier3 = new MockCourier(true);
+
+ MockRegistry.register("test", "java", epr1, courier1);
+ MockRegistry.register("test", "xml", epr2, courier2);
+ MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
+
+ message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add(("Hello CBR"));
+
+ InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", MessageFilterUnitTest.class);
+ String xml = FileUtil.readStream(in);
+ actions = ConfigTree.fromXml(xml).getChildren("action");
+ }
+
+ @Test
+ public void wrongDestinationName()
+ {
+ try {
+ MessageFilter cbr = new MessageFilter(actions[0]);
+ cbr.process(message);
+ //the config is wrong so we should error here, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ /* As it can't send the message to the DLS the log should say:
+ ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
+ ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
+ */
+ assertTrue(true);
+ }
+ }
+
+ @Test
+ public void correctDestinationName()
+ {
+ try {
+ MessageFilter cbr = new MessageFilter(actions[1]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message
+ assertNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void noDestinationMatches()
+ {
+ try {
+ MessageFilter cbr = new MessageFilter(actions[2]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message, message should be filtered with no errors.
+ assertNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -1,23 +0,0 @@
-<testActions>
- <action class="org.jboss.soa.esb.actions.MessageFilter" name="WrongDestinion"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized" service-category="test" service-name="java" />
- <route-to destination-name="xml" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.MessageFilter" name="Correct"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.MessageFilter" name="MyType"
- ruleSet="JBossESBRulesNoMatch.drl"
- >
- <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
-</testActions>
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/actions/MessageFilterUnitTest.xml 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,23 @@
+<testActions>
+ <action class="org.jboss.soa.esb.actions.MessageFilter" name="WrongDestinion"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized" service-category="test" service-name="java" />
+ <route-to destination-name="xml" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.MessageFilter" name="Correct"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.MessageFilter" name="MyType"
+ ruleSet="JBossESBRulesNoMatch.drl"
+ >
+ <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+</testActions>
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -29,7 +29,6 @@
import junit.framework.JUnit4TestAdapter;
import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.body.content.BytesBody;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.message.format.MessageType;
import org.jboss.soa.esb.services.routing.MessageRouterException;
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -29,7 +29,6 @@
import junit.framework.JUnit4TestAdapter;
import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.body.content.BytesBody;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.message.format.MessageType;
import org.jboss.soa.esb.services.routing.MessageRouterException;
Copied: labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/resources/JBossESBRulesNoMatch.drl (from rev 16081, labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBRulesNoMatch.drl)
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/resources/JBossESBRulesNoMatch.drl (rev 0)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/services/jbrules/src/test/resources/JBossESBRulesNoMatch.drl 2007-10-26 11:44:43 UTC (rev 16082)
@@ -0,0 +1,29 @@
+#created on: Oct 30, 2006
+package com.jboss.soa.esb.routing.cbr
+
+#list any import classes here.
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageType;
+
+#declare any global variables here
+global java.util.List destinations;
+
+
+rule "Routing Rule - Serialized based message"
+
+ when
+ Message( type == "MyType")
+ then
+ System.out.println("MyType");
+ destinations.add("mytype-destination");
+
+end
+
+rule "Routing Rule - XML based message"
+
+ when
+ Message( type == MessageType.JBOSS_XML)
+ then
+ System.out.println("JBoss_XML");
+ destinations.add("xml-destination");
+end
\ No newline at end of file
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -102,6 +102,6 @@
logger.error("DataCollectorAction received a message which was not a command message");
message = null;
}
- return message;
+ return null;
}
}
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/InvokerAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/InvokerAction.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/InvokerAction.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -112,6 +112,6 @@
logger.error("DataCollectorAction received a message which was not a command message");
message = null;
}
- return message;
+ return null;
}
}
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/OperationsCollectorAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/OperationsCollectorAction.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/OperationsCollectorAction.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -101,6 +101,6 @@
logger.error("DataCollectorAction received a message which was not a command message");
message = null;
}
- return message;
+ return null;
}
}
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerAction.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerAction.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -65,6 +65,6 @@
logger.error("DataCollectorAction received a message which was not a command message");
message = null;
}
- return message;
+ return null;
}
}
Modified: labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/FilerAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/FilerAction.java 2007-10-26 06:01:13 UTC (rev 16081)
+++ labs/jbossesb/workspace/dbevenius/redeliver/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/FilerAction.java 2007-10-26 11:44:43 UTC (rev 16082)
@@ -72,7 +72,7 @@
logger.error("OperationsCollectorAction received a message which was not a command message");
message = null;
}
- return message;
+ return null;
}
}
More information about the jboss-svn-commits
mailing list