Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFallbackSerializerDoesNotOverrideRegularSerializer()
        public virtual void testFallbackSerializerDoesNotOverrideRegularSerializer()
        {
            // given
            // that the process engine is configured with a serializer for a certain format
            // and a fallback serializer factory for the same format
            ProcessEngineConfigurationImpl engineConfiguration = (new StandaloneInMemProcessEngineConfiguration()).setJdbcUrl("jdbc:h2:mem:camunda-forceclose").setProcessEngineName("engine-forceclose");

            engineConfiguration.CustomPreVariableSerializers = Arrays.asList <TypedValueSerializer>(new ExampleConstantSerializer());
            engineConfiguration.FallbackSerializerFactory    = new ExampleSerializerFactory();

            processEngine = engineConfiguration.buildProcessEngine();
            deployOneTaskProcess(processEngine);

            // when setting a variable that no regular serializer can handle
            ObjectValue objectValue = Variables.objectValue("foo").serializationDataFormat(ExampleSerializer.FORMAT).create();

            ProcessInstance pi = processEngine.RuntimeService.startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValueTyped("var", objectValue));

            ObjectValue fetchedValue = processEngine.RuntimeService.getVariableTyped(pi.Id, "var", true);

            // then the fallback serializer is used
            Assert.assertNotNull(fetchedValue);
            Assert.assertEquals(ExampleSerializer.FORMAT, fetchedValue.SerializationDataFormat);
            Assert.assertEquals(ExampleConstantSerializer.DESERIALIZED_VALUE, fetchedValue.Value);
        }
Beispiel #2
0
 public override ObjectValue readValue(ValueFields valueFields, bool deserializeObjectValue)
 {
     if (!string.ReferenceEquals(valueFields.TextValue, null) && !string.ReferenceEquals(valueFields.TextValue2, null))
     {
         object jpaEntity = mappings.getJPAEntity(valueFields.TextValue, valueFields.TextValue2);
         return(Variables.objectValue(jpaEntity).create());
     }
     return(Variables.objectValue(null).create());
 }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetSingleVariableInstanceDeserialized()
        public virtual void testGetSingleVariableInstanceDeserialized()
        {
            ObjectValue serializedValue = MockObjectValue.fromObjectValue(Variables.objectValue("a value").serializationDataFormat("aDataFormat").create()).objectTypeName("aTypeName");

            MockHistoricVariableInstanceBuilder builder = MockProvider.mockHistoricVariableInstance().typedValue(serializedValue);
            HistoricVariableInstance            variableInstanceMock = builder.build();

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

            given().pathParam("id", MockProvider.EXAMPLE_VARIABLE_INSTANCE_ID).then().expect().statusCode(Status.OK.StatusCode).and().body("id", equalTo(builder.Id)).body("name", equalTo(builder.Name)).body("type", 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("executionId", equalTo(builder.ExecutionId)).body("errorMessage", equalTo(builder.ErrorMessage)).body("activityInstanceId", equalTo(builder.ActivityInstanceId)).body("caseDefinitionKey", equalTo(builder.CaseDefinitionKey)).body("caseDefinitionId", equalTo(builder.CaseDefinitionId)).body("caseInstanceId", equalTo(builder.CaseInstanceId)).body("caseExecutionId", equalTo(builder.CaseExecutionId)).body("taskId", equalTo(builder.TaskId)).body("tenantId", equalTo(builder.TenantId)).body("createTime", equalTo(MockProvider.EXAMPLE_HISTORIC_VARIABLE_INSTANCE_CREATE_TIME)).body("removalTime", equalTo(MockProvider.EXAMPLE_HISTORIC_VARIABLE_INSTANCE_REMOVAL_TIME)).body("rootProcessInstanceId", equalTo(builder.RootProcessInstanceId)).when().get(VARIABLE_INSTANCE_URL);

            verify(variableInstanceQueryMock, times(1)).disableBinaryFetching();
            verify(variableInstanceQueryMock, never()).disableCustomObjectDeserialization();
        }
Beispiel #4
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 #5
0
 public virtual ObjectValue convertToTypedValue(UntypedValueImpl untypedValue)
 {
     // untyped values are always deserialized
     return(Variables.objectValue(untypedValue.Value, untypedValue.Transient).create());
 }
Beispiel #6
0
 public override ObjectValue convertToTypedValue(UntypedValueImpl untypedValue)
 {
     return(Variables.objectValue(untypedValue.Value, untypedValue.Transient).create());
 }
Beispiel #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public org.camunda.bpm.engine.runtime.ProcessInstance call() throws Exception
            public override ProcessInstance call()
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final XmlSerializable var = new XmlSerializable();
                XmlSerializable var = new XmlSerializable();

                var.Property = "jonny";
                return(outerInstance.runtimeService.startProcessInstanceByKey("processWithTimer", Variables.createVariables().putValueTyped("testObject", Variables.objectValue(var).serializationDataFormat(DataFormats.JSON_DATAFORMAT_NAME).create())));
            }