use of org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit 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.ExampleOrganizationalUnit in project kie-wb-common by kiegroup.
the class ExamplesWizard method setDefaultTargetOrganizationalUnit.
public void setDefaultTargetOrganizationalUnit(final String ouName) {
final ExampleOrganizationalUnit targetOrganizationalUnit = new ExampleOrganizationalUnit(ouName);
this.model.setTargetOrganizationalUnit(targetOrganizationalUnit);
}
Aggregations