72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * The contents of this file are subject to the terms of the Common Development and
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * Distribution License (the License). You may not use this file except in compliance with the
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * specific language governing permission and limitations under the License.
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * When distributing Covered Software, include this CDDL Header Notice in each file and include
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * Header, with the fields enclosed by brackets [] replaced by your own identifying
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * information: "Portions copyright [year] [name of copyright owner]".
67486d6b1ecf210ee0fba21ef9298f4fb6213d2cTom Rumsey * Copyright 2013-2016 ForgeRock AS.
6309b849c2de831a0eaed9c27b5794bed9bd8fd1Neil Maddenimport org.forgerock.openam.sso.providers.stateless.StatelessSessionManager;
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshottimport com.iplanet.dpro.session.SessionException;
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnellimport com.iplanet.dpro.session.monitoring.MonitoredOperations;
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnellimport com.iplanet.dpro.session.monitoring.SessionMonitorType;
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnellimport com.iplanet.dpro.session.monitoring.SessionMonitoringStore;
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshottimport com.iplanet.dpro.session.operations.strategies.LocalOperations;
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshottimport com.iplanet.dpro.session.operations.strategies.StatelessOperations;
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshottpublic class ServerSessionOperationStrategyTest {
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott private ServerSessionOperationStrategy strategy;
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott // Strategies
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott mockStateless = mock(StatelessOperations.class);
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell mockStore = mock(SessionMonitoringStore.class);
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott strategy = new ServerSessionOperationStrategy(
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott // test instances
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott SessionID mockSessionId = mock(SessionID.class);
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott given(mockSessionId.getSessionServerID()).willReturn("TEST");
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott public void shouldUseLocalForLocalSessions() throws SessionException {
aa9422005d747789faacd4064a4d42c58014a41cTom Rumsey given(mockLocal.checkSessionExists(any(SessionID.class))).willReturn(true);
a90aba9cbcbb8e7fe95e45590d853959efe0d354Tom Rumsey SessionOperations operation = strategy.getOperation(mockSessionID);