Search in sources :

Example 11 with InvokerProperties

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

the class InvokerPropertiesTest method testIsInvocationDefined.

public void testIsInvocationDefined() throws Exception {
    Properties props = new Properties();
    InvokerProperties facade = new InvokerProperties(props);
    assertFalse(facade.isInvocationDefined(1));
    props.setProperty("invoker.goals", "install");
    assertFalse(facade.isInvocationDefined(1));
    props.setProperty("invoker.goals.2", "install");
    assertFalse(facade.isInvocationDefined(1));
    assertTrue(facade.isInvocationDefined(2));
    assertFalse(facade.isInvocationDefined(3));
}
Also used : InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) InvokerProperties(org.apache.maven.plugins.invoker.InvokerProperties) Properties(java.util.Properties)

Example 12 with InvokerProperties

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

the class SelectorTest method testSelectorMatch.

@Test
public void testSelectorMatch() {
    Selector selector = new Selector("3.2.5", "1.7");
    Properties props = new Properties();
    props.setProperty("selector.1.maven.version", "3.0+");
    InvokerProperties invokerProperties = new InvokerProperties(props);
    assertEquals(0, selector.getSelection(invokerProperties));
    props.setProperty("selector.1.maven.version", "3.3.1+");
    assertEquals(Selector.SELECTOR_MULTI, 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 13 with InvokerProperties

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

the class InvokerPropertiesTest method testConfigureRequestProfiles.

public void testConfigureRequestProfiles() throws Exception {
    Properties props = new Properties();
    InvokerProperties facade = new InvokerProperties(props);
    InvocationRequest request = new DefaultInvocationRequest();
    request.setProfiles(Collections.singletonList("test"));
    facade.configureInvocation(request, 0);
    assertEquals(Collections.singletonList("test"), request.getProfiles());
    props.setProperty("invoker.profiles", "verify");
    facade.configureInvocation(request, 0);
    assertEquals(Collections.singletonList("verify"), request.getProfiles());
    props.setProperty("invoker.profiles", "   ");
    facade.configureInvocation(request, 0);
    assertEquals(Arrays.asList(new String[0]), request.getProfiles());
    props.setProperty("invoker.profiles", "  clean , test   verify  ,");
    facade.configureInvocation(request, 0);
    assertEquals(Arrays.asList(new String[] { "clean", "test", "verify" }), request.getProfiles());
    props.setProperty("invoker.profiles", "");
    facade.configureInvocation(request, 0);
    assertEquals(Arrays.asList(new String[0]), request.getProfiles());
}
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 14 with InvokerProperties

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

the class SelectorTest method testGlobalMatch.

@Test
public void testGlobalMatch() {
    Selector selector = new Selector("3.2.5", "1.7");
    Properties props = new Properties();
    props.setProperty("invoker.maven.version", "3.0+");
    InvokerProperties invokerProperties = new InvokerProperties(props);
    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 15 with InvokerProperties

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

the class InvokerPropertiesTest method testConfigureRequestFailureBehavior.

public void testConfigureRequestFailureBehavior() throws Exception {
    Properties props = new Properties();
    InvokerProperties facade = new InvokerProperties(props);
    InvocationRequest request = new DefaultInvocationRequest();
    request.setReactorFailureBehavior(InvocationRequest.ReactorFailureBehavior.FailAtEnd);
    facade.configureInvocation(request, 0);
    assertEquals(InvocationRequest.ReactorFailureBehavior.FailAtEnd, request.getReactorFailureBehavior());
    props.setProperty("invoker.failureBehavior", InvocationRequest.ReactorFailureBehavior.FailNever.getLongOption());
    facade.configureInvocation(request, 0);
    assertEquals("fail-never", request.getReactorFailureBehavior().getLongOption());
}
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