use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class BaseLibraryIndexingTest method getModuleService.
protected KieModuleService getModuleService() {
final Package mockPackage = mock(Package.class);
when(mockPackage.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
final KieModuleService mockModuleService = mock(KieModuleService.class);
when(mockModuleService.resolvePackage(any(org.uberfire.backend.vfs.Path.class))).thenReturn(mockPackage);
return mockModuleService;
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class FindAllLibraryAssetsQueryTest method getModuleService.
@Override
protected KieModuleService getModuleService() {
final KieModuleService moduleService = super.getModuleService();
when(moduleService.resolveModule(any(org.uberfire.backend.vfs.Path.class))).thenAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
org.uberfire.backend.vfs.Path resource = (org.uberfire.backend.vfs.Path) invocationOnMock.getArguments()[0];
if (resource.toURI().contains(TEST_MODULE_ROOT)) {
return getKieModuleMock(TEST_MODULE_ROOT, TEST_MODULE_NAME);
} else if (resource.toURI().contains(SOME_OTHER_MODULE_ROOT)) {
return getKieModuleMock(SOME_OTHER_MODULE_ROOT, SOME_OTHER_MODULE_NAME);
} else {
return null;
}
}
});
return moduleService;
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class FindAllLibraryAssetsSortedQueryTest method getModuleService.
@Override
protected KieModuleService getModuleService() {
final KieModuleService mock = super.getModuleService();
when(mock.resolveModule(any(Path.class))).thenAnswer((Answer) invocationOnMock -> {
Path resource = (Path) invocationOnMock.getArguments()[0];
if (resource.toURI().contains(TEST_PROJECT_ROOT1)) {
return getKieModuleMock(TEST_PROJECT_ROOT1, TEST_PROJECT_NAME1);
} else if (resource.toURI().contains(TEST_PROJECT_ROOT2)) {
return getKieModuleMock(TEST_PROJECT_ROOT2, TEST_PROJECT_NAME2);
} else {
return null;
}
});
return mock;
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class IndexingTest method getModuleService.
protected KieModuleService getModuleService() {
final KieModule mockModule = getKieModuleMock(TEST_MODULE_ROOT, TEST_MODULE_NAME);
final Package mockPackage = mock(Package.class);
when(mockPackage.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
final KieModuleService mockWorkspaceProjectService = mock(KieModuleService.class);
when(mockWorkspaceProjectService.resolveModule(any(org.uberfire.backend.vfs.Path.class))).thenReturn(mockModule);
when(mockWorkspaceProjectService.resolvePackage(any(org.uberfire.backend.vfs.Path.class))).thenReturn(mockPackage);
return mockWorkspaceProjectService;
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class FindRulesByModuleQueryValidIndexTermsTest method getModuleService.
@Override
protected KieModuleService getModuleService() {
final KieModuleService mock = super.getModuleService();
when(mock.resolveModule(any(org.uberfire.backend.vfs.Path.class))).thenAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
org.uberfire.backend.vfs.Path resource = (org.uberfire.backend.vfs.Path) invocationOnMock.getArguments()[0];
if (resource.toURI().contains(TEST_MODULE_ROOT)) {
return getKieModuleMock(TEST_MODULE_ROOT, TEST_MODULE_NAME);
} else if (resource.toURI().contains(SOME_OTHER_PROJECT_ROOT)) {
return getKieModuleMock(SOME_OTHER_PROJECT_ROOT, SOME_OTHER_PROJECT_NAME);
} else {
return null;
}
}
});
return mock;
}
Aggregations