Search in sources :

Example 6 with ExampleOrganizationalUnit

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));
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) Repository(org.guvnor.structure.repositories.Repository) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ExampleOrganizationalUnit(org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) ExampleOrganizationalUnit(org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) Module(org.guvnor.common.services.project.model.Module) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject) Test(org.junit.Test)

Example 7 with ExampleOrganizationalUnit

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);
}
Also used : ExampleOrganizationalUnit(org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit)

Aggregations

ExampleOrganizationalUnit (org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit)7 WorkspaceProjectContextChangeEvent (org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent)5 ExampleProject (org.kie.workbench.common.screens.examples.model.ExampleProject)5 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)4 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)4 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)4 Test (org.junit.Test)4 NewProjectEvent (org.guvnor.common.services.project.events.NewProjectEvent)3 ArrayList (java.util.ArrayList)2 Branch (org.guvnor.structure.repositories.Branch)2 Repository (org.guvnor.structure.repositories.Repository)2 ExampleRepository (org.kie.workbench.common.screens.examples.model.ExampleRepository)2 Path (org.uberfire.backend.vfs.Path)2 Module (org.guvnor.common.services.project.model.Module)1 IOException (org.uberfire.java.nio.IOException)1