Search in sources :

Example 6 with MavenRequest

use of org.appformer.maven.integration.embedder.MavenRequest in project kie-wb-common by kiegroup.

the class AbstractMavenCommand method prepareExecution.

MavenRequest prepareExecution() {
    final MavenRequest mavenRequest = buildMavenRequest();
    mavenRequest.setBaseDirectory(baseDirectory);
    mavenRequest.setLoggingLevel(loggingLevel);
    mavenRequest.setUserProperties(buildUserProperties());
    return mavenRequest;
}
Also used : MavenRequest(org.appformer.maven.integration.embedder.MavenRequest)

Example 7 with MavenRequest

use of org.appformer.maven.integration.embedder.MavenRequest in project kie-wb-common by kiegroup.

the class ExecuteGoalsCommandTest method useDefaultGoalsTest.

@Test
public void useDefaultGoalsTest() {
    final ExecuteGoalsCommand command = new ExecuteGoalsCommand(BASE_DIRECTORY);
    final MavenRequest request = command.buildMavenRequest();
    assertThat(request.getGoals()).isEqualTo(ExecuteGoalsCommand.DEFAULT_GOALS);
}
Also used : MavenRequest(org.appformer.maven.integration.embedder.MavenRequest) Test(org.junit.Test)

Example 8 with MavenRequest

use of org.appformer.maven.integration.embedder.MavenRequest in project kie-wb-common by kiegroup.

the class ExecuteGoalsCommandTest method useCustomGoalsTest.

@Test
public void useCustomGoalsTest() {
    final List<String> customGoals = Collections.singletonList("compile");
    final ExecuteGoalsCommand command = new ExecuteGoalsCommand(BASE_DIRECTORY, customGoals);
    final MavenRequest request = command.buildMavenRequest();
    assertThat(request.getGoals()).isEqualTo(customGoals);
}
Also used : MavenRequest(org.appformer.maven.integration.embedder.MavenRequest) Test(org.junit.Test)

Example 9 with MavenRequest

use of org.appformer.maven.integration.embedder.MavenRequest in project kie-wb-common by kiegroup.

the class ExecuteGoalsCommandTest method executeTest.

@Test
public void executeTest() throws MavenEmbedderException {
    final ExecuteGoalsCommand command = spy(new ExecuteGoalsCommand(BASE_DIRECTORY));
    final MavenRequest mavenRequest = mock(MavenRequest.class);
    doReturn(mavenRequest).when(command).prepareExecution();
    final MavenEmbedder mavenEmbedder = mock(MavenEmbedder.class);
    final MavenExecutionResult result = mock(MavenExecutionResult.class);
    doReturn(result).when(mavenEmbedder).execute(mavenRequest);
    doReturn(mavenEmbedder).when(command).createMavenEmbedder();
    final MavenExecutionResult executionResult = command.execute();
    assertSame(result, executionResult);
}
Also used : MavenEmbedder(org.appformer.maven.integration.embedder.MavenEmbedder) MavenExecutionResult(org.apache.maven.execution.MavenExecutionResult) MavenRequest(org.appformer.maven.integration.embedder.MavenRequest) Test(org.junit.Test)

Example 10 with MavenRequest

use of org.appformer.maven.integration.embedder.MavenRequest in project kie-wb-common by kiegroup.

the class ExecuteGoalsCommandTest method buildMavenRequestTest.

@Test
public void buildMavenRequestTest() {
    final String pomPath = BASE_DIRECTORY + FileSystems.getDefault().getSeparator() + ExecuteGoalsCommand.POM_XML;
    final ExecuteGoalsCommand command = new ExecuteGoalsCommand(BASE_DIRECTORY);
    final MavenRequest request = command.buildMavenRequest();
    assertThat(request.getPom()).isEqualTo(pomPath);
    assertThat(request.getGoals()).isEqualTo(ExecuteGoalsCommand.DEFAULT_GOALS);
}
Also used : MavenRequest(org.appformer.maven.integration.embedder.MavenRequest) Test(org.junit.Test)

Aggregations

MavenRequest (org.appformer.maven.integration.embedder.MavenRequest)11 Test (org.junit.Test)6 MavenEmbedder (org.appformer.maven.integration.embedder.MavenEmbedder)3 Properties (java.util.Properties)2 MavenExecutionResult (org.apache.maven.execution.MavenExecutionResult)2 PrintStream (java.io.PrintStream)1 MavenEmbedderException (org.appformer.maven.integration.embedder.MavenEmbedderException)1 BuildException (org.guvnor.ala.exceptions.BuildException)1