Search in sources :

Example 1 with Archetype

use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.

the class LibraryServiceImpl method createProject.

@Override
public WorkspaceProject createProject(final OrganizationalUnit organizationalUnit, final String remoteRepositoryUrl, final String repositoryAlias) {
    final String projectName = repositoryAlias != null ? repositoryAlias : DEFAULT_PROJECT_NAME;
    final Optional<Archetype> baseArchetype = archetypeService.getBaseKieArchetype();
    final String baseArchetypeAlias = baseArchetype.map(Archetype::getAlias).orElse(null);
    final GAV gav = createGAV(projectName, organizationalUnit);
    final POM pom = createPOM(projectName, projectName, gav);
    return createProject(organizationalUnit, pom, DeploymentMode.VALIDATED, baseArchetypeAlias, remoteRepositoryUrl);
}
Also used : Archetype(org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype) GAV(org.guvnor.common.services.project.model.GAV) POM(org.guvnor.common.services.project.model.POM)

Example 2 with Archetype

use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.

the class AbstractArchetypeTablePresenterTest method finishLoadListTest.

@Test
public void finishLoadListTest() {
    final List<Archetype> archetypes = new ArrayList<>();
    archetypes.add(createArchetypeWithAlias("archetype 1"));
    archetypes.add(createArchetypeWithAlias("archetype 2"));
    archetypes.add(createArchetypeWithAlias("archetype 3"));
    final Map<String, Boolean> selectionMap = new HashMap<>();
    selectionMap.put("archetype 1", true);
    selectionMap.put("archetype 2", true);
    selectionMap.put("archetype 3", true);
    final PaginatedArchetypeList paginatedArchetypeList = new PaginatedArchetypeList(archetypes, 0, 10, 3);
    doReturn(selectionMap).when(archetypePreferences).getArchetypeSelectionMap();
    doReturn("archetype 1").when(archetypePreferences).getDefaultSelection();
    presenter.finishLoadList(paginatedArchetypeList);
    verify(archetypeListPresenter).setup(any(), any(), any());
    verify(view).setSelectionCounter(Mockito.<String>any());
    verify(busyIndicatorView).hideBusyIndicator();
    verify(view).show(true);
}
Also used : PaginatedArchetypeList(org.kie.workbench.common.screens.archetype.mgmt.shared.model.PaginatedArchetypeList) Archetype(org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 3 with Archetype

use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.

the class ArchetypeItemPresenterTest method setupWhenHideDefaultBadgeTest.

@Test
public void setupWhenHideDefaultBadgeTest() {
    final Archetype archetype = createArchetypeWithStatus(ArchetypeStatus.VALID);
    final ArchetypeItem archetypeItem = new ArchetypeItem(archetype, true, false);
    presenter.setup(archetypeItem, tablePresenter);
    verify(view).showDefaultBadge(false);
}
Also used : Archetype(org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype) ArchetypeItem(org.kie.workbench.common.screens.archetype.mgmt.client.table.item.model.ArchetypeItem) Test(org.junit.Test)

Example 4 with Archetype

use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.

the class ArchetypeItemPresenterTest method makeDefaultWhenIsNotValidTest.

@Test
public void makeDefaultWhenIsNotValidTest() {
    final Archetype archetype = createArchetypeWithStatus(ArchetypeStatus.INVALID);
    final ArchetypeItem archetypeItem = new ArchetypeItem(archetype, true, true);
    doReturn(true).when(tablePresenter).canMakeChanges();
    presenter.setup(archetypeItem, tablePresenter);
    presenter.makeDefault();
    verify(presenter, never()).setIncluded(true);
    verify(tablePresenter, never()).makeDefaultValue(any(), anyBoolean());
}
Also used : Archetype(org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype) ArchetypeItem(org.kie.workbench.common.screens.archetype.mgmt.client.table.item.model.ArchetypeItem) Test(org.junit.Test)

Example 5 with Archetype

use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.

the class ArchetypeItemPresenterTest method setupWhenDisableIncludeTest.

@Test
public void setupWhenDisableIncludeTest() {
    final Archetype archetype = createArchetypeWithStatus(ArchetypeStatus.INVALID);
    final ArchetypeItem archetypeItem = new ArchetypeItem(archetype, true, true);
    presenter.setup(archetypeItem, tablePresenter);
    verify(view).enableIncludeCheckbox(false);
}
Also used : Archetype(org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype) ArchetypeItem(org.kie.workbench.common.screens.archetype.mgmt.client.table.item.model.ArchetypeItem) Test(org.junit.Test)

Aggregations

Archetype (org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype)38 Test (org.junit.Test)31 Repository (org.guvnor.structure.repositories.Repository)14 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)13 ArrayList (java.util.ArrayList)8 ArchetypeItem (org.kie.workbench.common.screens.archetype.mgmt.client.table.item.model.ArchetypeItem)8 PaginatedArchetypeList (org.kie.workbench.common.screens.archetype.mgmt.shared.model.PaginatedArchetypeList)7 Path (org.uberfire.java.nio.file.Path)5 GAV (org.guvnor.common.services.project.model.GAV)3 POM (org.guvnor.common.services.project.model.POM)2 ArchetypeListUpdatedEvent (org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 File (java.io.File)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 BiFunction (java.util.function.BiFunction)1 Function (java.util.function.Function)1