Search in sources :

Example 1 with MetadataService

use of org.guvnor.common.services.shared.metadata.MetadataService in project kie-wb-common by kiegroup.

the class ProjectImportServiceImplRepositoryNamesTest method setup.

@Before
public void setup() {
    service = spy(new ProjectImportServiceImpl(ioService, metadataService, repositoryFactory, moduleService, validators, pathUtil, projectService, projectScreenService, newProjectEvent, repoService, spaceConfigStorageRegistry));
    when(spaceConfigStorageRegistry.get(anyString())).thenReturn(spaceConfigStorage);
    when(spaceConfigStorageRegistry.getBatch(anyString())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));
    when(spaceConfigStorageRegistry.exist(anyString())).thenReturn(true);
    when(validators.getValidators()).thenReturn(new ArrayList<>());
    when(ouService.getOrganizationalUnits()).thenReturn(new HashSet<OrganizationalUnit>() {

        {
            add(new OrganizationalUnitImpl("ou1Name", "ou1GroupId"));
        }
    });
    when(moduleService.resolveModule(any(Path.class))).thenAnswer((Answer<KieModule>) invocationOnMock -> {
        final Path path = (Path) invocationOnMock.getArguments()[0];
        final KieModule module = new KieModule(path, path, path, path, path, path, mock(POM.class));
        return module;
    });
    when(sessionInfo.getId()).thenReturn("sessionId");
    when(sessionInfo.getIdentity()).thenReturn(user);
    when(user.getIdentifier()).thenReturn("user");
    exProject1 = mock(ImportProject.class);
    importProjects = Collections.singletonList(exProject1);
    final OrganizationalUnit ou = mock(OrganizationalUnit.class);
    doReturn("ou").when(ou).getName();
    final GitRepository repository1 = mock(GitRepository.class);
    final Path repositoryRoot = mock(Path.class);
    final Path module1Root = mock(Path.class);
    when(organizationalUnit.getName()).thenReturn("ou");
    when(organizationalUnit.getSpace()).thenReturn(space);
    when(space.getName()).thenReturn("ou");
    when(exProject1.getName()).thenReturn("module1");
    when(exProject1.getRoot()).thenReturn(module1Root);
    when(repository1.getBranch("dev_branch")).thenReturn(Optional.of(new Branch("dev_branch", repositoryRoot)));
    final Optional<Branch> main = Optional.of(new Branch("main", PathFactory.newPath("testFile", "file:///")));
    when(repository1.getDefaultBranch()).thenReturn(main);
    when(repositoryRoot.toURI()).thenReturn("default:///");
    when(module1Root.toURI()).thenReturn("default:///module1");
    when(ouService.getOrganizationalUnit(eq("ou"))).thenReturn(ou);
    doReturn("module1").when(repository1).getAlias();
    final WorkspaceProject project = spy(new WorkspaceProject());
    doReturn(repository1.getAlias()).when(project).getName();
    doReturn(mock(Module.class)).when(project).getMainModule();
    doReturn(mock(OrganizationalUnit.class)).when(project).getOrganizationalUnit();
    doReturn(project).when(projectService).resolveProject(repository1);
    doReturn(project).when(projectService).resolveProject(any(Path.class));
    final ProjectScreenModel model = new ProjectScreenModel();
    model.setPOM(new POM());
    doReturn(model).when(projectScreenService).load(any());
}
Also used : Path(org.uberfire.backend.vfs.Path) RepositoryFactory(org.guvnor.structure.server.repositories.RepositoryFactory) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) OrganizationalUnitService(org.guvnor.structure.organizationalunit.OrganizationalUnitService) POM(org.guvnor.common.services.project.model.POM) PathFactory(org.uberfire.backend.vfs.PathFactory) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) SessionInfo(org.uberfire.rpc.SessionInfo) Module(org.guvnor.common.services.project.model.Module) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Assert.fail(org.junit.Assert.fail) SpaceConfigStorage(org.guvnor.structure.organizationalunit.config.SpaceConfigStorage) ProjectScreenService(org.kie.workbench.common.screens.projecteditor.service.ProjectScreenService) Mockito.doReturn(org.mockito.Mockito.doReturn) NewProjectEvent(org.guvnor.common.services.project.events.NewProjectEvent) MetadataService(org.guvnor.common.services.shared.metadata.MetadataService) SpaceConfigStorageRegistry(org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) KieModule(org.kie.workbench.common.services.shared.project.KieModule) List(java.util.List) ImportProjectValidators(org.kie.workbench.common.screens.examples.validation.ImportProjectValidators) PathUtil(org.guvnor.common.services.project.backend.server.utils.PathUtil) Optional(java.util.Optional) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) SpaceConfigStorageRegistryImpl(org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Mockito.doCallRealMethod(org.mockito.Mockito.doCallRealMethod) Space(org.uberfire.spaces.Space) Mock(org.mockito.Mock) OrganizationalUnitImpl(org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl) RunWith(org.junit.runner.RunWith) Mockito.spy(org.mockito.Mockito.spy) Captor(org.mockito.Captor) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Answer(org.mockito.stubbing.Answer) ArgumentCaptor(org.mockito.ArgumentCaptor) ProjectAlreadyExistException(org.kie.workbench.common.screens.examples.exception.ProjectAlreadyExistException) Path(org.uberfire.backend.vfs.Path) Before(org.junit.Before) Event(javax.enterprise.event.Event) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) Answers(org.mockito.Answers) Assert.assertNotNull(org.junit.Assert.assertNotNull) RepositoryService(org.guvnor.structure.repositories.RepositoryService) Test(org.junit.Test) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) Mockito.when(org.mockito.Mockito.when) WorkspaceProjectService(org.guvnor.common.services.project.service.WorkspaceProjectService) Mockito.verify(org.mockito.Mockito.verify) Mockito.never(org.mockito.Mockito.never) User(org.jboss.errai.security.shared.api.identity.User) ImportProject(org.kie.workbench.common.screens.examples.model.ImportProject) IOService(org.uberfire.io.IOService) Collections(java.util.Collections) Branch(org.guvnor.structure.repositories.Branch) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) SpaceConfigStorageRegistryImpl(org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ImportProject(org.kie.workbench.common.screens.examples.model.ImportProject) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) OrganizationalUnitImpl(org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl) POM(org.guvnor.common.services.project.model.POM) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) Branch(org.guvnor.structure.repositories.Branch) Module(org.guvnor.common.services.project.model.Module) KieModule(org.kie.workbench.common.services.shared.project.KieModule) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) KieModule(org.kie.workbench.common.services.shared.project.KieModule) Before(org.junit.Before)

