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 2020/12/04 15:07:11 UTC
[isis] 02/03: ISIS-2464: minor test cleanup
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
commit 8ab9d1320b583826dd7097254548a3d1d80aee4d
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Dec 4 15:23:50 2020 +0100
ISIS-2464: minor test cleanup
---
.../singleuser/SingleUserSession.java | 2 +-
...uthenticatedWebSessionForIsis_Authenticate.java | 9 +++---
.../AuthenticatedWebSessionForIsis_SignIn.java | 3 +-
...uthenticatedWebSessionForIsis_TestAbstract.java | 3 +-
.../AuthenticationSessionForTesting.java | 36 ----------------------
5 files changed, 9 insertions(+), 44 deletions(-)
diff --git a/core/security/src/main/java/org/apache/isis/core/security/authentication/singleuser/SingleUserSession.java b/core/security/src/main/java/org/apache/isis/core/security/authentication/singleuser/SingleUserSession.java
index 85ca16e..c44d07c 100644
--- a/core/security/src/main/java/org/apache/isis/core/security/authentication/singleuser/SingleUserSession.java
+++ b/core/security/src/main/java/org/apache/isis/core/security/authentication/singleuser/SingleUserSession.java
@@ -31,7 +31,7 @@ public final class SingleUserSession extends AuthenticationSessionAbstract {
UserMemento.ofName("prototyping"));
/**
- * Defaults session's authentication validation code to <tt>""</tt>.
+ * Defaults session's authentication validation code to {@code ""}
*/
public SingleUserSession() {
this(AuthenticationSessionAbstract.DEFAULT_AUTH_VALID_CODE);
diff --git a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_Authenticate.java b/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_Authenticate.java
index b03c496..e140ceb 100644
--- a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_Authenticate.java
+++ b/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_Authenticate.java
@@ -36,7 +36,6 @@ import static org.hamcrest.Matchers.nullValue;
import org.apache.isis.applib.services.registry.ServiceRegistry;
import org.apache.isis.applib.services.session.SessionLoggingService;
-import org.apache.isis.applib.services.user.UserMemento;
import org.apache.isis.commons.collections.Can;
import org.apache.isis.core.internaltestsupport.jmocking.JUnitRuleMockery2;
import org.apache.isis.core.runtime.context.IsisAppCommonContext;
@@ -46,9 +45,9 @@ import org.apache.isis.core.runtime.iactn.InteractionTracker;
import org.apache.isis.core.security.authentication.AuthenticationRequest;
import org.apache.isis.core.security.authentication.AuthenticationRequestPassword;
import org.apache.isis.core.security.authentication.manager.AuthenticationManager;
+import org.apache.isis.core.security.authentication.singleuser.SingleUserSession;
import org.apache.isis.core.security.authentication.standard.Authenticator;
import org.apache.isis.core.security.authentication.standard.RandomCodeGeneratorDefault;
-import org.apache.isis.core.security.authentication.standard.SimpleSession;
public class AuthenticatedWebSessionForIsis_Authenticate {
@@ -87,10 +86,10 @@ public class AuthenticatedWebSessionForIsis_Authenticate {
will(returnValue(mockIsisInteractionTracker));
allowing(mockIsisInteractionTracker).currentAuthenticationSession();
- will(returnValue(Optional.of(new AuthenticationSessionForTesting())));
+ will(returnValue(Optional.of(new SingleUserSession())));
allowing(mockIsisInteractionFactory)
- .runAuthenticated(with(new AuthenticationSessionForTesting()), with(any(ThrowingRunnable.class)));
+ .runAuthenticated(with(new SingleUserSession()), with(any(ThrowingRunnable.class)));
allowing(mockIsisInteractionFactory)
.runAnonymous(with(any(ThrowingRunnable.class)));
@@ -133,7 +132,7 @@ public class AuthenticatedWebSessionForIsis_Authenticate {
oneOf(mockAuthenticator).canAuthenticate(AuthenticationRequestPassword.class);
will(returnValue(true));
oneOf(mockAuthenticator).authenticate(with(any(AuthenticationRequest.class)), with(any(String.class)));
- will(returnValue(SimpleSession.validOfUserWithSystemDefaults(UserMemento.ofName("test-user"))));
+ will(returnValue(new SingleUserSession()));
}
});
diff --git a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_SignIn.java b/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_SignIn.java
index 5198002..31aa262 100644
--- a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_SignIn.java
+++ b/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_SignIn.java
@@ -42,6 +42,7 @@ import org.apache.isis.core.runtime.iactn.InteractionFactory.ThrowingRunnable;
import org.apache.isis.core.security.authentication.AuthenticationRequest;
import org.apache.isis.core.security.authentication.AuthenticationRequestPassword;
import org.apache.isis.core.security.authentication.manager.AuthenticationManager;
+import org.apache.isis.core.security.authentication.singleuser.SingleUserSession;
import org.apache.isis.core.security.authentication.standard.Authenticator;
import org.apache.isis.core.security.authentication.standard.RandomCodeGeneratorDefault;
@@ -80,7 +81,7 @@ public class AuthenticatedWebSessionForIsis_SignIn {
will(returnValue(mockIsisInteractionFactory));
allowing(mockIsisInteractionFactory)
- .runAuthenticated(with(new AuthenticationSessionForTesting()), with(any(ThrowingRunnable.class)));
+ .runAuthenticated(with(new SingleUserSession()), with(any(ThrowingRunnable.class)));
allowing(mockIsisInteractionFactory)
.runAnonymous(with(any(ThrowingRunnable.class)));
diff --git a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_TestAbstract.java b/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_TestAbstract.java
index ba40292..91d0d2b 100644
--- a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_TestAbstract.java
+++ b/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticatedWebSessionForIsis_TestAbstract.java
@@ -35,6 +35,7 @@ import org.apache.isis.core.runtime.context.IsisAppCommonContext;
import org.apache.isis.core.runtime.iactn.InteractionFactory;
import org.apache.isis.core.runtime.iactn.InteractionFactory.ThrowingRunnable;
import org.apache.isis.core.security.authentication.manager.AuthenticationManager;
+import org.apache.isis.core.security.authentication.singleuser.SingleUserSession;
public abstract class AuthenticatedWebSessionForIsis_TestAbstract {
@@ -61,7 +62,7 @@ public abstract class AuthenticatedWebSessionForIsis_TestAbstract {
allowing(mockCommonContext).lookupServiceElseFail(InteractionFactory.class);
will(returnValue(mockIsisInteractionFactory));
- allowing(mockIsisInteractionFactory).runAuthenticated(new AuthenticationSessionForTesting(), with(any(ThrowingRunnable.class)));
+ allowing(mockIsisInteractionFactory).runAuthenticated(new SingleUserSession(), with(any(ThrowingRunnable.class)));
// ignore
// must provide explicit expectation, since Locale is final.
diff --git a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticationSessionForTesting.java b/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticationSessionForTesting.java
deleted file mode 100644
index 7ea37cc..0000000
--- a/viewers/wicket/viewer/src/test/java/org/apache/isis/viewer/wicket/viewer/integration/AuthenticationSessionForTesting.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.wicket.viewer.integration;
-
-import org.apache.isis.applib.services.iactn.ExecutionContext;
-import org.apache.isis.applib.services.user.UserMemento;
-import org.apache.isis.core.security.authentication.AuthenticationSessionAbstract;
-
-class AuthenticationSessionForTesting extends AuthenticationSessionAbstract {
-
- private static final long serialVersionUID = 1L;
-
- private static final ExecutionContext INITIALISATION_CONTEXT =
- ExecutionContext.ofUserWithSystemDefaults(UserMemento.system());
-
- public AuthenticationSessionForTesting() {
- super(INITIALISATION_CONTEXT, AuthenticationSessionAbstract.DEFAULT_AUTH_VALID_CODE);
- }
-
-}