Santiago Vacas
2012-02-02 23:15:18 UTC
you need to update the mockito versions in the distribution whitelist files too
http://bamboo.mulesoft.org/browse/MULE3X-MULE3XSNAPSHOTS-JOB1-1196/log
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
http://bamboo.mulesoft.org/browse/MULE3X-MULE3XSNAPSHOTS-JOB1-1196/log
Revision 23785 Author dfeist Date 2012-02-01 11:48:47 -0600 (Wed, 01 Feb
2012)
Log Message
Merged revisions 23778-23780 via svnmerge from
https://svn.codehaus.org/mule/branches/mule-3.2.x
................
r23778 | dfeist | 2012-02-01 12:59:46 -0300 (Wed, 01 Feb 2012) | 9 lines
Merged revisions 23777 via svnmerge from
https://svn.codehaus.org/mule/branches/mule-3.1.x
........
r23777 | dfeist | 2012-02-01 12:02:19 -0300 (Wed, 01 Feb 2012) | 1 line
MULE-5980 SedaStageInterceptingMessageProcessor crashes when the
threadWaitTimeout is over. Add additional tests for
SedaStageInterceptingMessageProcessor. Upgrade to Mockito 1.9.0 to use the
timeout functionality.
........
................
r23779 | dfeist | 2012-02-01 13:16:28 -0300 (Wed, 01 Feb 2012) | 1 line
Add Flow variant for SedaStageWorkRejectionTestCase (MULE-5980)
................
r23780 | dfeist | 2012-02-01 13:30:00 -0300 (Wed, 01 Feb 2012) | 1 line
Add Flow variant for SedaStageWorkRejectionTestCase (MULE-5980)
................
Modified Paths
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java
branches/mule-3.x/pom.xml
Added Paths
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
Removed Paths
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
Property Changed
branches/mule-3.x/
Diff
Property changes: branches/mule-3.x
Modified: svnmerge-integrated
+
/branches/mule-3.2.x:1-22786,22788-22794,22796-22822,22824-22832,22834-22855,22858-22905,22907,22909-22924,22926-22950,22952-22988,22990-22991,22993-22994,22997,23006,23011,23014,23018,23022-23025,23027,23030,23035,23047,23051,23054-23055,23057,23059-23060,23069,23071,23075,23077,23080,23082,23086,23090,23092-23107,23116,23119,23122,23129,23137,23144,23147-23148,23150,23160,23171,23173,23186,23190,23192,23195,23198-23199,23202-23203,23207,23209,23211-23243,23245-23247,23249-23253,23256-23266,23268-23269,23273-23315,23317-23323,23325-23347,23349-23362,23366-23370,23376,23386,23391,23395,23398,23400,23403,23407,23413-23415,23421,23432,23437,23439,23456,23460,23462,23470,23472,23476,23480,23500,23508-23510,23518,23531,23551,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,237
54,23756,23759,23762-23763,23778-23780
Modified: svn:mergeinfo
/branches/mule-3.2.x:23057,23456,23460,23470,23472,23476,23480,23500,23508-23510,23518,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,23754,23756,23762-23763
+
/branches/mule-3.1.x:23454-23455,23459,23471,23475,23499,23506,23509,23516,23596,23610,23618,23628-23631,23634,23644,23647-23648,23653-23654,23659-23661,23672,23674,23679-23680,23684,23693,23700,23713,23734-23735,23749,23753,23761,23777
/branches/mule-3.2.x:23057,23456,23460,23470,23472,23476,23480,23500,23508-23510,23518,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,23754,23756,23762-23763,23778-23780
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java
(23784 => 23785)
---
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java 2012-02-01
17:38:38 UTC (rev 23784)
+++
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -11,6 +11,7 @@
package org.mule.processor;
import org.mule.DefaultMuleEvent;
+import org.mule.OptimizedRequestContext;
import org.mule.api.MuleContext;
import org.mule.api.MuleEvent;
import org.mule.api.MuleException;
@@ -235,7 +236,10 @@
}
catch (Exception e)
{
-
muleContext.getExceptionListener().handleException(e);
+ // because dequeued event may still be owned by a
previuos
+ // thread we need to use the copy created in
AsyncMessageProcessorWorker constructor.
+
OptimizedRequestContext.unsafeSetEvent(work.getEvent());
+
event.getFlowConstruct().getExceptionListener().handleException(e,
work.getEvent());
}
}
else
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java
(23784 => 23785)
---
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java 2012-02-01
17:38:38 UTC (rev 23784)
+++
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -13,9 +13,19 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import org.mule.MessageExchangePattern;
+import org.mule.api.MuleEvent;
import org.mule.api.MuleException;
import org.mule.api.MuleRuntimeException;
+import org.mule.api.config.ThreadingProfile;
+import org.mule.api.exception.MessagingExceptionHandler;
import org.mule.api.lifecycle.Initialisable;
import org.mule.api.lifecycle.InitialisationException;
import org.mule.api.lifecycle.Lifecycle;
@@ -23,11 +33,16 @@
import org.mule.api.lifecycle.Startable;
import org.mule.api.lifecycle.Stoppable;
import org.mule.api.processor.MessageProcessor;
+import org.mule.config.ChainedThreadingProfile;
import org.mule.config.QueueProfile;
+import org.mule.construct.Flow;
import org.mule.management.stats.QueueStatistics;
+import org.mule.processor.strategy.AsynchronousProcessingStrategy;
import org.mule.service.Pausable;
+import org.mule.util.concurrent.Latch;
import java.beans.ExceptionListener;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.resource.spi.work.Work;
@@ -35,6 +50,9 @@
import javax.resource.spi.work.WorkException;
import org.junit.Test;
+import org.mockito.ArgumentMatcher;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
public class SedaStageInterceptingMessageProcessorTestCase extends
AsyncInterceptingMessageProcessorTestCase
implements ExceptionListener
@@ -53,8 +71,8 @@
queueTimeout =
muleContext.getConfiguration().getDefaultQueueTimeout();
lifeCycleState = new TestLifeCycleState();
super.doSetUp();
- ((Initialisable) messageProcessor).initialise();
- ((Startable) messageProcessor).start();
+ ((Initialisable)messageProcessor).initialise();
+ ((Startable)messageProcessor).start();
lifeCycleState.start();
}
@@ -68,12 +86,148 @@
protected void doTearDown() throws Exception
{
super.doTearDown();
- ((Stoppable) messageProcessor).stop();
+ ((Stoppable)messageProcessor).stop();
lifeCycleState.stop();
lifeCycleState.dispose();
}
+ public void testProcessOneWayThreadWaitTimeout() throws Exception
+ {
+ ThreadingProfile threadingProfile = new ChainedThreadingProfile(
+ muleContext.getDefaultThreadingProfile());
+ threadingProfile.setThreadWaitTimeout(500);
+ threadingProfile.setMaxThreadsActive(2);
+
threadingProfile.setPoolExhaustedAction(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
+ threadingProfile.setMuleContext(muleContext);
+
+ MessageProcessor mockListener = mock(MessageProcessor.class);
+ when(mockListener.process((MuleEvent)any())).thenAnswer(new
Answer<MuleEvent>()
+ {
+ public MuleEvent answer(InvocationOnMock invocation) throws
Throwable
+ {
+ Thread.sleep(500);
+ return (MuleEvent)invocation.getArguments()[0];
+ }
+ });
+
+ SedaStageInterceptingMessageProcessor
sedaStageInterceptingMessageProcessor = new
SedaStageInterceptingMessageProcessor(
+ "testProcessOneWayThreadWaitTimeout",
"testProcessOneWayThreadWaitTimeout", queueProfile,
+ queueTimeout, threadingProfile, queueStatistics, muleContext);
+ sedaStageInterceptingMessageProcessor.setListener(mockListener);
+ sedaStageInterceptingMessageProcessor.initialise();
+ sedaStageInterceptingMessageProcessor.start();
+
+ MessagingExceptionHandler exceptionHandler =
mock(MessagingExceptionHandler.class);
+ Flow flow = mock(Flow.class);
+ when(flow.getExceptionListener()).thenReturn(exceptionHandler);
+ when(flow.getProcessingStrategy()).thenReturn(new
AsynchronousProcessingStrategy());
+ final MuleEvent event = getTestEvent(TEST_MESSAGE, flow,
MessageExchangePattern.ONE_WAY);
+
+ for (int i = 0; i < 3; i++)
+ {
+ sedaStageInterceptingMessageProcessor.process(event);
+ }
+
+ ArgumentMatcher<MuleEvent> notSameEvent = new
ArgumentMatcher<MuleEvent>()
+ {
+ public boolean matches(Object argument)
+ {
+ return !argument.equals(event);
+ }
+ };
+
+ // Two events are processed
+ verify(mockListener,
timeout(RECEIVE_TIMEOUT).times(2)).process(argThat(notSameEvent));
+
+ // One event gets processed by the exception strategy
+ verify(exceptionHandler,
timeout(RECEIVE_TIMEOUT).times(1)).handleException((Exception)any(),
+ argThat(notSameEvent));
+
+ }
+
+ public void testProcessOneWayWithException() throws Exception
+ {
+ final Latch latch = new Latch();
+ ThreadingProfile threadingProfile = new ChainedThreadingProfile(
+ muleContext.getDefaultThreadingProfile());
+ threadingProfile.setMuleContext(muleContext);
+
+ MessageProcessor mockListener = mock(MessageProcessor.class);
+ when(mockListener.process((MuleEvent)any())).thenAnswer(new
Answer<MuleEvent>()
+ {
+ public MuleEvent answer(InvocationOnMock invocation) throws
Throwable
+ {
+ latch.countDown();
+ throw new RuntimeException();
+ }
+ });
+
+ SedaStageInterceptingMessageProcessor
sedaStageInterceptingMessageProcessor = new
SedaStageInterceptingMessageProcessor(
+ "testProcessOneWayWithException",
"testProcessOneWayWithException", queueProfile, queueTimeout,
+ threadingProfile, queueStatistics, muleContext);
+ sedaStageInterceptingMessageProcessor.setListener(mockListener);
+ sedaStageInterceptingMessageProcessor.initialise();
+ sedaStageInterceptingMessageProcessor.start();
+
+ MessagingExceptionHandler exceptionHandler =
mock(MessagingExceptionHandler.class);
+ Flow flow = mock(Flow.class);
+ when(flow.getExceptionListener()).thenReturn(exceptionHandler);
+ when(flow.getProcessingStrategy()).thenReturn(new
AsynchronousProcessingStrategy());
+ final MuleEvent event = getTestEvent(TEST_MESSAGE, flow,
MessageExchangePattern.ONE_WAY);
+
+ sedaStageInterceptingMessageProcessor.process(event);
+
+ assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
+
+ ArgumentMatcher<MuleEvent> notSameEvent = new
ArgumentMatcher<MuleEvent>()
+ {
+ public boolean matches(Object argument)
+ {
+ return !argument.equals(event);
+ }
+ };
+
+ // One event get processed but then throws an exception
+ verify(mockListener,
timeout(RECEIVE_TIMEOUT).times(1)).process(argThat(notSameEvent));
+
+ // One event gets processed by the exception strategy
+ verify(exceptionHandler,
timeout(RECEIVE_TIMEOUT).times(1)).handleException((Exception)any(),
+ argThat(notSameEvent));
+
+ }
+
+ public void testProcessOneWayNoThreadingWithException() throws
Exception
+ {
+ ThreadingProfile threadingProfile = new ChainedThreadingProfile(
+ muleContext.getDefaultThreadingProfile());
+ threadingProfile.setDoThreading(false);
+ threadingProfile.setMuleContext(muleContext);
+
+ MessageProcessor mockListener = mock(MessageProcessor.class);
+ when(mockListener.process((MuleEvent)any())).thenThrow(new
RuntimeException());
+
+ SedaStageInterceptingMessageProcessor
sedaStageInterceptingMessageProcessor = new
SedaStageInterceptingMessageProcessor(
+ "testProcessOneWayNoThreadingWithException",
"testProcessOneWayNoThreadingWithException",
+ queueProfile, queueTimeout, threadingProfile, queueStatistics,
muleContext);
+ sedaStageInterceptingMessageProcessor.setListener(mockListener);
+ sedaStageInterceptingMessageProcessor.initialise();
+ sedaStageInterceptingMessageProcessor.start();
+
+ MessagingExceptionHandler exceptionHandler =
mock(MessagingExceptionHandler.class);
+ Flow flow = mock(Flow.class);
+ when(flow.getExceptionListener()).thenReturn(exceptionHandler);
+ when(flow.getProcessingStrategy()).thenReturn(new
AsynchronousProcessingStrategy());
+ MuleEvent event = getTestEvent(TEST_MESSAGE, flow,
MessageExchangePattern.ONE_WAY);
+
+ sedaStageInterceptingMessageProcessor.process(event);
+ }
+
@Override
protected AsyncInterceptingMessageProcessor
createAsyncInterceptingMessageProcessor(MessageProcessor listener)
throws Exception
Modified: branches/mule-3.x/pom.xml (23784 => 23785)
--- branches/mule-3.x/pom.xml 2012-02-01 17:38:38 UTC (rev 23784)
+++ branches/mule-3.x/pom.xml 2012-02-01 17:48:47 UTC (rev 23785)
@@ -530,7 +530,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
- <version>1.8.4</version>
+ <version>1.9.0</version>
</dependency>
<dependency>
http://www.cs.umd.edu/projects/PL/multithreadedtc/overview.html -->
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
(23780 => 23785)
---
branches/mule-3.2.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java 2012-02-01
16:30:00 UTC (rev 23780)
+++
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -1,74 +0,0 @@
-/*
- * $Id$
- *
--------------------------------------------------------------------------------------
- * Copyright (c) MuleSoft, Inc. All rights reserved.
http://www.mulesoft.com
- *
- * The software in this package is published under the terms of the CPAL
v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-
-package org.mule.test.integration.async;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.mule.api.MuleMessage;
-import org.mule.api.client.MuleClient;
-import org.mule.tck.AbstractServiceAndFlowTestCase;
-import org.mule.transport.NullPayload;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runners.Parameterized.Parameters;
-
-public class SedaStageWorkRejectionTestCase extends
AbstractServiceAndFlowTestCase
-{
- public SedaStageWorkRejectionTestCase(ConfigVariant variant, String
configResources)
- {
- super(variant, configResources);
- }
-
- public static Collection<Object[]> parameters()
- {
- return Arrays.asList(new Object[][]{
- {ConfigVariant.SERVICE,
-
"org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml"},
- {ConfigVariant.FLOW,
"org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml"}});
- }
-
- public void handleRejectedEventWithExceptionStrategy() throws Exception
- {
- // Send 3 messages
- MuleClient client = muleContext.getClient();
- int nrMessages = 3;
- for (int i = 0; i < nrMessages; i++)
- {
- client.dispatch("vm://flow.in", "some data " + i, null);
- }
-
- // Receive 2 messages
- for (int i = 0; i < 2; i++)
- {
- MuleMessage result = client.request("vm://flow.out",
RECEIVE_TIMEOUT);
- assertNotNull(result);
- assertNull(result.getExceptionPayload());
- assertFalse(result.getPayload() instanceof NullPayload);
-
- assertTrue(result.getPayloadAsString().contains("some data"));
- }
-
- // Third message doesn't arrive
- assertNull(client.request("vm://flow.out", RECEIVE_TIMEOUT / 5));
-
- // Third message was router via exception strategy
- MuleMessage result = client.request("vm://flow.exception",
RECEIVE_TIMEOUT);
- assertNotNull(result);
- }
-}
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
(from rev 23780,
branches/mule-3.2.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java)
(0 => 23785)
---
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
(rev 0)
+++
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -0,0 +1,74 @@
+/*
+ * $Id$
+ *
--------------------------------------------------------------------------------------
+ * Copyright (c) MuleSoft, Inc. All rights reserved.
http://www.mulesoft.com
+ *
+ * The software in this package is published under the terms of the CPAL
v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.test.integration.async;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.mule.api.MuleMessage;
+import org.mule.api.client.MuleClient;
+import org.mule.tck.AbstractServiceAndFlowTestCase;
+import org.mule.transport.NullPayload;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+
+public class SedaStageWorkRejectionTestCase extends
AbstractServiceAndFlowTestCase
+{
+ public SedaStageWorkRejectionTestCase(ConfigVariant variant, String
configResources)
+ {
+ super(variant, configResources);
+ }
+
+ public static Collection<Object[]> parameters()
+ {
+ return Arrays.asList(new Object[][]{
+ {ConfigVariant.SERVICE,
+
"org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml"},
+ {ConfigVariant.FLOW,
"org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml"}});
+ }
+
+ public void handleRejectedEventWithExceptionStrategy() throws Exception
+ {
+ // Send 3 messages
+ MuleClient client = muleContext.getClient();
+ int nrMessages = 3;
+ for (int i = 0; i < nrMessages; i++)
+ {
+ client.dispatch("vm://flow.in", "some data " + i, null);
+ }
+
+ // Receive 2 messages
+ for (int i = 0; i < 2; i++)
+ {
+ MuleMessage result = client.request("vm://flow.out",
RECEIVE_TIMEOUT);
+ assertNotNull(result);
+ assertNull(result.getExceptionPayload());
+ assertFalse(result.getPayload() instanceof NullPayload);
+
+ assertTrue(result.getPayloadAsString().contains("some data"));
+ }
+
+ // Third message doesn't arrive
+ assertNull(client.request("vm://flow.out", RECEIVE_TIMEOUT / 5));
+
+ // Third message was router via exception strategy
+ MuleMessage result = client.request("vm://flow.exception",
RECEIVE_TIMEOUT);
+ assertNotNull(result);
+ }
+}
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
(23780 => 23785)
---
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml 2012-02-01
16:30:00 UTC (rev 23780)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
- xmlns:test="http://www.mulesoft.org/schema/mule/test"
- xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
-
- http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
- http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
- http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
- <description>
- reproduce error that crashes seda service when seda
- queue is full
- </description>
-
- <queued-asynchronous-processing-strategy
- name="max2ThreadSmallTimeout" maxThreads="2"
- poolExhaustedAction="WAIT" threadWaitTimeout="500" />
-
- <flow name="sedaFlowCrash" processingStrategy="max2ThreadSmallTimeout">
- <vm:inbound-endpoint address="vm://flow.in"
- exchange-pattern="one-way" />
- <test:component waitTime="1000" />
- <vm:outbound-endpoint address="vm://flow.out"
- exchange-pattern="one-way" />
- <default-exception-strategy>
- <vm:outbound-endpoint address="vm://flow.exception"
- exchange-pattern="one-way" />
- </default-exception-strategy>
- </flow>
-
-</mule>
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
(from rev 23780,
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml)
(0 => 23785)
---
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
(rev 0)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+ xmlns:test="http://www.mulesoft.org/schema/mule/test"
+ xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
+
+ http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
+ http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+ <description>
+ reproduce error that crashes seda service when seda
+ queue is full
+ </description>
+
+ <queued-asynchronous-processing-strategy
+ name="max2ThreadSmallTimeout" maxThreads="2"
+ poolExhaustedAction="WAIT" threadWaitTimeout="500" />
+
+ <flow name="sedaFlowCrash" processingStrategy="max2ThreadSmallTimeout">
+ <vm:inbound-endpoint address="vm://flow.in"
+ exchange-pattern="one-way" />
+ <test:component waitTime="1000" />
+ <vm:outbound-endpoint address="vm://flow.out"
+ exchange-pattern="one-way" />
+ <default-exception-strategy>
+ <vm:outbound-endpoint address="vm://flow.exception"
+ exchange-pattern="one-way" />
+ </default-exception-strategy>
+ </flow>
+
+</mule>
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
(23780 => 23785)
---
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml 2012-02-01
16:30:00 UTC (rev 23780)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
- xmlns:test="http://www.mulesoft.org/schema/mule/test"
- xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
-
- http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
- http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
- http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
">
-
- <description>
- reproduce error that crashes seda service when seda queue is full
- </description>
-
- <model>
- <service name="sedaFlowCrash">
- <inbound>
- <vm:inbound-endpoint address="vm://flow.in"
exchange-pattern="one-way" />
- </inbound>
- <test:component waitTime="1000" />
- <outbound>
- <pass-through-router>
- <vm:outbound-endpoint address="vm://flow.out"
exchange-pattern="one-way" />
- </pass-through-router>
- </outbound>
- <default-exception-strategy>
- <vm:outbound-endpoint address="vm://flow.exception"
exchange-pattern="one-way" />
- </default-exception-strategy>
- <threading-profile maxThreadsActive="2" threadWaitTimeout="500"
- poolExhaustedAction="WAIT" />
- </service>
- </model>
-
-</mule>
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
(from rev 23780,
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml)
(0 => 23785)
---
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
(rev 0)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+ xmlns:test="http://www.mulesoft.org/schema/mule/test"
+ xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
+
+ http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
+ http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
">
+
+ <description>
+ reproduce error that crashes seda service when seda queue is full
+ </description>
+
+ <model>
+ <service name="sedaFlowCrash">
+ <inbound>
+ <vm:inbound-endpoint address="vm://flow.in"
exchange-pattern="one-way" />
+ </inbound>
+ <test:component waitTime="1000" />
+ <outbound>
+ <pass-through-router>
+ <vm:outbound-endpoint address="vm://flow.out"
exchange-pattern="one-way" />
+ </pass-through-router>
+ </outbound>
+ <default-exception-strategy>
+ <vm:outbound-endpoint address="vm://flow.exception"
exchange-pattern="one-way" />
+ </default-exception-strategy>
+ <threading-profile maxThreadsActive="2" threadWaitTimeout="500"
+ poolExhaustedAction="WAIT" />
+ </service>
+ </model>
+
+</mule>
________________________________
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------2012)
Log Message
Merged revisions 23778-23780 via svnmerge from
https://svn.codehaus.org/mule/branches/mule-3.2.x
................
r23778 | dfeist | 2012-02-01 12:59:46 -0300 (Wed, 01 Feb 2012) | 9 lines
Merged revisions 23777 via svnmerge from
https://svn.codehaus.org/mule/branches/mule-3.1.x
........
r23777 | dfeist | 2012-02-01 12:02:19 -0300 (Wed, 01 Feb 2012) | 1 line
MULE-5980 SedaStageInterceptingMessageProcessor crashes when the
threadWaitTimeout is over. Add additional tests for
SedaStageInterceptingMessageProcessor. Upgrade to Mockito 1.9.0 to use the
timeout functionality.
........
................
r23779 | dfeist | 2012-02-01 13:16:28 -0300 (Wed, 01 Feb 2012) | 1 line
Add Flow variant for SedaStageWorkRejectionTestCase (MULE-5980)
................
r23780 | dfeist | 2012-02-01 13:30:00 -0300 (Wed, 01 Feb 2012) | 1 line
Add Flow variant for SedaStageWorkRejectionTestCase (MULE-5980)
................
Modified Paths
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java
branches/mule-3.x/pom.xml
Added Paths
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
Removed Paths
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
Property Changed
branches/mule-3.x/
Diff
Property changes: branches/mule-3.x
Modified: svnmerge-integrated
+
/branches/mule-3.2.x:1-22786,22788-22794,22796-22822,22824-22832,22834-22855,22858-22905,22907,22909-22924,22926-22950,22952-22988,22990-22991,22993-22994,22997,23006,23011,23014,23018,23022-23025,23027,23030,23035,23047,23051,23054-23055,23057,23059-23060,23069,23071,23075,23077,23080,23082,23086,23090,23092-23107,23116,23119,23122,23129,23137,23144,23147-23148,23150,23160,23171,23173,23186,23190,23192,23195,23198-23199,23202-23203,23207,23209,23211-23243,23245-23247,23249-23253,23256-23266,23268-23269,23273-23315,23317-23323,23325-23347,23349-23362,23366-23370,23376,23386,23391,23395,23398,23400,23403,23407,23413-23415,23421,23432,23437,23439,23456,23460,23462,23470,23472,23476,23480,23500,23508-23510,23518,23531,23551,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,237
54,23756,23759,23762-23763,23778-23780
Modified: svn:mergeinfo
/branches/mule-3.2.x:23057,23456,23460,23470,23472,23476,23480,23500,23508-23510,23518,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,23754,23756,23762-23763
+
/branches/mule-3.1.x:23454-23455,23459,23471,23475,23499,23506,23509,23516,23596,23610,23618,23628-23631,23634,23644,23647-23648,23653-23654,23659-23661,23672,23674,23679-23680,23684,23693,23700,23713,23734-23735,23749,23753,23761,23777
/branches/mule-3.2.x:23057,23456,23460,23470,23472,23476,23480,23500,23508-23510,23518,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,23754,23756,23762-23763,23778-23780
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java
(23784 => 23785)
---
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java 2012-02-01
17:38:38 UTC (rev 23784)
+++
branches/mule-3.x/core/src/main/java/org/mule/processor/SedaStageInterceptingMessageProcessor.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -11,6 +11,7 @@
package org.mule.processor;
import org.mule.DefaultMuleEvent;
+import org.mule.OptimizedRequestContext;
import org.mule.api.MuleContext;
import org.mule.api.MuleEvent;
import org.mule.api.MuleException;
@@ -235,7 +236,10 @@
}
catch (Exception e)
{
-
muleContext.getExceptionListener().handleException(e);
+ // because dequeued event may still be owned by a
previuos
+ // thread we need to use the copy created in
AsyncMessageProcessorWorker constructor.
+
OptimizedRequestContext.unsafeSetEvent(work.getEvent());
+
event.getFlowConstruct().getExceptionListener().handleException(e,
work.getEvent());
}
}
else
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java
(23784 => 23785)
---
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java 2012-02-01
17:38:38 UTC (rev 23784)
+++
branches/mule-3.x/core/src/test/java/org/mule/processor/SedaStageInterceptingMessageProcessorTestCase.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -13,9 +13,19 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import org.mule.MessageExchangePattern;
+import org.mule.api.MuleEvent;
import org.mule.api.MuleException;
import org.mule.api.MuleRuntimeException;
+import org.mule.api.config.ThreadingProfile;
+import org.mule.api.exception.MessagingExceptionHandler;
import org.mule.api.lifecycle.Initialisable;
import org.mule.api.lifecycle.InitialisationException;
import org.mule.api.lifecycle.Lifecycle;
@@ -23,11 +33,16 @@
import org.mule.api.lifecycle.Startable;
import org.mule.api.lifecycle.Stoppable;
import org.mule.api.processor.MessageProcessor;
+import org.mule.config.ChainedThreadingProfile;
import org.mule.config.QueueProfile;
+import org.mule.construct.Flow;
import org.mule.management.stats.QueueStatistics;
+import org.mule.processor.strategy.AsynchronousProcessingStrategy;
import org.mule.service.Pausable;
+import org.mule.util.concurrent.Latch;
import java.beans.ExceptionListener;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.resource.spi.work.Work;
@@ -35,6 +50,9 @@
import javax.resource.spi.work.WorkException;
import org.junit.Test;
+import org.mockito.ArgumentMatcher;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
public class SedaStageInterceptingMessageProcessorTestCase extends
AsyncInterceptingMessageProcessorTestCase
implements ExceptionListener
@@ -53,8 +71,8 @@
queueTimeout =
muleContext.getConfiguration().getDefaultQueueTimeout();
lifeCycleState = new TestLifeCycleState();
super.doSetUp();
- ((Initialisable) messageProcessor).initialise();
- ((Startable) messageProcessor).start();
+ ((Initialisable)messageProcessor).initialise();
+ ((Startable)messageProcessor).start();
lifeCycleState.start();
}
@@ -68,12 +86,148 @@
protected void doTearDown() throws Exception
{
super.doTearDown();
- ((Stoppable) messageProcessor).stop();
+ ((Stoppable)messageProcessor).stop();
lifeCycleState.stop();
lifeCycleState.dispose();
}
+ public void testProcessOneWayThreadWaitTimeout() throws Exception
+ {
+ ThreadingProfile threadingProfile = new ChainedThreadingProfile(
+ muleContext.getDefaultThreadingProfile());
+ threadingProfile.setThreadWaitTimeout(500);
+ threadingProfile.setMaxThreadsActive(2);
+
threadingProfile.setPoolExhaustedAction(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
+ threadingProfile.setMuleContext(muleContext);
+
+ MessageProcessor mockListener = mock(MessageProcessor.class);
+ when(mockListener.process((MuleEvent)any())).thenAnswer(new
Answer<MuleEvent>()
+ {
+ public MuleEvent answer(InvocationOnMock invocation) throws
Throwable
+ {
+ Thread.sleep(500);
+ return (MuleEvent)invocation.getArguments()[0];
+ }
+ });
+
+ SedaStageInterceptingMessageProcessor
sedaStageInterceptingMessageProcessor = new
SedaStageInterceptingMessageProcessor(
+ "testProcessOneWayThreadWaitTimeout",
"testProcessOneWayThreadWaitTimeout", queueProfile,
+ queueTimeout, threadingProfile, queueStatistics, muleContext);
+ sedaStageInterceptingMessageProcessor.setListener(mockListener);
+ sedaStageInterceptingMessageProcessor.initialise();
+ sedaStageInterceptingMessageProcessor.start();
+
+ MessagingExceptionHandler exceptionHandler =
mock(MessagingExceptionHandler.class);
+ Flow flow = mock(Flow.class);
+ when(flow.getExceptionListener()).thenReturn(exceptionHandler);
+ when(flow.getProcessingStrategy()).thenReturn(new
AsynchronousProcessingStrategy());
+ final MuleEvent event = getTestEvent(TEST_MESSAGE, flow,
MessageExchangePattern.ONE_WAY);
+
+ for (int i = 0; i < 3; i++)
+ {
+ sedaStageInterceptingMessageProcessor.process(event);
+ }
+
+ ArgumentMatcher<MuleEvent> notSameEvent = new
ArgumentMatcher<MuleEvent>()
+ {
+ public boolean matches(Object argument)
+ {
+ return !argument.equals(event);
+ }
+ };
+
+ // Two events are processed
+ verify(mockListener,
timeout(RECEIVE_TIMEOUT).times(2)).process(argThat(notSameEvent));
+
+ // One event gets processed by the exception strategy
+ verify(exceptionHandler,
timeout(RECEIVE_TIMEOUT).times(1)).handleException((Exception)any(),
+ argThat(notSameEvent));
+
+ }
+
+ public void testProcessOneWayWithException() throws Exception
+ {
+ final Latch latch = new Latch();
+ ThreadingProfile threadingProfile = new ChainedThreadingProfile(
+ muleContext.getDefaultThreadingProfile());
+ threadingProfile.setMuleContext(muleContext);
+
+ MessageProcessor mockListener = mock(MessageProcessor.class);
+ when(mockListener.process((MuleEvent)any())).thenAnswer(new
Answer<MuleEvent>()
+ {
+ public MuleEvent answer(InvocationOnMock invocation) throws
Throwable
+ {
+ latch.countDown();
+ throw new RuntimeException();
+ }
+ });
+
+ SedaStageInterceptingMessageProcessor
sedaStageInterceptingMessageProcessor = new
SedaStageInterceptingMessageProcessor(
+ "testProcessOneWayWithException",
"testProcessOneWayWithException", queueProfile, queueTimeout,
+ threadingProfile, queueStatistics, muleContext);
+ sedaStageInterceptingMessageProcessor.setListener(mockListener);
+ sedaStageInterceptingMessageProcessor.initialise();
+ sedaStageInterceptingMessageProcessor.start();
+
+ MessagingExceptionHandler exceptionHandler =
mock(MessagingExceptionHandler.class);
+ Flow flow = mock(Flow.class);
+ when(flow.getExceptionListener()).thenReturn(exceptionHandler);
+ when(flow.getProcessingStrategy()).thenReturn(new
AsynchronousProcessingStrategy());
+ final MuleEvent event = getTestEvent(TEST_MESSAGE, flow,
MessageExchangePattern.ONE_WAY);
+
+ sedaStageInterceptingMessageProcessor.process(event);
+
+ assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
+
+ ArgumentMatcher<MuleEvent> notSameEvent = new
ArgumentMatcher<MuleEvent>()
+ {
+ public boolean matches(Object argument)
+ {
+ return !argument.equals(event);
+ }
+ };
+
+ // One event get processed but then throws an exception
+ verify(mockListener,
timeout(RECEIVE_TIMEOUT).times(1)).process(argThat(notSameEvent));
+
+ // One event gets processed by the exception strategy
+ verify(exceptionHandler,
timeout(RECEIVE_TIMEOUT).times(1)).handleException((Exception)any(),
+ argThat(notSameEvent));
+
+ }
+
+ public void testProcessOneWayNoThreadingWithException() throws
Exception
+ {
+ ThreadingProfile threadingProfile = new ChainedThreadingProfile(
+ muleContext.getDefaultThreadingProfile());
+ threadingProfile.setDoThreading(false);
+ threadingProfile.setMuleContext(muleContext);
+
+ MessageProcessor mockListener = mock(MessageProcessor.class);
+ when(mockListener.process((MuleEvent)any())).thenThrow(new
RuntimeException());
+
+ SedaStageInterceptingMessageProcessor
sedaStageInterceptingMessageProcessor = new
SedaStageInterceptingMessageProcessor(
+ "testProcessOneWayNoThreadingWithException",
"testProcessOneWayNoThreadingWithException",
+ queueProfile, queueTimeout, threadingProfile, queueStatistics,
muleContext);
+ sedaStageInterceptingMessageProcessor.setListener(mockListener);
+ sedaStageInterceptingMessageProcessor.initialise();
+ sedaStageInterceptingMessageProcessor.start();
+
+ MessagingExceptionHandler exceptionHandler =
mock(MessagingExceptionHandler.class);
+ Flow flow = mock(Flow.class);
+ when(flow.getExceptionListener()).thenReturn(exceptionHandler);
+ when(flow.getProcessingStrategy()).thenReturn(new
AsynchronousProcessingStrategy());
+ MuleEvent event = getTestEvent(TEST_MESSAGE, flow,
MessageExchangePattern.ONE_WAY);
+
+ sedaStageInterceptingMessageProcessor.process(event);
+ }
+
@Override
protected AsyncInterceptingMessageProcessor
createAsyncInterceptingMessageProcessor(MessageProcessor listener)
throws Exception
Modified: branches/mule-3.x/pom.xml (23784 => 23785)
--- branches/mule-3.x/pom.xml 2012-02-01 17:38:38 UTC (rev 23784)
+++ branches/mule-3.x/pom.xml 2012-02-01 17:48:47 UTC (rev 23785)
@@ -530,7 +530,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
- <version>1.8.4</version>
+ <version>1.9.0</version>
</dependency>
<dependency>
http://www.cs.umd.edu/projects/PL/multithreadedtc/overview.html -->
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
(23780 => 23785)
---
branches/mule-3.2.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java 2012-02-01
16:30:00 UTC (rev 23780)
+++
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -1,74 +0,0 @@
-/*
- * $Id$
- *
--------------------------------------------------------------------------------------
- * Copyright (c) MuleSoft, Inc. All rights reserved.
http://www.mulesoft.com
- *
- * The software in this package is published under the terms of the CPAL
v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-
-package org.mule.test.integration.async;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.mule.api.MuleMessage;
-import org.mule.api.client.MuleClient;
-import org.mule.tck.AbstractServiceAndFlowTestCase;
-import org.mule.transport.NullPayload;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runners.Parameterized.Parameters;
-
-public class SedaStageWorkRejectionTestCase extends
AbstractServiceAndFlowTestCase
-{
- public SedaStageWorkRejectionTestCase(ConfigVariant variant, String
configResources)
- {
- super(variant, configResources);
- }
-
- public static Collection<Object[]> parameters()
- {
- return Arrays.asList(new Object[][]{
- {ConfigVariant.SERVICE,
-
"org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml"},
- {ConfigVariant.FLOW,
"org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml"}});
- }
-
- public void handleRejectedEventWithExceptionStrategy() throws Exception
- {
- // Send 3 messages
- MuleClient client = muleContext.getClient();
- int nrMessages = 3;
- for (int i = 0; i < nrMessages; i++)
- {
- client.dispatch("vm://flow.in", "some data " + i, null);
- }
-
- // Receive 2 messages
- for (int i = 0; i < 2; i++)
- {
- MuleMessage result = client.request("vm://flow.out",
RECEIVE_TIMEOUT);
- assertNotNull(result);
- assertNull(result.getExceptionPayload());
- assertFalse(result.getPayload() instanceof NullPayload);
-
- assertTrue(result.getPayloadAsString().contains("some data"));
- }
-
- // Third message doesn't arrive
- assertNull(client.request("vm://flow.out", RECEIVE_TIMEOUT / 5));
-
- // Third message was router via exception strategy
- MuleMessage result = client.request("vm://flow.exception",
RECEIVE_TIMEOUT);
- assertNotNull(result);
- }
-}
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
(from rev 23780,
branches/mule-3.2.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java)
(0 => 23785)
---
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java
(rev 0)
+++
branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/async/SedaStageWorkRejectionTestCase.java 2012-02-01
17:48:47 UTC (rev 23785)
@@ -0,0 +1,74 @@
+/*
+ * $Id$
+ *
--------------------------------------------------------------------------------------
+ * Copyright (c) MuleSoft, Inc. All rights reserved.
http://www.mulesoft.com
+ *
+ * The software in this package is published under the terms of the CPAL
v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.test.integration.async;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.mule.api.MuleMessage;
+import org.mule.api.client.MuleClient;
+import org.mule.tck.AbstractServiceAndFlowTestCase;
+import org.mule.transport.NullPayload;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+
+public class SedaStageWorkRejectionTestCase extends
AbstractServiceAndFlowTestCase
+{
+ public SedaStageWorkRejectionTestCase(ConfigVariant variant, String
configResources)
+ {
+ super(variant, configResources);
+ }
+
+ public static Collection<Object[]> parameters()
+ {
+ return Arrays.asList(new Object[][]{
+ {ConfigVariant.SERVICE,
+
"org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml"},
+ {ConfigVariant.FLOW,
"org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml"}});
+ }
+
+ public void handleRejectedEventWithExceptionStrategy() throws Exception
+ {
+ // Send 3 messages
+ MuleClient client = muleContext.getClient();
+ int nrMessages = 3;
+ for (int i = 0; i < nrMessages; i++)
+ {
+ client.dispatch("vm://flow.in", "some data " + i, null);
+ }
+
+ // Receive 2 messages
+ for (int i = 0; i < 2; i++)
+ {
+ MuleMessage result = client.request("vm://flow.out",
RECEIVE_TIMEOUT);
+ assertNotNull(result);
+ assertNull(result.getExceptionPayload());
+ assertFalse(result.getPayload() instanceof NullPayload);
+
+ assertTrue(result.getPayloadAsString().contains("some data"));
+ }
+
+ // Third message doesn't arrive
+ assertNull(client.request("vm://flow.out", RECEIVE_TIMEOUT / 5));
+
+ // Third message was router via exception strategy
+ MuleMessage result = client.request("vm://flow.exception",
RECEIVE_TIMEOUT);
+ assertNotNull(result);
+ }
+}
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
(23780 => 23785)
---
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml 2012-02-01
16:30:00 UTC (rev 23780)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
- xmlns:test="http://www.mulesoft.org/schema/mule/test"
- xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
-
- http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
- http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
- http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
- <description>
- reproduce error that crashes seda service when seda
- queue is full
- </description>
-
- <queued-asynchronous-processing-strategy
- name="max2ThreadSmallTimeout" maxThreads="2"
- poolExhaustedAction="WAIT" threadWaitTimeout="500" />
-
- <flow name="sedaFlowCrash" processingStrategy="max2ThreadSmallTimeout">
- <vm:inbound-endpoint address="vm://flow.in"
- exchange-pattern="one-way" />
- <test:component waitTime="1000" />
- <vm:outbound-endpoint address="vm://flow.out"
- exchange-pattern="one-way" />
- <default-exception-strategy>
- <vm:outbound-endpoint address="vm://flow.exception"
- exchange-pattern="one-way" />
- </default-exception-strategy>
- </flow>
-
-</mule>
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
(from rev 23780,
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml)
(0 => 23785)
---
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml
(rev 0)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-flow.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+ xmlns:test="http://www.mulesoft.org/schema/mule/test"
+ xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
+
+ http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
+ http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+ <description>
+ reproduce error that crashes seda service when seda
+ queue is full
+ </description>
+
+ <queued-asynchronous-processing-strategy
+ name="max2ThreadSmallTimeout" maxThreads="2"
+ poolExhaustedAction="WAIT" threadWaitTimeout="500" />
+
+ <flow name="sedaFlowCrash" processingStrategy="max2ThreadSmallTimeout">
+ <vm:inbound-endpoint address="vm://flow.in"
+ exchange-pattern="one-way" />
+ <test:component waitTime="1000" />
+ <vm:outbound-endpoint address="vm://flow.out"
+ exchange-pattern="one-way" />
+ <default-exception-strategy>
+ <vm:outbound-endpoint address="vm://flow.exception"
+ exchange-pattern="one-way" />
+ </default-exception-strategy>
+ </flow>
+
+</mule>
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
(23780 => 23785)
---
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml 2012-02-01
16:30:00 UTC (rev 23780)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
- xmlns:test="http://www.mulesoft.org/schema/mule/test"
- xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
-
- http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
- http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
- http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
">
-
- <description>
- reproduce error that crashes seda service when seda queue is full
- </description>
-
- <model>
- <service name="sedaFlowCrash">
- <inbound>
- <vm:inbound-endpoint address="vm://flow.in"
exchange-pattern="one-way" />
- </inbound>
- <test:component waitTime="1000" />
- <outbound>
- <pass-through-router>
- <vm:outbound-endpoint address="vm://flow.out"
exchange-pattern="one-way" />
- </pass-through-router>
- </outbound>
- <default-exception-strategy>
- <vm:outbound-endpoint address="vm://flow.exception"
exchange-pattern="one-way" />
- </default-exception-strategy>
- <threading-profile maxThreadsActive="2" threadWaitTimeout="500"
- poolExhaustedAction="WAIT" />
- </service>
- </model>
-
-</mule>
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
(from rev 23780,
branches/mule-3.2.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml)
(0 => 23785)
---
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml
(rev 0)
+++
branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/async/seda-stage-work-rejection-config-service.xml 2012-02-01
17:48:47 UTC (rev 23785)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+ xmlns:test="http://www.mulesoft.org/schema/mule/test"
+ xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
+
+ http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
+ http://www.mulesoft.org/schema/mule/test
http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
">
+
+ <description>
+ reproduce error that crashes seda service when seda queue is full
+ </description>
+
+ <model>
+ <service name="sedaFlowCrash">
+ <inbound>
+ <vm:inbound-endpoint address="vm://flow.in"
exchange-pattern="one-way" />
+ </inbound>
+ <test:component waitTime="1000" />
+ <outbound>
+ <pass-through-router>
+ <vm:outbound-endpoint address="vm://flow.out"
exchange-pattern="one-way" />
+ </pass-through-router>
+ </outbound>
+ <default-exception-strategy>
+ <vm:outbound-endpoint address="vm://flow.exception"
exchange-pattern="one-way" />
+ </default-exception-strategy>
+ <threading-profile maxThreadsActive="2" threadWaitTimeout="500"
+ poolExhaustedAction="WAIT" />
+ </service>
+ </model>
+
+</mule>
________________________________
http://xircles.codehaus.org/manage_email
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email