Example 2 with MetadataService

use of org.guvnor.common.services.shared.metadata.MetadataService in project kie-wb-common by kiegroup.

the class ExamplesServiceImplTest method setup.

@Before
public void setup() throws Exception {
    when(spaceConfigStorageRegistry.get(Mockito.<String>any())).thenReturn(spaceConfigStorage);
    when(spaceConfigStorageRegistry.getBatch(Mockito.<String>any())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));
    when(spaceConfigStorageRegistry.exist(Mockito.<String>any())).thenReturn(true);
    when(ou.getSpace()).thenReturn(space);
    when(space.getName()).thenReturn("ou");
    service = spy(new ExamplesServiceImpl(ioService, repositoryFactory, moduleService, ouService, projectService, metadataService, newProjectEvent, projectScreenService, validators, spaceConfigStorageRegistry, systemFS, pathUtil, repositoryService));
    FileUtils.deleteDirectory(new File(".kie-wb-playground"));
    when(this.validators.getValidators()).thenReturn(new ArrayList<>());
    doAnswer(invocationOnMock -> {
        String spaceName = (String) invocationOnMock.getArguments()[0];
        String defaultGroupId = (String) invocationOnMock.getArguments()[1];
        OrganizationalUnitImpl o = new OrganizationalUnitImpl(spaceName, defaultGroupId);
        organizationalUnits.put(spaceName, o);
        return o;
    }).when(ouService).createOrganizationalUnit(Mockito.<String>any(), Mockito.<String>any());
    doAnswer(invocationOnMock -> organizationalUnits.get(invocationOnMock.getArguments()[0])).when(ouService).getOrganizationalUnit(Mockito.<String>any());
    when(ouService.getOrganizationalUnits()).thenReturn(new HashSet<OrganizationalUnit>() {

        {
            add(new OrganizationalUnitImpl("ou1Name", "ou1GroupId"));
            add(new OrganizationalUnitImpl("ou2Name", "ou2GroupId"));
        }
    });
    when(moduleService.resolveModule(Mockito.<Path>any())).thenAnswer((Answer<KieModule>) invocationOnMock -> {
        final Path path = (Path) invocationOnMock.getArguments()[0];
        final KieModule module = new KieModule(path, path, path, path, path, path, mock(POM.class));
        return module;
    });
    when(sessionInfo.getId()).thenReturn("sessionId");
    when(sessionInfo.getIdentity()).thenReturn(user);
    when(user.getIdentifier()).thenReturn("user");
    doAnswer(invocationOnMock -> organizationalUnits.containsKey(invocationOnMock.getArguments()[0])).when(service).existSpace(any());
}
Also used : Arrays(java.util.Arrays) RepositoryInfo(org.guvnor.structure.organizationalunit.config.RepositoryInfo) RepositoryFactory(org.guvnor.structure.server.repositories.RepositoryFactory) URL(java.net.URL) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) OrganizationalUnitService(org.guvnor.structure.organizationalunit.OrganizationalUnitService) ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) POM(org.guvnor.common.services.project.model.POM) PathFactory(org.uberfire.backend.vfs.PathFactory) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) Map(java.util.Map) After(org.junit.After) Spy(org.mockito.Spy) Mockito.doAnswer(org.mockito.Mockito.doAnswer) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) SessionInfo(org.uberfire.rpc.SessionInfo) Module(org.guvnor.common.services.project.model.Module) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) SpaceConfigStorage(org.guvnor.structure.organizationalunit.config.SpaceConfigStorage) ProjectScreenService(org.kie.workbench.common.screens.projecteditor.service.ProjectScreenService) Mockito.doReturn(org.mockito.Mockito.doReturn) NewProjectEvent(org.guvnor.common.services.project.events.NewProjectEvent) MetadataService(org.guvnor.common.services.shared.metadata.MetadataService) SpaceConfigStorageRegistry(org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry) Set(java.util.Set) KieModule(org.kie.workbench.common.services.shared.project.KieModule) List(java.util.List) ImportProjectValidators(org.kie.workbench.common.screens.examples.validation.ImportProjectValidators) Assert.assertFalse(org.junit.Assert.assertFalse) PathUtil(org.guvnor.common.services.project.backend.server.utils.PathUtil) Optional(java.util.Optional) EventSourceMock(org.uberfire.mocks.EventSourceMock) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) SpaceConfigStorageRegistryImpl(org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Space(org.uberfire.spaces.Space) Mock(org.mockito.Mock) OrganizationalUnitImpl(org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) Mockito.spy(org.mockito.Mockito.spy) Captor(org.mockito.Captor) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Answer(org.mockito.stubbing.Answer) ExamplesMetaData(org.kie.workbench.common.screens.examples.model.ExamplesMetaData) ArgumentCaptor(org.mockito.ArgumentCaptor) Path(org.uberfire.backend.vfs.Path) Before(org.junit.Before) Event(javax.enterprise.event.Event) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) Assert.assertNotNull(org.junit.Assert.assertNotNull) RepositoryService(org.guvnor.structure.repositories.RepositoryService) Assert.assertTrue(org.junit.Assert.assertTrue) FileUtils(org.apache.commons.io.FileUtils) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) Mockito.when(org.mockito.Mockito.when) WorkspaceProjectService(org.guvnor.common.services.project.service.WorkspaceProjectService) File(java.io.File) ExampleOrganizationalUnit(org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit) Mockito.verify(org.mockito.Mockito.verify) ImportUtils.makeGitRepository(org.kie.workbench.common.screens.examples.backend.server.ImportUtils.makeGitRepository) Mockito(org.mockito.Mockito) Mockito.never(org.mockito.Mockito.never) Assert.assertNull(org.junit.Assert.assertNull) Paths(java.nio.file.Paths) User(org.jboss.errai.security.shared.api.identity.User) ImportProject(org.kie.workbench.common.screens.examples.model.ImportProject) IOService(org.uberfire.io.IOService) Collections(java.util.Collections) FileSystem(org.uberfire.java.nio.file.FileSystem) Assert.assertEquals(org.junit.Assert.assertEquals) Branch(org.guvnor.structure.repositories.Branch) Path(org.uberfire.backend.vfs.Path) SpaceConfigStorageRegistryImpl(org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ExampleOrganizationalUnit(org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit) File(java.io.File) OrganizationalUnitImpl(org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl) KieModule(org.kie.workbench.common.services.shared.project.KieModule) Before(org.junit.Before)

Example 3 with MetadataService

use of org.guvnor.common.services.shared.metadata.MetadataService in project kie-wb-common by kiegroup.

the class DataModelServiceConstructorTest method testConstructor.

@Test
public void testConstructor() throws IllegalArgumentException, FileSystemNotFoundException, SecurityException, URISyntaxException {
    final URL packageUrl = this.getClass().getResource("/DataModelServiceConstructorTest/src/main/java/t1p1");
    final RenameService renameService = mock(RenameService.class);
    final SaveAndRenameServiceImpl saveAndRenameService = mock(SaveAndRenameServiceImpl.class);
    RepositoryService repoService = mock(RepositoryService.class);
    IOService ioService = new IOServiceDotFileImpl();
    Collection<Role> roles = new ArrayList<>();
    Collection<Group> groups = new ArrayList<>();
    User user = new UserImpl("admin", roles, groups);
    SessionInfo sessionInfo = new SessionInfoImpl("admin", user);
    Instance<User> userInstance = mock(Instance.class);
    when(userInstance.get()).thenReturn(user);
    ConfigIOServiceProducer cfiosProducer = new ConfigIOServiceProducer();
    cfiosProducer.setup();
    IOService configIOService = cfiosProducer.configIOService();
    MetadataService metadataService = new MetadataServiceImpl(ioService, configIOService, mock(CommentedOptionFactory.class), sessionInfo);
    POMContentHandler pomContentHandler = new POMContentHandler();
    M2RepoServiceImpl m2RepoService = new M2RepoServiceImpl();
    PomEnhancer pomEnhancer = new DefaultPomEnhancer();
    POMService pomService = new POMServiceImpl(ioService, pomContentHandler, m2RepoService, metadataService, new EventSourceMock<>(), mock(ModuleService.class), mock(CommentedOptionFactory.class), pomEnhancer);
    KModuleContentHandler moduleContentHandler = new KModuleContentHandler();
    CommentedOptionFactory commentedOptionFactory = new CommentedOptionFactoryImpl(sessionInfo);
    ProjectConfigurationContentHandler moduleConfigurationContentHandler = new ProjectConfigurationContentHandler();
    ProjectImportsService moduleImportsService = new ProjectImportsServiceImpl(ioService, moduleConfigurationContentHandler, renameService, saveAndRenameService);
    Event<NewModuleEvent> newModuleEvent = new EventSourceMock<>();
    Event<NewPackageEvent> newPackageEvent = new EventSourceMock<>();
    Event<InvalidateDMOModuleCacheEvent> invalidateDMOCache = new EventSourceMock<>();
    PermissionTypeRegistry permissionTypeRegistry = new DefaultPermissionTypeRegistry();
    DotNamedPermissionType permissionType = new DotNamedPermissionType(REPOSITORY_TYPE.getName());
    permissionType.createPermission(REPOSITORY_TYPE, RepositoryAction.READ, true);
    permissionType.createPermission(REPOSITORY_TYPE, RepositoryAction.CREATE, true);
    permissionType.createPermission(REPOSITORY_TYPE, RepositoryAction.UPDATE, true);
    permissionType.createPermission(REPOSITORY_TYPE, RepositoryAction.DELETE, true);
    permissionTypeRegistry.register(permissionType);
    ModuleRepositoryResolver repositoryResolver = new ModuleRepositoryResolverImpl(ioService, null, null);
    FileDiscoveryService fileDiscoveryService = new FileDiscoveryServiceImpl();
    HackedKieModuleServiceImpl moduleService = null;
    HackedKModuleServiceImpl kModuleService = new HackedKModuleServiceImpl(ioService, moduleService, metadataService, moduleContentHandler);
    KieResourceResolver resourceResolver = new KieResourceResolver(ioService, pomService, commentedOptionFactory, kModuleService, resourcePathResolversInstance);
    ModuleSaver moduleSaver = null;
    moduleService = new HackedKieModuleServiceImpl(ioService, moduleSaver, pomService, repoService, newModuleEvent, newPackageEvent, invalidateDMOCache, sessionInfo, commentedOptionFactory, mock(ModuleFinder.class), mock(PackageServiceLoader.class), resourceResolver, repositoryResolver);
    ModuleRepositoriesContentHandler contentHandler = new ModuleRepositoriesContentHandler();
    ModuleRepositoriesService moduleRepositoriesService = new KieModuleRepositoriesServiceImpl(ioService, repositoryResolver, resourceResolver, contentHandler, commentedOptionFactory);
    DependencyService dependencyService = new DependencyServiceImpl();
    PackageNameSearchProvider packageNameSearchProvider = new PackageNameSearchProvider(dependencyService);
    PackageNameAllowListLoader loader = new PackageNameAllowListLoader(packageNameSearchProvider, ioService);
    MetadataServerSideService serverSideMetdataService = new MetadataServiceImpl(ioService, configIOService, commentedOptionFactory, sessionInfo);
    PackageNameAllowListSaver saver = new PackageNameAllowListSaver(ioService, serverSideMetdataService, commentedOptionFactory);
    PackageNameAllowListService packageNameAllowListService = new PackageNameAllowListServiceImpl(ioService, moduleService, loader, saver);
    moduleSaver = new ModuleSaver(ioService, pomService, kModuleService, newModuleEvent, newPackageEvent, resourceResolver, moduleImportsService, moduleRepositoriesService, packageNameAllowListService, commentedOptionFactory, sessionInfo);
    moduleService.setModuleSaver(moduleSaver);
    kModuleService.setModuleService(moduleService);
    ProjectImportsService importsService = new ProjectImportsServiceImpl(ioService, moduleConfigurationContentHandler, renameService, saveAndRenameService);
    Instance<BuildValidationHelper> buildValidationHelperBeans = null;
    Instance<Predicate<String>> classFilterBeans = null;
    HackedLRUModuleDependenciesClassLoaderCache dependenciesClassLoaderCache = new HackedLRUModuleDependenciesClassLoaderCache();
    LRUPomModelCache pomModelCache = new LRUPomModelCache();
    LRUBuilderCache builderCache = new LRUBuilderCache(ioService, moduleService, importsService, buildValidationHelperBeans, dependenciesClassLoaderCache, pomModelCache, packageNameAllowListService, classFilterBeans);
    Instance<PostBuildHandler> handlerInstance = mock(Instance.class);
    Iterator<PostBuildHandler> mockIterator = mock(Iterator.class);
    when(handlerInstance.iterator()).thenReturn(mockIterator);
    when(mockIterator.hasNext()).thenReturn(false);
    DeploymentVerifier deploymentVerifier = new DeploymentVerifier(repositoryResolver, moduleRepositoriesService);
    BuildHelper buildHelper = new BuildHelper(pomService, m2RepoService, moduleService, deploymentVerifier, builderCache, handlerInstance, userInstance);
    PipelineRegistry pipelineRegistry = new InMemoryPipelineRegistry();
    BuildPipelineInitializer pipelineInitializer = new BuildPipelineInitializer(pipelineRegistry, getConfigExecutors(moduleService, buildHelper));
    BuildPipelineInvoker pipelineInvoker = new BuildPipelineInvoker(pipelineInitializer.getExecutor(), pipelineRegistry);
    BuildServiceHelper buildServiceHelper = new BuildServiceHelper(pipelineInvoker, deploymentVerifier);
    BuildService buildService = new BuildServiceImpl(moduleService, buildServiceHelper, builderCache);
    BuildInfoService buildInfoService = new BuildInfoService(buildService, builderCache);
    ModuleDataModelOracleBuilderProvider builderProvider = new ModuleDataModelOracleBuilderProvider(packageNameAllowListService, importsService);
    LRUModuleDataModelOracleCache cacheModules = new LRUModuleDataModelOracleCache(builderProvider, moduleService, buildInfoService);
    dependenciesClassLoaderCache.setBuildInfoService(buildInfoService);
    LRUDataModelOracleCache cachePackages = new LRUDataModelOracleCache(ioService, fileDiscoveryService, cacheModules, moduleService, buildInfoService, dataModelExtensionProvider, new RawMVELEvaluator());
    DataModelService dataModelService = new DataModelServiceImpl(cachePackages, cacheModules, moduleService);
    final org.uberfire.java.nio.file.Path nioPackagePath = fs.getPath(packageUrl.toURI());
    final Path packagePath = Paths.convert(nioPackagePath);
    final ModuleDataModelOracle oracle = dataModelService.getModuleDataModel(packagePath);
    assertNotNull(oracle);
    assertEquals(4, oracle.getModuleModelFields().size());
    assertContains("t1p1.Bean1", oracle.getModuleModelFields().keySet());
    assertContains("t1p1.DRLBean", oracle.getModuleModelFields().keySet());
    assertContains("t1p2.Bean2", oracle.getModuleModelFields().keySet());
    assertContains("java.lang.String", oracle.getModuleModelFields().keySet());
    assertEquals(TypeSource.JAVA_PROJECT, oracle.getModuleTypeSources().get("t1p1.Bean1"));
    assertEquals(TypeSource.DECLARED, oracle.getModuleTypeSources().get("t1p1.DRLBean"));
    assertEquals(TypeSource.JAVA_PROJECT, oracle.getModuleTypeSources().get("t1p2.Bean2"));
    assertEquals(TypeSource.JAVA_DEPENDENCY, oracle.getModuleTypeSources().get("java.lang.String"));
}
Also used : KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) ModuleService(org.guvnor.common.services.project.service.ModuleService) IOServiceDotFileImpl(org.uberfire.io.impl.IOServiceDotFileImpl) ProjectImportsService(org.kie.workbench.common.services.shared.project.ProjectImportsService) ArrayList(java.util.ArrayList) POMContentHandler(org.guvnor.common.services.project.backend.server.utils.POMContentHandler) KieResourceResolver(org.kie.workbench.common.services.backend.project.KieResourceResolver) PackageNameAllowListLoader(org.kie.workbench.common.services.backend.allowlist.PackageNameAllowListLoader) MetadataServerSideService(org.guvnor.common.services.backend.metadata.MetadataServerSideService) Predicate(java.util.function.Predicate) ProjectImportsServiceImpl(org.kie.workbench.common.services.backend.project.ProjectImportsServiceImpl) PackageNameSearchProvider(org.kie.workbench.common.services.backend.allowlist.PackageNameSearchProvider) RawMVELEvaluator(org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator) ModuleDataModelOracleBuilderProvider(org.kie.workbench.common.services.datamodel.backend.server.cache.ModuleDataModelOracleBuilderProvider) DefaultPermissionTypeRegistry(org.uberfire.security.impl.authz.DefaultPermissionTypeRegistry) FileDiscoveryServiceImpl(org.guvnor.common.services.backend.file.FileDiscoveryServiceImpl) BuildPipelineInvoker(org.kie.workbench.common.services.backend.builder.ala.BuildPipelineInvoker) DefaultPomEnhancer(org.guvnor.common.services.project.backend.server.DefaultPomEnhancer) KieModuleRepositoriesServiceImpl(org.kie.workbench.common.services.backend.project.KieModuleRepositoriesServiceImpl) FileDiscoveryService(org.guvnor.common.services.backend.file.FileDiscoveryService) Role(org.jboss.errai.security.shared.api.Role) LRUPomModelCache(org.kie.workbench.common.services.backend.builder.core.LRUPomModelCache) BuildServiceHelper(org.kie.workbench.common.services.backend.builder.service.BuildServiceHelper) ModuleRepositoriesContentHandler(org.guvnor.common.services.project.backend.server.ModuleRepositoriesContentHandler) BuildHelper(org.kie.workbench.common.services.backend.builder.core.BuildHelper) DefaultPermissionTypeRegistry(org.uberfire.security.impl.authz.DefaultPermissionTypeRegistry) PermissionTypeRegistry(org.uberfire.security.authz.PermissionTypeRegistry) ModuleRepositoryResolverImpl(org.guvnor.common.services.project.backend.server.ModuleRepositoryResolverImpl) BuildServiceImpl(org.kie.workbench.common.services.backend.builder.service.BuildServiceImpl) BuildValidationHelper(org.guvnor.common.services.project.builder.service.BuildValidationHelper) Group(org.jboss.errai.security.shared.api.Group) CommentedOptionFactory(org.guvnor.common.services.backend.util.CommentedOptionFactory) User(org.jboss.errai.security.shared.api.identity.User) BuildService(org.guvnor.common.services.project.builder.service.BuildService) DefaultPomEnhancer(org.guvnor.common.services.project.backend.server.DefaultPomEnhancer) PomEnhancer(org.guvnor.common.services.project.backend.server.PomEnhancer) POMServiceImpl(org.guvnor.common.services.project.backend.server.POMServiceImpl) SessionInfo(org.uberfire.rpc.SessionInfo) PackageNameAllowListServiceImpl(org.kie.workbench.common.services.backend.allowlist.PackageNameAllowListServiceImpl) MetadataServiceImpl(org.guvnor.common.services.backend.metadata.MetadataServiceImpl) EventSourceMock(org.uberfire.mocks.EventSourceMock) ModuleRepositoriesService(org.guvnor.common.services.project.service.ModuleRepositoriesService) DependencyService(org.kie.workbench.common.services.shared.dependencies.DependencyService) BuildPipelineInitializer(org.kie.workbench.common.services.backend.builder.ala.BuildPipelineInitializer) URL(java.net.URL) SessionInfoImpl(org.uberfire.rpc.impl.SessionInfoImpl) MetadataService(org.guvnor.common.services.shared.metadata.MetadataService) InMemoryPipelineRegistry(org.guvnor.ala.registry.inmemory.InMemoryPipelineRegistry) PipelineRegistry(org.guvnor.ala.registry.PipelineRegistry) SaveAndRenameServiceImpl(org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl) IOService(org.uberfire.io.IOService) NewPackageEvent(org.guvnor.common.services.project.events.NewPackageEvent) PackageNameAllowListSaver(org.kie.workbench.common.services.backend.allowlist.PackageNameAllowListSaver) PackageNameAllowListService(org.kie.workbench.common.services.shared.allowlist.PackageNameAllowListService) BuildInfoService(org.kie.workbench.common.services.backend.builder.service.BuildInfoService) UserImpl(org.jboss.errai.security.shared.api.identity.UserImpl) DotNamedPermissionType(org.uberfire.security.impl.authz.DotNamedPermissionType) KModuleContentHandler(org.kie.workbench.common.services.backend.kmodule.KModuleContentHandler) PostBuildHandler(org.guvnor.common.services.project.builder.service.PostBuildHandler) RepositoryService(org.guvnor.structure.repositories.RepositoryService) LRUModuleDataModelOracleCache(org.kie.workbench.common.services.datamodel.backend.server.cache.LRUModuleDataModelOracleCache) Path(org.uberfire.backend.vfs.Path) InvalidateDMOModuleCacheEvent(org.guvnor.common.services.project.builder.events.InvalidateDMOModuleCacheEvent) LRUBuilderCache(org.kie.workbench.common.services.backend.builder.core.LRUBuilderCache) ModuleDataModelOracle(org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle) ModuleSaver(org.kie.workbench.common.services.backend.project.ModuleSaver) RenameService(org.uberfire.ext.editor.commons.service.RenameService) InMemoryPipelineRegistry(org.guvnor.ala.registry.inmemory.InMemoryPipelineRegistry) POMService(org.guvnor.common.services.project.service.POMService) ConfigIOServiceProducer(org.uberfire.backend.server.io.ConfigIOServiceProducer) NewModuleEvent(org.guvnor.common.services.project.events.NewModuleEvent) DeploymentVerifier(org.kie.workbench.common.services.backend.builder.core.DeploymentVerifier) LRUDataModelOracleCache(org.kie.workbench.common.services.datamodel.backend.server.cache.LRUDataModelOracleCache) M2RepoServiceImpl(org.guvnor.m2repo.backend.server.M2RepoServiceImpl) DependencyServiceImpl(org.kie.workbench.common.services.backend.dependencies.DependencyServiceImpl) ProjectConfigurationContentHandler(org.guvnor.common.services.project.backend.server.ProjectConfigurationContentHandler) ModuleRepositoryResolver(org.guvnor.common.services.project.service.ModuleRepositoryResolver) DataModelService(org.kie.workbench.common.services.datamodel.backend.server.service.DataModelService) CommentedOptionFactoryImpl(org.guvnor.common.services.backend.util.CommentedOptionFactoryImpl) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)3 MetadataService (org.guvnor.common.services.shared.metadata.MetadataService)3 RepositoryService (org.guvnor.structure.repositories.RepositoryService)3 User (org.jboss.errai.security.shared.api.identity.User)3 Test (org.junit.Test)3 KieModuleService (org.kie.workbench.common.services.shared.project.KieModuleService)3 URL (java.net.URL)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Optional (java.util.Optional)2 Event (javax.enterprise.event.Event)2 PathUtil (org.guvnor.common.services.project.backend.server.utils.PathUtil)2 Path (org.uberfire.backend.vfs.Path)2 IOService (org.uberfire.io.IOService)2 EventSourceMock (org.uberfire.mocks.EventSourceMock)2 SessionInfo (org.uberfire.rpc.SessionInfo)2 File (java.io.File)1 Paths (java.nio.file.Paths)1 Arrays (java.util.Arrays)1