Package org.fudgemsg

Examples of org.fudgemsg.MutableFudgeMsg


  /** Field name. */
  public static final String OPTION_TYPE_FIELD_NAME = "optionType";

  @Override
  public MutableFudgeMsg buildMessage(FudgeSerializer serializer, EquityIndexDividendFutureOptionSecurity object) {
    final MutableFudgeMsg msg = serializer.newMessage();
    EquityIndexDividendFutureOptionSecurityFudgeBuilder.toFudgeMsg(serializer, object, msg);
    return msg;
  }
View Full Code Here


  private static final String EXCHANGE_ID_FIELD_NAME = "exchangeId";
  private static final String SCHEME_NAME = "schemeName";

  @Override
  public MutableFudgeMsg buildMessage(final FudgeSerializer serializer, final BloombergCommodityFutureOptionVolatilitySurfaceInstrumentProvider object) {
    final MutableFudgeMsg message = serializer.newMessage();
    FudgeSerializer.addClassHeader(message, BloombergCommodityFutureOptionVolatilitySurfaceInstrumentProvider.class);
    message.add(PREFIX_FIELD_NAME, object.getFutureOptionPrefix());
    message.add(POSTFIX_FIELD_NAME, object.getPostfix());
    message.add(DATA_FIELD_NAME, object.getDataFieldName());
    message.add(CALL_FIELD_NAME, object.useCallAboveStrike());
    message.add(EXCHANGE_ID_FIELD_NAME, object.getExchangeIdName());
    message.add(SCHEME_NAME, object.getSchemeName());
    return message;
  }
View Full Code Here

  @BeforeMethod
  public void setUp() {
   
    _expectedRows = Lists.newArrayList();
   
    MutableFudgeMsg row = s_fudgeContext.newMessage();
    row.add("Name", "Kirk");
    row.add("JobTitle", "CEO");
    _expectedRows.add(row);
   
    row = s_fudgeContext.newMessage();
    row.add("Name", "Jim");
    row.add("JobTitle", "CTO");
    _expectedRows.add(row);
   
    row = s_fudgeContext.newMessage();
    row.add("Name", "Elaine");
    row.add("JobTitle", "CQO");
    _expectedRows.add(row);
   
    row = s_fudgeContext.newMessage();
    row.add("Name", "Andrew");
    row.add("JobTitle", "Engineer");
    _expectedRows.add(row);
   
    row = s_fudgeContext.newMessage();
    row.add("Name", "Alan");
    _expectedRows.add(row);
   
    _csvDocReader = new CSVDocumentReader(CSVDocumentReaderTest.class.getResource("test_csv_document_read.csv"));
   
  }
View Full Code Here

  /** The default value of the exchange id */
  private static final String DEFAULT_EXCHANGE_ID = "CBT";

  @Override
  public MutableFudgeMsg buildMessage(final FudgeSerializer serializer, final BloombergEquityFutureOptionVolatilitySurfaceInstrumentProvider object) {
    final MutableFudgeMsg message = serializer.newMessage();
    FudgeSerializer.addClassHeader(message, BloombergEquityFutureOptionVolatilitySurfaceInstrumentProvider.class);
    message.add(PREFIX_FIELD_NAME, object.getFutureOptionPrefix());
    message.add(POSTFIX_FIELD_NAME, object.getPostfix());
    message.add(DATA_FIELD_NAME, object.getDataFieldName());
    message.add(CALL_FIELD_NAME, object.useCallAboveStrike());
    message.add(EXCHANGE_ID_FIELD_NAME, object.getExchangeIdName());
    message.add(TICKER_SCHEME_NAME, object.getSchemeName());
    return message;
  }
View Full Code Here

    CollectingFudgeMessageReceiver collectingReceiver = new CollectingFudgeMessageReceiver();
    ByteArrayFudgeMessageReceiver fudgeReceiver = new ByteArrayFudgeMessageReceiver(collectingReceiver);
    DirectInvocationByteArrayMessageSender byteArraySender = new DirectInvocationByteArrayMessageSender(fudgeReceiver);
    ByteArrayFudgeMessageSender fudgeSender = new ByteArrayFudgeMessageSender(byteArraySender, context);
   
    MutableFudgeMsg msg = context.newMessage();
    msg.add("Foo", "Bar");
    msg.add("Number Problems", 99);
   
    fudgeSender.send(msg);
   
    List<FudgeMsgEnvelope> receivedMessages = collectingReceiver.getMessages();
    assertEquals(1, receivedMessages.size());
