We are upgrading from 8.2 to 9.3. We have some existing unit tests to test extensions we've built that are designed to test concurrency scenarios. There is a difference in how the BaseSession.hasPermission method executes from 8.2 to 9.3. In both versions, BaseSession.hasPermission calls ClientLoginModule.getCurrentPrincipal. In 8.2, when running as a separate thread, the getCurrentPrincipal method returns null and hasPermission retrurns true. In 9.3 from a separate thread, getCurrentPrincipal method also returns null but then hasPermission returns false. The null return triggers the different behavior in the BaseSession.hasPermission method between 8.2 and 9.3. I can overcome this by preceding the getUserModel call inside the thread with the following statement: Framework.Login();. This eliminates the null return. But I'm wondering if there's a better approach. Thanks
@Test
public void foo() throws Exception {
UserManager userManager = Framework.getLocalService(UserManager.class);
userManager.getUserModel("ex-1");
Executors.newFixedThreadPool(1).execute(new FutureTask<>(() -> {
UserManager userManager = Framework.getLocalService(UserManager.class);
userManager.getUserModel("ex-2");
}));
}