コード例 #1
0
  /** Test setter and getter methods. */
  @Test(timeout = 1000)
  public void testSetterGetter() {
    FBindingOperationInputMessage input = new FBindingOperationInputMessage("input");
    FBindingOperationOutputMessage output = new FBindingOperationOutputMessage("output");
    FBindingOperation bindingOperation =
        FBindingOperation.factory.create("foo", FOperationType.ONE_WAY, input, output);

    // Test operation name
    bindingOperation.setBindingOperationName("bar");
    assertEquals(
        "Binding operation name must match new value.",
        "bar",
        bindingOperation.getBindingOperationName());

    // Test operation input
    bindingOperation.setInputMessage(new FBindingOperationInputMessage("newInput"));
    assertEquals(
        "Binding operation input message name must match new value.",
        "newInput",
        bindingOperation.getInputMessage().getBindingOperationMessageName());

    // Test operation output
    bindingOperation.setOutputMessage(new FBindingOperationOutputMessage("newOutput"));
    assertEquals(
        "Binding operation output message name must match new value.",
        "newOutput",
        bindingOperation.getOutputMessage().getBindingOperationMessageName());
  }
コード例 #2
0
  /** Test object equality. */
  @Test(timeout = 1000)
  public void testEquality() {
    FBindingOperationInputMessage firstInput = new FBindingOperationInputMessage("firstInput");
    FBindingOperationInputMessage secondInput = new FBindingOperationInputMessage("secondInput");
    FBindingOperationOutputMessage output = new FBindingOperationOutputMessage("output");
    FBindingOperation firstOperation =
        FBindingOperation.factory.create(
            "foo", FOperationType.REQUEST_RESPONSE, firstInput, output);
    FBindingOperation secondOperation =
        FBindingOperation.factory.create(
            "bar", FOperationType.REQUEST_RESPONSE, secondInput, output);

    // Notice: Operation type is solely used for implicit message naming in
    // FBindingOperation, so we cannot reset it after calling the constructor.

    // Unequality
    assertFalse(
        "Operation objects with different names and messages must not be equal.",
        firstOperation.equals(secondOperation));

    secondOperation.setInputMessage(firstInput);
    assertFalse(
        "Operation objects with different names must not be equal.",
        firstOperation.equals(secondOperation));

    // Equality
    secondOperation.setBindingOperationName("foo");
    assertTrue("Operation objects must be equal.", firstOperation.equals(secondOperation));
  }