AMSetupFilterTest.java revision 9446b3153033ef93a59c5288074e6c688e7fdf5d
/*
* 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 ForgeRock AS.
*/
public class AMSetupFilterTest {
private AMSetupFilter setupFilter;
@Mock
private AMSetupManager setupManager;
public void setupClass() {
}
public void setup() {
initMocks(this);
setupFilter = new AMSetupFilter();
}
public void tearDown() {
}
@Test
public void initShouldSetEncryptionPasswordIfNotConfigured() throws Exception {
//Given
//When
//Then
}
@Test
public void initShouldNotSetEncryptionPasswordIfConfigured() throws Exception {
//Given
//When
//Then
}
@Test
public void filterShouldAllowRequestsThroughIfConfigured() throws Exception {
//Given
//When
//Then
}
private Object[][] setupRequestUris() {
return new Object[][]{
{"/config/options.htm"},
{"/setup/setSetupProgress"},
{"/config/upgrade/upgrade.htm"},
{"/upgrade/setUpgradeProgress"},
};
}
//Given
//When
//Then
}
@Test
public void filterShouldRedirectRequestsIfUpgradeInProgressButConfigStoreIsDown() throws Exception {
//Given
configStoreIsDown("CONFIG_STORE_DOWN_REDIRECT_URI");
//When
//Then
}
@Test
public void filterShouldThrowConfigurationExceptionIfUpgradeInProgressAndConfigStoreIsDownButNoRedirectUriSet()
throws Exception {
//Given
//When
try {
fail("Expected ServletException with ConfigurationException is cause");
} catch (ServletException e) {
//Then
}
}
@Test
public void filterShouldAllowConfiguratorRequestsThroughIfNotConfigured() throws Exception {
//Given
//When
//Then
}
@Test
public void filterShouldRedirectRequestsToSetupPageIfNotConfigured() throws Exception {
//Given
//When
//Then
}
@Test
public void filterShouldRedirectRequestsToNoWritePermissionPageIfNotConfiguredAndCannotWriteToUseHomeDirectory()
throws Exception {
//Given
//When
//Then
}
private Object[][] allowedRequestsWhilstConfiguring() {
return new Object[][]{
{".ico"},
{".htm"},
{".css"},
{".js"},
{".jpg"},
{".gif"},
{".png"},
{".JPG"},
{"SMSObjectIF"},
{"setSetupProgress"},
{"setUpgradeProgress"},
{"/legal-notices/"},
};
}
public void filterShouldAllowCertainRequestsThroughIfNotConfiguredAndInConfigurationMode(String requestUriSuffix)
throws Exception {
//Previous request must have been redirected to setup page to set the pass-through flag
//Given
//When
//Then
}
@Test
public void filterShouldRedirectRequestsToSetupPageIfNotConfiguredAndInConfigurationMode() throws Exception {
//Given
//Previous request must have been redirected to setup page to set the pass-through flag
}
private void initializeFilter() throws ServletException {
}
private void systemIsNotConfigured() {
}
private void systemIsConfigured() {
}
private void systemIsBeingUpgraded() {
}
if (redirectUri != null) {
}
}
return request;
}
private void withWritePermissionsOnBootstrapRootDirectory() {
}
private void noWritePermissionsOnBootstrapRootDirectory() {
}
}