Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetSingleVariableInstanceForBinaryVariable()
        public virtual void testGetSingleVariableInstanceForBinaryVariable()
        {
            MockVariableInstanceBuilder builder = MockProvider.mockVariableInstance();
            VariableInstance            variableInstanceMock = builder.typedValue(Variables.byteArrayValue(null)).build();

            when(variableInstanceQueryMock.variableId(variableInstanceMock.Id)).thenReturn(variableInstanceQueryMock);
            when(variableInstanceQueryMock.disableBinaryFetching()).thenReturn(variableInstanceQueryMock);
            when(variableInstanceQueryMock.disableCustomObjectDeserialization()).thenReturn(variableInstanceQueryMock);
            when(variableInstanceQueryMock.singleResult()).thenReturn(variableInstanceMock);

            given().pathParam("id", MockProvider.EXAMPLE_VARIABLE_INSTANCE_ID).then().expect().statusCode(Status.OK.StatusCode).and().body("type", equalTo(VariableTypeHelper.toExpectedValueTypeName(ValueType.BYTES))).body("value", nullValue()).when().get(VARIABLE_INSTANCE_URL);

            verify(variableInstanceQueryMock, times(1)).disableBinaryFetching();
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetSingleVariableInstanceForBinaryVariable()
        public virtual void testGetSingleVariableInstanceForBinaryVariable()
        {
            MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();

            HistoricVariableUpdate detailMock = builder.typedValue(Variables.byteArrayValue(null)).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();
        }
Exemple #3
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();
        }
Exemple #4
0
            public Void execute(CommandContext commandContext)
            {
                //create a variable
                VariableInstanceEntity variable = VariableInstanceEntity.createAndInsert("aVariable", Variables.byteArrayValue(new sbyte[0]));
                string byteArrayId = variable.ByteArrayValueId;

                //delete the variable
                variable.delete();

                //check if the variable is deleted transient
                //-> no insert and delete stmt will be flushed
                DbEntityManager dbEntityManager = commandContext.DbEntityManager;
                CachedDbEntity  cachedEntity    = dbEntityManager.DbEntityCache.getCachedEntity(typeof(ByteArrayEntity), byteArrayId);

                DbEntityState entityState = cachedEntity.EntityState;

                assertEquals(DbEntityState.DELETED_TRANSIENT, entityState);

                return(null);
            }
Exemple #5
0
        public virtual void testConcurrentFetchAndDelete()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String processInstanceId = deployAndStartProcess(PROCESS_WITH_USERTASK, org.camunda.bpm.engine.variable.Variables.createVariables().putValue(VARIABLE_NAME, org.camunda.bpm.engine.variable.Variables.byteArrayValue(VARIABLE_VALUE.getBytes()))).getId();
            string processInstanceId = deployAndStartProcess(PROCESS_WITH_USERTASK, Variables.createVariables().putValue(VARIABLE_NAME, Variables.byteArrayValue(VARIABLE_VALUE.GetBytes()))).Id;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String[] historicByteArrayId = new String[1];
            string[] historicByteArrayId = new string[1];
            commandExecutor.execute(new CommandAnonymousInnerClass(this, processInstanceId, historicByteArrayId));

            ThreadControl asyncThread = executeControllableCommand(new AsyncThread(this, processInstanceId, historicByteArrayId[0]));

            asyncThread.waitForSync();

            commandExecutor.execute(new CommandAnonymousInnerClass2(this, historicByteArrayId));

            commandExecutor.execute(new CommandAnonymousInnerClass3(this, historicByteArrayId));

            // when
            asyncThread.makeContinue();
            asyncThread.waitUntilDone();

            // then
            assertThat(runtimeService.createVariableInstanceQuery().singleResult().Name, @is(VARIABLE_NAME));
            assertThat(StringHelper.NewString((sbyte[])runtimeService.createVariableInstanceQuery().singleResult().Value), @is(ANOTHER_VARIABLE_VALUE));
        }
Exemple #6
0
            public override Void execute(CommandContext commandContext)
            {
                commandContext.DbEntityManager.selectById(typeof(ByteArrayEntity), historicByteArrayId);   // cache

                monitor.sync();

                outerInstance.runtimeService.setVariable(processInstanceId, outerInstance.VARIABLE_NAME, Variables.byteArrayValue(outerInstance.ANOTHER_VARIABLE_VALUE.GetBytes()));

                return(null);
            }