Search in sources :

Example 1 with AbstractMavenCommand

use of org.kie.workbench.common.screens.archetype.mgmt.backend.maven.AbstractMavenCommand in project kie-wb-common by kiegroup.

the class ArchetypeServiceImplTest method executeMavenWhenHasExceptionsTest.

@Test(expected = MavenExecutionException.class)
public void executeMavenWhenHasExceptionsTest() throws MavenEmbedderException {
    final AbstractMavenCommand command = mock(AbstractMavenCommand.class);
    final MavenExecutionResult result = mock(MavenExecutionResult.class);
    doReturn(true).when(result).hasExceptions();
    doReturn(result).when(command).execute();
    service.executeMaven(command);
}
Also used : MavenExecutionResult(org.apache.maven.execution.MavenExecutionResult) AbstractMavenCommand(org.kie.workbench.common.screens.archetype.mgmt.backend.maven.AbstractMavenCommand) Test(org.junit.Test)

Example 2 with AbstractMavenCommand

use of org.kie.workbench.common.screens.archetype.mgmt.backend.maven.AbstractMavenCommand in project kie-wb-common by kiegroup.

the class ArchetypeServiceImplTest method executeMavenSuccessTest.

@Test
public void executeMavenSuccessTest() throws MavenEmbedderException {
    final AbstractMavenCommand command = mock(AbstractMavenCommand.class);
    doReturn(mock(MavenExecutionResult.class)).when(command).execute();
    try {
        service.executeMaven(command);
    } catch (Exception e) {
        fail("Should not have thrown any exception");
    }
}
Also used : MavenExecutionResult(org.apache.maven.execution.MavenExecutionResult) AbstractMavenCommand(org.kie.workbench.common.screens.archetype.mgmt.backend.maven.AbstractMavenCommand) MavenEmbedderException(org.appformer.maven.integration.embedder.MavenEmbedderException) GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) ArchetypeAlreadyExistsException(org.kie.workbench.common.screens.archetype.mgmt.shared.exceptions.ArchetypeAlreadyExistsException) InvalidArchetypeException(org.kie.workbench.common.screens.archetype.mgmt.shared.exceptions.InvalidArchetypeException) MavenExecutionException(org.kie.workbench.common.screens.archetype.mgmt.shared.exceptions.MavenExecutionException) WrongRepositoryStateException(org.eclipse.jgit.api.errors.WrongRepositoryStateException) Test(org.junit.Test)

Aggregations

MavenExecutionResult (org.apache.maven.execution.MavenExecutionResult)2 Test (org.junit.Test)2 AbstractMavenCommand (org.kie.workbench.common.screens.archetype.mgmt.backend.maven.AbstractMavenCommand)2 MavenEmbedderException (org.appformer.maven.integration.embedder.MavenEmbedderException)1 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)1 WrongRepositoryStateException (org.eclipse.jgit.api.errors.WrongRepositoryStateException)1 ArchetypeAlreadyExistsException (org.kie.workbench.common.screens.archetype.mgmt.shared.exceptions.ArchetypeAlreadyExistsException)1 InvalidArchetypeException (org.kie.workbench.common.screens.archetype.mgmt.shared.exceptions.InvalidArchetypeException)1 MavenExecutionException (org.kie.workbench.common.screens.archetype.mgmt.shared.exceptions.MavenExecutionException)1