Package org.fudgemsg.mapping

Examples of org.fudgemsg.mapping.FudgeDeserializer


      Thread.sleep(100);
    }
    Thread.sleep(100);
    assertEquals(1, _collectingReceiver.getMessages().size());
   
    FudgeDeserializer deserializer = new FudgeDeserializer(fudgeContext);
    for (byte[] byteArray : _collectingReceiver.getMessages()) {
      FudgeMsgEnvelope msgEnvelope = fudgeContext.deserialize(byteArray);
      LiveDataValueUpdateBean update = LiveDataValueUpdateBeanFudgeBuilder.fromFudgeMsg(deserializer, msgEnvelope.getMessage());
      assertEquals(msg, update.getFields());
    }
View Full Code Here


    }
    Thread.sleep(100);
    assertEquals(3, _collectingReceiver.getMessages().size());
    LiveDataValueUpdateBean[] updates = new LiveDataValueUpdateBean[3];
   
    FudgeDeserializer deserializer = new FudgeDeserializer(fudgeContext);
    for (int i = 0; i < _collectingReceiver.getMessages().size(); i++) {
      FudgeMsgEnvelope msgEnvelope = fudgeContext.deserialize(_collectingReceiver.getMessages().get(i));
      LiveDataValueUpdateBean update = LiveDataValueUpdateBeanFudgeBuilder.fromFudgeMsg(deserializer, msgEnvelope.getMessage());
      updates[i] = update;
    }
View Full Code Here

    assertNull(PagingRequestFudgeBuilder.toFudgeMsg(new FudgeSerializer(OpenGammaFudgeContext.getInstance()), null));
    assertNotNull(PagingRequestFudgeBuilder.toFudgeMsg(new FudgeSerializer(OpenGammaFudgeContext.getInstance()), sample));
  }

  public void test_fromFudgeMsg() {
    assertNull(PagingRequestFudgeBuilder.fromFudgeMsg(new FudgeDeserializer(OpenGammaFudgeContext.getInstance()), null));
  }
View Full Code Here

    assertNull(PagingFudgeBuilder.toFudgeMsg(new FudgeSerializer(OpenGammaFudgeContext.getInstance()), null));
    assertNotNull(PagingFudgeBuilder.toFudgeMsg(new FudgeSerializer(OpenGammaFudgeContext.getInstance()), sample));
  }

  public void test_fromFudgeMsg() {
    assertNull(PagingFudgeBuilder.fromFudgeMsg(new FudgeDeserializer(OpenGammaFudgeContext.getInstance()), null));
  }
View Full Code Here

      @Override
      public void messageReceived(FudgeContext fudgeContext,
          FudgeMsgEnvelope msgEnvelope) {
       
        FudgeMsg msg = msgEnvelope.getMessage();
        ResolveResponse response = ResolveResponse.fromFudgeMsg(new FudgeDeserializer(_fudgeContext), msg);
        resolved.set(response.getResolvedSpecification());
        responseReceived.set(true);
       
      }
    });
View Full Code Here

  // until we can get a handle on the construction of receivers based on responses.
  @Override
  public void messageReceived(FudgeContext fudgeContext,
      FudgeMsgEnvelope msgEnvelope) {
    FudgeMsg fudgeMsg = msgEnvelope.getMessage();
    LiveDataValueUpdateBean update = LiveDataValueUpdateBeanFudgeBuilder.fromFudgeMsg(new FudgeDeserializer(fudgeContext), fudgeMsg);
    valueUpdate(update);
  }
View Full Code Here

        if ((envelope == null) || (envelope.getMessage() == null)) {
          throw new OpenGammaRuntimeException("Got a message that can't be deserialized from a Fudge message.");
        }
        FudgeMsg msg = envelope.getMessage();
       
        LiveDataSubscriptionResponseMsg responseMessage = LiveDataSubscriptionResponseMsg.fromFudgeMsg(new FudgeDeserializer(getFudgeContext()), msg);
        if (responseMessage.getResponses().isEmpty()) {
          throw new OpenGammaRuntimeException("Got empty subscription response " + responseMessage);
        }
       
        messageReceived(responseMessage);
View Full Code Here

  }

  @Override
  protected void readFromStorage() {
    FudgeSerializer serializer = new FudgeSerializer(OpenGammaFudgeContext.getInstance());
    FudgeDeserializer deserializer = new FudgeDeserializer(OpenGammaFudgeContext.getInstance());
    DBCursor cursor = _mongoCollection.find();
    while (cursor.hasNext()) {
      DBObject mainObject = cursor.next();
      DBObject fieldData = (DBObject) mainObject.get("fieldData");
      MutableFudgeMsg msg = serializer.objectToFudgeMsg(fieldData);
View Full Code Here

  @Override
  public void saveToStorage(Set<PersistentSubscription> newState) {
    clean();
    FudgeSerializer serializer = new FudgeSerializer(OpenGammaFudgeContext.getInstance());
    FudgeDeserializer deserializer = new FudgeDeserializer(OpenGammaFudgeContext.getInstance());
    List<DBObject> objects = new ArrayList<DBObject>();
    for (PersistentSubscription sub : newState) {
      FudgeMsg msg = LiveDataSpecificationFudgeBuilder.toFudgeMsg(serializer, sub.getFullyQualifiedSpec());
      DBObject fieldData = deserializer.fudgeMsgToObject(DBObject.class, msg);
      BasicDBObject mainObject = new BasicDBObject();
      mainObject.append("fieldData", fieldData);
      objects.add(mainObject);
    }
    _mongoCollection.insert(objects);
View Full Code Here

   * Dispatches a message to the server.
   *
   * @param msg  the message, not null
   */
  private void dispatchLiveDataUpdate(FudgeMsg msg) {
    CogdaLiveDataUpdateMessage updateMessage = CogdaLiveDataUpdateBuilder.buildObjectStatic(new FudgeDeserializer(getFudgeContext()), msg);
    LiveDataSpecification ldspec = new LiveDataSpecification(updateMessage.getNormalizationScheme(), updateMessage.getSubscriptionId());
    LiveDataValueUpdateBean valueUpdateBean = new LiveDataValueUpdateBean(0L, ldspec, updateMessage.getValues());
    super.valueUpdate(valueUpdateBean);
  }
View Full Code Here

TOP

Related Classes of org.fudgemsg.mapping.FudgeDeserializer

Copyright © 2018 www.massapicom. 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.