Search in sources :

Example 1 with Selector

use of org.apache.maven.plugins.invoker.Selector 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 2 with Selector

use of org.apache.maven.plugins.invoker.Selector 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 3 with Selector

use of org.apache.maven.plugins.invoker.Selector 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)

Aggregations

Properties (java.util.Properties)3 InvokerProperties (org.apache.maven.plugins.invoker.InvokerProperties)3 Selector (org.apache.maven.plugins.invoker.Selector)3 Test (org.junit.Test)3