use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class BuilderTestBase method getReference.
protected <T> T getReference(Class<T> clazz) {
Bean bean = (Bean) beanManager.getBeans(clazz).iterator().next();
CreationalContext cc = beanManager.createCreationalContext(bean);
return (T) beanManager.getReference(bean, clazz, cc);
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class BuilderTestBase method setUpGuvnorM2Repo.
protected void setUpGuvnorM2Repo() {
Bean m2RepoServiceBean = (Bean) beanManager.getBeans(ExtendedM2RepoService.class).iterator().next();
CreationalContext cc = beanManager.createCreationalContext(m2RepoServiceBean);
ExtendedM2RepoService m2RepoService = (ExtendedM2RepoService) beanManager.getReference(m2RepoServiceBean, ExtendedM2RepoService.class, cc);
String m2RepoURL = m2RepoService.getRepositoryURL();
// Deploy a 1.0 version of guvnor-m2repo-dependency-example1-snapshot kjar
GAV gav = new GAV("org.kie.workbench.common.services.builder.tests", "dependency-test1", "1.0");
InputStream is = this.getClass().getResourceAsStream("/dependency-test1-1.0.jar");
m2RepoService.deployJarInternal(is, gav);
// Deploy a SNAPSHOT version of guvnor-m2repo-dependency-example1-snapshot kjar
GAV gav2 = new GAV("org.kie.workbench.common.services.builder.tests", "dependency-test1-snapshot", "1.0-SNAPSHOT");
InputStream is2 = this.getClass().getResourceAsStream("/dependency-test1-snapshot-1.0-SNAPSHOT.jar");
m2RepoService.deployJarInternal(is2, gav2);
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleImplResolveModuleValidTest 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("/ModuleBackendTestModuleStructureValid");
final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
final Path rootPath = paths.convert(nioRootPath);
// Test a root resolves to the Module's root
final Module result = moduleService.resolveModule(rootPath);
assertEquals(rootPath.toURI(), result.getRootPath().toURI());
}
use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.
the class ModuleImplResolveModuleValidTest 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 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/resources/rule1.drl");
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 testResolveModuleWithGlobalFile.
@Test
public void testResolveModuleWithGlobalFile() 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/global/themes.json");
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());
}
Aggregations