Compare commits
No commits in common. "ca5cde5f5590ed9de284bd16324753d043cb6f93" and "c300a89ab8b56455a12c54e630159c58e60d68e7" have entirely different histories.
ca5cde5f55
...
c300a89ab8
@ -26,11 +26,9 @@ class HsDomainSetupHostingAssetValidator extends HostingAssetEntityValidator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> validateEntity(final HsHostingAsset assetEntity) {
|
public List<String> validateEntity(final HsHostingAsset assetEntity) {
|
||||||
final var violations = super.validateEntity(assetEntity);
|
final var violations = // new ArrayList<String>();
|
||||||
if (!violations.isEmpty() || assetEntity.isLoaded()) {
|
super.validateEntity(assetEntity);
|
||||||
// it makes no sense to do DNS-based validation
|
if (!violations.isEmpty()) {
|
||||||
// if the entity is already persisted or
|
|
||||||
// if the identifier (domain name) or structure is already invalid
|
|
||||||
return violations;
|
return violations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package net.hostsharing.hsadminng.hs.hosting.asset;
|
package net.hostsharing.hsadminng.hs.hosting.asset;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration;
|
import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration;
|
||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
@ -578,6 +576,7 @@ public class HsHostingAssetControllerRestTest {
|
|||||||
when(emf.createEntityManager(any(Map.class))).thenReturn(em);
|
when(emf.createEntityManager(any(Map.class))).thenReturn(em);
|
||||||
when(emf.createEntityManager(any(SynchronizationType.class))).thenReturn(em);
|
when(emf.createEntityManager(any(SynchronizationType.class))).thenReturn(em);
|
||||||
when(emf.createEntityManager(any(SynchronizationType.class), any(Map.class))).thenReturn(em);
|
when(emf.createEntityManager(any(SynchronizationType.class), any(Map.class))).thenReturn(em);
|
||||||
|
// doNothing().when(transactionManager).commit(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ -646,7 +645,7 @@ public class HsHostingAssetControllerRestTest {
|
|||||||
entry("includes", false),
|
entry("includes", false),
|
||||||
entry("letsencrypt", false),
|
entry("letsencrypt", false),
|
||||||
entry("multiviews", false),
|
entry("multiviews", false),
|
||||||
entry("fcgi-php-bin", "/usr/lib/cgi-bin/php-orig"),
|
entry("fcgi-php-bin", "/usr/lib/cgi-bin/php8"),
|
||||||
entry("passenger-nodejs", "/usr/bin/node-js7"),
|
entry("passenger-nodejs", "/usr/bin/node-js7"),
|
||||||
entry("passenger-python", "/usr/bin/python6"),
|
entry("passenger-python", "/usr/bin/python6"),
|
||||||
entry("passenger-ruby", "/usr/bin/ruby5"),
|
entry("passenger-ruby", "/usr/bin/ruby5"),
|
||||||
@ -672,8 +671,7 @@ public class HsHostingAssetControllerRestTest {
|
|||||||
"autoconfig": true,
|
"autoconfig": true,
|
||||||
"multiviews": true,
|
"multiviews": true,
|
||||||
"passenger": false,
|
"passenger": false,
|
||||||
"fcgi-php-bin": null,
|
"fcgi-php-bin": "/usr/lib/cgi-bin/php9",
|
||||||
"passenger-nodejs": "/usr/bin/node-js8",
|
|
||||||
"subdomains": ["www","test"]
|
"subdomains": ["www","test"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -687,20 +685,11 @@ public class HsHostingAssetControllerRestTest {
|
|||||||
"type": "DOMAIN_HTTP_SETUP",
|
"type": "DOMAIN_HTTP_SETUP",
|
||||||
"identifier": "example.org|HTTP",
|
"identifier": "example.org|HTTP",
|
||||||
"caption": "some updated fake Domain-HTTP-Setup",
|
"caption": "some updated fake Domain-HTTP-Setup",
|
||||||
"alarmContact": null
|
"alarmContact": null,
|
||||||
}
|
|
||||||
""")))
|
|
||||||
.andReturn();
|
|
||||||
|
|
||||||
// and the config properties do match not just leniently but even strictly
|
|
||||||
final var actualConfig = formatJsonNode(result.getResponse().getContentAsString());
|
|
||||||
final var expectedConfig = formatJsonNode("""
|
|
||||||
{
|
|
||||||
"config": {
|
"config": {
|
||||||
"autoconfig": true,
|
"autoconfig": true,
|
||||||
"cgi": false,
|
"cgi": false,
|
||||||
"fastcgi": false,
|
"fastcgi": false,
|
||||||
// "fcgi-php-bin" : "/usr/lib/cgi-bin/php", TODO.spec: do we want defaults to work like initializers?
|
|
||||||
"greylisting": false,
|
"greylisting": false,
|
||||||
"htdocsfallback": false,
|
"htdocsfallback": false,
|
||||||
"includes": false,
|
"includes": false,
|
||||||
@ -709,24 +698,20 @@ public class HsHostingAssetControllerRestTest {
|
|||||||
"multiviews": true,
|
"multiviews": true,
|
||||||
"passenger": false,
|
"passenger": false,
|
||||||
"passenger-errorpage": true,
|
"passenger-errorpage": true,
|
||||||
"passenger-nodejs" : "/usr/bin/node-js8",
|
"passenger-nodejs": "/usr/bin/node-js7",
|
||||||
"passenger-python": "/usr/bin/python6",
|
"passenger-python": "/usr/bin/python6",
|
||||||
"passenger-ruby": "/usr/bin/ruby5",
|
"passenger-ruby": "/usr/bin/ruby5",
|
||||||
|
"fcgi-php-bin": "/usr/lib/cgi-bin/php9",
|
||||||
"subdomains": ["www","test"]
|
"subdomains": ["www","test"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""");
|
""")))
|
||||||
assertThat(actualConfig).isEqualTo(expectedConfig);
|
.andReturn();
|
||||||
}
|
|
||||||
|
|
||||||
private static final ObjectMapper SORTED_MAPPER = new ObjectMapper();
|
// and the config properties do match not just leniently but even strictly
|
||||||
static {
|
final var resultBody = new ObjectMapper().readTree(result.getResponse().getContentAsString());
|
||||||
SORTED_MAPPER.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
|
for (int n = 0; n < resultBody.size(); ++n) {
|
||||||
}
|
// assertThat(resultBody.get(n).path("config")).isEqualTo(testCase.expectedConfig(n));
|
||||||
|
}
|
||||||
private static String formatJsonNode(final String json) throws JsonProcessingException {
|
|
||||||
final var node = SORTED_MAPPER.readTree(json.replaceAll("//.*", "")).path("config");
|
|
||||||
final var obj = SORTED_MAPPER.treeToValue(node, Object.class);
|
|
||||||
return SORTED_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(obj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1450,7 +1450,6 @@ public class ImportHostingAssets extends BaseOfficeDataImport {
|
|||||||
// nothing here
|
// nothing here
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
domainSetupAsset.markAsLoaded(); // to skip setup verification
|
|
||||||
domainSetupsByName.put(domain_name, domainSetupAsset);
|
domainSetupsByName.put(domain_name, domainSetupAsset);
|
||||||
domainSetupAssets.put(domain_id, domainSetupAsset);
|
domainSetupAssets.put(domain_id, domainSetupAsset);
|
||||||
domainSetupAsset.setSubHostingAssets(new ArrayList<>());
|
domainSetupAsset.setSubHostingAssets(new ArrayList<>());
|
||||||
|
Loading…
Reference in New Issue
Block a user