use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolvePackageInvalidNoKModuleTest method testResolvePackageWithMainPath.
@Test
public void testResolvePackageWithMainPath() 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("/ModuleBackendTestModuleStructureInvalidNoKModule/src/main");
final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
final Path rootPath = paths.convert(nioRootPath);
// Test a non-Project Path resolves to null
final Package result = moduleService.resolvePackage(rootPath);
assertNull(result);
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleImplResolveModuleValidTest method testResolveModuleWithChildPath.
@Test
public void testResolveModuleWithChildPath() 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");
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");
final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI());
final Path testPath = paths.convert(nioTestPath);
// Test a child folder resolves to the Module's root
final Module result = moduleService.resolveModule(testPath);
assertEquals(rootPath.toURI(), result.getRootPath().toURI());
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleImplResolveModuleValidTest method testResolveModuleWithJavaFile.
@Test
public void testResolveModuleWithJavaFile() 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");
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/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 child folder resolves to the Module's root
final Module result = moduleService.resolveModule(testPath);
assertEquals(rootPath.toURI(), result.getRootPath().toURI());
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleImplResolveModuleValidTest method testModuleServiceInstantiation.
@Test
public void testModuleServiceInstantiation() 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 javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleServiceImplResolveModuleInvalidNoKModuleTest 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("/ModuleBackendTestModuleStructureInvalidNoKModule");
final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
final Path rootPath = paths.convert(nioRootPath);
// Test a non-Module Path resolves to null
final Module result = moduleService.resolveModule(rootPath);
assertNull(result);
}
Aggregations