Search in sources :

Example 11 with CeylonImportJarTool

use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool in project ceylon-compiler by ceylon.

the class ImportJarToolTests method testJarOnly.

@Test
public void testJarOnly() {
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("my.jar"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Invalid value 'my.jar' given for argument 'module' to command 'import-jar'", e.getMessage());
    }
}
Also used : OptionArgumentException(com.redhat.ceylon.common.tool.OptionArgumentException) CeylonImportJarTool(com.redhat.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 12 with CeylonImportJarTool

use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool in project ceylon-compiler by ceylon.

the class ImportJarToolTests method testBug1630.

@Test
public void testBug1630() throws Exception {
    FileUtil.delete(destFile("importtest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--dry-run", "--descriptor", "test/src/com/redhat/ceylon/tools/test/test-descriptor.properties", "importtest/1.0", "test/src/com/redhat/ceylon/tools/test/test2.jar"));
        tool.run();
        Assert.fail();
    } catch (ToolUsageError e) {
        Assert.assertEquals("Problems were found, aborting.", e.getMessage());
    }
}
Also used : CeylonImportJarTool(com.redhat.ceylon.tools.importjar.CeylonImportJarTool) ToolUsageError(com.redhat.ceylon.common.tool.ToolUsageError) Test(org.junit.Test)

Example 13 with CeylonImportJarTool

use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool in project ceylon-compiler by ceylon.

the class ImportJarToolTests method testSimpleModuleVersionJar.

@Test
public void testSimpleModuleVersionJar() throws Exception {
    FileUtil.delete(destFile("importtest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--force", "importtest/1.0", "test/src/com/redhat/ceylon/tools/test/test.jar"));
    tool.run();
    File f1 = destFile("importtest/1.0/importtest-1.0.jar");
    File f2 = destFile("importtest/1.0/importtest-1.0.jar.sha1");
    Assert.assertTrue(f1.exists() && f2.exists());
}
Also used : CeylonImportJarTool(com.redhat.ceylon.tools.importjar.CeylonImportJarTool) File(java.io.File) Test(org.junit.Test)

Example 14 with CeylonImportJarTool

use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool in project ceylon-compiler by ceylon.

the class ImportJarToolTests method testVerbosePackageModuleVersionJar.

@Test
public void testVerbosePackageModuleVersionJar() throws Exception {
    FileUtil.delete(destFile("importtest/imptest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--verbose", "--force", "importtest.imptest/1.0", "test/src/com/redhat/ceylon/tools/test/test.jar"));
    tool.run();
    File f1 = destFile("importtest/imptest/1.0/importtest.imptest-1.0.jar");
    File f2 = destFile("importtest/imptest/1.0/importtest.imptest-1.0.jar.sha1");
    Assert.assertTrue(f1.exists() && f2.exists());
}
Also used : CeylonImportJarTool(com.redhat.ceylon.tools.importjar.CeylonImportJarTool) File(java.io.File) Test(org.junit.Test)

Example 15 with CeylonImportJarTool

use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool in project ceylon-compiler by ceylon.

the class ImportJarToolTests method testWithXmlDescriptor.

@Test
public void testWithXmlDescriptor() throws Exception {
    FileUtil.delete(destFile("importtest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--descriptor", "test/src/com/redhat/ceylon/tools/test/test-descriptor.xml", "importtest/1.0", "test/src/com/redhat/ceylon/tools/test/test.jar"));
    tool.run();
    File f1 = destFile("importtest/1.0/importtest-1.0.jar");
    File f2 = destFile("importtest/1.0/importtest-1.0.jar.sha1");
    File f3 = destFile("importtest/1.0/module.xml");
    Assert.assertTrue(f1.exists() && f2.exists());
    Assert.assertTrue(f3.exists());
}
Also used : CeylonImportJarTool(com.redhat.ceylon.tools.importjar.CeylonImportJarTool) File(java.io.File) Test(org.junit.Test)

Aggregations

CeylonImportJarTool (com.redhat.ceylon.tools.importjar.CeylonImportJarTool)16 Test (org.junit.Test)16 File (java.io.File)6 ImportJarException (com.redhat.ceylon.tools.importjar.ImportJarException)5 OptionArgumentException (com.redhat.ceylon.common.tool.OptionArgumentException)3 ToolUsageError (com.redhat.ceylon.common.tool.ToolUsageError)2