Skip to content

Commit

Permalink
MGR-138 Results should have predictable order.
Browse files Browse the repository at this point in the history
  • Loading branch information
dheuvels committed Oct 18, 2022
1 parent dae834f commit 6b32792
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 63 deletions.
Expand Up @@ -20,6 +20,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import java.util.stream.Collectors;
import javax.validation.Valid;

import org.appng.api.Environment;
Expand Down Expand Up @@ -70,7 +71,7 @@ public void setTemplate(String template) {
}

public String getHostAliases() {
return String.join(System.lineSeparator(), site.getHostAliases());
return site.getHostAliases().stream().sorted().collect(Collectors.joining(System.lineSeparator()));
}

public void setHostAliases(String hostAliases) {
Expand Down
Expand Up @@ -16,19 +16,14 @@
package org.appng.application.manager.business;

import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

import org.appng.api.FieldProcessor;
import org.appng.api.Platform;
import org.appng.api.ProcessingException;
import org.appng.api.model.Property;
import org.appng.api.model.Site.SiteState;
import org.appng.api.support.CallableAction;
import org.appng.api.support.CallableDataSource;
import org.appng.api.support.PropertyHolder;
import org.appng.application.manager.form.PropertyForm;
import org.appng.application.manager.form.SiteForm;
import org.appng.core.domain.PropertyImpl;
Expand All @@ -37,8 +32,6 @@
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.mockito.Mockito;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.test.context.ContextConfiguration;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
Expand Down
110 changes: 55 additions & 55 deletions src/test/resources/xml/SitesTest-testShowSite.xml
@@ -1,61 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<datasource xmlns="http://www.appng.org/schema/platform" id="site">
<config>
<title id="site">Site</title>
<params>
<param name="siteid">1</param>
</params>
<meta-data binding="site" bindClass="org.appng.application.manager.form.SiteForm">
<field name="name" type="text" readonly="true" binding="site.name">
<label id="name">Name</label>
</field>
<field name="host" type="text" binding="site.host">
<label id="host">Hostname</label>
</field>
<field name="hostAliases" type="longtext" binding="hostAliases">
<label id="hostAliases">Hostname aliases (one per line)</label>
</field>
<field name="domain" type="text" binding="site.domain">
<label id="domain">Domain</label>
</field>
<field name="description" type="longtext" binding="site.description">
<label id="description">Description</label>
</field>
<field name="active" type="checkbox" readonly="false" binding="site.active">
<label id="active">Active</label>
</field>
<field name="template" type="list:radio" binding="template">
<label id="template">Template</label>
</field>
</meta-data>
</config>
<data>
<selection id="template">
<title id="template">Template</title>
</selection>
<result>
<field name="name" type="text">
<value>site1</value>
</field>
<config>
<title id="site">Site</title>
<params>
<param name="siteid">1</param>
</params>
<meta-data binding="site" bindClass="org.appng.application.manager.form.SiteForm">
<field name="name" type="text" readonly="true" binding="site.name">
<label id="name">Name</label>
</field>
<field name="host" type="text" binding="site.host">
<label id="host">Hostname</label>
</field>
<field name="hostAliases" type="longtext" binding="hostAliases">
<label id="hostAliases">Hostname aliases (one per line)</label>
</field>
<field name="domain" type="text" binding="site.domain">
<label id="domain">Domain</label>
</field>
<field name="description" type="longtext" binding="site.description">
<label id="description">Description</label>
</field>
<field name="active" type="checkbox" readonly="false" binding="site.active">
<label id="active">Active</label>
</field>
<field name="template" type="list:radio" binding="template">
<label id="template">Template</label>
</field>
</meta-data>
</config>
<data>
<selection id="template">
<title id="template">Template</title>
</selection>
<result>
<field name="name" type="text">
<value>site1</value>
</field>
<field name="host" type="text">
<value>hostname1.domain.tld</value>
</field>
<field name="hostAliases" type="longtext">
<value>lottchen
doppeltes</value>
</field>
<field name="domain" type="text">
<value>https://hostname1.domain.tld</value>
</field>
<field name="description" type="longtext">
<value></value>
</field>
<field name="active" type="checkbox">
<value>true</value>
</field>
<field name="template" type="list:radio">
<value></value>
</field>
</result>
</data>
<field name="hostAliases" type="longtext">
<value>doppeltes
lottchen</value>
</field>
<field name="domain" type="text">
<value>https://hostname1.domain.tld</value>
</field>
<field name="description" type="longtext">
<value></value>
</field>
<field name="active" type="checkbox">
<value>true</value>
</field>
<field name="template" type="list:radio">
<value></value>
</field>
</result>
</data>
</datasource>

0 comments on commit 6b32792

Please sign in to comment.