This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] | |
<dependency> | |
<groupId>org.skyscreamer</groupId> | |
<artifactId>jsonassert</artifactId> | |
<version>1.5.0</version> | |
<scope>test</scope> | |
<exclusions> | |
<exclusion> | |
<groupId>com.vaadin.external.google</groupId> | |
<artifactId>android-json</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] | |
<spring:beans> | |
[...] | |
<spring:bean | |
id="httpRequestExceptionInterceptor" | |
class="com.ricston.mule.interceptors.HttpRequestExceptionInterceptor"> | |
<spring:property name="lastErrorMessageVarName" value="lastHttpError"/> | |
</spring:bean> | |
<aop:config> | |
<aop:aspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HttpRequestExceptionInterceptor { | |
/** Flow variable name for transferring the outside event session to inside the enricher */ | |
private static final String OUTSIDE_EVENT_SESSION = | |
"_HttpRequestExceptionInterceptor_outsideEventSession"; | |
/** Session variable name for the MuleMessage on an exception */ | |
private String lastErrorMessageVarName = "lastHttpError"; | |
public void setLastErrorMessageVarName(final String name) { | |
this.lastErrorMessageVarName = name; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Replicates the belongs() method used in Mule's SuccessStatusValidator | |
def belongs(values, value) { | |
var intValue = Integer.parseInt(value); | |
var valueParts = values.toString().split(','); //values.split sometimes fails. Strange... | |
var valuePart; | |
var limits; | |
var code; | |
var lower; | |
var upper; | |
var i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isHttpBroken() { | |
return (message.inboundProperties.'http.status' >= 400); // or better | |
} | |
def errorMessage(pmessage, pwhateveryouneed) { | |
if (isHttpBroken()) { // would need to add expected here as well | |
flowVars.errorContainer.message = pmessage; | |
flowVars.errorContainer.httpStatus = message.inboundProperties.'http.status'; | |
flowVars.errorContainer.httpReason = message.inboundProperties.'http.reason'; | |
flowVars.errorContainer.payload = message.payloadAs(java.lang.String); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* © 2019 Ricston Ltd is protected under international copyright law. The software in this package | |
* is published under the terms of the Ricston End User Licensing Agreement (EULA), a copy of which | |
* has been included with this distribution in the LICENSE.md file. | |
*/ | |
package com.ricston.munit.mock; | |
import static org.mule.api.transport.PropertyScope.INBOUND; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": #[flowVars.currentTestId], | |
"name": "item #[flowVars.currentTestId]", | |
"price": 6.9, | |
"_links": { | |
"self": { | |
"href": "http://localhost:8082/api/products/#[flowVars.currentTestId]" | |
}, | |
"product": { | |
"href": "http://localhost:8082/api/products/#[flowVars.currentTestId]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<spring:beans> | |
<!-- [...] --> | |
<spring:bean | |
id="interceptMockAdvice" | |
class="com.ricston.munit.mock.MockInterceptor"> | |
<property name="triggerExpression" value="#[true]"/> | |
</spring:bean> | |
<aop:config> | |
<aop:aspect | |
id="interceptMockAspect" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [...] | |
public class MockInterceptor implements MuleContextAware { | |
//[...] | |
public MessageProcessorBehavior aroundGetBetterMatchingBehavior(final ProceedingJoinPoint joinPoint) throws Throwable { | |
if (joinPoint.getTarget() instanceof MessageProcessorManager == false | |
|| joinPoint.getArgs()[0] instanceof MessageProcessorCall == false) { | |
throw new IllegalArgumentException( | |
"MockInterceptor needs signature MessageProcessorManager.getBetterMatchingBehavior(*)"); | |
// or better log and return joinPoint.proceed(); ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.skyscreamer</groupId> | |
<artifactId>jsonassert</artifactId> | |
<version>1.5.0</version> | |
<scope>test</scope> | |
<exclusions> | |
<exclusion> | |
<groupId>com.vaadin.external.google</groupId> | |
<artifactId>json-android</artifactId> | |
</exclusion> |
NewerOlder