Ejemplo n.º 1
0
  public void testSettingGettingNestedGroupWithCustomAndStandardFields() throws FieldNotFound {
    final String settingValue = "SETTING_VALUE";

    final quickfix.fix44.QuoteRequest.NoRelatedSym gNoRelatedSym =
        buildNestedGroupWithCustomAndStandardFields(settingValue);

    // Getting part
    final quickfix.fix44.QuoteRequest.NoRelatedSym.NoLegs getgrp =
        new quickfix.fix44.QuoteRequest.NoRelatedSym.NoLegs();
    gNoRelatedSym.getGroup(1, getgrp);
    final StringField accessorField = new StringField(9001); // Custom Field
    final StringField gotField = getgrp.getField(accessorField);

    final LegSymbol accessorFieldStd = new LegSymbol(); // Standard Field
    final LegSymbol gotFieldStd = (LegSymbol) getgrp.getField(accessorFieldStd);

    assertEquals(
        "GettingValue is not the same the SettingValue", settingValue, gotField.getValue());

    assertEquals(
        "GettingValue is not the same the SettingValue", settingValue, gotFieldStd.getValue());
  }
Ejemplo n.º 2
0
  // Testing group re-usability when setting values
  public void testSettingGettingGroupByReusingGroup() throws FieldNotFound {
    // The root group
    final quickfix.fix44.QuoteRequest.NoRelatedSym gNoRelatedSym =
        new quickfix.fix44.QuoteRequest.NoRelatedSym();

    // Create the initial group
    final quickfix.fix44.QuoteRequest.NoRelatedSym.NoLegs nestedgroup =
        new quickfix.fix44.QuoteRequest.NoRelatedSym.NoLegs();
    final String notOverridenFieldValue = "Value1.1";
    nestedgroup.setField(new LegSymbol(notOverridenFieldValue));
    nestedgroup.setField(new StringField(9001, "Value1.2"));
    gNoRelatedSym.addGroup(nestedgroup);

    // Create the second group by re-using the same group and changing one value of only one field
    final String overridenFieldValue = "Value2.2";
    nestedgroup.setField(new StringField(9001, overridenFieldValue));
    gNoRelatedSym.addGroup(nestedgroup);

    // Getting part
    final quickfix.fix44.QuoteRequest.NoRelatedSym.NoLegs getgrp =
        new quickfix.fix44.QuoteRequest.NoRelatedSym.NoLegs();
    gNoRelatedSym.getGroup(2, getgrp);
    final StringField accessorField = new StringField(9001); // Custom Field
    final StringField gotField = getgrp.getField(accessorField);

    final LegSymbol accessorFieldStd = new LegSymbol(); // Standard Field
    final LegSymbol gotFieldStd = (LegSymbol) getgrp.getField(accessorFieldStd);

    // Ensures that the field overriden has been set correctly
    assertEquals(
        "GettingValue is not the same the SettingValue", overridenFieldValue, gotField.getValue());

    // Ensures that the field not overriden has been set correctly
    assertEquals(
        "GettingValue is not the same the SettingValue",
        notOverridenFieldValue,
        gotFieldStd.getValue());
  }