Search in sources :

Example 6 with UserImpl

use of org.jboss.errai.security.shared.api.identity.UserImpl in project kie-wb-common by kiegroup.

the class ModuleSaverTest method setUp.

@Before
public void setUp() throws Exception {
    fs = new SimpleFileSystemProvider();
    super.startWeld();
    // Instantiate Paths used in tests for Path conversion
    final Bean pathsBean = (Bean) beanManager.getBeans(Paths.class).iterator().next();
    final CreationalContext cc = beanManager.createCreationalContext(pathsBean);
    paths = (Paths) beanManager.getReference(pathsBean, Paths.class, cc);
    // Ensure URLs use the default:// scheme
    fs.forceAsDefault();
    final Event<NewModuleEvent> newModuleEvent = mock(Event.class);
    when(ioService.createDirectory(any(org.uberfire.java.nio.file.Path.class))).thenAnswer(new Answer<Object>() {

        @Override
        public Object answer(final InvocationOnMock invocation) throws Throwable {
            return invocation.getArguments()[0];
        }
    });
    doCallRealMethod().when(resourceResolver).getDefaultWorkspacePath(any());
    doCallRealMethod().when(resourceResolver).getLegalId(any());
    saver = new ModuleSaver(ioService, pomService, mock(KModuleService.class), newModuleEvent, newPackageEvent, resourceResolver, mock(ProjectImportsService.class), mock(ModuleRepositoriesService.class), mock(PackageNameWhiteListService.class), mock(CommentedOptionFactory.class), new SessionInfo() {

        @Override
        public String getId() {
            return "session";
        }

        @Override
        public User getIdentity() {
            return new UserImpl("testuser");
        }
    });
}
Also used : Path(org.uberfire.backend.vfs.Path) SessionInfo(org.uberfire.rpc.SessionInfo) Bean(javax.enterprise.inject.spi.Bean) SimpleFileSystemProvider(org.uberfire.java.nio.fs.file.SimpleFileSystemProvider) CreationalContext(javax.enterprise.context.spi.CreationalContext) NewModuleEvent(org.guvnor.common.services.project.events.NewModuleEvent) InvocationOnMock(org.mockito.invocation.InvocationOnMock) UserImpl(org.jboss.errai.security.shared.api.identity.UserImpl) Paths(org.uberfire.backend.server.util.Paths) Before(org.junit.Before)

Aggregations

UserImpl (org.jboss.errai.security.shared.api.identity.UserImpl)6 ArrayList (java.util.ArrayList)3 Before (org.junit.Before)3 List (java.util.List)2 NewModuleEvent (org.guvnor.common.services.project.events.NewModuleEvent)2 Path (org.uberfire.backend.vfs.Path)2 SearchResponseImpl (org.uberfire.ext.security.management.impl.SearchResponseImpl)2 SessionInfo (org.uberfire.rpc.SessionInfo)2 URL (java.net.URL)1 Predicate (java.util.function.Predicate)1 CreationalContext (javax.enterprise.context.spi.CreationalContext)1 Bean (javax.enterprise.inject.spi.Bean)1 SocialUser (org.ext.uberfire.social.activities.model.SocialUser)1 SocialUserRepositoryAPI (org.ext.uberfire.social.activities.service.SocialUserRepositoryAPI)1 SocialUserServiceAPI (org.ext.uberfire.social.activities.service.SocialUserServiceAPI)1 PipelineRegistry (org.guvnor.ala.registry.PipelineRegistry)1 InMemoryPipelineRegistry (org.guvnor.ala.registry.inmemory.InMemoryPipelineRegistry)1 FileDiscoveryService (org.guvnor.common.services.backend.file.FileDiscoveryService)1 FileDiscoveryServiceImpl (org.guvnor.common.services.backend.file.FileDiscoveryServiceImpl)1 MetadataServerSideService (org.guvnor.common.services.backend.metadata.MetadataServerSideService)1