Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetSingleDetail()
        public virtual void testGetSingleDetail()
        {
            MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

            HistoricVariableUpdate detailMock = builder.build();

            when(historicDetailQueryMock.detailId(detailMock.Id)).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).then().expect().statusCode(Status.OK.StatusCode).and().body("id", equalTo(builder.Id)).body("variableName", equalTo(builder.Name)).body("variableInstanceId", equalTo(builder.VariableInstanceId)).body("variableType", equalTo(VariableTypeHelper.toExpectedValueTypeName(builder.TypedValue.Type))).body("value", equalTo(builder.Value)).body("processDefinitionKey", equalTo(builder.ProcessDefinitionKey)).body("processDefinitionId", equalTo(builder.ProcessDefinitionId)).body("processInstanceId", equalTo(builder.ProcessInstanceId)).body("errorMessage", equalTo(builder.ErrorMessage)).body("activityInstanceId", equalTo(builder.ActivityInstanceId)).body("revision", equalTo(builder.Revision)).body("time", equalTo(builder.Time)).body("taskId", equalTo(builder.TaskId)).body("executionId", equalTo(builder.ExecutionId)).body("caseDefinitionKey", equalTo(builder.CaseDefinitionKey)).body("caseDefinitionId", equalTo(builder.CaseDefinitionId)).body("caseInstanceId", equalTo(builder.CaseInstanceId)).body("caseExecutionId", equalTo(builder.CaseExecutionId)).body("tenantId", equalTo(builder.TenantId)).when().get(HISTORIC_DETAIL_URL);

            verify(historicDetailQueryMock, times(1)).disableBinaryFetching();
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetSingleVariableUpdateDeserialized()
        public virtual void testGetSingleVariableUpdateDeserialized()
        {
            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.Id)).thenReturn(historicDetailQueryMock);
            when(historicDetailQueryMock.disableBinaryFetching()).thenReturn(historicDetailQueryMock);
            when(historicDetailQueryMock.singleResult()).thenReturn(variableInstanceMock);

            given().pathParam("id", builder.Id).then().expect().statusCode(Status.OK.StatusCode).and().body("id", equalTo(builder.Id)).body("variableName", equalTo(builder.Name)).body("variableInstanceId", equalTo(builder.VariableInstanceId)).body("variableType", equalTo(VariableTypeHelper.toExpectedValueTypeName(builder.TypedValue.Type))).body("value", equalTo("a value")).body("valueInfo.serializationDataFormat", equalTo("aDataFormat")).body("valueInfo.objectTypeName", equalTo("aTypeName")).body("processDefinitionKey", equalTo(builder.ProcessDefinitionKey)).body("processDefinitionId", equalTo(builder.ProcessDefinitionId)).body("processInstanceId", equalTo(builder.ProcessInstanceId)).body("errorMessage", equalTo(builder.ErrorMessage)).body("activityInstanceId", equalTo(builder.ActivityInstanceId)).body("revision", equalTo(builder.Revision)).body("time", equalTo(builder.Time)).body("taskId", equalTo(builder.TaskId)).body("executionId", equalTo(builder.ExecutionId)).body("caseDefinitionKey", equalTo(builder.CaseDefinitionKey)).body("caseDefinitionId", equalTo(builder.CaseDefinitionId)).body("caseInstanceId", equalTo(builder.CaseInstanceId)).body("caseExecutionId", equalTo(builder.CaseExecutionId)).body("tenantId", equalTo(builder.TenantId)).when().get(HISTORIC_DETAIL_URL);

            verify(historicDetailQueryMock, times(1)).disableBinaryFetching();
            verify(historicDetailQueryMock, never()).disableCustomObjectDeserialization();
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetBinaryDataForNullFileVariable()
        public virtual void testGetBinaryDataForNullFileVariable()
        {
            string filename = "test.txt";

            sbyte[]   byteContent   = null;
            FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.ToString()).create();

            MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

            HistoricVariableUpdate detailMock = builder.typedValue(variableValue).build();

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

            given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_VAR_UPDATE_ID).then().expect().statusCode(Status.OK.StatusCode).and().contentType(ContentType.TEXT).and().body(@is(equalTo(""))).when().get(VARIABLE_INSTANCE_BINARY_DATA_URL);
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBinaryDataForBinaryVariable()
        public virtual void testBinaryDataForBinaryVariable()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final byte[] byteContent = "some bytes".getBytes();
            sbyte[] byteContent = "some bytes".GetBytes();

            MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

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

            when(historicDetailQueryMock.detailId(detailMock.Id)).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().statusCode(Status.OK.StatusCode).contentType(ContentType.BINARY.ToString()).when().get(VARIABLE_INSTANCE_BINARY_DATA_URL);

            sbyte[] responseBytes = response.Body.asByteArray();
            Assert.assertEquals(StringHelper.NewString(byteContent), StringHelper.NewString(responseBytes));
            verify(historicDetailQueryMock, never()).disableBinaryFetching();
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBinaryDataForFileVariable()
        public virtual void testBinaryDataForFileVariable()
        {
            string filename = "test.txt";

            sbyte[]   byteContent   = "test".GetBytes();
            string    encoding      = "UTF-8";
            FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.ToString()).encoding(encoding).create();

            MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

            HistoricVariableUpdate detailMock = builder.typedValue(variableValue).build();

            when(historicDetailQueryMock.detailId(detailMock.Id)).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().statusCode(Status.OK.StatusCode).body(@is(equalTo(StringHelper.NewString(byteContent)))).and().header("Content-Disposition", "attachment; filename=" + filename).when().get(VARIABLE_INSTANCE_BINARY_DATA_URL);
            //due to some problems with wildfly we gotta check this separately
            string contentType = response.ContentType;

            assertThat(contentType, @is(either(CoreMatchers.equalTo <object>(ContentType.TEXT.ToString() + "; charset=UTF-8")).or(CoreMatchers.equalTo <object>(ContentType.TEXT.ToString() + ";charset=UTF-8"))));

            verify(historicDetailQueryMock, never()).disableBinaryFetching();
        }