Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
128 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
server/src/main/resources/META-INF/navigation/finishlogin.navigation.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
server/src/test/java/org/gluu/oxtrust/action/ConfigurationStatusTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* oxTrust is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. | ||
* | ||
* Copyright (c) 2014, Gluu | ||
*/ | ||
|
||
package org.gluu.oxtrust.action; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertTrue; | ||
|
||
import java.util.Date; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.gluu.oxtrust.action.ConfigurationStatusAction; | ||
import org.gluu.oxtrust.action.Authenticator; | ||
import org.gluu.oxtrust.ldap.service.ConfigurationService; | ||
import org.gluu.oxtrust.model.GluuConfiguration; | ||
import org.gluu.oxtrust.security.Identity; | ||
import org.gluu.oxtrust.util.OxTrustConstants; | ||
import org.testng.annotations.Parameters; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* User: Oleksiy Tataryn | ||
*/ | ||
public class ConfigurationStatusTest extends BaseTest { | ||
|
||
@Inject | ||
private Identity identity; | ||
|
||
@Inject | ||
private Authenticator authenticator; | ||
|
||
@Inject | ||
private ConfigurationService configurationService; | ||
|
||
@Inject | ||
private ConfigurationStatusAction configurationStatusAction; | ||
|
||
public void loginUuser(String userUid) { | ||
identity.getOauthData().setUserUid(userUid); | ||
identity.getOauthData().setIdToken("dummy_id_token"); | ||
|
||
String loggedIn = authenticator.authenticate(); | ||
assertEquals(loggedIn, OxTrustConstants.RESULT_SUCCESS, "User is not logged in"); | ||
assertTrue(identity.isLoggedIn(), "User is not logged in"); | ||
} | ||
|
||
@Test | ||
@Parameters({ "test.login.user.admin.uid" }) | ||
public void testIsConfigurationStatus1(String userUid) { | ||
loginUuser(userUid); | ||
|
||
GluuConfiguration configuration = configurationService.getConfiguration(); | ||
|
||
Date currentDateTime = new Date(); | ||
configuration.setLastUpdate(currentDateTime); | ||
|
||
configurationService.updateConfiguration(configuration); | ||
assertEquals(configurationStatusAction.checkHealth(), OxTrustConstants.RESULT_SUCCESS); | ||
assertEquals(configurationStatusAction.getHealth(), "OK"); | ||
} | ||
|
||
@Test(dependsOnMethods = { "testIsConfigurationStatus1" }) | ||
@Parameters({ "test.login.user.admin.uid" }) | ||
public void testIsConfigurationStatus2(String userUid) { | ||
loginUuser(userUid); | ||
|
||
GluuConfiguration configuration = configurationService.getConfiguration(); | ||
|
||
long currentTime = System.currentTimeMillis() - 50 * 1000; | ||
Date currentDateTime = new Date(currentTime); | ||
configuration.setLastUpdate(currentDateTime); | ||
|
||
configurationService.updateConfiguration(configuration); | ||
assertEquals(configurationStatusAction.checkHealth(), OxTrustConstants.RESULT_SUCCESS); | ||
assertEquals(configurationStatusAction.getHealth(), "OK"); | ||
} | ||
|
||
@Test(dependsOnMethods = { "testIsConfigurationStatus2" }) | ||
@Parameters({ "test.login.user.admin.uid" }) | ||
public void testIsConfigurationStatus3(String userUid) { | ||
loginUuser(userUid); | ||
|
||
GluuConfiguration configuration = configurationService.getConfiguration(); | ||
|
||
long currentTime = System.currentTimeMillis() - 101 * 1000; | ||
Date currentDateTime = new Date(currentTime); | ||
configuration.setLastUpdate(currentDateTime); | ||
|
||
configurationService.updateConfiguration(configuration); | ||
assertEquals(configurationStatusAction.checkHealth(), OxTrustConstants.RESULT_SUCCESS); | ||
assertEquals(configurationStatusAction.getHealth(), "FAIL"); | ||
} | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters