use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class DecisionRequirementsDefinitionRestServiceQueryTest method testDecisionRequirementDefinitionTenantIdList.
@Test
public void testDecisionRequirementDefinitionTenantIdList() {
List<DecisionRequirementsDefinition> decisionRequirementsDefinitions = Arrays.asList(MockProvider.mockDecisionRequirementsDefinition().tenantId(MockProvider.EXAMPLE_TENANT_ID).build(), MockProvider.createAnotherMockDecisionRequirementsDefinition());
mockedQuery = createMockQuery(decisionRequirementsDefinitions);
Response response = given().queryParam("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID_LIST).then().expect().statusCode(Status.OK.getStatusCode()).when().get(DECISION_REQUIREMENTS_DEFINITION_QUERY_URL);
verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(2);
String returnedTenantId1 = from(content).getString("[0].tenantId");
String returnedTenantId2 = from(content).getString("[1].tenantId");
assertThat(returnedTenantId1).isEqualTo(MockProvider.EXAMPLE_TENANT_ID);
assertThat(returnedTenantId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class DecisionRequirementsDefinitionRestServiceImpl method getDecisionRequirementsDefinitions.
@Override
public List<DecisionRequirementsDefinitionDto> getDecisionRequirementsDefinitions(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
DecisionRequirementsDefinitionQueryDto queryDto = new DecisionRequirementsDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
List<DecisionRequirementsDefinitionDto> dtos = new ArrayList<DecisionRequirementsDefinitionDto>();
ProcessEngine engine = getProcessEngine();
DecisionRequirementsDefinitionQuery query = queryDto.toQuery(engine);
List<DecisionRequirementsDefinition> matchingDefinitions = null;
if (firstResult != null || maxResults != null) {
matchingDefinitions = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingDefinitions = query.list();
}
for (DecisionRequirementsDefinition definition : matchingDefinitions) {
DecisionRequirementsDefinitionDto dto = DecisionRequirementsDefinitionDto.fromDecisionRequirementsDefinition(definition);
dtos.add(dto);
}
return dtos;
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method queryByDecisionRequirementsDefinitionId.
@Test
public void queryByDecisionRequirementsDefinitionId() {
testRule.deploy(DRD_DISH_RESOURCE, DRD_SCORE_RESOURCE);
List<DecisionRequirementsDefinition> drds = repositoryService.createDecisionRequirementsDefinitionQuery().orderByDecisionRequirementsDefinitionName().asc().list();
String dishDrdId = drds.get(0).getId();
String scoreDrdId = drds.get(1).getId();
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
verifyQueryResults(query.decisionRequirementsDefinitionId("non existing"), 0);
verifyQueryResults(query.decisionRequirementsDefinitionId(dishDrdId), 3);
verifyQueryResults(query.decisionRequirementsDefinitionId(scoreDrdId), 2);
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancySharedDecisionInstanceStatisticsQueryTest method testQueryNoAuthenticatedTenants.
@Test
public void testQueryNoAuthenticatedTenants() {
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
identityService.setAuthentication(USER_ID, null, null);
HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionRequirementsDefinitionQueryTest method queryByLatestNoTenantIdSet.
@Test
public void queryByLatestNoTenantIdSet() {
// deploy a second version for tenant one
testRule.deployForTenant(TENANT_ONE, DMN);
DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(DECISION_REQUIREMENTS_DEFINITION_KEY).latestVersion();
// one definition for each tenant
assertThat(query.count(), is(3L));
Map<String, DecisionRequirementsDefinition> definitionsForTenant = getDecisionRequirementsDefinitionsForTenant(query.list());
assertThat(definitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(definitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(definitionsForTenant.get(null).getVersion(), is(1));
}
Aggregations