Search in sources :

Example 41 with CreationalContext

use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.

the class ModuleServiceImplResolvePackageInvalidNoKModuleTest 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);
}
Also used : KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) CreationalContext(javax.enterprise.context.spi.CreationalContext) Bean(javax.enterprise.inject.spi.Bean) Test(org.junit.Test)

Example 42 with CreationalContext

use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.

the class ModuleServiceImplResolvePackageInvalidNoKModuleTest 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("/ModuleBackendTestModuleStructureInvalidNoKModule/src");
    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);
}
Also used : Path(org.uberfire.backend.vfs.Path) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) CreationalContext(javax.enterprise.context.spi.CreationalContext) Package(org.guvnor.common.services.project.model.Package) URL(java.net.URL) Bean(javax.enterprise.inject.spi.Bean) Test(org.junit.Test)

Example 43 with CreationalContext

use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.

the class ModuleServiceImplResolvePackageInvalidNoKModuleTest method testResolvePackageWithJavaFileInDefaultPackage.

@Test
public void testResolvePackageWithJavaFileInDefaultPackage() 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/java");
    final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
    final Path rootPath = paths.convert(nioRootPath);
    final URL testUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureInvalidNoKModule/src/main/java/Bean.java");
    final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI());
    final Path testPath = paths.convert(nioTestPath);
    // Test a non-Project Path resolves to null
    final Package result = moduleService.resolvePackage(testPath);
    assertNull(result);
}
Also used : Path(org.uberfire.backend.vfs.Path) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) CreationalContext(javax.enterprise.context.spi.CreationalContext) Package(org.guvnor.common.services.project.model.Package) URL(java.net.URL) Bean(javax.enterprise.inject.spi.Bean) Test(org.junit.Test)

Example 44 with CreationalContext

use of javax.enterprise.context.spi.CreationalContext in project kie-wb-common by kiegroup.

the class ModuleServiceImplResolvePackageInvalidNoKModuleTest method testResolvePackageDefaultJava.

@Test
public void testResolvePackageDefaultJava() 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/java");
    final org.uberfire.java.nio.file.Path nioRootPath = fs.getPath(rootUrl.toURI());
    final Path rootPath = paths.convert(nioRootPath);
    final URL testUrl = this.getClass().getResource("/ModuleBackendTestModuleStructureInvalidNoKModule/src/main/java");
    final org.uberfire.java.nio.file.Path nioTestPath = fs.getPath(testUrl.toURI());
    final Path testPath = paths.convert(nioTestPath);
    // Test a non-Project Path resolves to null
    final Package result = moduleService.resolvePackage(testPath);
    assertNull(result);
}
Also used : Path(org.uberfire.backend.vfs.Path) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) CreationalContext(javax.enterprise.context.spi.CreationalContext) Package(org.guvnor.common.services.project.model.Package) URL(java.net.URL) Bean(javax.enterprise.inject.spi.Bean) Test(org.junit.Test)

Example 45 with CreationalContext

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);
}
Also used : Path(org.uberfire.backend.vfs.Path) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) CreationalContext(javax.enterprise.context.spi.CreationalContext) Package(org.guvnor.common.services.project.model.Package) URL(java.net.URL) Bean(javax.enterprise.inject.spi.Bean) Test(org.junit.Test)

Aggregations

CreationalContext (javax.enterprise.context.spi.CreationalContext)132 Bean (javax.enterprise.inject.spi.Bean)113 Test (org.junit.Test)83 URL (java.net.URL)67 Path (org.uberfire.backend.vfs.Path)67 KieModuleService (org.kie.workbench.common.services.shared.project.KieModuleService)66 Package (org.guvnor.common.services.project.model.Package)43 Module (org.guvnor.common.services.project.model.Module)13 BeanManager (javax.enterprise.inject.spi.BeanManager)11 BuildResults (org.guvnor.common.services.project.builder.model.BuildResults)6 IncrementalBuildResults (org.guvnor.common.services.project.builder.model.IncrementalBuildResults)6 Before (org.junit.Before)6 Weld (org.jboss.weld.environment.se.Weld)5 Context (javax.enterprise.context.spi.Context)4 InjectionTarget (javax.enterprise.inject.spi.InjectionTarget)4 WebBeansContext (org.apache.webbeans.config.WebBeansContext)4 Fabric8Extension (io.fabric8.cdi.Fabric8Extension)3 Annotation (java.lang.annotation.Annotation)3 Method (java.lang.reflect.Method)3 Type (java.lang.reflect.Type)3