Examples of HistoricVariableUpdate


Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

      List<HistoricDetail> variableUpdates = historyService.createHistoricDetailQuery().variableUpdates().list();

      assertEquals(2, variableUpdates.size());

      for (HistoricDetail detail : variableUpdates) {
        HistoricVariableUpdate update = (HistoricVariableUpdate) detail;
        boolean update1Processed = false;
        boolean update2Processed = false;

        if (!update1Processed && update.getValue().equals("value1")) {
          update1Processed = true;
        } else if (!update2Processed && update.getValue().equals("value2")) {
          update2Processed = true;
        } else {
          fail("unexpected variable update");
        }
      }
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

      // check history
      List<HistoricDetail> updates = historyService.createHistoricDetailQuery().variableUpdates().list();
      assertEquals(2, updates.size());

      Map<String, HistoricVariableUpdate> updatesMap = new HashMap<String, HistoricVariableUpdate>();
      HistoricVariableUpdate update = (HistoricVariableUpdate) updates.get(0);
      updatesMap.put((String) update.getValue(), update);
      update = (HistoricVariableUpdate) updates.get(1);
      updatesMap.put((String) update.getValue(), update);

      HistoricVariableUpdate update1 = updatesMap.get("1");
      HistoricVariableUpdate update2 = updatesMap.get("2");

      assertNotNull(update1.getActivityInstanceId());
      assertNotNull(update1.getExecutionId());
      HistoricActivityInstance historicActivityInstance1 = historyService.createHistoricActivityInstanceQuery().activityInstanceId(update1.getActivityInstanceId()).singleResult();
      assertEquals(historicActivityInstance1.getExecutionId(), update1.getExecutionId());
      assertEquals("usertask1", historicActivityInstance1.getActivityId());

      // TODO http://jira.codehaus.org/browse/ACT-1083
      assertNotNull(update2.getActivityInstanceId());
      HistoricActivityInstance historicActivityInstance2 = historyService.createHistoricActivityInstanceQuery().activityInstanceId(update2.getActivityInstanceId()).singleResult();
      assertEquals("usertask2", historicActivityInstance2.getActivityId());

    /*
     * This is OK! The variable is set on the root execution, on a execution never run through the activity, where the process instances
     * stands when calling the set Variable. But the ActivityId of this flow node is used. So the execution id's doesn't have to be equal.
     *
     * execution id: On which execution it was set
     * activity id: in which activity was the process instance when setting the variable
     */
      assertFalse(historicActivityInstance2.getExecutionId().equals(update2.getExecutionId()));
    }
  }
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

        .orderByVariableRevision()
        .asc()
        .list();

      for (HistoricDetail detail : details) {
        HistoricVariableUpdate variableDetail = (HistoricVariableUpdate) detail;
        assertEquals(0, variableDetail.getRevision());
      }
    }
  }
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

        .asc()
        .list();

      int i = 0;
      for (HistoricDetail detail : details) {
        HistoricVariableUpdate variableDetail = (HistoricVariableUpdate) detail;
        assertEquals(i, variableDetail.getRevision());
        i++;
      }
    }

  }
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

    if(historicDetail != null) {
      if(!(historicDetail instanceof HistoricVariableUpdate)) {
        throw new InvalidRequestException(Status.BAD_REQUEST, "Historic detail with Id '"+detailId + "' is not a variable update.");
      }

      HistoricVariableUpdate update = (HistoricVariableUpdate) historicDetail;

      if (ValueType.BYTES.getName().equals(update.getTypeName())) {
        byte[] valueBytes = (byte[]) update.getValue();
        if (valueBytes == null) {
          valueBytes = new byte[0];
        }

        return new ByteArrayInputStream(valueBytes);
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

    this.revision = revision;
    return this;
  }

  public HistoricVariableUpdate build() {
    HistoricVariableUpdate mockVariable = mock(HistoricVariableUpdate.class);
    when(mockVariable.getId()).thenReturn(id);
    when(mockVariable.getVariableName()).thenReturn(name);
    when(mockVariable.getVariableTypeName()).thenReturn(typedValue.getType().getName());

    if (ObjectValue.class.isAssignableFrom(typedValue.getClass())) {
      ObjectValue objectValue = (ObjectValue) typedValue;
      if (objectValue.isDeserialized()) {
        when(mockVariable.getValue()).thenReturn(typedValue.getValue());
      } else {
        when(mockVariable.getValue()).thenReturn(null);
      }
    } else {
      when(mockVariable.getValue()).thenReturn(typedValue.getValue());
    }

    when(mockVariable.getTypedValue()).thenReturn(typedValue);
    when(mockVariable.getProcessInstanceId()).thenReturn(processInstanceId);
    when(mockVariable.getErrorMessage()).thenReturn(errorMessage);
    when(mockVariable.getRevision()).thenReturn(revision);
    when(mockVariable.getTime()).thenReturn(DateTimeUtil.parseDate(time));
    when(mockVariable.getActivityInstanceId()).thenReturn(activityInstanceId);
    when(mockVariable.getTaskId()).thenReturn(taskId);
    when(mockVariable.getExecutionId()).thenReturn(executionId);
    when(mockVariable.getTypeName()).thenReturn(typedValue.getType().getName());

    return mockVariable;
  }
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

  @Test
  public void testGetSingleDetail() {
    MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

    HistoricVariableUpdate detailMock = builder.build();

    when(historicDetailQueryMock.detailId(detailMock.getId())).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.disableBinaryFetching()).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.disableCustomObjectDeserialization()).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.singleResult()).thenReturn(detailMock);

    given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_VAR_UPDATE_ID)
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

    ObjectValue serializedValue = MockObjectValue.fromObjectValue(
        Variables.objectValue("a value").serializationDataFormat("aDataFormat").create())
        .objectTypeName("aTypeName");

    MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate().typedValue(serializedValue);
    HistoricVariableUpdate variableInstanceMock = builder.build();

    when(historicDetailQueryMock.detailId(variableInstanceMock.getId())).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.disableBinaryFetching()).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.singleResult()).thenReturn(variableInstanceMock);

    given()
      .pathParam("id", builder.getId())
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

  public void testGetSingleVariableUpdateSerialized() {
    ObjectValue serializedValue = Variables.serializedObjectValue("a serialized value")
        .serializationDataFormat("aDataFormat").objectTypeName("aTypeName").create();

    MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate().typedValue(serializedValue);
    HistoricVariableUpdate variableInstanceMock = builder.build();

    when(historicDetailQueryMock.detailId(variableInstanceMock.getId())).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.disableBinaryFetching()).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.disableCustomObjectDeserialization()).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.singleResult()).thenReturn(variableInstanceMock);

    given()
View Full Code Here

Examples of org.camunda.bpm.engine.history.HistoricVariableUpdate

  @Test
  public void testGetSingleVariableInstanceForBinaryVariable() {
    MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

    HistoricVariableUpdate detailMock = builder
        .typedValue(Variables.byteArrayValue(null))
        .build();

    when(historicDetailQueryMock.detailId(detailMock.getId())).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.disableBinaryFetching()).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.disableCustomObjectDeserialization()).thenReturn(historicDetailQueryMock);
    when(historicDetailQueryMock.singleResult()).thenReturn(detailMock);

    given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_VAR_UPDATE_ID)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.