Search in sources :

Example 1 with CeylonImportJarTool

use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool in project ceylon by eclipse.

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(), toolOptions("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(org.eclipse.ceylon.common.tool.OptionArgumentException) CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 2 with CeylonImportJarTool

use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool in project ceylon by eclipse.

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(), toolOptions("--descriptor", "test/src/org/eclipse/ceylon/tools/test/test-descriptor.xml", "importtest/1.0", "test/src/org/eclipse/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(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) File(java.io.File) Test(org.junit.Test)

Example 3 with CeylonImportJarTool

use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool in project ceylon by eclipse.

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(), toolOptions("--force", "importtest/1.0", "test/src/org/eclipse/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(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) File(java.io.File) Test(org.junit.Test)

Example 4 with CeylonImportJarTool

use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool in project ceylon by eclipse.

the class ImportJarToolTests method testDryRun.

@Test
public void testDryRun() throws Exception {
    FileUtil.delete(destFile("importtest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--dry-run", "--descriptor", "test/src/org/eclipse/ceylon/tools/test/test-descriptor.properties", "importtest/1.0", "test/src/org/eclipse/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.properties");
    File f4 = destFile("importtest/1.0/module.properties.sha1");
    Assert.assertTrue(!f1.exists());
    Assert.assertTrue(!f2.exists());
    Assert.assertTrue(!f3.exists());
    Assert.assertTrue(!f4.exists());
}
Also used : CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) File(java.io.File) Test(org.junit.Test)

Example 5 with CeylonImportJarTool

use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool in project ceylon by eclipse.

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(), toolOptions("--dry-run", "--descriptor", "test/src/org/eclipse/ceylon/tools/test/test-descriptor.properties", "importtest/1.0", "test/src/org/eclipse/ceylon/tools/test/test2.jar"));
        tool.run();
        Assert.fail();
    } catch (ToolUsageError e) {
        Assert.assertEquals("Problems were found, aborting.", e.getMessage());
    }
}
Also used : CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) ToolUsageError(org.eclipse.ceylon.common.tool.ToolUsageError) Test(org.junit.Test)

Aggregations

CeylonImportJarTool (org.eclipse.ceylon.tools.importjar.CeylonImportJarTool)23 Test (org.junit.Test)22 File (java.io.File)12 ImportJarException (org.eclipse.ceylon.tools.importjar.ImportJarException)6 OptionArgumentException (org.eclipse.ceylon.common.tool.OptionArgumentException)3 ToolUsageError (org.eclipse.ceylon.common.tool.ToolUsageError)3 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)1 MavenArtifactContext (org.eclipse.ceylon.cmr.api.MavenArtifactContext)1 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)1 CeylonRepoManagerBuilder (org.eclipse.ceylon.cmr.ceylon.CeylonUtils.CeylonRepoManagerBuilder)1 ToolError (org.eclipse.ceylon.common.tool.ToolError)1