Package org.fudgemsg

Examples of org.fudgemsg.FudgeContext.deserialize()


    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


    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;
    }
   
    assertEquals(msg1, updates[0].getFields());
View Full Code Here

   * @throws IllegalArgumentException if the raw security is not an encoding of a {@code Tutorial1Security}
   */
  public static Tutorial1Security fromRawSecurity(final RawSecurity raw) {
    ArgumentChecker.isTrue(isInstance(raw), "raw");
    final FudgeContext context = OpenGammaFudgeContext.getInstance();
    final FudgeMsg fudgeMsg = context.deserialize(raw.getRawData()).getMessage();
    final FudgeDeserializer deserializer = new FudgeDeserializer(context);
    return new Tutorial1Security(raw, deserializer, fudgeMsg);
  }

  /**
 
View Full Code Here

    FudgeDeserializer deserializationContext = new FudgeDeserializer(context);
    ValueRequirement test = new ValueRequirement("DATA", ComputationTargetType.PRIMITIVE, USD);
    MutableFudgeMsg inMsg = serializationContext.objectToFudgeMsg(test);
    assertNotNull(inMsg);
    assertEquals(3, inMsg.getNumFields());
    FudgeMsg outMsg = context.deserialize(context.toByteArray(inMsg)).getMessage();
    ValueRequirement decoded = deserializationContext.fudgeMsgToObject(ValueRequirement.class, outMsg);
    assertEquals(test, decoded);
    test = new ValueRequirement("DATA", ComputationTargetType.PRIMITIVE, USD, ValueProperties.with(ValuePropertyNames.FUNCTION, "Foo").get());
    inMsg = serializationContext.objectToFudgeMsg(test);
    assertNotNull(inMsg);
View Full Code Here

    assertEquals(test, decoded);
    test = new ValueRequirement("DATA", ComputationTargetType.PRIMITIVE, USD, ValueProperties.with(ValuePropertyNames.FUNCTION, "Foo").get());
    inMsg = serializationContext.objectToFudgeMsg(test);
    assertNotNull(inMsg);
    assertEquals(4, inMsg.getNumFields());
    outMsg = context.deserialize(context.toByteArray(inMsg)).getMessage();
    decoded = deserializationContext.fudgeMsgToObject(ValueRequirement.class, outMsg);
    assertEquals(test, decoded);
  }

}
View Full Code Here

  public void fudgeEncoding() {
    FudgeContext context = OpenGammaFudgeContext.getInstance();
    CalculationJobSpecification spec1 = new CalculationJobSpecification(UniqueId.of("Test", "ViewCycle"), "config", Instant.now(), 1L);
    FudgeSerializer serializationContext = new FudgeSerializer(context);
    MutableFudgeMsg inMsg = serializationContext.objectToFudgeMsg(spec1);
    FudgeMsg outMsg = context.deserialize(context.toByteArray(inMsg)).getMessage();
    FudgeDeserializer deserializationContext = new FudgeDeserializer(context);
    CalculationJobSpecification spec2 = deserializationContext.fudgeMsgToObject(CalculationJobSpecification.class, outMsg);
    assertEquals(spec1, spec2);
  }
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.