Package org.camunda.bpm.engine.history

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


        .asc()
        .list();

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

  }
View Full Code Here

    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

    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

  @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

    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

  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

  @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

  public void testBinaryDataForBinaryVariable() {
    final byte[] byteContent = "some bytes".getBytes();

    MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

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

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

    Response response = given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_VAR_UPDATE_ID)
    .then().expect()
View Full Code Here

  }

  @Test
  public void testBinaryDataForNonBinaryVariable() {
    HistoricVariableUpdate detailMock =  MockProvider.createMockHistoricVariableUpdate();

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

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

TOP

Related Classes of org.camunda.bpm.engine.history.HistoricVariableUpdate

Copyright © 2018 www.massapicom. 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.