Search in sources :

Example 1 with ArchetypeListUpdatedEvent

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

the class ArchetypeManagementScreenPresenterTest method fireNotificationOnArchetypeListUpdatedEvent.

private void fireNotificationOnArchetypeListUpdatedEvent(final ArchetypeListOperation operation, final String notificationMsg, final String tsKey) {
    doReturn(notificationMsg).when(ts).getTranslation(tsKey);
    doReturn(true).when(archetypeTablePresenter).isSetup();
    presenter.onArchetypeListUpdatedEvent(new ArchetypeListUpdatedEvent(operation));
    verify(notificationEvent).fire(new NotificationEvent(notificationMsg, NotificationEvent.NotificationType.SUCCESS));
}
Also used : ArchetypeListUpdatedEvent(org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 2 with ArchetypeListUpdatedEvent

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

the class ArchetypeServiceImpl method finishAddExternalArchetype.

private void finishAddExternalArchetype(final GAV templateGav, final File workingDirectory) throws GitAPIException, MavenEmbedderException {
    final File repositoryDirectory = new File(workingDirectory, templateGav.getArtifactId());
    final Archetype archetype = finishAddArchetype(templateGav, repositoryDirectory, false);
    archetypePreferencesManager.addArchetype(archetype.getAlias());
    archetypeListUpdatedEvent.fire(new ArchetypeListUpdatedEvent(ArchetypeListOperation.ADD));
}
Also used : Archetype(org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype) ArchetypeListUpdatedEvent(org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent) File(java.io.File)

Example 3 with ArchetypeListUpdatedEvent

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

the class ArchetypeServiceImpl method validate.

@Override
public void validate(final String alias) {
    checkNotEmpty(ALIAS_PARAM, alias);
    final Repository repository = resolveRepository(alias);
    if (repository == null) {
        throw new IllegalStateException(String.format("Repository %s cannot be resolved.", alias));
    }
    validateArchetype(repository);
    archetypePreferencesManager.addArchetype(alias);
    archetypeListUpdatedEvent.fire(new ArchetypeListUpdatedEvent(ArchetypeListOperation.VALIDATE));
}
Also used : Repository(org.guvnor.structure.repositories.Repository) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) ArchetypeListUpdatedEvent(org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent)

Example 4 with ArchetypeListUpdatedEvent

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

the class AbstractArchetypeTablePresenterTest method onArchetypeListUpdatedEventWhenIsNotSetupTest.

@Test
public void onArchetypeListUpdatedEventWhenIsNotSetupTest() {
    setPresenterPrivateField("setup", false);
    presenter.onArchetypeListUpdatedEvent(new ArchetypeListUpdatedEvent(ArchetypeListOperation.ADD));
    verify(archetypeService, never()).list(any(), any(), any());
}
Also used : ArchetypeListUpdatedEvent(org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent) Test(org.junit.Test)

Example 5 with ArchetypeListUpdatedEvent

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

the class AbstractArchetypeTablePresenterTest method onArchetypeListUpdatedEventWhenIsSetupTest.

@Test
public void onArchetypeListUpdatedEventWhenIsSetupTest() {
    setPresenterPrivateField("setup", true);
    doReturn(promises.resolve()).when(presenter).loadList(false);
    presenter.onArchetypeListUpdatedEvent(new ArchetypeListUpdatedEvent(ArchetypeListOperation.ADD));
    verify(presenter).loadList(false);
}
Also used : ArchetypeListUpdatedEvent(org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent) Test(org.junit.Test)

Aggregations

ArchetypeListUpdatedEvent (org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent)11 Test (org.junit.Test)7 Repository (org.guvnor.structure.repositories.Repository)3 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)3 Archetype (org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype)3 File (java.io.File)1 GAV (org.guvnor.common.services.project.model.GAV)1 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)1 AbstractMavenCommand (org.kie.workbench.common.screens.archetype.mgmt.backend.maven.AbstractMavenCommand)1 KieModule (org.kie.workbench.common.services.shared.project.KieModule)1 Path (org.uberfire.java.nio.file.Path)1 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)1