Skip to content

Commit

Permalink
author url is empty after installation (publish url is there)
Browse files Browse the repository at this point in the history
publish credentials are mandatory
environment info not displayed for inactive tests
  • Loading branch information
mariuszkubis committed Sep 27, 2016
1 parent 7c3de26 commit 7c96988
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@
xtype="textfield"/>
<publishCredentials
jcr:primaryType="cq:Widget"
allowBlank="false"
allowBlank="true"
fieldLabel="Publish Credentials"
name="./publishCredentials"
defaultValue="admin:admin"
xtype="textfield"/>

</items>
</configuration>
</items>
Expand Down
23 changes: 16 additions & 7 deletions src/main/java/com/cognifide/secureaem/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public AbstractTest(Configuration config) {

public void test() throws IOException {
result = null;

appendEnvironmentInfo();
if ("true".equals(config.getStringValue("enabled", "false"))) {
try {
result = doTest();
Expand All @@ -53,6 +53,19 @@ public void test() throws IOException {
}
}

private void appendEnvironmentInfo() {
environments = new HashSet<>();
if (this instanceof AuthorTest) {
environments.add(AuthorTest.ENVIRONMENT_NAME);
}
if (this instanceof PublishTest) {
environments.add(PublishTest.ENVIRONMENT_NAME);
}
if (this instanceof DispatcherTest) {
environments.add(DispatcherTest.ENVIRONMENT_NAME);
}
}

/**
* Perform test.
*
Expand All @@ -68,24 +81,20 @@ public void test() throws IOException {
private TestResult doTest() throws Exception {
boolean success = true;
boolean testDone = false;
infoMessages = new ArrayList<String>();
errorMessages = new ArrayList<String>();
environments = new HashSet<String>();
infoMessages = new ArrayList<>();
errorMessages = new ArrayList<>();

if (this instanceof AuthorTest && StringUtils.isNotBlank(config.getAuthor())) {
environments.add(AuthorTest.ENVIRONMENT_NAME);
success = doTest(config.getAuthor(), AuthorTest.ENVIRONMENT_NAME);
testDone = true;
}

if (this instanceof PublishTest && StringUtils.isNotBlank(config.getPublish())) {
environments.add(PublishTest.ENVIRONMENT_NAME);
success = doTest(config.getPublish(), PublishTest.ENVIRONMENT_NAME) && success;
testDone = true;
}

if (this instanceof DispatcherTest && StringUtils.isNotBlank(config.getDispatcherUrl())) {
environments.add(DispatcherTest.ENVIRONMENT_NAME);
success = doTest(config.getDispatcherUrl(), DispatcherTest.ENVIRONMENT_NAME) && success;
testDone = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class DefaultConfigurationProvider {

private static final Pattern P_ARGUMENT = Pattern.compile("-p (\\d+)");

private static final Pattern JAR_FILENAME = Pattern.compile("-(\\d+)\\.jar");
private static final Pattern JAR_FILENAME = Pattern.compile("-.(\\d+)\\.jar");

private static final String CONFIG_NODE = "/etc/secureaem/jcr:content/globalConfig";

Expand Down

0 comments on commit 7c96988

Please sign in to comment.