Fix missing variables test

This commit is contained in:
stianst 2018-07-30 09:44:27 +02:00 committed by Stian Thorgersen
parent 7f875e37a5
commit fffffd49e2
8 changed files with 29 additions and 23 deletions

View file

@ -32,7 +32,7 @@ Run the appropriate module installation script.
For the OIDC module, enter the following command:
----
$ {EAP_HOME}/bin/jboss-cli.sh -c --file=${EAP_HOME}/bin/adapter-install.cli
$ $EAP_HOME/bin/jboss-cli.sh -c --file=$EAP_HOME/bin/adapter-install.cli
----
Your installation is complete.
@ -69,7 +69,7 @@ Run the appropriate module installation script.
For the OIDC module, enter the following command:
----
$ {EAP_HOME}/bin/jboss-cli.sh -c --file=${EAP_HOME}/bin/adapter-install.cli
$ $EAP_HOME/bin/jboss-cli.sh -c --file=$EAP_HOME/bin/adapter-install.cli
----
Your installation is complete.

View file

@ -8,7 +8,7 @@ You then have to provide some extra configuration via normal Spring Boot configu
===== Adapter Installation
The Keycloak Spring Boot adapter takes advantage of Spring Boot's autoconfiguration so all you need to do is add the Keycloak Spring Boot starter to your project.
They Keycloak Spring Boot Starter is also directly available from the http://start.spring.io/[Spring Start Page].
They Keycloak Spring Boot Starter is also directly available from the https://start.spring.io/[Spring Start Page].
To add it manually using Maven, add the following to your dependencies:

View file

@ -32,7 +32,7 @@ Run the appropriate module installation script.
For the SAML module, enter the following command:
----
$ {EAP_HOME}/bin/jboss-cli.sh -c --file=${EAP_HOME}/bin/adapter-install-saml.cli
$ $EAP_HOME/bin/jboss-cli.sh -c --file=$EAP_HOME/bin/adapter-install-saml.cli
----
Your installation is complete.
@ -69,7 +69,7 @@ Run the appropriate module installation script.
For the SAML module, enter the following command:
----
$ {EAP_HOME}/bin/jboss-cli.sh -c --file=${EAP_HOME}/bin/adapter-install-saml.cli
$ $EAP_HOME/bin/jboss-cli.sh -c --file=$EAP_HOME/bin/adapter-install-saml.cli
----
Your installation is complete.

View file

@ -9,9 +9,11 @@ import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
public abstract class AbstractDocsTest {
@ -61,25 +63,25 @@ public abstract class AbstractDocsTest {
@Test
public void checkVariables() {
List<String> missingVariables = utils.findMissingVariables(body, config.getIgnoredVariables());
Set<String> missingVariables = utils.findMissingVariables(body, config.getIgnoredVariables());
checkFailures("Variables not found", missingVariables);
}
@Test
public void checkIncludes() {
List<String> missingIncludes = utils.findMissingIncludes(body);
Set<String> missingIncludes = utils.findMissingIncludes(body);
checkFailures("Includes not found", missingIncludes);
}
@Test
public void checkImages() {
List<String> failures = linkUtils.findInvalidImages(body, guideDir, guideUrl);
Set<String> failures = linkUtils.findInvalidImages(body, guideDir, guideUrl);
checkFailures("Images not found", failures);
}
@Test
public void checkInternalAnchors() {
List<String> invalidInternalAnchors = linkUtils.findInvalidInternalAnchors(body);
Set<String> invalidInternalAnchors = linkUtils.findInvalidInternalAnchors(body);
checkFailures("Internal anchors not found", invalidInternalAnchors);
}
@ -87,7 +89,7 @@ public abstract class AbstractDocsTest {
public void checkExternalLinks() throws IOException {
List<LinkUtils.InvalidLink> invalidLinks = linkUtils.findInvalidLinks(body, config.getIgnoredLinks(), config.getIgnoredLinkRedirects());
if (!invalidLinks.isEmpty()) {
List<String> failures = new LinkedList<>();
Set<String> failures = new HashSet<>();
for (LinkUtils.InvalidLink l : invalidLinks) {
failures.add(l.getLink() + " (" + l.getError() + ")");
}
@ -95,7 +97,7 @@ public abstract class AbstractDocsTest {
}
}
private void checkFailures(String message, List<String> failures) {
private void checkFailures(String message, Set<String> failures) {
if (!failures.isEmpty()) {
throw new Failures(message, failures);
}

View file

@ -3,12 +3,13 @@ package org.keycloak.documentation.test;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Set;
public class Failures extends AssertionError {
private List<String> failures;
private Set<String> failures;
public Failures(String error, List<String> failures) {
public Failures(String error, Set<String> failures) {
super(error);
this.failures = failures;
}

View file

@ -8,8 +8,10 @@ import java.io.IOException;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -59,9 +61,9 @@ public class DocUtils {
}
}
public List<String> findMissingVariables(String body, List<String> ignoredVariables) {
List<String> missingVariables = new LinkedList<>();
Pattern p = Pattern.compile("[^$/=\\s]\\{([^ }\"]*)}");
public Set<String> findMissingVariables(String body, List<String> ignoredVariables) {
Set<String> missingVariables = new HashSet<>();
Pattern p = Pattern.compile("[^$/=\n]\\{([^ }\"]*)}");
Matcher m = p.matcher(body);
while (m.find()) {
String key = m.group(1);
@ -72,8 +74,8 @@ public class DocUtils {
return missingVariables;
}
public List<String> findMissingIncludes(String body) {
List<String> missingIncludes = new LinkedList<>();
public Set<String> findMissingIncludes(String body) {
Set<String> missingIncludes = new HashSet<>();
Pattern p = Pattern.compile("Unresolved directive.*");
Matcher m = p.matcher(body);
if (m.find()) {

View file

@ -34,8 +34,8 @@ public class LinkUtils {
saveCheckedLinksCache();
}
public List<String> findInvalidInternalAnchors(String body) {
List<String> invalidInternalAnchors = new LinkedList<>();
public Set<String> findInvalidInternalAnchors(String body) {
Set<String> invalidInternalAnchors = new HashSet<>();
Pattern p = Pattern.compile("<a href=\"([^ \"]*)[^>]*\">");
Matcher m = p.matcher(body);
while (m.find()) {
@ -109,8 +109,8 @@ public class LinkUtils {
return invalidLinks;
}
public List<String> findInvalidImages(String body, File guideDir, String guideUrl) {
List<String> missingImages = new LinkedList<>();
public Set<String> findInvalidImages(String body, File guideDir, String guideUrl) {
Set<String> missingImages = new HashSet<>();
Pattern p = Pattern.compile("<img src=\"([^ \"]*)[^>]*\"");
Matcher m = p.matcher(body);
while (m.find()) {

View file

@ -18,4 +18,5 @@ keycloak.access_token
keycloak.access_token['/sub']
keycloak.access_token['/preferred_username']
keycloak.access_token['/custom_claim']
resource_id
resource_id
$evaluation.grant()