Skip to content

Commit

Permalink
for integration tests, in the runFlow method check for responseEvent.…
Browse files Browse the repository at this point in the history
…getMessage().getExceptionPayload() != null and if true throw an exception so that the test fails
  • Loading branch information
Federico Recio authored and genjosanzo committed Apr 11, 2012
1 parent d85c1c7 commit 12e6415
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 4 deletions.
Expand Up @@ -34,6 +34,9 @@ protected <T> void runFlow(String flowName) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -29,11 +29,14 @@ protected Flow lookupFlowConstruct(String name) {
return (Flow) AbstractMuleTestCase.muleContext.getRegistry().lookupFlowConstruct(name);
}

protected void runFlow(String flowName) throws Exception {
protected <T> void runFlow(String flowName) throws Exception {
String payload = EMPTY_PAYLOAD;
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -29,13 +29,14 @@ protected Flow lookupFlowConstruct(String name) {
return (Flow) AbstractMuleTestCase.muleContext.getRegistry().lookupFlowConstruct(name);
}

protected <T> T runFlow(String flowName) throws Exception {
protected <T> void runFlow(String flowName) throws Exception {
String payload = EMPTY_PAYLOAD;
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);

return (T) responseEvent.getMessage().getPayload();
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -51,6 +51,9 @@ private Flow lookupFlowConstruct(String name) {
private Object runFlow(String flowName, String payload) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
if(event.getMessage().getExceptionPayload() != null) {
throw new Exception(event.getMessage().getExceptionPayload().getRootException());
}
return flow.process(event).getMessage().getPayload();
}
}
Expand Up @@ -34,6 +34,9 @@ protected <T> void runFlow(String flowName) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -34,6 +34,9 @@ protected <T> void runFlow(String flowName) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -34,6 +34,9 @@ protected <T> void runFlow(String flowName) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -34,6 +34,9 @@ protected <T> void runFlow(String flowName) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -34,6 +34,9 @@ protected <T> void runFlow(String flowName) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down
Expand Up @@ -34,6 +34,9 @@ protected <T> void runFlow(String flowName) throws Exception {
Flow flow = lookupFlowConstruct(flowName);
MuleEvent event = AbstractMuleTestCase.getTestEvent(payload);
MuleEvent responseEvent = flow.process(event);
if(responseEvent.getMessage().getExceptionPayload() != null) {
throw new Exception(responseEvent.getMessage().getExceptionPayload().getRootException());
}
}

protected <T> void runFlow(String flowName, T expect) throws Exception {
Expand Down

0 comments on commit 12e6415

Please sign in to comment.