You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/02/22 16:19:46 UTC

[isis] branch master updated: ISIS-1870 fix errors (mock setup)

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new dbe8458  ISIS-1870 fix errors (mock setup)
dbe8458 is described below

commit dbe845847aa97ad3752116df049f2d00f7650a25
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Feb 22 17:19:43 2018 +0100

    ISIS-1870 fix errors (mock setup)
---
 ...AuthenticatorOrAuthorizorTest_authenticate.java | 38 +++++++++++++---------
 ...ticatorOrAuthorizorTest_isVisibleInAnyRole.java |  7 ++++
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_authenticate.java b/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_authenticate.java
index 722b2a7..924f556 100644
--- a/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_authenticate.java
+++ b/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_authenticate.java
@@ -18,31 +18,31 @@
  */
 package org.apache.isis.security.shiro;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.config.IniSecurityManagerFactory;
 import org.apache.shiro.mgt.SecurityManager;
 import org.apache.shiro.subject.Subject;
 import org.apache.shiro.util.Factory;
+import org.jmock.Expectations;
 import org.jmock.auto.Mock;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
 public class ShiroAuthenticatorOrAuthorizorTest_authenticate {
 
     @Rule
@@ -55,8 +55,14 @@ public class ShiroAuthenticatorOrAuthorizorTest_authenticate {
 
     @Before
     public void setUp() throws Exception {
-        authOrAuth = new ShiroAuthenticatorOrAuthorizor(mockConfiguration);
-        authOrAuth.init(DeploymentCategory.PRODUCTION);
+        
+    	context.checking(new Expectations() {{
+            allowing(mockConfiguration).getBoolean("isis.authentication.shiro.autoLogoutIfAlreadyAuthenticated", false);
+            will(returnValue(false));
+        }});
+    	
+   		authOrAuth = new ShiroAuthenticatorOrAuthorizor(mockConfiguration);
+    	authOrAuth.init(DeploymentCategory.PRODUCTION);
     }
 
     @After
diff --git a/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_isVisibleInAnyRole.java b/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_isVisibleInAnyRole.java
index ae8d414..01af4a8 100644
--- a/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_isVisibleInAnyRole.java
+++ b/core/security-shiro/src/test/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizorTest_isVisibleInAnyRole.java
@@ -23,6 +23,7 @@ import org.apache.shiro.config.IniSecurityManagerFactory;
 import org.apache.shiro.mgt.SecurityManager;
 import org.apache.shiro.subject.Subject;
 import org.apache.shiro.util.Factory;
+import org.jmock.Expectations;
 import org.jmock.auto.Mock;
 import org.junit.After;
 import org.junit.Before;
@@ -52,6 +53,12 @@ public class ShiroAuthenticatorOrAuthorizorTest_isVisibleInAnyRole {
 
     @Before
     public void setUp() throws Exception {
+    	
+    	context.checking(new Expectations() {{
+            allowing(mockConfiguration).getBoolean("isis.authentication.shiro.autoLogoutIfAlreadyAuthenticated", false);
+            will(returnValue(false));
+        }});
+    	
         authOrAuth = new ShiroAuthenticatorOrAuthorizor(mockConfiguration);
         authOrAuth.init(DeploymentCategory.PRODUCTION);
     }

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.