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");
}
});
}
Aggregations