@Test
  public void getOperationFromQueue_oneInQueue() throws Exception {
    // given
    List<Operation> operations = createOperationsForQueue(1, 1);

    // when
    Operation dbOp = getOperationFromQueue(operations.get(0).getServiceInstance().getInstanceId());

    // then
    assertNotNull(dbOp);
    assertEquals(operations.get(0).getTkey(), dbOp.getTkey());
    assertEquals(Boolean.valueOf(true), Boolean.valueOf(dbOp.isForQueue()));
  }
  @Test
  public void getOperation_moreNotInQueue() throws Exception {
    // given
    List<Operation> operations = createOperationsNotForQueue(3, 2);

    // when
    Operation dbOp =
        getOperationByInstanceId(operations.get(0).getServiceInstance().getInstanceId());

    // then
    assertNotNull(dbOp);
    assertEquals(operations.get(0).getTkey(), dbOp.getTkey());
    assertEquals(Boolean.valueOf(false), Boolean.valueOf(dbOp.isForQueue()));
  }
  @Test
  public void addOperation() throws Exception {
    // given
    ServiceInstance si = createInstance("instanceId");
    Properties prop = givenOperationDescription();

    // when
    Operation op = this.addOperation(si, prop, TX_ID);

    // then
    Operation dbOp = retrieveOperation(op.getTkey());
    assertNotNull(dbOp);
    assertEquals(si, op.getServiceInstance());
    assertEquals(OP_ID, op.getOperationId());
    assertEquals(USER_ID, op.getUserId());
    assertEquals(TX_ID, op.getTransactionId());
    assertEquals(Boolean.valueOf(false), Boolean.valueOf(op.isForQueue()));
  }