Skip to content

Commit

Permalink
KEYCLOAK-9712 KEYCLOAK-9911 moved Javascript adater tests and LoginMo…
Browse files Browse the repository at this point in the history
…dulesTest outsite of adapter package
  • Loading branch information
vramik authored and pdrozd committed Mar 28, 2019
1 parent 5eb9291 commit 35fa4b8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.Assert;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.javascript.AbstractJavascriptTest;
import org.keycloak.testsuite.auth.page.login.OAuthGrant;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
import org.keycloak.testsuite.util.JavascriptBrowser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@
* limitations under the License.
*/

package org.keycloak.testsuite.adapter.jaas;
package org.keycloak.testsuite.jaas;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.invoke.MethodHandles;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

import javax.security.auth.Subject;
Expand All @@ -46,6 +43,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import org.junit.AfterClass;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -90,13 +88,20 @@ public void addTestRealms(List<RealmRepresentation> testRealms) {
testRealms.add(IOUtil.loadRealm("/adapter-test/demorealm.json"));
}

private static void enabled() {
Assume.assumeTrue(AUTH_SERVER_SSL_REQUIRED);
}

@BeforeClass
public static void createTemporaryFiles() throws Exception {
enabled();

copyContentAndReplaceAuthServerAddress(new File(DIRECT_GRANT_CONFIG), DIRECT_GRANT_CONFIG_FILE);
copyContentAndReplaceAuthServerAddress(new File(BEARER_CONFIG), BEARER_CONFIG_FILE);
}

public void removeTemporaryFiles() {
@AfterClass
public static void removeTemporaryFiles() {
DIRECT_GRANT_CONFIG_FILE.deleteOnExit();
BEARER_CONFIG_FILE.deleteOnExit();
}
Expand Down Expand Up @@ -127,10 +132,6 @@ public void generateAudienceClientScope() {

@Test
public void testDirectAccessGrantLoginModuleLoginFailed() throws Exception {
Assume.assumeTrue(AUTH_SERVER_SSL_REQUIRED);



LoginContext loginContext = new LoginContext("does-not-matter", null,
createJaasCallbackHandler("[email protected]", "bad-password"),
createJaasConfigurationForDirectGrant(null));
Expand All @@ -146,7 +147,6 @@ public void testDirectAccessGrantLoginModuleLoginFailed() throws Exception {

@Test
public void testDirectAccessGrantLoginModuleLoginSuccess() throws Exception {
Assume.assumeTrue(AUTH_SERVER_SSL_REQUIRED);
oauth.realm("demo");

LoginContext loginContext = directGrantLogin(null);
Expand All @@ -169,7 +169,6 @@ public void testDirectAccessGrantLoginModuleLoginSuccess() throws Exception {

@Test
public void testBearerLoginFailedLogin() throws Exception {
Assume.assumeTrue(AUTH_SERVER_SSL_REQUIRED);
oauth.realm("demo");

LoginContext directGrantCtx = directGrantLogin(null);
Expand All @@ -194,7 +193,6 @@ public void testBearerLoginFailedLogin() throws Exception {

@Test
public void testBearerLoginSuccess() throws Exception {
Assume.assumeTrue(AUTH_SERVER_SSL_REQUIRED);
oauth.realm("demo");

LoginContext directGrantCtx = directGrantLogin("customer-db-audience-required");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.keycloak.testsuite.adapter.javascript;
package org.keycloak.testsuite.javascript;

import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.keycloak.testsuite.adapter.javascript;
package org.keycloak.testsuite.javascript;

import org.jboss.arquillian.graphene.page.Page;
import org.junit.Assume;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.keycloak.testsuite.adapter.javascript;
package org.keycloak.testsuite.javascript;

import org.junit.Assume;
import org.junit.Before;
Expand Down
2 changes: 1 addition & 1 deletion travis-run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if [ $1 == "server-group1" ]; then
fi

if [ $1 == "server-group2" ]; then
run-server-tests org.keycloak.testsuite.ac*.**.*Test,org.keycloak.testsuite.cli*.**.*Test,org.keycloak.testsuite.co*.**.*Test
run-server-tests org.keycloak.testsuite.ac*.**.*Test,org.keycloak.testsuite.cli*.**.*Test,org.keycloak.testsuite.co*.**.*Test,org.keycloak.testsuite.j*.**.*Test
fi

if [ $1 == "server-group3" ]; then
Expand Down

0 comments on commit 35fa4b8

Please sign in to comment.