use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool 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());
}
}
use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool 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());
}
}
use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool in project ceylon by eclipse.
the class ImportJarToolTests method testJarAndSourceJarNoDescriptorVerbose.
@Test
public void testJarAndSourceJarNoDescriptorVerbose() throws Exception {
ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
Assert.assertNotNull(model);
CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--force", "--verbose", "source.import.test/1.0", "test/src/org/eclipse/ceylon/tools/test/test.jar", "test/src/org/eclipse/ceylon/tools/test/test-source.jar"));
tool.run();
File jarFile = destFile("source/import/test/1.0/source.import.test-1.0.jar");
File sha1JarFile = destFile("source/import/test/1.0/source.import.test-1.0.jar.sha1");
File sourceJarFile = destFile("source/import/test/1.0/source.import.test-1.0-sources.jar");
File sha1SourceJarFile = destFile("source/import/test/1.0/source.import.test-1.0-sources.jar.sha1");
Assert.assertTrue(jarFile.exists() && sha1JarFile.exists() && sourceJarFile.exists() && sha1SourceJarFile.exists());
}
use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool in project ceylon by eclipse.
the class ImportJarToolTests method testJarAndSourceJarNoDescriptor.
@Test
public void testJarAndSourceJarNoDescriptor() throws Exception {
ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
Assert.assertNotNull(model);
CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--force", "source.import.test/1.0", "test/src/org/eclipse/ceylon/tools/test/test.jar", "test/src/org/eclipse/ceylon/tools/test/test-source.jar"));
tool.run();
File jarFile = destFile("source/import/test/1.0/source.import.test-1.0.jar");
File sha1JarFile = destFile("source/import/test/1.0/source.import.test-1.0.jar.sha1");
File sourceJarFile = destFile("source/import/test/1.0/source.import.test-1.0-sources.jar");
File sha1SourceJarFile = destFile("source/import/test/1.0/source.import.test-1.0-sources.jar.sha1");
Assert.assertTrue(jarFile.exists() && sha1JarFile.exists() && sourceJarFile.exists() && sha1SourceJarFile.exists());
}
use of org.eclipse.ceylon.tools.importjar.CeylonImportJarTool 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());
}
}
Aggregations