@Test
  public void testAllConfigurationChanges() throws Exception {
    final ModelNode update =
        Util.getWriteAttributeOperation(ADDRESS, "max-history", ALL_MAX_HISTORY_SIZE);
    getModelControllerClient().execute(update);
    final ModelNode listConfigurationChanges = Util.createOperation("list-changes", ADDRESS);
    List<ModelNode> changes =
        getManagementClient().executeForResult(listConfigurationChanges).asList();
    assertThat(changes.toString(), changes.size(), is(ALL_MAX_HISTORY_SIZE));
    for (ModelNode change : changes) {
      assertThat(change.hasDefined(OPERATION_DATE), is(true));
      assertThat(change.hasDefined(USER_ID), is(false));
      assertThat(change.hasDefined(DOMAIN_UUID), is(false));
      assertThat(change.hasDefined(ACCESS_MECHANISM), is(true));
      assertThat(change.get(ACCESS_MECHANISM).asString(), is("NATIVE"));
      // TODO Elytron - Restore capturing the Remote address.
      // assertThat(change.hasDefined(REMOTE_ADDRESS), is(true));
      assertThat(change.get(OPERATIONS).asList().size(), is(1));
    }

    ModelNode currentChange = changes.get(0);
    ModelNode currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(WRITE_ATTRIBUTE_OPERATION));
    assertThat(currentChangeOp.get(OP_ADDR).asString(), is(ADDRESS.toModelNode().asString()));
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChange = changes.get(1);
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(WRITE_ATTRIBUTE_OPERATION));
    assertThat(
        currentChangeOp.get(OP_ADDR).asString(),
        is(ALLOWED_ORIGINS_ADDRESS.toModelNode().asString()));
    assertThat(currentChange.get(OUTCOME).asString(), is(FAILED));
    currentChange = changes.get(2);
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(REMOVE));
    assertThat(currentChangeOp.get(OP_ADDR).asString(), is(SYSTEM_PROPERTY_ADDRESS.toString()));
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChange = changes.get(3);
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(UNDEFINE_ATTRIBUTE_OPERATION));
    assertThat(
        currentChangeOp.get(OP_ADDR).asString(),
        is(ALLOWED_ORIGINS_ADDRESS.toModelNode().asString()));
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChange = changes.get(4);
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(ADD));
    assertThat(
        currentChangeOp.get(OP_ADDR).asString(),
        is(SYSTEM_PROPERTY_ADDRESS.toModelNode().asString()));
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
  }
  private void validateChanges(List<ModelNode> changes) throws IOException {
    for (ModelNode change : changes) {
      assertThat(change.hasDefined(OPERATION_DATE), is(true));
      assertThat(change.hasDefined(USER_ID), is(false));
      assertThat(change.hasDefined(DOMAIN_UUID), is(true));
      assertThat(change.hasDefined(ACCESS_MECHANISM), is(true));
      assertThat(change.get(ACCESS_MECHANISM).asString(), is("NATIVE"));
      // TODO Elytron - Restore capturing the Remote address.
      // assertThat(change.hasDefined(REMOTE_ADDRESS), is(true));
      assertThat(change.get(OPERATIONS).asList().size(), is(1));
    }
    ModelNode currentChange = changes.get(0);
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    ModelNode currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(REMOVE));
    assertThat(removePrefix(currentChangeOp).toString(), is(IN_MEMORY_HANDLER_ADDRESS.toString()));

    currentChange = changes.get(1);
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(WRITE_ATTRIBUTE_OPERATION));
    assertThat(removePrefix(currentChangeOp).toString(), is(IN_MEMORY_HANDLER_ADDRESS.toString()));
    assertThat(currentChangeOp.get(VALUE).asInt(), is(50));

    currentChange = changes.get(2);
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(ADD));
    assertThat(removePrefix(currentChangeOp).toString(), is(IN_MEMORY_HANDLER_ADDRESS.toString()));

    currentChange = changes.get(3);
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(REMOVE));
    assertThat(removePrefix(currentChangeOp).toString(), is(SYSTEM_PROPERTY_ADDRESS.toString()));

    currentChange = changes.get(4);
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(WRITE_ATTRIBUTE_OPERATION));
    assertThat(removePrefix(currentChangeOp).toString(), is(AUDIT_LOG_ADDRESS.toString()));
    assertThat(currentChangeOp.get(VALUE).asBoolean(), is(true));

    currentChange = changes.get(5);
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(UNDEFINE_ATTRIBUTE_OPERATION));
    assertThat(removePrefix(currentChangeOp).toString(), is(ALLOWED_ORIGINS_ADDRESS.toString()));

    assertThat(currentChangeOp.get(NAME).asString(), is(ALLOWED_ORIGINS));

    currentChange = changes.get(6);
    assertThat(currentChange.get(OUTCOME).asString(), is(SUCCESS));
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(OP).asString(), is(ADD));
    assertThat(removePrefix(currentChangeOp).toString(), is(SYSTEM_PROPERTY_ADDRESS.toString()));
    assertThat(currentChangeOp.get(VALUE).asString(), is("changeConfig"));

    currentChange = changes.get(7);
    assertThat(currentChange.get(OUTCOME).asString(), is(FAILED));
    currentChangeOp = currentChange.get(OPERATIONS).asList().get(0);
    assertThat(currentChangeOp.get(NAME).asString(), is(ALLOWED_ORIGINS));
  }