use of org.kie.workbench.common.screens.examples.model.ImportProject in project kie-wb-common by kiegroup.
the class LibraryServiceImpl method getExampleProjects.
@Override
public Set<ImportProject> getExampleProjects(OrganizationalUnit organizationalUnit) {
final String importProjectsUrl = getCustomImportProjectsUrl();
final ExampleRepository repository = importProjectsUrl == null || importProjectsUrl.isEmpty() ? examplesService.getPlaygroundRepository() : new ExampleRepository(importProjectsUrl);
final Set<ImportProject> projects = examplesService.getProjects(organizationalUnit, repository);
return projects;
}
use of org.kie.workbench.common.screens.examples.model.ImportProject in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method getDefaultExampleProjectsTest.
@Test
public void getDefaultExampleProjectsTest() {
System.setProperty("org.kie.project.examples.repository.url", "");
final ExampleRepository playgroundRepository = new ExampleRepository("playgroundRepositoryUrl");
doReturn(playgroundRepository).when(examplesService).getPlaygroundRepository();
final Set<ImportProject> importProjects = new HashSet<>();
importProjects.add(mock(ImportProject.class));
doReturn(importProjects).when(examplesService).getProjects(any(), eq(playgroundRepository));
final Set<ImportProject> loadedImportProjects = libraryService.getExampleProjects(ou1);
assertEquals(importProjects, loadedImportProjects);
}
use of org.kie.workbench.common.screens.examples.model.ImportProject in project kie-wb-common by kiegroup.
the class ExamplesServiceImplTest method testGetProjects_EmptyRepositoryUrl.
@Test
public void testGetProjects_EmptyRepositoryUrl() {
final Set<ImportProject> modules = service.getProjects(ou, new ExampleRepository(""));
assertNotNull(modules);
assertEquals(0, modules.size());
}
use of org.kie.workbench.common.screens.examples.model.ImportProject in project kie-wb-common by kiegroup.
the class ExamplesServiceImplTest method testGetProjects_WhiteSpaceRepositoryUrl.
@Test
public void testGetProjects_WhiteSpaceRepositoryUrl() {
final Set<ImportProject> modules = service.getProjects(ou, new ExampleRepository(" "));
assertNotNull(modules);
assertEquals(0, modules.size());
}
use of org.kie.workbench.common.screens.examples.model.ImportProject in project kie-wb-common by kiegroup.
the class ExamplesServiceImplTest method testGetProjects_NullRepositoryUrl.
@Test
public void testGetProjects_NullRepositoryUrl() {
final Set<ImportProject> modules = service.getProjects(ou, new ExampleRepository(null));
assertNotNull(modules);
assertEquals(0, modules.size());
}
Aggregations