use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool 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.CeylonImportJarTool in project ceylon-compiler by ceylon.
the class ImportJarToolTests method testWithPropertiesDescriptor.
@Test
public void testWithPropertiesDescriptor() 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.properties", "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.properties");
Assert.assertTrue(f1.exists() && f2.exists());
Assert.assertTrue(f3.exists());
}
use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool 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.CeylonImportJarTool in project ceylon-compiler by ceylon.
the class ImportJarToolTests method testNoArgs.
@Test
public void testNoArgs() {
ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
Assert.assertNotNull(model);
try {
CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options());
Assert.fail();
} catch (OptionArgumentException e) {
Assert.assertEquals("Argument 'module' to command 'import-jar' should appear at least 1 time(s)", e.getMessage());
}
}
use of com.redhat.ceylon.tools.importjar.CeylonImportJarTool 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