Search in sources :

Example 1 with ImportJarException

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

the class ImportJarToolTests method testNonexistentSourceJar.

@Test
public void testNonexistentSourceJar() {
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("test/1.0", "test/src/org/eclipse/ceylon/tools/test/test.jar", "test/src/org/eclipse/ceylon/tools/test/nonexistent-sources.jar"));
        Assert.fail();
    } catch (ImportJarException e) {
        String srcJarName = "test/src/org/eclipse/ceylon/tools/test/nonexistent-sources.jar";
        srcJarName = srcJarName.replace('/', File.separatorChar);
        Assert.assertEquals("Source jar file " + srcJarName + " does not exist", e.getMessage());
    }
}
Also used : ImportJarException(org.eclipse.ceylon.tools.importjar.ImportJarException) CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 2 with ImportJarException

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

the class ImportJarToolTests method testWithInvalidPropertiesDescriptor.

@Test
public void testWithInvalidPropertiesDescriptor() throws Exception {
    FileUtil.delete(destFile("importtest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--descriptor", "test/src/org/eclipse/ceylon/tools/test/test-descriptor-broken.properties", "importtest/1.0", "test/src/org/eclipse/ceylon/tools/test/test.jar"));
        tool.run();
        Assert.fail();
    } catch (ImportJarException e) {
        Assert.assertEquals("Invalid module version '' in module descriptor dependency list", e.getMessage());
    }
}
Also used : ImportJarException(org.eclipse.ceylon.tools.importjar.ImportJarException) CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 3 with ImportJarException

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

the class ImportJarToolTests method testWithMissingXmlDescriptor.

@Test
public void testWithMissingXmlDescriptor() throws Exception {
    FileUtil.delete(destFile("importtest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--descriptor", "test/src/org/eclipse/ceylon/tools/test/test-nonexistent-descriptor.xml", "importtest/1.0", "test/src/org/eclipse/ceylon/tools/test/test.jar"));
        tool.run();
        Assert.fail();
    } catch (ImportJarException e) {
        String xmlName = "test/src/org/eclipse/ceylon/tools/test/test-nonexistent-descriptor.xml";
        xmlName = xmlName.replace('/', File.separatorChar);
        Assert.assertEquals("Descriptor file " + xmlName + " does not exist", e.getMessage());
    }
}
Also used : ImportJarException(org.eclipse.ceylon.tools.importjar.ImportJarException) CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 4 with ImportJarException

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

the class ImportJarToolTests method testNonexistentJar.

@Test
public void testNonexistentJar() {
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("test/1.0", "test/src/org/eclipse/ceylon/tools/test/nonexistent.jar"));
        Assert.fail();
    } catch (ImportJarException e) {
        String jarName = "test/src/org/eclipse/ceylon/tools/test/nonexistent.jar";
        jarName = jarName.replace('/', File.separatorChar);
        Assert.assertEquals("Jar file " + jarName + " does not exist", e.getMessage());
    }
}
Also used : ImportJarException(org.eclipse.ceylon.tools.importjar.ImportJarException) CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 5 with ImportJarException

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

the class ImportJarToolTests method testDescriptorSuffix.

@Test
public void testDescriptorSuffix() {
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--descriptor", "test/src/org/eclipse/ceylon/tools/test/ImportJarToolTests.java", "test/1.0", "test/src/org/eclipse/ceylon/tools/test/test.jar"));
        Assert.fail();
    } catch (ImportJarException e) {
        Assert.assertEquals("Descriptor file test/src/org/eclipse/ceylon/tools/test/ImportJarToolTests.java does not end with '.xml' or '.properties' extension", e.getMessage().replace('\\', '/'));
    }
}
Also used : ImportJarException(org.eclipse.ceylon.tools.importjar.ImportJarException) CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Aggregations

CeylonImportJarTool (org.eclipse.ceylon.tools.importjar.CeylonImportJarTool)6 ImportJarException (org.eclipse.ceylon.tools.importjar.ImportJarException)6 Test (org.junit.Test)6