//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testEvaluateDecisionByKeyAndTenantId() public virtual void testEvaluateDecisionByKeyAndTenantId() { DecisionDefinition mockDefinition = MockProvider.mockDecisionDefinition().tenantId(MockProvider.EXAMPLE_TENANT_ID).build(); UpRuntimeData = mockDefinition; DmnDecisionResult decisionResult = MockProvider.createMockDecisionResult(); when(decisionEvaluationBuilderMock.evaluate()).thenReturn(decisionResult); IDictionary <string, object> json = new Dictionary <string, object>(); json["variables"] = VariablesBuilder.create().variable("amount", 420).variable("invoiceCategory", "MISC").Variables; given().pathParam("key", MockProvider.EXAMPLE_DECISION_DEFINITION_KEY).pathParam("tenant-id", MockProvider.EXAMPLE_TENANT_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.OK.StatusCode).when().post(EVALUATE_DECISION_BY_KEY_AND_TENANT_ID_URL); IDictionary <string, object> expectedVariables = new Dictionary <string, object>(); expectedVariables["amount"] = 420; expectedVariables["invoiceCategory"] = "MISC"; verify(decisionDefinitionQueryMock).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID); verify(decisionEvaluationBuilderMock).variables(expectedVariables); verify(decisionEvaluationBuilderMock).evaluate(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testConditionEvaluationFailingInvalidTenantParameters() public virtual void testConditionEvaluationFailingInvalidTenantParameters() { IDictionary <string, object> parameters = new Dictionary <string, object>(); IDictionary <string, object> variables = VariablesBuilder.create().variable("foo", "bar").Variables; parameters["variables"] = variables; parameters["tenantId"] = MockProvider.EXAMPLE_TENANT_ID; parameters["withoutTenantId"] = true; given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.BAD_REQUEST.StatusCode).body("type", equalTo(typeof(InvalidRequestException).Name)).body("message", equalTo("Parameter 'tenantId' cannot be used together with parameter 'withoutTenantId'.")).when().post(CONDITION_URL); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testConditionEvaluationThrowsAuthorizationException() public virtual void testConditionEvaluationThrowsAuthorizationException() { IDictionary <string, object> parameters = new Dictionary <string, object>(); IDictionary <string, object> variables = VariablesBuilder.create().variable("foo", "bar").Variables; parameters["variables"] = variables; string message = "expected exception"; doThrow(new AuthorizationException(message)).when(conditionEvaluationBuilderMock).evaluateStartConditions(); given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.FORBIDDEN.StatusCode).body("type", equalTo(typeof(AuthorizationException).Name)).body("message", equalTo(message)).when().post(CONDITION_URL); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testConditionEvaluationWithBusinessKey() public virtual void testConditionEvaluationWithBusinessKey() { IDictionary <string, object> parameters = new Dictionary <string, object>(); IDictionary <string, object> variables = VariablesBuilder.create().variable("foo", "bar").Variables; parameters["variables"] = variables; parameters["businessKey"] = MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY; given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.OK.StatusCode).when().post(CONDITION_URL); verify(runtimeServiceMock).createConditionEvaluation(); verify(conditionEvaluationBuilderMock).processInstanceBusinessKey(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testConditionEvaluationWithoutTenantId() public virtual void testConditionEvaluationWithoutTenantId() { IDictionary <string, object> parameters = new Dictionary <string, object>(); IDictionary <string, object> variables = VariablesBuilder.create().variable("foo", "bar").Variables; parameters["variables"] = variables; parameters["withoutTenantId"] = true; given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.OK.StatusCode).when().post(CONDITION_URL); verify(runtimeServiceMock).createConditionEvaluation(); verify(conditionEvaluationBuilderMock).withoutTenantId(); verify(conditionEvaluationBuilderMock).evaluateStartConditions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testConditionEvaluationWithProcessDefinition() public virtual void testConditionEvaluationWithProcessDefinition() { IDictionary <string, object> parameters = new Dictionary <string, object>(); IDictionary <string, object> variables = VariablesBuilder.create().variable("foo", "bar").Variables; parameters["variables"] = variables; parameters["processDefinitionId"] = MockProvider.EXAMPLE_PROCESS_DEFINITION_ID; given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.OK.StatusCode).when().post(CONDITION_URL); verify(runtimeServiceMock).createConditionEvaluation(); verify(conditionEvaluationBuilderMock).processDefinitionId(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)); verify(conditionEvaluationBuilderMock).evaluateStartConditions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBroadcastWithVariables() public virtual void shouldBroadcastWithVariables() { IDictionary <string, object> requestBody = new Dictionary <string, object>(); requestBody["name"] = "aSignalName"; requestBody["variables"] = VariablesBuilder.create().variable("total", 420).variable("invoiceId", "ABC123").Variables; given().contentType(POST_JSON_CONTENT_TYPE).body(requestBody).then().expect().statusCode(Status.NO_CONTENT.StatusCode).when().post(SIGNAL_URL); verify(runtimeServiceMock).createSignalEvent((string)requestBody["name"]); IDictionary <string, object> expectedVariables = new Dictionary <string, object>(); expectedVariables["total"] = 420; expectedVariables["invoiceId"] = "ABC123"; verify(signalBuilderMock).Variables = expectedVariables; verify(signalBuilderMock).send(); verifyNoMoreInteractions(signalBuilderMock); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testEvaluateDecisionById() public virtual void testEvaluateDecisionById() { DmnDecisionResult decisionResult = MockProvider.createMockDecisionResult(); when(decisionEvaluationBuilderMock.evaluate()).thenReturn(decisionResult); IDictionary <string, object> json = new Dictionary <string, object>(); json["variables"] = VariablesBuilder.create().variable("amount", 420).variable("invoiceCategory", "MISC").Variables; given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.OK.StatusCode).when().post(EVALUATE_DECISION_URL); IDictionary <string, object> expectedVariables = new Dictionary <string, object>(); expectedVariables["amount"] = 420; expectedVariables["invoiceCategory"] = "MISC"; verify(decisionEvaluationBuilderMock).variables(expectedVariables); verify(decisionEvaluationBuilderMock).evaluate(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testConditionEvaluationOnlyVariables() public virtual void testConditionEvaluationOnlyVariables() { IDictionary <string, object> parameters = new Dictionary <string, object>(); IDictionary <string, object> variables = VariablesBuilder.create().variable("foo", "bar").Variables; parameters["variables"] = variables; Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.OK.StatusCode).when().post(CONDITION_URL); assertNotNull(response); string content = response.asString(); assertTrue(content.Length > 0); checkResult(content); verify(runtimeServiceMock).createConditionEvaluation(); IDictionary <string, object> expectedVariables = new Dictionary <string, object>(); expectedVariables["foo"] = "bar"; verify(conditionEvaluationBuilderMock).Variables = expectedVariables; verify(conditionEvaluationBuilderMock).evaluateStartConditions(); verifyNoMoreInteractions(conditionEvaluationBuilderMock); }