/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015-2016 ForgeRock AS.
*/
import com.iplanet.dpro.session.service.cluster.MultiServerClusterMonitor.ClusterStateServiceFactory;
public class MultiServerClusterMonitorTest {
public void setUp() {
}
@Test
// Given
given(mockServerConfig.getServerFromID("01")).willReturn("http://openam1.example.com:18080/openam");
given(mockServerConfig.getServerFromID("02")).willReturn("http://openam2.example.com:28080/openam");
given(mockServerConfig.getServerFromID("03")).willReturn("http://openam.example.com:8080/openam"); // the 'site'
given(mockServerConfig.getLocalServerSessionServiceURL()).willReturn(new URL("http://openam1.example.com:18080/openam/sessionservice"));
// When
// Then
}
@Test
public void canDeterministicallyEstablishFailoverHostServerIdForSessionIfHomeServerIsDown() throws Exception {
// Given
// A site with 2x AM servers, if server "01" is presented a session that is homed
// on server "02" which is down, then a deterministic routing algorithm should be
// used to generate a sequence of alternative servers to try to re-home the session
// to. The first of these alternate servers that is found to be up will become the
// new home server for that session.
given(mockServerConfig.getServerFromID("01")).willReturn("http://openam1.example.com:18080/openam");
given(mockServerConfig.getServerFromID("02")).willReturn("http://openam2.example.com:28080/openam");
given(mockServerConfig.getServerFromID("03")).willReturn("http://openam.example.com:8080/openam"); // the 'site'
given(mockServerConfig.getLocalServerSessionServiceURL()).willReturn(new URL("http://openam2.example.com:28080/openam/sessionservice"));
).willReturn("4059025133086137527");
// When
// Then
}
}