use of com.redhat.ceylon.tools.importjar.ImportJarException in project ceylon-compiler by ceylon.
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(), options("--descriptor", "test/src/com/redhat/ceylon/tools/test/test-nonexistent-descriptor.xml", "importtest/1.0", "test/src/com/redhat/ceylon/tools/test/test.jar"));
tool.run();
Assert.fail();
} catch (ImportJarException e) {
String xmlName = "test/src/com/redhat/ceylon/tools/test/test-nonexistent-descriptor.xml";
xmlName = xmlName.replace('/', File.separatorChar);
Assert.assertEquals("Descriptor file " + xmlName + " does not exist", e.getMessage());
}
}
use of com.redhat.ceylon.tools.importjar.ImportJarException in project ceylon-compiler by ceylon.
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(), options("test/1.0", "test/src/com/redhat/ceylon/tools/test/nonexistent.jar"));
Assert.fail();
} catch (ImportJarException e) {
String jarName = "test/src/com/redhat/ceylon/tools/test/nonexistent.jar";
jarName = jarName.replace('/', File.separatorChar);
Assert.assertEquals("Jar file " + jarName + " does not exist", e.getMessage());
}
}
use of com.redhat.ceylon.tools.importjar.ImportJarException in project ceylon-compiler by ceylon.
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(), options("--descriptor", "test/src/com/redhat/ceylon/tools/test/ImportJarToolTests.java", "test/1.0", "test/src/com/redhat/ceylon/tools/test/test.jar"));
Assert.fail();
} catch (ImportJarException e) {
Assert.assertEquals("Descriptor file test/src/com/redhat/ceylon/tools/test/ImportJarToolTests.java does not end with '.xml' or '.properties' extension", e.getMessage().replace('\\', '/'));
}
}
use of com.redhat.ceylon.tools.importjar.ImportJarException in project ceylon-compiler by ceylon.
the class ImportJarToolTests method testWithInvalidXmlDescriptor.
@Test
public void testWithInvalidXmlDescriptor() throws Exception {
FileUtil.delete(destFile("importtest"));
ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
Assert.assertNotNull(model);
try {
CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--descriptor", "test/src/com/redhat/ceylon/tools/test/test-descriptor-broken.xml", "importtest/1.0", "test/src/com/redhat/ceylon/tools/test/test.jar"));
tool.run();
Assert.fail();
} catch (ImportJarException e) {
Assert.assertEquals("Descriptor file test/src/com/redhat/ceylon/tools/test/test-descriptor-broken.xml is not a valid module.xml file: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.", e.getMessage().replace('\\', '/'));
}
}
use of com.redhat.ceylon.tools.importjar.ImportJarException in project ceylon-compiler by ceylon.
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(), options("--descriptor", "test/src/com/redhat/ceylon/tools/test/test-descriptor-broken.properties", "importtest/1.0", "test/src/com/redhat/ceylon/tools/test/test.jar"));
tool.run();
Assert.fail();
} catch (ImportJarException e) {
Assert.assertEquals("Invalid module version '' in module descriptor dependency list", e.getMessage());
}
}
Aggregations