View Full Code Here

  public static MutableFudgeMsg toFudgeMsg(final FudgeSerializer serializer, final ExternalIdSearch object) {
    if (object == null) {
      return null;
    }
    final MutableFudgeMsg msg = serializer.newMessage();
    toFudgeMsg(serializer, object, msg);
    return msg;
  }
View Full Code Here

    toFudgeMsg(serializer, object, msg);
    return msg;
  }

  public static void toFudgeMsg(final FudgeSerializer serializer, final ExternalIdSearch object, final MutableFudgeMsg msg) {
    final MutableFudgeMsg ids = serializer.newMessage();
    for (ExternalId externalId : object.getExternalIds()) {
      addToMessage(ids, null, ExternalIdFudgeBuilder.toFudgeMsg(serializer, externalId));
    }
    addToMessage(msg, IDENTIFIERS_FIELD_NAME, ids);
    addToMessage(msg, SEARCH_TYPE_FIELD_NAME, object.getSearchType().name());
View Full Code Here

    FudgeContext context = new FudgeContext();
    FudgeRequestReceiver requestReceiver = new FudgeRequestReceiver() {
      @Override
      public FudgeMsg requestReceived(
          FudgeDeserializer deserializer, FudgeMsgEnvelope requestEnvelope) {
        MutableFudgeMsg response = deserializer.getFudgeContext().newMessage();
        response.add("Killing", "In The Name Of");
        return response;
      }
    };
   
    FudgeRequestSender sender = InMemoryRequestConduit.create(requestReceiver);
   
    MutableFudgeMsg request = context.newMessage();
    request.add("Rage", "Against The Machine");
   
    CollectingFudgeMessageReceiver responseReceiver = new CollectingFudgeMessageReceiver();
    sender.sendRequest(request, responseReceiver);
    List<FudgeMsgEnvelope> receivedMessages = responseReceiver.getMessages();
    assertEquals(1, receivedMessages.size());
View Full Code Here

  private static final String QUOTE_UNITS_FIELD = "quoteUnits";
  private static final String INSTRUMENT_PROVIDER_FIELD = "cubeInstrumentProvider";

  @Override
  public MutableFudgeMsg buildMessage(final FudgeSerializer serializer, final SwaptionVolatilityCubeSpecification object) {
    final MutableFudgeMsg message = serializer.newMessage();
    message.add(NAME_FIELD, object.getName());
    message.add(TARGET_FIELD, FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(object.getTarget()), object.getTarget().getClass()));
    message.add(CUBE_QUOTE_TYPE_FIELD, object.getCubeQuoteType());
    message.add(QUOTE_UNITS_FIELD, object.getQuoteUnits());
    serializer.addToMessageWithClassHeaders(message, INSTRUMENT_PROVIDER_FIELD, null, object.getCubeInstrumentProvider());
    return message;
  }
View Full Code Here

  private static final String XS_FIELD = "xs";
  private static final String YS_FIELD = "ys";

  @Override
  public MutableFudgeMsg buildMessage(final FudgeSerializer serializer, final VolatilitySurfaceDefinition<?, ?> object) {
    final MutableFudgeMsg message = serializer.newMessage();
    // the following forces it not to use a secondary type if one is available.
    message.add(TARGET_FIELD, FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(object.getTarget()), object.getTarget().getClass()));
    if (object.getTarget() instanceof Currency) {
      final Currency ccy = (Currency) object.getTarget();
      message.add(CURRENCY_FIELD, null, ccy.getCode());
    } else {
      // just for now...
      message.add(CURRENCY_FIELD, null, Currency.USD.getCode());
    }
    message.add(NAME_FIELD, object.getName());
    for (final Object x : object.getXs()) {
      if (x instanceof Number) {
        serializer.addToMessageWithClassHeaders(message, XS_FIELD, null, x);
      } else {
        message.add(XS_FIELD, null, FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(x), x.getClass()));
      }
    }
    for (final Object y : object.getYs()) {
      if (y instanceof Number) {
        serializer.addToMessageWithClassHeaders(message, YS_FIELD, null, y);
      } else {
        message.add(YS_FIELD, null, FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(y), y.getClass()));
      }
    }
    return message;
  }
View Full Code Here

TOP

Related Classes of org.fudgemsg.MutableFudgeMsg

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.