Search in sources :

Example 6 with InvokerProperties

use of org.apache.maven.plugins.invoker.InvokerProperties in project maven-plugins by apache.

the class InvokerPropertiesTest method testConfigureRequestOffline.

public void testConfigureRequestOffline() throws Exception {
    Properties props = new Properties();
    InvokerProperties facade = new InvokerProperties(props);
    InvocationRequest request = new DefaultInvocationRequest();
    request.setOffline(true);
    facade.configureInvocation(request, 0);
    assertTrue(request.isOffline());
    request.setOffline(false);
    facade.configureInvocation(request, 0);
    assertFalse(request.isOffline());
    props.setProperty("invoker.offline", "true");
    facade.configureInvocation(request, 0);
    assertTrue(request.isOffline());
    props.setProperty("invoker.offline", "false");
    facade.configureInvocation(request, 0);
    assertFalse(request.isOffline());
}
Also used : InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvocationRequest(org.apache.maven.shared.invoker.InvocationRequest) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) Properties(java.util.Properties)

Example 7 with InvokerProperties

use of org.apache.maven.plugins.invoker.InvokerProperties in project maven-plugins by apache.

the class InvokerPropertiesTest method testConfigureRequestGoals.

public void testConfigureRequestGoals() throws Exception {
    Properties props = new Properties();
    InvokerProperties facade = new InvokerProperties(props);
    InvocationRequest request = new DefaultInvocationRequest();
    request.setGoals(Collections.singletonList("test"));
    facade.configureInvocation(request, 0);
    assertEquals(Collections.singletonList("test"), request.getGoals());
    props.setProperty("invoker.goals", "verify");
    facade.configureInvocation(request, 0);
    assertEquals(Collections.singletonList("verify"), request.getGoals());
    props.setProperty("invoker.goals", "   ");
    facade.configureInvocation(request, 0);
    assertEquals(Arrays.asList(new String[0]), request.getGoals());
    props.setProperty("invoker.goals", "  clean , test   verify  ");
    facade.configureInvocation(request, 0);
    assertEquals(Arrays.asList(new String[] { "clean", "test", "verify" }), request.getGoals());
    props.setProperty("invoker.goals", "");
    facade.configureInvocation(request, 0);
    assertEquals(Arrays.asList(new String[0]), request.getGoals());
}
Also used : InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvocationRequest(org.apache.maven.shared.invoker.InvocationRequest) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) Properties(java.util.Properties)

Example 8 with InvokerProperties

use of org.apache.maven.plugins.invoker.InvokerProperties in project maven-plugins by apache.

the class SelectorTest method testSelectorWithGlobalMatch.

@Test
public void testSelectorWithGlobalMatch() {
    Selector selector = new Selector("3.2.5", "1.7");
    Properties props = new Properties();
    // invoker.maven.version is used by all selectors
    props.setProperty("invoker.maven.version", "3.0+");
    props.setProperty("selector.1.java.version", "1.4+");
    props.setProperty("selector.2.os.family", "myos");
    InvokerProperties invokerProperties = new InvokerProperties(props);
    assertEquals(0, selector.getSelection(invokerProperties));
    props.setProperty("invoker.maven.version", "3.3.1+");
    assertEquals(Selector.SELECTOR_MULTI, selector.getSelection(invokerProperties));
    props.setProperty("invoker.maven.version", "3.0+");
    props.setProperty("selector.1.maven.version", "3.3.1+");
    assertEquals(Selector.SELECTOR_MULTI, selector.getSelection(invokerProperties));
    props.setProperty("selector.2.os.family", "!myos");
    assertEquals(0, selector.getSelection(invokerProperties));
}
Also used : InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) Properties(java.util.Properties) Selector(org.apache.maven.plugins.invoker.Selector) Test(org.junit.Test)

Example 9 with InvokerProperties

use of org.apache.maven.plugins.invoker.InvokerProperties in project maven-plugins by apache.

the class InvokerPropertiesTest method testConfigureRequestProject.

public void testConfigureRequestProject() throws Exception {
    Properties props = new Properties();
    InvokerProperties facade = new InvokerProperties(props);
    InvocationRequest request = new DefaultInvocationRequest();
    File tempPom = File.createTempFile("maven-invoker-plugin-test", ".pom");
    File tempDir = tempPom.getParentFile();
    request.setBaseDirectory(tempDir);
    facade.configureInvocation(request, 0);
    assertEquals(tempDir, request.getBaseDirectory());
    assertEquals(null, request.getPomFile());
    props.setProperty("invoker.project", tempPom.getName());
    request.setBaseDirectory(tempDir);
    facade.configureInvocation(request, 0);
    assertEquals(tempDir, request.getBaseDirectory());
    assertEquals(tempPom, request.getPomFile());
    props.setProperty("invoker.project", "");
    request.setBaseDirectory(tempDir);
    facade.configureInvocation(request, 0);
    assertEquals(tempDir, request.getBaseDirectory());
    assertEquals(null, request.getPomFile());
    tempPom.delete();
}
Also used : InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvocationRequest(org.apache.maven.shared.invoker.InvocationRequest) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) Properties(java.util.Properties) File(java.io.File)

Example 10 with InvokerProperties

use of org.apache.maven.plugins.invoker.InvokerProperties in project maven-plugins by apache.

the class InvokerPropertiesTest method testConfigureRequestRecursion.

public void testConfigureRequestRecursion() throws Exception {
    Properties props = new Properties();
    InvokerProperties facade = new InvokerProperties(props);
    InvocationRequest request = new DefaultInvocationRequest();
    request.setRecursive(true);
    facade.configureInvocation(request, 0);
    assertTrue(request.isRecursive());
    request.setRecursive(false);
    facade.configureInvocation(request, 0);
    assertFalse(request.isRecursive());
    props.setProperty("invoker.nonRecursive", "true");
    facade.configureInvocation(request, 0);
    assertFalse(request.isRecursive());
    props.setProperty("invoker.nonRecursive", "false");
    facade.configureInvocation(request, 0);
    assertTrue(request.isRecursive());
}
Also used : InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvocationRequest(org.apache.maven.shared.invoker.InvocationRequest) DefaultInvocationRequest(org.apache.maven.shared.invoker.DefaultInvocationRequest) InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) Properties(java.util.Properties)

Aggregations

InvokerProperties (org.apache.maven.plugins.invoker.InvokerProperties)16 Properties (java.util.Properties)15 DefaultInvocationRequest (org.apache.maven.shared.invoker.DefaultInvocationRequest)7 InvocationRequest (org.apache.maven.shared.invoker.InvocationRequest)7 Selector (org.apache.maven.plugins.invoker.Selector)3 Test (org.junit.Test)3 File (java.io.File)1