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());
}
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());
}
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));
}
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();
}
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());
}
Aggregations