use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageNameValidTest method testResolvePackageWithResourcesFileInSubPackage.
@Test
public void testResolvePackageWithResourcesFileInSubPackage() 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/org/kie/test/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("org.kie.test", result.getPackageName());
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageNameValidTest method testResolvePackageWithJavaFileInSubPackage.
@Test
public void testResolvePackageWithJavaFileInSubPackage() 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/java/org/kie/test/Bean.java");
final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI());
final Path testPath = paths.convert(nioTestPath);
// Test a Java file resolves to the containing package
final Package result = moduleService.resolvePackage(testPath);
assertEquals("org.kie.test", result.getPackageName());
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackagesTest method getKieModuleService.
private KieModuleService getKieModuleService() {
final Bean moduleServiceBean = (Bean) beanManager.getBeans(KieModuleService.class).iterator().next();
final CreationalContext cc = beanManager.createCreationalContext(moduleServiceBean);
return (KieModuleService) beanManager.getReference(moduleServiceBean, KieModuleService.class, cc);
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolveModuleInvalidNoPOMTest method testResolveModuleWithResourcesFile.
@Test
public void testResolveModuleWithResourcesFile() 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("/ModuleBackendTestModuleStructureInvalidNoPOM/src/main/resources/rule1.drl");
final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI());
final Path testPath = paths.convert(nioTestPath);
final Module result = moduleService.resolveModule(testPath);
assertEquals("org.kie.workbench.services", result.getPom().getGav().getGroupId());
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolveModuleInvalidNoPOMTest method testResolveModuleWithRootPath.
@Test
public void testResolveModuleWithRootPath() 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("/ModuleBackendTestModuleStructureInvalidNoPOM");
final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
final Path rootPath = paths.convert(nioRootPath);
final Module result = moduleService.resolveModule(rootPath);
assertEquals("org.kie.workbench.services", result.getPom().getGav().getGroupId());
}
Aggregations