@Override protected boolean isProjectResourceUpdateNeeded(Path resource) { return moduleService.isPom(resource) || kModuleService.isKModule(resource); } }
@Test public void testIsKModuleFileWithNonKModuleFile() throws Exception { final URL testUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureValid/src/main/resources/META-INF"); final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI()); final Path testPath = paths.convert(nioTestPath); //Test a kModule.xml file resolves to a null package final boolean result = kModuleService.isKModule(testPath); assertFalse(result); } }
@Test public void testIsKModuleFileWithKModuleFile() throws Exception { final URL testUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureValid/src/main/resources/META-INF/kmodule.xml"); final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI()); final Path testPath = paths.convert(nioTestPath); //Test a kModule.xml file resolves to a null package final boolean result = kModuleService.isKModule(testPath); assertTrue(result); }
@Override public org.guvnor.common.services.project.model.Package resolvePackage(final Path resource) { try { //Null resource paths cannot resolve to a Module if (resource == null) { return null; } //If Path is not within a Module we cannot resolve a package final Module module = resolveModule(resource, false); if (module == null) { return null; } //pom.xml and kmodule.xml are not inside packages if (isPom(resource) || kModuleService.isKModule(resource)) { return null; } return makePackage(module, resource); } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }