public JavaFileObjectImpl getReadable(FileKey key) throws IOException { JavaFileObjectImpl<P> entry = entries.get(key); if (entry == null) { P file = fs.getPath(key.names); if (file != null && fs.isFile(file)) { entries.put(key, entry = new JavaFileObjectImpl<P>(location, key, fs, file)); } } return entry; }
public final Timestamped<Resource> getResource(Iterable<String> names) throws IOException { P path = getPath(names); if (path != null && isFile(path)) { return getResource(path); } else { return null; } }
private void assertFS(URL url) throws IOException { ReadFileSystem fs = ReadFileSystem.create(url); Object path = fs.getPath("juzu", "impl", "fs", "spi", "ReadFileSystemTestCase.class"); assertNotNull(path); } }
private void assertFS(URL url) throws IOException { ReadFileSystem fs = ReadFileSystem.create(url); Object path = fs.getPath("juzu", "impl", "fs", "spi", "ReadFileSystemTestCase.class"); assertNotNull(path); } }
@Test public void testAbstractClass() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.implementation.abstractclass"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.IMPLEMENTATION_NOT_ABSTRACT, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "implementation", "abstractclass", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testNoZeroCtor() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.nozeroargctor"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.PROVIDER_FACTORY_NO_ZERO_ARG_CTOR, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "nozeroargctor", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testAbstractClass() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.abstractclass"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.IMPLEMENTATION_NOT_ABSTRACT, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "abstractclass", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testNotPublicClass() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.notpublicclass"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.PROVIDER_FACTORY_NOT_PUBLIC, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "notpublicclass", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testNotAssignable() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.notassignable"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.PROVIDER_NOT_ASSIGNABLE, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "notassignable", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testAbstractClass() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.abstractclass"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.IMPLEMENTATION_NOT_ABSTRACT, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "abstractclass", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testNotAssignable() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.implementation.notassignable"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.IMPLEMENTATION_NOT_ASSIGNABLE, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "implementation", "notassignable", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testAbstractClass() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.abstractclass"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.IMPLEMENTATION_NOT_ABSTRACT, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "abstractclass", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testNotAssignable() throws Exception { CompilerAssert<File, File> compiler = compiler("plugin.binding.implementation.notassignable"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.IMPLEMENTATION_NOT_ASSIGNABLE, error.getCode()); File f = compiler.getSourcePath().getPath("plugin", "binding", "implementation", "notassignable", "package-info.java"); assertEquals(f, error.getSourceFile()); }
@Test public void testMalformedPath() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.malformedpath"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(LessMetaModelPlugin.MALFORMED_PATH, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less", "malformedpath", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less", "malformedpath", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testMalformedPath() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.malformedpath"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(LessMetaModelPlugin.MALFORMED_PATH, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less", "malformedpath", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less", "malformedpath", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testCannotResolve() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.cannotresolve"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(LessMetaModelPlugin.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less", "cannotresolve", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less", "cannotresolve", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testRemoveTemplate() throws Exception { CompilerAssert<File, File> helper = compiler("metamodel.template"); helper.assertCompile(); // assertDelete(helper.getSourcePath().getPath("metamodel", "template", "templates", "index.gtmpl")); // helper.failCompile(); }
@Test public void testFail() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.fail"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "fail", "package-info.java"); // assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less4j", "fail", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testCannotResolve() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.cannotresolve"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "cannotresolve", "package-info.java"); // assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less4j", "cannotresolve", "assets", "stylesheet.css"); assertNull(f); } /*
@Test public void testCannotResolve() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.cannotresolve"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "cannotresolve", "package-info.java"); // assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less4j", "cannotresolve", "assets", "stylesheet.css"); assertNull(f); } /*