Search in sources :

Example 6 with MavenConfig

use of org.jboss.galleon.cli.config.mvn.MavenConfig in project galleon by wildfly.

the class MavenConfigTestCase method testLocalRepository.

@Test
public void testLocalRepository() throws Exception {
    MavenConfig config = cli.getSession().getPmConfiguration().getMavenConfig();
    Path defaultOriginalPath = config.getLocalRepository();
    Path foo = cli.newDir("foo", true);
    Assert.assertFalse(config.getLocalRepository().endsWith("foo"));
    cli.execute("maven set-local-repository " + foo.toFile().getAbsolutePath());
    Assert.assertEquals(foo, config.getLocalRepository());
    Assert.assertEquals(foo, Configuration.parse().getMavenConfig().getLocalRepository());
    cli.execute("maven get-info");
    Assert.assertTrue(cli.getOutput().contains(foo.toFile().getAbsolutePath()));
    cli.execute("maven reset-local-repository");
    Assert.assertEquals(defaultOriginalPath, config.getLocalRepository());
    Assert.assertEquals(defaultOriginalPath, Configuration.parse().getMavenConfig().getLocalRepository());
}
Also used : Path(java.nio.file.Path) MavenConfig(org.jboss.galleon.cli.config.mvn.MavenConfig) Test(org.junit.Test)

Example 7 with MavenConfig

use of org.jboss.galleon.cli.config.mvn.MavenConfig in project galleon by wildfly.

the class MavenConfigTestCase method testOffline.

@Test
public void testOffline() throws Exception {
    MavenConfig config = cli.getSession().getPmConfiguration().getMavenConfig();
    Assert.assertTrue(config.isOffline());
    try {
        cli.execute("maven enable-offline foo");
        throw new Exception("Should have failed");
    } catch (CommandException ex) {
    // XXX OK
    }
    cli.execute("maven enable-offline false");
    Assert.assertFalse(config.isOffline());
    Assert.assertFalse(Configuration.parse().getMavenConfig().isOffline());
    cli.execute("maven reset-offline");
    Assert.assertFalse(config.isOffline());
    Assert.assertFalse(Configuration.parse().getMavenConfig().isOffline());
}
Also used : CommandException(org.aesh.command.CommandException) MavenConfig(org.jboss.galleon.cli.config.mvn.MavenConfig) CommandException(org.aesh.command.CommandException) Test(org.junit.Test)

Aggregations

MavenConfig (org.jboss.galleon.cli.config.mvn.MavenConfig)7 Test (org.junit.Test)6 CommandException (org.aesh.command.CommandException)4 Path (java.nio.file.Path)2 Table (org.jboss.galleon.cli.cmd.Table)1 Cell (org.jboss.galleon.cli.cmd.Table.Cell)1 MavenRemoteRepository (org.jboss.galleon.cli.config.mvn.MavenRemoteRepository)1