Exemple #1
0
        protected internal virtual string createCaseInstance(string tenantId)
        {
            VariableMap         variables = Variables.putValue(VARIABLE_NAME, VARIABLE_VALUE);
            CaseInstanceBuilder builder   = caseService.withCaseDefinitionByKey("twoTaskCase").setVariables(variables);

            if (string.ReferenceEquals(tenantId, null))
            {
                return(builder.create().Id);
            }
            else
            {
                return(builder.caseDefinitionTenantId(tenantId).create().Id);
            }
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpRuntime()
        public virtual void setUpRuntime()
        {
            CaseDefinition mockCaseDefinition = MockProvider.createMockCaseDefinition();

            UpRuntimeData = mockCaseDefinition;

            caseServiceMock = mock(typeof(CaseService));

            when(processEngine.CaseService).thenReturn(caseServiceMock);

            caseInstanceBuilder = mock(typeof(CaseInstanceBuilder));
            CaseInstance mockCaseInstance = MockProvider.createMockCaseInstance();

            when(caseServiceMock.withCaseDefinition(MockProvider.EXAMPLE_CASE_DEFINITION_ID)).thenReturn(caseInstanceBuilder);
            when(caseInstanceBuilder.businessKey(anyString())).thenReturn(caseInstanceBuilder);
            when(caseInstanceBuilder.setVariables(Matchers.any <IDictionary <string, object> >())).thenReturn(caseInstanceBuilder);
            when(caseInstanceBuilder.create()).thenReturn(mockCaseInstance);
        }
Exemple #3
0
        protected internal virtual string createAndCloseCaseInstance(string tenantId)
        {
            string caseInstanceId;

            CaseInstanceBuilder builder = caseService.withCaseDefinitionByKey("oneTaskCase");

            if (string.ReferenceEquals(tenantId, null))
            {
                caseInstanceId = builder.create().Id;
            }
            else
            {
                caseInstanceId = builder.caseDefinitionTenantId(tenantId).create().Id;
            }

            caseService.completeCaseExecution(caseInstanceId);
            caseService.closeCaseInstance(caseInstanceId);

            return(caseInstanceId);
        }
Exemple #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCreateCaseInstanceByInvalidCaseDefinitionId()
        public virtual void testCreateCaseInstanceByInvalidCaseDefinitionId()
        {
            when(caseInstanceBuilder.create()).thenThrow(new ProcessEngineException("expected exception"));

            given().pathParam("id", MockProvider.EXAMPLE_CASE_DEFINITION_ID).contentType(POST_JSON_CONTENT_TYPE).body(EMPTY_JSON_OBJECT).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.StatusCode).contentType(ContentType.JSON).body("type", equalTo(typeof(RestException).Name)).body("message", containsString("Cannot instantiate case definition aCaseDefnitionId: expected exception")).when().post(CREATE_INSTANCE_URL);
        }