use of org.kie.server.services.api.KieServerRegistry in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeRestApplicationComponentsServiceTest method getAppComponents.
@Test
public void getAppComponents() {
TaskAssigningRuntimeServiceBase serviceMock = mock(TaskAssigningRuntimeServiceBase.class);
KieServerRegistry registryMock = mock(KieServerRegistry.class);
TaskAssigningRuntimeRestApplicationComponentsService componentsService = new TaskAssigningRuntimeRestApplicationComponentsService();
Collection<Object> result = componentsService.getAppComponents(TaskAssigningRuntimeKieServerExtension.EXTENSION_NAME, SupportedTransports.REST, serviceMock, registryMock);
assertEquals(1, result.size());
assertTrue(result.iterator().next() instanceof TaskAssigningRuntimeResource);
}
use of org.kie.server.services.api.KieServerRegistry in project businessautomation-cop by redhat-cop.
the class CustomCaseMgmtKieServerAppComponentService method getAppComponents.
public Collection<Object> getAppComponents(String extension, SupportedTransports type, Object... services) {
// skip calls from other than owning extension
if (!OWNER_EXTENSION.equals(extension)) {
return Collections.emptyList();
}
logger.info("Creating custom kie server extension CustomCaseMgmtKieServerAppComponentService");
KieServerRegistry registry = null;
CaseManagementServiceBase caseManagementServiceBase = null;
CaseManagementRuntimeDataServiceBase caseManagementRuntimeDataService = null;
for (Object object : services) {
if (CaseManagementServiceBase.class.isAssignableFrom(object.getClass())) {
caseManagementServiceBase = (CaseManagementServiceBase) object;
continue;
} else if (KieServerRegistry.class.isAssignableFrom(object.getClass())) {
registry = (KieServerRegistry) object;
continue;
} else if (CaseManagementRuntimeDataServiceBase.class.isAssignableFrom(object.getClass())) {
caseManagementRuntimeDataService = (CaseManagementRuntimeDataServiceBase) object;
}
}
List<Object> components = new ArrayList<Object>(1);
if (SupportedTransports.REST.equals(type)) {
components.add(new GetCasesWithDataResource(caseManagementServiceBase, caseManagementRuntimeDataService, registry));
}
return components;
}
use of org.kie.server.services.api.KieServerRegistry in project businessautomation-cop by redhat-cop.
the class CustomJbpmKieServerAppComponentService method getAppComponents.
public Collection<Object> getAppComponents(String extension, SupportedTransports type, Object... services) {
// skip calls from other than owning extension
if (!OWNER_EXTENSION.equals(extension)) {
return Collections.emptyList();
}
logger.debug("Creating custom kie server extension CustomJbpmKieServerAppComponentService");
RuntimeDataService runtimeDataService = null;
AdvanceRuntimeDataService advanceRuntimeDataService = null;
KieServerRegistry context = null;
for (Object object : services) {
if (RuntimeDataService.class.isAssignableFrom(object.getClass())) {
runtimeDataService = (RuntimeDataService) object;
continue;
} else if (AdvanceRuntimeDataService.class.isAssignableFrom(object.getClass())) {
advanceRuntimeDataService = (AdvanceRuntimeDataService) object;
continue;
} else if (KieServerRegistry.class.isAssignableFrom(object.getClass())) {
context = (KieServerRegistry) object;
continue;
}
}
List<Object> components = new ArrayList<Object>(1);
if (SupportedTransports.REST.equals(type)) {
RuntimeDataServiceBase runtimeDataServiceBase = new RuntimeDataServiceBase(runtimeDataService, advanceRuntimeDataService, context);
components.add(new CustomResource(runtimeDataServiceBase, context));
}
return components;
}
Aggregations