Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testNonExistingDecisionDefinitionRetrieval_ByKey()
        public virtual void testNonExistingDecisionDefinitionRetrieval_ByKey()
        {
            string nonExistingKey = "aNonExistingDefinitionKey";

            when(repositoryServiceMock.createDecisionDefinitionQuery().decisionDefinitionKey(nonExistingKey)).thenReturn(decisionDefinitionQueryMock);
            when(decisionDefinitionQueryMock.latestVersion()).thenReturn(decisionDefinitionQueryMock);
            when(decisionDefinitionQueryMock.singleResult()).thenReturn(null);
            when(decisionDefinitionQueryMock.list()).thenReturn(System.Linq.Enumerable.Empty <DecisionDefinition> ());

            given().pathParam("key", nonExistingKey).then().expect().statusCode(Status.NOT_FOUND.StatusCode).contentType(ContentType.JSON).body("type", @is(typeof(RestException).Name)).body("message", containsString("No matching decision definition with key: " + nonExistingKey)).when().get(SINGLE_DECISION_DEFINITION_BY_KEY_URL);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void dmnDeploymentWithDecisionLiteralExpression()
        public virtual void dmnDeploymentWithDecisionLiteralExpression()
        {
            string deploymentId = testRule.deploy(DMN_DECISION_LITERAL_EXPRESSION).Id;

            // there should be decision deployment
            DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();

            assertEquals(1, deploymentQuery.count());

            // there should be one decision definition
            DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();

            assertEquals(1, query.count());

            DecisionDefinition decisionDefinition = query.singleResult();

            assertTrue(decisionDefinition.Id.StartsWith("decisionLiteralExpression:1:", StringComparison.Ordinal));
            assertEquals("http://camunda.org/schema/1.0/dmn", decisionDefinition.Category);
            assertEquals("decisionLiteralExpression", decisionDefinition.Key);
            assertEquals("Decision with Literal Expression", decisionDefinition.Name);
            assertEquals(1, decisionDefinition.Version);
            assertEquals(DMN_DECISION_LITERAL_EXPRESSION, decisionDefinition.ResourceName);
            assertEquals(deploymentId, decisionDefinition.DeploymentId);
            assertNull(decisionDefinition.DiagramResourceName);
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void dmnDeploymentWithDmnSuffix()
        public virtual void dmnDeploymentWithDmnSuffix()
        {
            string deploymentId = testRule.deploy(DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX).Id;

            // there should be one deployment
            DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();

            assertEquals(1, deploymentQuery.count());

            // there should be one case definition
            DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();

            assertEquals(1, query.count());

            DecisionDefinition decisionDefinition = query.singleResult();

            assertTrue(decisionDefinition.Id.StartsWith("decision:1:", StringComparison.Ordinal));
            assertEquals("http://camunda.org/schema/1.0/dmn", decisionDefinition.Category);
            assertEquals("CheckOrder", decisionDefinition.Name);
            assertEquals("decision", decisionDefinition.Key);
            assertEquals(1, decisionDefinition.Version);
            assertEquals(DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX, decisionDefinition.ResourceName);
            assertEquals(deploymentId, decisionDefinition.DeploymentId);
            assertNull(decisionDefinition.DiagramResourceName);
        }
Пример #4
0
        public virtual void testQueryByLatestWithTenantId()
        {
            // deploy a second version for tenant one
            deploymentForTenant(TENANT_ONE, DMN);

            DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE);

            assertThat(query.count(), @is(1L));

            DecisionDefinition decisionDefinition = query.singleResult();

            assertThat(decisionDefinition.TenantId, @is(TENANT_ONE));
            assertThat(decisionDefinition.Version, @is(2));

            query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_TWO);

            assertThat(query.count(), @is(1L));

            decisionDefinition = query.singleResult();
            assertThat(decisionDefinition.TenantId, @is(TENANT_TWO));
            assertThat(decisionDefinition.Version, @is(1));
        }
Пример #5
0
        public virtual void testQueryByLatestWithoutTenantId()
        {
            // deploy a second version without tenant id
            deployment(DMN);

            DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().withoutTenantId();

            assertThat(query.count(), @is(1L));

            DecisionDefinition decisionDefinition = query.singleResult();

            assertThat(decisionDefinition.TenantId, @is(nullValue()));
            assertThat(decisionDefinition.Version, @is(2));
        }
Пример #6
0
        public virtual void testQueryWithReadPermissionOnOneDecisionDefinition()
        {
            // given user gets read permission on the decision definition
            createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ);

            // when
            DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();

            // then
            verifyQueryResults(query, 1);

            DecisionDefinition definition = query.singleResult();

            assertNotNull(definition);
            assertEquals(DECISION_DEFINITION_KEY, definition.Key);
        }