public void TestACustomCreatedExceptionHandlerWhichReturnsAValueAsResultThatGetsInvokedWithIcomingPort() { string destination = TcpUrlOpenEngSB + tmpGuid.ToString(); IIncomingPort inPort = new JmsIncomingPort(destination, new TestCustomExceptionHandler(), ConnectorId); inPort.Close(); Assert.AreEqual <String>(inPort.Receive(), "TestCase"); }
private MethodResultMessage WaitAndCheckAnswer(JmsDestination destinationinfo, String id) { IIncomingPort portIn = new JmsIncomingPort(JmsDestination.CreateDestinationString(destinationinfo.Host, id), ExceptionHandler, ConnectorId); string reply = portIn.Receive(); MethodResultMessage result = Marshaller.UnmarshallObject <MethodResultMessage>(reply); portIn.Close(); if (result.Result.Type == ReturnType.Exception) { throw new OpenEngSBException("Remote Exception while Registering service proxy", new Exception(result.Result.ClassName)); } return(result); }
public void TestJmsPortWithWrongUrlParameter() { string destination = "Wrong?" + tmpGuid.ToString(); // The exceptHandler returns null and so the is connector is not stored try { JmsPort outPort = new JmsIncomingPort(destination, new TestCustomExceptionHandler(), ConnectorId); Assert.Fail(); } catch { } }
/// <summary> /// Will be invoked when a call to the proxy has been made. /// </summary> /// <param name="msg">Message, which contains the Parameters of the Method</param> /// <returns>Received Method</returns> public override IMessage Invoke(IMessage msg) { IMethodCallMessage callMessage = msg as IMethodCallMessage; MethodCallMessage methodCallRequest = ToMethodCallRequest(callMessage); string methodCallMsg = Marshaller.MarshallObject(methodCallRequest); IOutgoingPort portOut = new JmsOutgoingPort(JmsDestination.CreateDestinationString(Host, HostQueue), Exceptionhandler, ConnectorId); portOut.Send(methodCallMsg, methodCallRequest.CallId); IIncomingPort portIn = new JmsIncomingPort(JmsDestination.CreateDestinationString(Host, methodCallRequest.CallId), Exceptionhandler, ConnectorId); string methodReturnMsg = portIn.Receive(); MethodResultMessage methodReturn = Marshaller.UnmarshallObject <MethodResultMessage>(methodReturnMsg); return(ToMessage(methodReturn.Result, callMessage)); }