arquillian-testsuite: KEYCLOAK-2046
This commit is contained in:
parent
2b23497f92
commit
ee801c2c32
9 changed files with 0 additions and 184 deletions
|
@ -9,7 +9,6 @@ import org.jboss.arquillian.core.spi.LoadableExtension;
|
|||
import org.jboss.arquillian.graphene.location.CustomizableURLResourceProvider;
|
||||
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
|
||||
import org.jboss.arquillian.test.spi.execution.TestExecutionDecider;
|
||||
import org.keycloak.testsuite.arquillian.jira.JiraTestExecutionDecider;
|
||||
import org.keycloak.testsuite.arquillian.karaf.CustomKarafContainer;
|
||||
import org.keycloak.testsuite.arquillian.migration.MigrationTestExecutionDecider;
|
||||
import org.keycloak.testsuite.arquillian.undertow.CustomUndertowContainer;
|
||||
|
@ -39,7 +38,6 @@ public class KeycloakArquillianExtension implements LoadableExtension {
|
|||
.service(DeployableContainer.class, CustomKarafContainer.class);
|
||||
|
||||
builder
|
||||
//.service(TestExecutionDecider.class, JiraTestExecutionDecider.class)
|
||||
.service(TestExecutionDecider.class, MigrationTestExecutionDecider.class);
|
||||
|
||||
builder
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.keycloak.testsuite.arquillian.jira;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.ClientBuilder;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:pmensik@redhat.com">Petr Mensik</a>
|
||||
*/
|
||||
public class JBossJiraParser {
|
||||
|
||||
private static final String JBOSS_TRACKER_REST_URL = "https://issues.jboss.org/rest/api/latest/issue/";
|
||||
|
||||
public static boolean isIssueClosed(String issueId) {
|
||||
Status issueStatus;
|
||||
try {
|
||||
issueStatus = getIssueStatus(issueId);
|
||||
} catch (Exception e) {
|
||||
issueStatus = Status.CLOSED; //let the test run in case there is no connection
|
||||
}
|
||||
return issueStatus == Status.CLOSED || issueStatus == Status.RESOLVED;
|
||||
}
|
||||
|
||||
private static Status getIssueStatus(String issueId) throws Exception {
|
||||
Client client = ClientBuilder.newClient();
|
||||
WebTarget target = client.target(JBOSS_TRACKER_REST_URL);
|
||||
String json = target.path(issueId).request().accept(MediaType.APPLICATION_JSON_TYPE).get(String.class);
|
||||
JsonObject jsonObject = new Gson().fromJson(json, JsonElement.class).getAsJsonObject();
|
||||
String status = jsonObject.getAsJsonObject("fields").getAsJsonObject("status").get("name").getAsString();
|
||||
client.close();
|
||||
return Status.getByStatus(status);
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.keycloak.testsuite.arquillian.jira;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Value should contain name of the issue listed in JBoss JIRA (like
|
||||
* KEYCLOAK-1234), it can also contain multiple names separated by coma.
|
||||
*
|
||||
* @author <a href="mailto:pmensik@redhat.com">Petr Mensik</a>
|
||||
*
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
@Documented
|
||||
public @interface Jira {
|
||||
|
||||
String value();
|
||||
boolean enabled() default true;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.keycloak.testsuite.arquillian.jira;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.jboss.arquillian.test.spi.execution.ExecutionDecision;
|
||||
import org.jboss.arquillian.test.spi.execution.TestExecutionDecider;
|
||||
|
||||
import static org.keycloak.testsuite.arquillian.jira.JBossJiraParser.isIssueClosed;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:pmensik@redhat.com">Petr Mensik</a>
|
||||
*/
|
||||
public class JiraTestExecutionDecider implements TestExecutionDecider {
|
||||
|
||||
private static Map<String, Boolean> cache = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public ExecutionDecision decide(Method method) {
|
||||
Jira jiraAnnotation = method.getAnnotation(Jira.class);
|
||||
if (jiraAnnotation != null && jiraAnnotation.enabled()) {
|
||||
boolean executeTest = true;
|
||||
String[] issueIds = getIssuesId(jiraAnnotation.value());
|
||||
for (String issueId : issueIds) {
|
||||
if (cache.containsKey(issueId)) {
|
||||
executeTest = cache.get(issueId);
|
||||
} else {
|
||||
if (isIssueClosed(issueId)) {
|
||||
cache.put(issueId, true);
|
||||
} else {
|
||||
executeTest = false;
|
||||
cache.put(issueId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (executeTest) {
|
||||
return ExecutionDecision.execute();
|
||||
} else {
|
||||
return ExecutionDecision.dontExecute("Issue is still opened, therefore skipping the test " + method.getName());
|
||||
}
|
||||
}
|
||||
return ExecutionDecision.execute();
|
||||
}
|
||||
|
||||
private String[] getIssuesId(String value) {
|
||||
return value.replaceAll("\\s+", "").split(",");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int precedence() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.keycloak.testsuite.arquillian.jira;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:pmensik@redhat.com">Petr Mensik</a>
|
||||
*/
|
||||
public enum Status {
|
||||
|
||||
OPEN("Open"), CLOSED("Closed"), PULL_REQUEST_SENT("Pull Request Sent"), REOPENED("Reopened"),
|
||||
RESOLVED("Resolved"), CODING_IN_PROGRESS("Coding In Progress ");
|
||||
|
||||
private String status;
|
||||
|
||||
private Status(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public static Status getByStatus(String status) {
|
||||
for (Status s : Status.values()) {
|
||||
if (s.getStatus().equals(status)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,7 +10,6 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
|||
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
|
||||
import org.keycloak.testsuite.adapter.page.AngularCorsProductExample;
|
||||
import org.keycloak.testsuite.adapter.page.CorsDatabaseServiceExample;
|
||||
import org.keycloak.testsuite.arquillian.jira.Jira;
|
||||
import org.keycloak.testsuite.auth.page.account.Account;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -63,7 +62,6 @@ public abstract class AbstractCorsExampleAdapterTest extends AbstractExampleAdap
|
|||
driver.manage().deleteAllCookies();
|
||||
}
|
||||
|
||||
@Jira("KEYCLOAK-1546")
|
||||
@Test
|
||||
public void angularCorsProductTest() {
|
||||
angularCorsProductExample.navigateTo();
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.keycloak.testsuite.adapter.page.CustomerPortal;
|
|||
import org.keycloak.testsuite.adapter.page.InputPortal;
|
||||
import org.keycloak.testsuite.adapter.page.ProductPortal;
|
||||
import org.keycloak.testsuite.adapter.page.SecurePortal;
|
||||
import org.keycloak.testsuite.arquillian.jira.Jira;
|
||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
|
||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
|
||||
import org.keycloak.util.BasicAuthHelper;
|
||||
|
@ -224,7 +223,6 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
|
|||
}
|
||||
|
||||
@Test
|
||||
@Jira(value = "KEYCLOAK-1478") // rejected
|
||||
public void testLoginSSOIdleRemoveExpiredUserSessions() {
|
||||
// test login to customer-portal which does a bearer request to customer-db
|
||||
customerPortal.navigateTo();
|
||||
|
@ -279,7 +277,6 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
|
|||
testRealmResource().update(demoRealmRep);
|
||||
}
|
||||
|
||||
@Jira("KEYCLOAK-518")
|
||||
@Test
|
||||
public void testNullBearerToken() {
|
||||
Client client = ClientBuilder.newClient();
|
||||
|
@ -293,7 +290,6 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
|
|||
client.close();
|
||||
}
|
||||
|
||||
@Jira("KEYCLOAK-1368")
|
||||
@Test
|
||||
public void testNullBearerTokenCustomErrorPage() {
|
||||
Client client = ClientBuilder.newClient();
|
||||
|
@ -326,7 +322,6 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
|
|||
client.close();
|
||||
}
|
||||
|
||||
@Jira("KEYCLOAK-518")
|
||||
@Test
|
||||
public void testBadUser() {
|
||||
Client client = ClientBuilder.newClient();
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
|
|||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.testsuite.adapter.page.SessionPortal;
|
||||
import org.keycloak.testsuite.arquillian.jira.Jira;
|
||||
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
|
||||
import org.keycloak.testsuite.auth.page.account.Sessions;
|
||||
import org.keycloak.testsuite.auth.page.login.Login;
|
||||
|
@ -60,7 +59,6 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
|
|||
@SecondBrowser
|
||||
protected WebDriver driver2;
|
||||
|
||||
@Jira("KEYCLOAK-732")
|
||||
@Test
|
||||
public void testSingleSessionInvalidated() {
|
||||
|
||||
|
@ -102,7 +100,6 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
|
|||
}
|
||||
|
||||
@Test
|
||||
@Jira("KEYCLOAK-741, KEYCLOAK-1485")
|
||||
public void testSessionInvalidatedAfterFailedRefresh() {
|
||||
RealmRepresentation testRealmRep = testRealmResource().toRepresentation();
|
||||
ClientResource sessionPortalRes = null;
|
||||
|
@ -139,7 +136,6 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
|
|||
}
|
||||
|
||||
@Test
|
||||
@Jira("KEYCLOAK-942")
|
||||
public void testAdminApplicationLogout() {
|
||||
// login as bburke
|
||||
loginAndCheckSession(driver, testRealmLoginPage);
|
||||
|
@ -157,7 +153,6 @@ public abstract class AbstractSessionServletAdapterTest extends AbstractServlets
|
|||
}
|
||||
|
||||
@Test
|
||||
@Jira("KEYCLOAK-1216, KEYCLOAK-1485")
|
||||
public void testAccountManagementSessionsLogout() {
|
||||
// login as bburke
|
||||
loginAndCheckSession(driver, testRealmLoginPage);
|
||||
|
|
|
@ -26,7 +26,6 @@ import static org.junit.Assert.*;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.testsuite.arquillian.jira.Jira;
|
||||
import org.keycloak.testsuite.console.AbstractConsoleTest;
|
||||
import org.keycloak.testsuite.console.page.authentication.otppolicy.OTPPolicy;
|
||||
import org.keycloak.testsuite.console.page.authentication.otppolicy.OTPPolicyForm.Digits;
|
||||
|
@ -67,7 +66,6 @@ public class OTPPolicyTest extends AbstractConsoleTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Jira(value = "KEYCLOAK-2031")
|
||||
public void invalidValuesTest() {
|
||||
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.EMPTY, "", "30");
|
||||
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage());
|
||||
|
|
Loading…
Reference in a new issue