use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ProjectPageTest method testIsProjectSelected_NotSelected.
@Test
public void testIsProjectSelected_NotSelected() {
final ExampleProject project = mock(ExampleProject.class);
assertFalse(page.isProjectSelected(project));
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class LibraryServiceImpl method importProject.
@Override
public WorkspaceProject importProject(final OrganizationalUnit organizationalUnit, final ExampleProject exampleProject) {
final ExampleOrganizationalUnit exampleOrganizationalUnit = new ExampleOrganizationalUnit(organizationalUnit.getName());
final List<ExampleProject> exampleProjects = Collections.singletonList(exampleProject);
final WorkspaceProjectContextChangeEvent projectContextChangeEvent = examplesService.setupExamples(exampleOrganizationalUnit, exampleProjects);
return projectContextChangeEvent.getWorkspaceProject();
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class LibraryServiceImpl method getExampleProjects.
@Override
public Set<ExampleProject> getExampleProjects() {
final String importProjectsUrl = getCustomImportProjectsUrl();
final ExampleRepository repository = importProjectsUrl == null || importProjectsUrl.isEmpty() ? examplesService.getPlaygroundRepository() : new ExampleRepository(importProjectsUrl);
final Set<ExampleProject> projects = examplesService.getProjects(repository);
return projects;
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method importDefaultProjectTest.
@Test
public void importDefaultProjectTest() {
final Repository repository = mock(Repository.class);
when(repository.getAlias()).thenReturn("example");
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
when(organizationalUnit.getName()).thenReturn("ou");
when(organizationalUnit.getIdentifier()).thenReturn("ou");
when(organizationalUnit.getRepositories()).thenReturn(singletonList(repository));
when(ouService.getOrganizationalUnits()).thenReturn(singletonList(organizationalUnit));
final ExampleProject exampleProject = mock(ExampleProject.class);
doReturn("example").when(exampleProject).getName();
final WorkspaceProject project = mock(WorkspaceProject.class);
final Module module = mock(Module.class);
doReturn(module).when(project).getMainModule();
final WorkspaceProjectContextChangeEvent projectContextChangeEvent = mock(WorkspaceProjectContextChangeEvent.class);
doReturn(project).when(projectContextChangeEvent).getWorkspaceProject();
doReturn(projectContextChangeEvent).when(examplesService).setupExamples(any(ExampleOrganizationalUnit.class), anyList());
final WorkspaceProject importedProject = libraryService.importProject(organizationalUnit, exampleProject);
assertEquals(module, importedProject.getMainModule());
verify(examplesService).setupExamples(new ExampleOrganizationalUnit(organizationalUnit.getName()), singletonList(exampleProject));
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method getCustomExampleProjectsTest.
@Test
public void getCustomExampleProjectsTest() {
System.setProperty("org.kie.project.examples.repository.url", "importProjectsUrl");
final Set<ExampleProject> exampleProjects = new HashSet<>();
exampleProjects.add(mock(ExampleProject.class));
doReturn(exampleProjects).when(examplesService).getProjects(new ExampleRepository("importProjectsUrl"));
final Set<ExampleProject> loadedExampleProjects = libraryService.getExampleProjects();
assertEquals(exampleProjects, loadedExampleProjects);
}
Aggregations