Package com.opengamma.transport

Examples of com.opengamma.transport.CollectingFudgeMessageReceiver.waitForMessage()


        public void run() {
          sender.sendRequest(FudgeContext.EMPTY_MESSAGE, collectingReceiver);
        }
      }.start();
    }
    assertNotNull("Message should be received in 4s timeout", collectingReceiver.waitForMessage(4000L));
    assertNotNull("Message should be received in 4s timeout", collectingReceiver.waitForMessage(4000L));
  }

  @Test(invocationCount = 5, successPercentage = 19)
  public void parallelSendTest_single() throws Exception {
View Full Code Here


          sender.sendRequest(FudgeContext.EMPTY_MESSAGE, collectingReceiver);
        }
      }.start();
    }
    assertNotNull("Message should be received in 4s timeout", collectingReceiver.waitForMessage(4000L));
    assertNotNull("Message should be received in 4s timeout", collectingReceiver.waitForMessage(4000L));
  }

  @Test(invocationCount = 5, successPercentage = 19)
  public void parallelSendTest_single() throws Exception {
    final AtomicInteger concurrencyMax = new AtomicInteger(0);
View Full Code Here

    client.setPortNumber(server.getPortNumber());
    // connect and send testMessage1, then verify that testMessage2 was sent back
    final CollectingFudgeMessageReceiver clientReceiver = new CollectingFudgeMessageReceiver();
    client.setFudgeMessageReceiver(clientReceiver);
    client.getFudgeMessageSender().send(testMessage1);
    final FudgeMsgEnvelope envelope = clientReceiver.waitForMessage(Timeout.standardTimeoutMillis());
    assertNotNull(envelope);
    assertEquals(testMessage2, envelope.getMessage());
    client.stop();
    server.stop();
  }
View Full Code Here

    client.getFudgeMessageSender().send(testMessage1);
    assertTrue(message3Receiver.getMessages().isEmpty());
    client.getFudgeMessageSender().send(testMessage2);
    assertTrue(message3Receiver.getMessages().isEmpty());
    client.getFudgeMessageSender().send(testMessage3);
    final FudgeMsgEnvelope envelope = message3Receiver.waitForMessage(Timeout.standardTimeoutMillis());
    assertNotNull(envelope);
    assertEquals(testMessage3, envelope.getMessage());
    server.stop();
    client.stop();
  }
View Full Code Here

    client.getFudgeMessageSender().send(FudgeContext.EMPTY_MESSAGE);
    client.getFudgeMessageSender().send(FudgeContext.EMPTY_MESSAGE);
    client.getFudgeMessageSender().send(FudgeContext.EMPTY_MESSAGE);
    final int[] result = new int[4];
    for (int i = 0; i < 4; i++) {
      final FudgeMsgEnvelope envelope = responses.waitForMessage(Timeout.standardTimeoutMillis() * 2L);
      assertNotNull (envelope);
      result[i] = envelope.getMessage().getInt("foo");
    }
    return result;
  }
View Full Code Here

    final SocketFudgeMessageSender sender = new SocketFudgeMessageSender();
    sender.setInetAddress(InetAddress.getLocalHost());
    sender.setPortNumber(server.getPortNumber());
    sender.send(FudgeContext.EMPTY_MESSAGE);
    sender.send(FudgeContext.EMPTY_MESSAGE);
    assertNotNull (receiver.waitForMessage(2000));
    assertNotNull (receiver.waitForMessage(2000));
  }

  public void parallelSendTest_single() throws Exception {
    for (int retry = 0; retry < 3; retry++) {
View Full Code Here

    sender.setInetAddress(InetAddress.getLocalHost());
    sender.setPortNumber(server.getPortNumber());
    sender.send(FudgeContext.EMPTY_MESSAGE);
    sender.send(FudgeContext.EMPTY_MESSAGE);
    assertNotNull (receiver.waitForMessage(2000));
    assertNotNull (receiver.waitForMessage(2000));
  }

  public void parallelSendTest_single() throws Exception {
    for (int retry = 0; retry < 3; retry++) {
      try {
View Full Code Here

    conduit.getEnd2 ().getFudgeMessageSender().send (FudgeSerializer.addClassHeader(scontext.objectToFudgeMsg (new Init(0)), Init.class, RemoteCalcNodeMessage.class));
    final CalculationJob job = createTestCalculationJob();
    AbstractIdentifierMap.convertIdentifiers(identifierMap, job);
    conduit.getEnd2().getFudgeMessageSender().send(
        FudgeSerializer.addClassHeader(scontext.objectToFudgeMsg(new Execute(job)), Execute.class, RemoteCalcNodeMessage.class));
    final FudgeMsgEnvelope resultMsgEnvelope = messages.waitForMessage(TIMEOUT);
    assertNotNull(resultMsgEnvelope);
    final RemoteCalcNodeMessage resultMessage = dcontext.fudgeMsgToObject(RemoteCalcNodeMessage.class, resultMsgEnvelope.getMessage());
    assertTrue(resultMessage instanceof Result);
    final Result result = (Result) resultMessage;
    assertEquals(job.getSpecification(), result.getResult().getSpecification());
View Full Code Here

    final CalculationJob job1 = createTestCalculationJob();
    final CalculationJob job2 = createTestCalculationJob();
    AbstractIdentifierMap.convertIdentifiers(identifierMap, job1);
    conduit.getEnd2().getFudgeMessageSender().send(FudgeSerializer.addClassHeader(scontext.objectToFudgeMsg(new Execute(job1)), Execute.class, RemoteCalcNodeMessage.class));
    conduit.getEnd2().getFudgeMessageSender().send(FudgeSerializer.addClassHeader(scontext.objectToFudgeMsg(new IsAlive(Arrays.asList (job1.getSpecification (), job2.getSpecification ()))), IsAlive.class, RemoteCalcNodeMessage.class));
    final FudgeMsgEnvelope resultMsgEnvelope = messages.waitForMessage(TIMEOUT);
    assertNotNull(resultMsgEnvelope);
    final RemoteCalcNodeMessage failureMessage = dcontext.fudgeMsgToObject(RemoteCalcNodeMessage.class, resultMsgEnvelope.getMessage());
    assertTrue(failureMessage instanceof Failure);
    final Failure failure = (Failure) failureMessage;
    assertEquals(job2.getSpecification(), failure.getJob());
View Full Code Here

    final RemoteCalcNodeMessage failureMessage = dcontext.fudgeMsgToObject(RemoteCalcNodeMessage.class, resultMsgEnvelope.getMessage());
    assertTrue(failureMessage instanceof Failure);
    final Failure failure = (Failure) failureMessage;
    assertEquals(job2.getSpecification(), failure.getJob());
    // No more messages - job1 is alive
    assertNull (messages.waitForMessage(TIMEOUT));
  }

  public void errorInvocation() {
    final IdentifierMap identifierMap = new InMemoryIdentifierMap ();
    final DirectFudgeConnection conduit = new DirectFudgeConnection(s_fudgeContext);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.