use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageValidTest method testProjectServiceInstantiation.
@Test
public void testProjectServiceInstantiation() throws Exception {
final Bean moduleServiceBean = (Bean) beanManager.getBeans(KieModuleService.class).iterator().next();
final CreationalContext cc = beanManager.createCreationalContext(moduleServiceBean);
final KieModuleService moduleService = (KieModuleService) beanManager.getReference(moduleServiceBean, KieModuleService.class, cc);
assertNotNull(moduleService);
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageValidTest method testResolvePackageWithKModuleFile.
@Test
public void testResolvePackageWithKModuleFile() throws Exception {
final Bean moduleServiceBean = (Bean) beanManager.getBeans(KieModuleService.class).iterator().next();
final CreationalContext cc = beanManager.createCreationalContext(moduleServiceBean);
final KieModuleService moduleService = (KieModuleService) beanManager.getReference(moduleServiceBean, KieModuleService.class, cc);
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 Package result = moduleService.resolvePackage(testPath);
assertNull(result);
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageValidTest method testResolvePackageWithSrcPath.
@Test
public void testResolvePackageWithSrcPath() throws Exception {
final Bean moduleServiceBean = (Bean) beanManager.getBeans(KieModuleService.class).iterator().next();
final CreationalContext cc = beanManager.createCreationalContext(moduleServiceBean);
final KieModuleService moduleService = (KieModuleService) beanManager.getReference(moduleServiceBean, KieModuleService.class, cc);
final URL rootUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureValid/src");
final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
final Path rootPath = paths.convert(nioRootPath);
// Test a root/src resolves to null
final Package result = moduleService.resolvePackage(rootPath);
assertNull(result);
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageValidTest method testIsPOMFileWithPOMFile.
@Test
public void testIsPOMFileWithPOMFile() throws Exception {
final Bean moduleServiceBean = (Bean) beanManager.getBeans(KieModuleService.class).iterator().next();
final CreationalContext cc = beanManager.createCreationalContext(moduleServiceBean);
final KieModuleService moduleService = (KieModuleService) beanManager.getReference(moduleServiceBean, KieModuleService.class, cc);
final URL testUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureValid/pom.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 = moduleService.isPom(testPath);
assertTrue(result);
}
use of org.kie.workbench.common.services.shared.project.KieModuleService in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageValidTest method testResolvePackageWithResourcesFileInDefaultPackage.
@Test
public void testResolvePackageWithResourcesFileInDefaultPackage() throws Exception {
final Bean moduleServiceBean = (Bean) beanManager.getBeans(KieModuleService.class).iterator().next();
final CreationalContext cc = beanManager.createCreationalContext(moduleServiceBean);
final KieModuleService moduleService = (KieModuleService) beanManager.getReference(moduleServiceBean, KieModuleService.class, cc);
final URL rootUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureValid/src/main/resources");
final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
final Path rootPath = paths.convert(nioRootPath);
final URL testUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureValid/src/main/resources/rule1.drl");
final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI());
final Path testPath = paths.convert(nioTestPath);
// Test a Resources file resolves to the containing package
final Package result = moduleService.resolvePackage(testPath);
assertEquals(rootPath.toURI(), result.getPackageMainResourcesPath().toURI());
}
Aggregations