ForwardMessagesAction extends TlsAction implements ReceivingAction, SendingAction { @Override public void execute(State state) throws WorkflowExecutionException { if (isExecuted()) { throw new WorkflowExecutionException("Action already executed!"); } assertAliasesSetProperly(); TlsContext receiveFromCtx = state.getTlsContext(receiveFromAlias); TlsContext forwardToCtx = state.getTlsContext(forwardToAlias); receiveMessages(receiveFromCtx); applyMessages(forwardToCtx); forwardMessages(forwardToCtx); } ForwardMessagesAction();  ForwardMessagesAction(String receiveFromAlias, String forwardToAlias); protected  ForwardMessagesAction(String receiveFromAlias, String forwardToAlias,
            ReceiveMessageHelper receiveMessageHelper);  ForwardMessagesAction(String receiveFromAlias, String forwardToAlias, List<ProtocolMessage> messages);  ForwardMessagesAction(String receiveFromAlias, String forwardToAlias, ProtocolMessage... messages); void setReceiveFromAlias(String receiveFromAlias); void setForwardToAlias(String forwardToAlias); @Override void execute(State state); String getReceiveFromAlias(); String getForwardToAlias(); @Override boolean executedAsPlanned(); @Override void reset(); @Override List<ProtocolMessage> getReceivedMessages(); @Override List<AbstractRecord> getReceivedRecords(); @Override List<ProtocolMessage> getSendMessages(); @Override List<AbstractRecord> getSendRecords(); List<ProtocolMessage> getMessages(); void setMessages(List<ProtocolMessage> messages); void setMessages(ProtocolMessage... messages); @Override int hashCode(); @Override boolean equals(Object obj); @Override Set<String> getAllAliases(); @Override void assertAliasesSetProperly(); String getReadableString(List<ProtocolMessage> messages); String getReadableString(List<ProtocolMessage> messages, Boolean verbose); @Override void normalize(); @Override void normalize(TlsAction defaultAction); @Override void filter(); @Override void filter(TlsAction defaultAction);  }
@Test public void executingTwiceThrowsException() throws Exception { action = new ForwardMessagesAction(ctx1Alias, ctx2Alias, alert); action.execute(state); assertTrue(action.isExecuted()); exception.expect(WorkflowExecutionException.class); exception.expectMessage("Action already executed!"); action.execute(state); }
@Test public void executingWithNullAliasThrowsException() throws Exception { action = new ForwardMessagesAction(null, ctx2Alias, alert); exception.expect(WorkflowExecutionException.class); exception .expectMessage("Can't execute ForwardMessagesAction with empty receive alias (if using XML: add <from/>"); action.execute(state); action = new ForwardMessagesAction(ctx1Alias, null, alert); exception.expect(WorkflowExecutionException.class); exception .expectMessage("Can't execute ForwardMessagesAction with empty forward alias (if using XML: add <to/>"); action.execute(state); }
@Test public void executingWithEmptyAliasThrowsException() throws Exception { action = new ForwardMessagesAction("", ctx2Alias, alert); exception.expect(WorkflowExecutionException.class); exception .expectMessage("Can't execute ForwardMessagesAction with empty receive alias (if using XML: add <from/>"); action.execute(state); action = new ForwardMessagesAction(ctx1Alias, "", alert); exception.expect(WorkflowExecutionException.class); exception .expectMessage("Can't execute ForwardMessagesAction with empty forward alias (if using XML: add <to/>"); action.execute(state); }