import-email-addresses (#86)
Co-authored-by: Michael Hoennig <michael@hoennig.de> Reviewed-on: #86 Reviewed-by: Marc Sandlus <marc.sandlus@hostsharing.net>
This commit is contained in:
parent
99a26aed8b
commit
0763511edd
6
.aliases
6
.aliases
@ -84,3 +84,9 @@ alias fp='grep -r '@Accepts' src | sed -e 's/^.*@/@/g' | sort -u | wc -l'
|
||||
alias gw-spotless='./gradlew spotlessApply -x pitest -x test -x :processResources'
|
||||
alias gw-test='. .aliases; ./gradlew test importOfficeData'
|
||||
alias gw-check='. .aliases; gw test importOfficeData check -x pitest -x :dependencyCheckAnalyze'
|
||||
|
||||
# etc/docker-compose.yml limits CPUs+MEM and includes a PostgreSQL config for analysing slow queries
|
||||
alias gw-importOfficeData-in-docker-compose='
|
||||
docker-compose -f etc/docker-compose.yml down &&
|
||||
docker-compose -f etc/docker-compose.yml up -d && sleep 10 &&
|
||||
time gw-importHostingAssets'
|
||||
|
@ -126,7 +126,7 @@ SELECT calls,
|
||||
query
|
||||
FROM statements
|
||||
WHERE calls > 100 AND shared_blks_hit > 0
|
||||
ORDER BY total_exec_time_mins DESC
|
||||
ORDER BY total_exec_time DESC
|
||||
LIMIT 16;
|
||||
```
|
||||
|
||||
|
@ -7,7 +7,7 @@ services:
|
||||
environment:
|
||||
POSTGRES_PASSWORD: password
|
||||
volumes:
|
||||
- /home/mi/Projekte/Hostsharing/hsadmin-ng/etc/postgresql-log-slow-queries.conf:/etc/postgresql/postgresql.conf
|
||||
- ./postgresql-log-slow-queries.conf:/etc/postgresql/postgresql.conf
|
||||
ports:
|
||||
- "5432:5432"
|
||||
command:
|
||||
@ -17,3 +17,11 @@ services:
|
||||
apt-get update &&
|
||||
apt-get install -y postgresql-contrib &&
|
||||
docker-entrypoint.sh postgres -c config_file=/etc/postgresql/postgresql.conf
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 8G
|
||||
reservations:
|
||||
cpus: '1'
|
||||
memory: 2G
|
@ -158,8 +158,8 @@ public class HsBookingItemEntity implements Stringifyable, BaseEntity<HsBookingI
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> directProps() {
|
||||
return resources;
|
||||
public PatchableMapWrapper<Object> directProps() {
|
||||
return getResources();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,8 +128,8 @@ public class HsHostingAssetEntity implements HsHostingAsset {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> directProps() {
|
||||
return config;
|
||||
public PatchableMapWrapper<Object> directProps() {
|
||||
return getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,7 @@ public class HsHostingAssetEntityPatcher implements EntityPatcher<HsHostingAsset
|
||||
private final EntityManager em;
|
||||
private final HsHostingAssetEntity entity;
|
||||
|
||||
HsHostingAssetEntityPatcher(final EntityManager em, final HsHostingAssetEntity entity) {
|
||||
public HsHostingAssetEntityPatcher(final EntityManager em, final HsHostingAssetEntity entity) {
|
||||
this.em = em;
|
||||
this.entity = entity;
|
||||
}
|
||||
|
@ -6,8 +6,10 @@ import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAsse
|
||||
import net.hostsharing.hsadminng.hs.validation.HsEntityValidator;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Wraps the steps of the pararation, validation, mapping and revamp around saving of a HsHostingAsset into a readable API.
|
||||
@ -40,12 +42,14 @@ public class HostingAssetEntitySaveProcessor {
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO.impl: remove once the migration of legacy data is done
|
||||
/// validates the entity itself including its properties, but ignoring some error messages for import of legacy data
|
||||
public HostingAssetEntitySaveProcessor validateEntityIgnoring(final String ignoreRegExp) {
|
||||
public HostingAssetEntitySaveProcessor validateEntityIgnoring(final String... ignoreRegExp) {
|
||||
step("validateEntity", "prepareForSave");
|
||||
final var ignoreRegExpPatterns = Arrays.stream(ignoreRegExp).map(Pattern::compile).toList();
|
||||
MultiValidationException.throwIfNotEmpty(
|
||||
validator.validateEntity(entity).stream()
|
||||
.filter(errorMsg -> !errorMsg.matches(ignoreRegExp))
|
||||
.filter(error -> ignoreRegExpPatterns.stream().noneMatch(p -> p.matcher(error).matches() ))
|
||||
.toList()
|
||||
);
|
||||
return this;
|
||||
|
@ -11,20 +11,22 @@ import static net.hostsharing.hsadminng.hs.validation.StringProperty.stringPrope
|
||||
|
||||
class HsEMailAddressHostingAssetValidator extends HostingAssetEntityValidator {
|
||||
|
||||
private static final String UNIX_USER_REGEX = "^[a-z][a-z0-9]{2}[0-9]{2}(-[a-z0-9][a-z0-9\\._-]*)?$"; // also accepts legacy pac-names
|
||||
private static final String TARGET_MAILBOX_REGEX = "^[a-z][a-z0-9]{2}[0-9]{2}(-[a-z0-9][a-z0-9\\.+_-]*)?$"; // also accepts legacy pac-names
|
||||
private static final String EMAIL_ADDRESS_LOCAL_PART_REGEX = "[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+"; // RFC 5322
|
||||
private static final String EMAIL_ADDRESS_DOMAIN_PART_REGEX = "[a-zA-Z0-9.-]+";
|
||||
private static final String EMAIL_ADDRESS_FULL_REGEX = "^" + EMAIL_ADDRESS_LOCAL_PART_REGEX + "@" + EMAIL_ADDRESS_DOMAIN_PART_REGEX + "$";
|
||||
private static final String EMAIL_ADDRESS_FULL_REGEX = "^(" + EMAIL_ADDRESS_LOCAL_PART_REGEX + ")?@" + EMAIL_ADDRESS_DOMAIN_PART_REGEX + "$";
|
||||
private static final String NOBODY_REGEX = "^nobody$";
|
||||
private static final String DEVNULL_REGEX = "^/dev/null$";
|
||||
public static final int EMAIL_ADDRESS_MAX_LENGTH = 320; // according to RFC 5321 and RFC 5322
|
||||
|
||||
HsEMailAddressHostingAssetValidator() {
|
||||
super( HsHostingAssetType.EMAIL_ADDRESS,
|
||||
AlarmContact.isOptional(),
|
||||
|
||||
stringProperty("local-part").matchesRegEx("^" + EMAIL_ADDRESS_LOCAL_PART_REGEX + "$").required(),
|
||||
stringProperty("sub-domain").matchesRegEx("^" + EMAIL_ADDRESS_LOCAL_PART_REGEX + "$").optional(),
|
||||
stringProperty("local-part").matchesRegEx("^" + EMAIL_ADDRESS_LOCAL_PART_REGEX + "$").writeOnce().optional(),
|
||||
stringProperty("sub-domain").matchesRegEx("^" + EMAIL_ADDRESS_LOCAL_PART_REGEX + "$").writeOnce().optional(),
|
||||
arrayOf(
|
||||
stringProperty("target").maxLength(EMAIL_ADDRESS_MAX_LENGTH).matchesRegEx(UNIX_USER_REGEX, EMAIL_ADDRESS_FULL_REGEX)
|
||||
stringProperty("target").maxLength(EMAIL_ADDRESS_MAX_LENGTH).matchesRegEx(TARGET_MAILBOX_REGEX, EMAIL_ADDRESS_FULL_REGEX, NOBODY_REGEX, DEVNULL_REGEX)
|
||||
).required().minLength(1));
|
||||
}
|
||||
|
||||
@ -43,9 +45,9 @@ class HsEMailAddressHostingAssetValidator extends HostingAssetEntityValidator {
|
||||
}
|
||||
|
||||
private static String combineIdentifier(final HsHostingAsset emailAddressAssetEntity) {
|
||||
return emailAddressAssetEntity.getDirectValue("local-part", String.class) +
|
||||
ofNullable(emailAddressAssetEntity.getDirectValue("sub-domain", String.class)).map(s -> "." + s).orElse("") +
|
||||
"@" +
|
||||
emailAddressAssetEntity.getParentAsset().getIdentifier();
|
||||
return ofNullable(emailAddressAssetEntity.getDirectValue("local-part", String.class)).orElse("")
|
||||
+ "@"
|
||||
+ ofNullable(emailAddressAssetEntity.getDirectValue("sub-domain", String.class)).map(s -> s + ".").orElse("")
|
||||
+ emailAddressAssetEntity.getParentAsset().getParentAsset().getIdentifier();
|
||||
}
|
||||
}
|
||||
|
@ -43,10 +43,10 @@ public class ArrayProperty<P extends ValidatableProperty<?, E>, E> extends Valid
|
||||
@Override
|
||||
protected void validate(final List<String> result, final E[] propValue, final PropertiesProvider propProvider) {
|
||||
if (minLength != null && propValue.length < minLength) {
|
||||
result.add(propertyName + "' length is expected to be at min " + minLength + " but length of " + display(propValue) + " is " + propValue.length);
|
||||
result.add(propertyName + "' length is expected to be at min " + minLength + " but length of " + displayArray(propValue) + " is " + propValue.length);
|
||||
}
|
||||
if (maxLength != null && propValue.length > maxLength) {
|
||||
result.add(propertyName + "' length is expected to be at max " + maxLength + " but length of " + display(propValue) + " is " + propValue.length);
|
||||
result.add(propertyName + "' length is expected to be at max " + maxLength + " but length of " + displayArray(propValue) + " is " + propValue.length);
|
||||
}
|
||||
stream(propValue).forEach(e -> elementsOf.validate(result, e, propProvider));
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class ArrayProperty<P extends ValidatableProperty<?, E>, E> extends Valid
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
private String display(final E... propValue) {
|
||||
private String displayArray(final E... propValue) {
|
||||
return "[" + Arrays.toString(propValue) + "]";
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.hostsharing.hsadminng.hs.validation;
|
||||
|
||||
import java.util.Map;
|
||||
import net.hostsharing.hsadminng.mapper.PatchableMapWrapper;
|
||||
|
||||
public interface PropertiesProvider {
|
||||
|
||||
boolean isLoaded();
|
||||
Map<String, Object> directProps();
|
||||
PatchableMapWrapper<Object> directProps();
|
||||
Object getContextValue(final String propName);
|
||||
|
||||
default <T> T getDirectValue(final String propName, final Class<T> clazz) {
|
||||
@ -16,6 +16,10 @@ public interface PropertiesProvider {
|
||||
return cast(propName, directProps().get(propName), clazz, defaultValue);
|
||||
}
|
||||
|
||||
default boolean isPatched(String propertyName) {
|
||||
return directProps().isPatched(propertyName);
|
||||
}
|
||||
|
||||
default <T> T getContextValue(final String propName, final Class<T> clazz) {
|
||||
return cast(propName, getContextValue(propName), clazz, null);
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ public class StringProperty<P extends StringProperty<P>> extends ValidatableProp
|
||||
|
||||
@Override
|
||||
protected void validate(final List<String> result, final String propValue, final PropertiesProvider propProvider) {
|
||||
super.validate(result, propValue, propProvider);
|
||||
if (minLength != null && propValue.length()<minLength) {
|
||||
result.add(propertyName + "' length is expected to be at min " + minLength + " but length of " + display(propValue) + " is " + propValue.length());
|
||||
}
|
||||
@ -87,12 +88,10 @@ public class StringProperty<P extends StringProperty<P>> extends ValidatableProp
|
||||
stream(matchesRegEx).map(p -> p.matcher(propValue)).noneMatch(Matcher::matches)) {
|
||||
result.add(propertyName + "' is expected to match any of " + Arrays.toString(matchesRegEx) + " but " + display(propValue) + " does not match" + (matchesRegEx.length>1?" any":""));
|
||||
}
|
||||
if (isReadOnly() && propValue != null) {
|
||||
result.add(propertyName + "' is readonly but given as " + display(propValue));
|
||||
}
|
||||
}
|
||||
|
||||
private String display(final String propValue) {
|
||||
@Override
|
||||
protected String display(final String propValue) {
|
||||
return undisclosed ? "provided value" : ("'" + propValue + "'");
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import static org.apache.commons.lang3.ObjectUtils.isArray;
|
||||
public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T> {
|
||||
|
||||
protected static final String[] KEY_ORDER_HEAD = Array.of("propertyName");
|
||||
protected static final String[] KEY_ORDER_TAIL = Array.of("required", "requiresAtLeastOneOf", "requiresAtMaxOneOf", "defaultValue", "readOnly", "writeOnly", "computed", "isTotalsValidator", "thresholdPercentage");
|
||||
protected static final String[] KEY_ORDER_TAIL = Array.of("required", "requiresAtLeastOneOf", "requiresAtMaxOneOf", "defaultValue", "readOnly", "writeOnce","writeOnly", "computed", "isTotalsValidator", "thresholdPercentage");
|
||||
protected static final String[] KEY_ORDER = Array.join(KEY_ORDER_HEAD, KEY_ORDER_TAIL);
|
||||
|
||||
final Class<T> type;
|
||||
@ -66,6 +66,9 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
|
||||
@Accessors(makeFinal = true, chain = true, fluent = false)
|
||||
private boolean writeOnly;
|
||||
|
||||
@Accessors(makeFinal = true, chain = true, fluent = false)
|
||||
private boolean writeOnce;
|
||||
|
||||
private Function<ValidatableProperty<?, ?>[], T[]> deferredInit;
|
||||
private boolean isTotalsValidator = false;
|
||||
|
||||
@ -97,7 +100,11 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
|
||||
|
||||
public P writeOnly() {
|
||||
this.writeOnly = true;
|
||||
optional();
|
||||
return self();
|
||||
}
|
||||
|
||||
public P writeOnce() {
|
||||
this.writeOnce = true;
|
||||
return self();
|
||||
}
|
||||
|
||||
@ -198,6 +205,9 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
|
||||
if (required == TRUE) {
|
||||
result.add(propertyName + "' is required but missing");
|
||||
}
|
||||
if (isWriteOnce() && propsProvider.isLoaded() && propsProvider.isPatched(propertyName) ) {
|
||||
result.add(propertyName + "' is write-once but got removed");
|
||||
}
|
||||
validateRequiresAtLeastOneOf(result, propsProvider);
|
||||
}
|
||||
if (propValue != null){
|
||||
@ -239,19 +249,35 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void validate(final List<String> result, final T propValue, final PropertiesProvider propProvider);
|
||||
protected void validate(final List<String> result, final T propValue, final PropertiesProvider propProvider) {
|
||||
if (isReadOnly() && propValue != null) {
|
||||
result.add(propertyName + "' is readonly but given as " + display(propValue));
|
||||
}
|
||||
if (isWriteOnce() && propProvider.isLoaded() && propValue != null && propProvider.isPatched(propertyName) ) {
|
||||
result.add(propertyName + "' is write-once but given as " + display(propValue));
|
||||
}
|
||||
}
|
||||
|
||||
public void verifyConsistency(final Map.Entry<? extends Enum<?>, ?> typeDef) {
|
||||
if (required == null && requiresAtLeastOneOf == null && requiresAtMaxOneOf == null && !readOnly && defaultValue == null) {
|
||||
if (isSpecPotentiallyComplete()) {
|
||||
throw new IllegalStateException(typeDef.getKey() + "[" + propertyName + "] not fully initialized, please call either .readOnly(), .required(), .optional(), .withDefault(...), .requiresAtLeastOneOf(...) or .requiresAtMaxOneOf(...)" );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSpecPotentiallyComplete() {
|
||||
return required == null && requiresAtLeastOneOf == null && requiresAtMaxOneOf == null && !readOnly && !writeOnly
|
||||
&& defaultValue == null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getValue(final Map<String, Object> propValues) {
|
||||
return (T) Optional.ofNullable(propValues.get(propertyName)).orElse(defaultValue);
|
||||
}
|
||||
|
||||
protected String display(final T propValue) {
|
||||
return propValue == null ? null : propValue.toString();
|
||||
}
|
||||
|
||||
protected abstract String simpleTypeName();
|
||||
|
||||
public Map<String, Object> toOrderedMap() {
|
||||
|
@ -7,7 +7,9 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@ -23,6 +25,7 @@ public class PatchableMapWrapper<T> implements Map<String, T> {
|
||||
.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
private final Map<String, T> delegate;
|
||||
private final Set<String> patched = new HashSet<>();
|
||||
|
||||
private PatchableMapWrapper(final Map<String, T> map) {
|
||||
delegate = map;
|
||||
@ -36,6 +39,10 @@ public class PatchableMapWrapper<T> implements Map<String, T> {
|
||||
});
|
||||
}
|
||||
|
||||
public static <T> PatchableMapWrapper<T> of(final Map<String, T> delegate) {
|
||||
return new PatchableMapWrapper<T>(delegate);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <E> ImmutablePair<String, E> entry(final String key, final E value) {
|
||||
return new ImmutablePair<>(key, value);
|
||||
@ -45,6 +52,7 @@ public class PatchableMapWrapper<T> implements Map<String, T> {
|
||||
if (entries != null ) {
|
||||
delegate.clear();
|
||||
delegate.putAll(entries);
|
||||
patched.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +66,10 @@ public class PatchableMapWrapper<T> implements Map<String, T> {
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isPatched(final String propertyName) {
|
||||
return patched.contains(propertyName);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public String toString() {
|
||||
return jsonWriter.writeValueAsString(delegate);
|
||||
@ -92,11 +104,17 @@ public class PatchableMapWrapper<T> implements Map<String, T> {
|
||||
|
||||
@Override
|
||||
public T put(final String key, final T value) {
|
||||
if (!Objects.equals(value, delegate.get(key))) {
|
||||
patched.add(key);
|
||||
}
|
||||
return delegate.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T remove(final Object key) {
|
||||
if (delegate.containsKey(key.toString())) {
|
||||
patched.add(key.toString());
|
||||
}
|
||||
return delegate.remove(key);
|
||||
}
|
||||
|
||||
@ -107,20 +125,24 @@ public class PatchableMapWrapper<T> implements Map<String, T> {
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
patched.addAll(delegate.keySet());
|
||||
delegate.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<String> keySet() {
|
||||
return delegate.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<T> values() {
|
||||
return delegate.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<Entry<String, T>> entrySet() {
|
||||
return delegate.entrySet();
|
||||
}
|
||||
|
@ -189,15 +189,11 @@ begin
|
||||
select g.descendantUuid, g.ascendantUuid, level + 1 as level
|
||||
from RbacGrants g
|
||||
inner join grants on grants.descendantUuid = g.ascendantUuid
|
||||
where g.assumed
|
||||
),
|
||||
granted as (
|
||||
select distinct descendantUuid
|
||||
from grants
|
||||
where g.assumed and level<10
|
||||
)
|
||||
select distinct perm.objectUuid as objectUuid
|
||||
from granted
|
||||
join RbacPermission perm on granted.descendantUuid = perm.uuid
|
||||
from grants
|
||||
join RbacPermission perm on grants.descendantUuid = perm.uuid
|
||||
join RbacObject obj on obj.uuid = perm.objectUuid
|
||||
where obj.objectTable = '%1$s' -- 'SELECT' permission is included in all other permissions
|
||||
limit 8001
|
||||
|
@ -170,9 +170,9 @@ class HsBookingItemRepositoryIntegrationTest extends ContextBasedTestWithCleanup
|
||||
// then
|
||||
allTheseBookingItemsAreReturned(
|
||||
result,
|
||||
"HsBookingItemEntity(D-1000212:D-1000212 default project, MANAGED_WEBSPACE, [2022-10-01,), separate ManagedWebspace, { Daemons: 0, Multi: 1, SSD: 100, Traffic: 50 } )",
|
||||
"HsBookingItemEntity(D-1000212:D-1000212 default project, MANAGED_SERVER, [2022-10-01,), separate ManagedServer, { CPU: 2, RAM: 8, SSD: 500, Traffic: 500 } )",
|
||||
"HsBookingItemEntity(D-1000212:D-1000212 default project, PRIVATE_CLOUD, [2024-04-01,), some PrivateCloud, { CPU: 10, HDD: 10000, RAM: 32, SSD: 4000, Traffic: 2000 } )");
|
||||
"HsBookingItemEntity(D-1000212:D-1000212 default project, MANAGED_WEBSPACE, [2022-10-01,), separate ManagedWebspace, { Daemons: 0, Multi: 1, SSD: 100, Traffic: 50 })",
|
||||
"HsBookingItemEntity(D-1000212:D-1000212 default project, MANAGED_SERVER, [2022-10-01,), separate ManagedServer, { CPU: 2, RAM: 8, SSD: 500, Traffic: 500 })",
|
||||
"HsBookingItemEntity(D-1000212:D-1000212 default project, PRIVATE_CLOUD, [2024-04-01,), some PrivateCloud, { CPU: 10, HDD: 10000, RAM: 32, SSD: 4000, Traffic: 2000 })");
|
||||
assertThat(result.stream().filter(bi -> bi.getRelatedHostingAsset()!=null).findAny())
|
||||
.as("at least one relatedProject expected, but none found => fetching relatedProject does not work")
|
||||
.isNotEmpty();
|
||||
@ -193,9 +193,9 @@ class HsBookingItemRepositoryIntegrationTest extends ContextBasedTestWithCleanup
|
||||
// then:
|
||||
exactlyTheseBookingItemsAreReturned(
|
||||
result,
|
||||
"HsBookingItemEntity(D-1000111:D-1000111 default project, MANAGED_WEBSPACE, [2022-10-01,), separate ManagedWebspace, { Daemons: 0, Multi: 1, SSD: 100, Traffic: 50 } )",
|
||||
"HsBookingItemEntity(D-1000111:D-1000111 default project, MANAGED_SERVER, [2022-10-01,), separate ManagedServer, { CPU: 2, RAM: 8, SSD: 500, Traffic: 500 } )",
|
||||
"HsBookingItemEntity(D-1000111:D-1000111 default project, PRIVATE_CLOUD, [2024-04-01,), some PrivateCloud, { CPU: 10, HDD: 10000, RAM: 32, SSD: 4000, Traffic: 2000 } )");
|
||||
"HsBookingItemEntity(D-1000111:D-1000111 default project, MANAGED_WEBSPACE, [2022-10-01,), separate ManagedWebspace, { Daemons : 0, Multi : 1, SSD : 100, Traffic : 50 })",
|
||||
"HsBookingItemEntity(D-1000111:D-1000111 default project, MANAGED_SERVER, [2022-10-01,), separate ManagedServer, { CPU : 2, RAM : 8, SSD : 500, Traffic : 500 })",
|
||||
"HsBookingItemEntity(D-1000111:D-1000111 default project, PRIVATE_CLOUD, [2024-04-01,), some PrivateCloud, { CPU : 10, HDD : 10000, RAM : 32, SSD : 4000, Traffic : 2000 })");
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,6 +359,7 @@ class HsBookingItemRepositoryIntegrationTest extends ContextBasedTestWithCleanup
|
||||
.extracting(HsBookingItemEntity::toString)
|
||||
.extracting(string -> string.replaceAll("\\s+", " "))
|
||||
.extracting(string -> string.replaceAll("\"", ""))
|
||||
.extracting(string -> string.replaceAll(" : ", ": "))
|
||||
.contains(bookingItemNames);
|
||||
}
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"caption": "some patched test-unix-user",
|
||||
"caption" : "some patched test-unix-user",
|
||||
"config": {
|
||||
"shell": "/bin/bash",
|
||||
"totpKey": "0x1234567890abcdef0123456789abcdef",
|
||||
@ -588,7 +588,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
}).returnedValue()).isPresent().get()
|
||||
.matches(asset -> {
|
||||
assertThat(asset.getCaption()).isEqualTo("some patched test-unix-user");
|
||||
assertThat(asset.getConfig().toString()).isEqualTo("""
|
||||
assertThat(asset.getConfig().toString()).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
"password": "$6$Jr5w/Y8zo8pCkqg7$/rePRbvey3R6Sz/02YTlTQcRt5qdBPTj2h5.hz.rB8NfIoND8pFOjeB7orYcPs9JNf3JDxPP2V.6MQlE5BwAY/",
|
||||
"shell": "/bin/bash",
|
||||
|
@ -227,7 +227,7 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu
|
||||
exactlyTheseAssetsAreReturned(
|
||||
result,
|
||||
"HsHostingAssetEntity(MANAGED_WEBSPACE, fir01, some Webspace, MANAGED_SERVER:vm1011, D-1000111:D-1000111 default project:separate ManagedWebspace)",
|
||||
"HsHostingAssetEntity(MANAGED_SERVER, vm1011, some ManagedServer, D-1000111:D-1000111 default project:separate ManagedServer, { monit_max_cpu_usage: 90, monit_max_ram_usage: 80, monit_max_ssd_usage: 70 } )");
|
||||
"HsHostingAssetEntity(MANAGED_SERVER, vm1011, some ManagedServer, D-1000111:D-1000111 default project:separate ManagedServer, { monit_max_cpu_usage : 90, monit_max_ram_usage : 80, monit_max_ssd_usage : 70 })");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -444,6 +444,7 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu
|
||||
.extracting(HsHostingAssetEntity::toString)
|
||||
.extracting(input -> input.replaceAll("\\s+", " "))
|
||||
.extracting(input -> input.replaceAll("\"", ""))
|
||||
.extracting(input -> input.replaceAll("\" : ", "\": "))
|
||||
.containsExactlyInAnyOrder(serverNames);
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,10 @@ import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemType;
|
||||
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetEntity;
|
||||
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetEntity.HsHostingAssetEntityBuilder;
|
||||
import net.hostsharing.hsadminng.mapper.Array;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Map.entry;
|
||||
@ -60,6 +62,11 @@ class HsDomainDnsSetupHostingAssetValidatorUnitTest {
|
||||
));
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void reset() {
|
||||
HsDomainDnsSetupHostingAssetValidator.addZonefileErrorsTo(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void containsExpectedProperties() {
|
||||
// when
|
||||
@ -318,4 +325,30 @@ class HsDomainDnsSetupHostingAssetValidatorUnitTest {
|
||||
"[example.org|DNS] zone example.org/IN: not loaded due to errors."
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void acceptsInvalidZonefileWithActiveErrorFilter() {
|
||||
// given
|
||||
final var givenEntity = validEntityBuilder().config(Map.ofEntries(
|
||||
entry("user-RR", Array.of(
|
||||
"example.org. 1814400 IN SOA example.org. root.example.org (1234 10800 900 604800 86400)",
|
||||
"example.org. 1814400 IN SOA example.org. root.example.org (4321 10800 900 604800 86400)"
|
||||
))
|
||||
))
|
||||
.build();
|
||||
final var validator = HostingAssetEntityValidatorRegistry.forType(givenEntity.getType());
|
||||
|
||||
// when
|
||||
final var zonefileErrors = new ArrayList<String>();
|
||||
HsDomainDnsSetupHostingAssetValidator.addZonefileErrorsTo(zonefileErrors);
|
||||
final var errors = validator.validateContext(givenEntity);
|
||||
|
||||
// then
|
||||
assertThat(errors).isEmpty();
|
||||
assertThat(zonefileErrors).containsExactlyInAnyOrder(
|
||||
"[example.org|DNS] dns_master_load:line 26: example.org: multiple RRs of singleton type",
|
||||
"[example.org|DNS] zone example.org/IN: loading from master file (null) failed: multiple RRs of singleton type",
|
||||
"[example.org|DNS] zone example.org/IN: not loaded due to errors."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,30 +4,43 @@ import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetEntity;
|
||||
import net.hostsharing.hsadminng.mapper.Array;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Map.entry;
|
||||
import static java.util.Map.ofEntries;
|
||||
import static net.hostsharing.hsadminng.hs.booking.item.TestHsBookingItem.TEST_MANAGED_SERVER_BOOKING_ITEM;
|
||||
import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.DOMAIN_MBOX_SETUP;
|
||||
import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.EMAIL_ADDRESS;
|
||||
import static net.hostsharing.hsadminng.hs.hosting.asset.TestHsHostingAssetEntities.TEST_MANAGED_SERVER_HOSTING_ASSET;
|
||||
import static net.hostsharing.hsadminng.mapper.PatchableMapWrapper.entry;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class HsEMailAddressHostingAssetValidatorUnitTest {
|
||||
|
||||
final static HsHostingAssetEntity domainMboxetup = HsHostingAssetEntity.builder()
|
||||
final static HsHostingAssetEntity domainSetup = HsHostingAssetEntity.builder()
|
||||
.type(DOMAIN_MBOX_SETUP)
|
||||
.identifier("example.org")
|
||||
.build();
|
||||
final static HsHostingAssetEntity domainMboxSetup = HsHostingAssetEntity.builder()
|
||||
.type(DOMAIN_MBOX_SETUP)
|
||||
.identifier("example.org|MBOX")
|
||||
.parentAsset(domainSetup)
|
||||
.build();
|
||||
static HsHostingAssetEntity.HsHostingAssetEntityBuilder validEntityBuilder() {
|
||||
return HsHostingAssetEntity.builder()
|
||||
.type(EMAIL_ADDRESS)
|
||||
.parentAsset(domainMboxetup)
|
||||
.identifier("test@example.org")
|
||||
.config(Map.ofEntries(
|
||||
entry("local-part", "test"),
|
||||
entry("target", Array.of("xyz00", "xyz00-abc", "office@example.com"))
|
||||
));
|
||||
.parentAsset(domainMboxSetup)
|
||||
.identifier("old-local-part@example.org")
|
||||
.config(new HashMap<>(ofEntries(
|
||||
entry("local-part", "old-local-part"),
|
||||
entry("target", Array.of(
|
||||
"xyz00",
|
||||
"xyz00-abc",
|
||||
"xyz00-xyz+list",
|
||||
"office@example.com",
|
||||
"/dev/null"
|
||||
))
|
||||
)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -37,9 +50,9 @@ class HsEMailAddressHostingAssetValidatorUnitTest {
|
||||
|
||||
// then
|
||||
assertThat(validator.properties()).map(Map::toString).containsExactlyInAnyOrder(
|
||||
"{type=string, propertyName=local-part, matchesRegEx=[^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$], required=true}",
|
||||
"{type=string, propertyName=sub-domain, matchesRegEx=[^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$]}",
|
||||
"{type=string[], propertyName=target, elementsOf={type=string, propertyName=target, matchesRegEx=[^[a-z][a-z0-9]{2}[0-9]{2}(-[a-z0-9][a-z0-9\\._-]*)?$, ^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$], maxLength=320}, required=true, minLength=1}");
|
||||
"{type=string, propertyName=local-part, matchesRegEx=[^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$], writeOnce=true}",
|
||||
"{type=string, propertyName=sub-domain, matchesRegEx=[^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$], writeOnce=true}",
|
||||
"{type=string[], propertyName=target, elementsOf={type=string, propertyName=target, matchesRegEx=[^[a-z][a-z0-9]{2}[0-9]{2}(-[a-z0-9][a-z0-9\\.+_-]*)?$, ^([a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+)?@[a-zA-Z0-9.-]+$, ^nobody$, ^/dev/null$], maxLength=320}, required=true, minLength=1}");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -59,10 +72,14 @@ class HsEMailAddressHostingAssetValidatorUnitTest {
|
||||
void rejectsInvalidProperties() {
|
||||
// given
|
||||
final var emailAddressHostingAssetEntity = validEntityBuilder()
|
||||
.config(Map.ofEntries(
|
||||
.config(new HashMap<>(ofEntries(
|
||||
entry("local-part", "no@allowed"),
|
||||
entry("sub-domain", "no@allowedeither"),
|
||||
entry("target", Array.of("xyz00", "xyz00-abc", "garbage", "office@example.com"))))
|
||||
entry("target", Array.of(
|
||||
"xyz00",
|
||||
"xyz00-abc",
|
||||
"garbage",
|
||||
"office@example.com")))))
|
||||
.build();
|
||||
final var validator = HostingAssetEntityValidatorRegistry.forType(emailAddressHostingAssetEntity.getType());
|
||||
|
||||
@ -71,9 +88,69 @@ class HsEMailAddressHostingAssetValidatorUnitTest {
|
||||
|
||||
// then
|
||||
assertThat(result).containsExactlyInAnyOrder(
|
||||
"'EMAIL_ADDRESS:test@example.org.config.local-part' is expected to match any of [^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$] but 'no@allowed' does not match",
|
||||
"'EMAIL_ADDRESS:test@example.org.config.sub-domain' is expected to match any of [^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$] but 'no@allowedeither' does not match",
|
||||
"'EMAIL_ADDRESS:test@example.org.config.target' is expected to match any of [^[a-z][a-z0-9]{2}[0-9]{2}(-[a-z0-9][a-z0-9\\._-]*)?$, ^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$] but 'garbage' does not match any");
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.config.local-part' is expected to match any of [^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$] but 'no@allowed' does not match",
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.config.sub-domain' is expected to match any of [^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+$] but 'no@allowedeither' does not match",
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.config.target' is expected to match any of [^[a-z][a-z0-9]{2}[0-9]{2}(-[a-z0-9][a-z0-9\\.+_-]*)?$, ^([a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+)?@[a-zA-Z0-9.-]+$, ^nobody$, ^/dev/null$] but 'garbage' does not match any");
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsOverwritingWriteOnceProperties() {
|
||||
// given
|
||||
final var emailAddressHostingAssetEntity = validEntityBuilder()
|
||||
.isLoaded(true)
|
||||
.build();
|
||||
final var validator = HostingAssetEntityValidatorRegistry.forType(emailAddressHostingAssetEntity.getType());
|
||||
|
||||
// when
|
||||
emailAddressHostingAssetEntity.getConfig().put("local-part", "new-local-part");
|
||||
emailAddressHostingAssetEntity.getConfig().put("sub-domain", "new-sub-domain");
|
||||
final var result = validator.validateEntity(emailAddressHostingAssetEntity);
|
||||
|
||||
// then
|
||||
assertThat(result).containsExactlyInAnyOrder(
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.config.local-part' is write-once but given as 'new-local-part'",
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.config.sub-domain' is write-once but given as 'new-sub-domain'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsRemovingWriteOnceProperties() {
|
||||
// given
|
||||
final var emailAddressHostingAssetEntity = validEntityBuilder()
|
||||
.config(new HashMap<>(ofEntries(
|
||||
entry("local-part", "old-local-part"),
|
||||
entry("sub-domain", "old-sub-domain"),
|
||||
entry("target", Array.of("xyz00", "xyz00-abc", "office@example.com"))
|
||||
)))
|
||||
.isLoaded(true)
|
||||
.build();
|
||||
final var validator = HostingAssetEntityValidatorRegistry.forType(emailAddressHostingAssetEntity.getType());
|
||||
|
||||
// when
|
||||
emailAddressHostingAssetEntity.getConfig().remove("local-part");
|
||||
emailAddressHostingAssetEntity.getConfig().remove("sub-domain");
|
||||
final var result = validator.validateEntity(emailAddressHostingAssetEntity);
|
||||
|
||||
// then
|
||||
assertThat(result).containsExactlyInAnyOrder(
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.config.local-part' is write-once but got removed",
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.config.sub-domain' is write-once but got removed");
|
||||
}
|
||||
|
||||
@Test
|
||||
void acceptsOverwritingWriteOncePropertiesWithSameValues() {
|
||||
// given
|
||||
final var emailAddressHostingAssetEntity = validEntityBuilder()
|
||||
.isLoaded(true)
|
||||
.build();
|
||||
final var validator = HostingAssetEntityValidatorRegistry.forType(emailAddressHostingAssetEntity.getType());
|
||||
|
||||
// when
|
||||
emailAddressHostingAssetEntity.getConfig().put("local-part", "old-local-part");
|
||||
emailAddressHostingAssetEntity.getConfig().remove("sub-domain"); // is not there anyway
|
||||
final var result = validator.validateEntity(emailAddressHostingAssetEntity);
|
||||
|
||||
// then
|
||||
assertThat(result).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -89,7 +166,7 @@ class HsEMailAddressHostingAssetValidatorUnitTest {
|
||||
|
||||
// then
|
||||
assertThat(result).containsExactlyInAnyOrder(
|
||||
"'identifier' expected to match '^\\Qtest@example.org\\E$', but is 'abc00-office'");
|
||||
"'identifier' expected to match '^\\Qold-local-part@example.org\\E$', but is 'abc00-office'");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -107,8 +184,8 @@ class HsEMailAddressHostingAssetValidatorUnitTest {
|
||||
|
||||
// then
|
||||
assertThat(result).containsExactlyInAnyOrder(
|
||||
"'EMAIL_ADDRESS:test@example.org.bookingItem' must be null but is of type MANAGED_SERVER",
|
||||
"'EMAIL_ADDRESS:test@example.org.parentAsset' must be of type DOMAIN_MBOX_SETUP but is of type MANAGED_SERVER",
|
||||
"'EMAIL_ADDRESS:test@example.org.assignedToAsset' must be null but is of type MANAGED_SERVER");
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.bookingItem' must be null but is of type MANAGED_SERVER",
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.parentAsset' must be of type DOMAIN_MBOX_SETUP but is of type MANAGED_SERVER",
|
||||
"'EMAIL_ADDRESS:old-local-part@example.org.assignedToAsset' must be null but is of type MANAGED_SERVER");
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.ValidationException;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@ -309,7 +310,7 @@ public class CsvDataImport extends ContextBasedTest {
|
||||
void logError(final Runnable assertion) {
|
||||
try {
|
||||
assertion.run();
|
||||
} catch (final AssertionError exc) {
|
||||
} catch (final AssertionError | ValidationException exc) {
|
||||
logError(exc.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ public class HsHostingAssetRealEntity implements HsHostingAsset {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> directProps() {
|
||||
return config;
|
||||
public PatchableMapWrapper<Object> directProps() {
|
||||
return getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -134,6 +134,15 @@ public class ImportOfficeData extends CsvDataImport {
|
||||
static Map<Integer, HsOfficeCoopSharesTransactionEntity> coopShares = new WriteOnceMap<>();
|
||||
static Map<Integer, HsOfficeCoopAssetsTransactionEntity> coopAssets = new WriteOnceMap<>();
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void verifyInitialDatabase() {
|
||||
// SQL DELETE for thousands of records takes too long, so we make sure, we only start with initial or test data
|
||||
final var contactCount = (Integer) em.createNativeQuery("select count(*) from hs_office_contact", Integer.class)
|
||||
.getSingleResult();
|
||||
assertThat(contactCount).isLessThan(20);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1010)
|
||||
void importBusinessPartners() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.hostsharing.hsadminng.hs.validation;
|
||||
|
||||
import net.hostsharing.hsadminng.hash.LinuxEtcShadowHashGenerator;
|
||||
import net.hostsharing.hsadminng.mapper.PatchableMapWrapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
@ -109,10 +110,10 @@ class PasswordPropertyUnitTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> directProps() {
|
||||
return Map.ofEntries(
|
||||
public PatchableMapWrapper<Object> directProps() {
|
||||
return PatchableMapWrapper.of(Map.ofEntries(
|
||||
entry(passwordProp.propertyName, "some password")
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +34,7 @@ public abstract class PatchUnitTestBase<R, E> {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void willPatchAllProperties() {
|
||||
protected void willPatchAllProperties() {
|
||||
// given
|
||||
final var givenEntity = newInitialEntity();
|
||||
final var patchResource = newPatchResource();
|
||||
@ -55,7 +55,7 @@ public abstract class PatchUnitTestBase<R, E> {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("propertyTestCases")
|
||||
void willPatchOnlyGivenProperty(final Property<R, Object, E, Object> testCase) {
|
||||
protected void willPatchOnlyGivenProperty(final Property<R, Object, E, Object> testCase) {
|
||||
|
||||
// given
|
||||
final var givenEntity = newInitialEntity();
|
||||
|
@ -1,8 +1,8 @@
|
||||
database_id;engine;packet_id;name;owner;encoding
|
||||
|
||||
77;pgsql;630;hsh00_vorstand;hsh00_vorstand;LATIN1
|
||||
786;mysql;630;hsh00_addr;hsh00;latin1
|
||||
805;mysql;630;hsh00_db2;hsh00;LATIN-1
|
||||
1077;pgsql;630;hsh00_vorstand;hsh00_vorstand;LATIN1
|
||||
1786;mysql;630;hsh00_addr;hsh00;latin1
|
||||
1805;mysql;630;hsh00_dba;hsh00;LATIN-1
|
||||
|
||||
1858;pgsql;630;hsh00;hsh00;LATIN1
|
||||
1860;pgsql;630;hsh00_hsadmin;hsh00_hsadmin;UTF8
|
||||
|
|
@ -1,17 +1,17 @@
|
||||
dbuser_id;engine;packet_id;name;password_hash
|
||||
|
||||
1857;pgsql;630;hsh00;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$JDiZmaxU+O+ByArLY/CkYZ8HbOk0r/I8LyABnno5gQs=:NI3T500/63dzI1B07Jh3UtQGlukS6JxuS0XoxM/QgAc=
|
||||
1858;mysql;630;hsh00;*59067A36BA197AD0A47D74909296C5B002A0FB9F
|
||||
1859;pgsql;630;hsh00_vorstand;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg=
|
||||
1860;pgsql;630;hsh00_hsadmin;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg=
|
||||
1861;pgsql;630;hsh00_hsadmin_ro;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8=
|
||||
4931;pgsql;630;hsh00_phpPgSqlAdmin;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8=
|
||||
4908;mysql;630;hsh00_mantis;*EA4C0889A22AAE66BBEBC88161E8CF862D73B44F
|
||||
4909;mysql;630;hsh00_mantis_ro;*B3BB6D0DA2EC01958616E9B3BCD2926FE8C38383
|
||||
4932;mysql;630;hsh00_phpMyAdmin;*3188720B1889EF5447C722629765F296F40257C2
|
||||
1857;pgsql;10630;hsh00;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$JDiZmaxU+O+ByArLY/CkYZ8HbOk0r/I8LyABnno5gQs=:NI3T500/63dzI1B07Jh3UtQGlukS6JxuS0XoxM/QgAc=
|
||||
1858;mysql;10630;hsh00;*59067A36BA197AD0A47D74909296C5B002A0FB9F
|
||||
1859;pgsql;10630;hsh00_vorstand;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg=
|
||||
1860;pgsql;10630;hsh00_hsadmin;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg=
|
||||
1861;pgsql;10630;hsh00_hsadmin_ro;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8=
|
||||
4931;pgsql;10630;hsh00_phpPgSqlAdmin;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8=
|
||||
4908;mysql;10630;hsh00_mantis;*EA4C0889A22AAE66BBEBC88161E8CF862D73B44F
|
||||
4909;mysql;10630;hsh00_mantis_ro;*B3BB6D0DA2EC01958616E9B3BCD2926FE8C38383
|
||||
4932;mysql;10630;hsh00_phpMyAdmin;*3188720B1889EF5447C722629765F296F40257C2
|
||||
|
||||
7520;mysql;1094;lug00_wla;*11667C0EAC42BF8B0295ABEDC7D2868A835E4DB5
|
||||
7522;pgsql;1094;lug00_ola;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$tir+cV3ZzOZeEWurwAJk+8qkvsTAWaBfwx846oYMOr4=:p4yk/4hHkfSMAFxSuTuh3RIrbSpHNBh7h6raVa3nt1c=
|
||||
7520;mysql;11094;lug00_wla;*11667C0EAC42BF8B0295ABEDC7D2868A835E4DB5
|
||||
7522;pgsql;11094;lug00_ola;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$tir+cV3ZzOZeEWurwAJk+8qkvsTAWaBfwx846oYMOr4=:p4yk/4hHkfSMAFxSuTuh3RIrbSpHNBh7h6raVa3nt1c=
|
||||
|
||||
7604;mysql;1112;mim00_test;*156CFD94A0594A5C3F4C6742376DDF4B8C5F6D90
|
||||
7605;pgsql;1112;mim00_office;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$43jziwd1o+nkfjE0zFbks24Zy5GK+km87B7vzEQt4So=:xRQntZxBxdo1JJbhkegnUFKHT0T8MDW75hkQs2S3z6k=
|
||||
7604;mysql;11112;mim00_test;*156CFD94A0594A5C3F4C6742376DDF4B8C5F6D90
|
||||
7605;pgsql;11112;mim00_office;SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$43jziwd1o+nkfjE0zFbks24Zy5GK+km87B7vzEQt4So=:xRQntZxBxdo1JJbhkegnUFKHT0T8MDW75hkQs2S3z6k=
|
||||
|
|
@ -7,4 +7,4 @@ domain_id;domain_name;domain_since;domain_dns_master;domain_owner;valid_subdomai
|
||||
4589;ist-im-netz.de;2013-09-17;dns.hostsharing.net;5964;*;/usr/bin/python3;/usr/bin/node;/usr/bin/ruby;/usr/lib/cgi-bin/php;htdocsfallback,indexes,includes,letsencrypt,multiviews,cgi,fastcgi,passenger
|
||||
4600;waera.de;2013-09-17;dns.hostsharing.net;5964;*;/usr/bin/python3;/usr/bin/node;/usr/bin/ruby;/usr/lib/cgi-bin/php;greylisting,multiviews,indexes,htdocsfallback,includes,cgi,fastcgi,passenger
|
||||
4604;xn--wra-qla.de;2013-09-17;dns.hostsharing.net;5964;*;/usr/bin/python3;/usr/bin/node;/usr/bin/ruby;/usr/lib/cgi-bin/php;greylisting,multiviews,indexes,htdocsfallback,includes,cgi,fastcgi,passenger
|
||||
27662;dph-netzwerk.de;2021-06-02;h93.hostsharing.net;169596;*;/usr/bin/python3;/usr/bin/node;/usr/bin/ruby;/usr/lib/cgi-bin/php;htdocsfallback,indexes,autoconfig,greylisting,includes,letsencrypt,multiviews,cgi,fastcgi,passenger
|
||||
7662;dph-netzwerk.de;2021-06-02;h93.hostsharing.net;9596;*;/usr/bin/python3;/usr/bin/node;/usr/bin/ruby;/usr/lib/cgi-bin/php;htdocsfallback,indexes,autoconfig,greylisting,includes,letsencrypt,multiviews,cgi,fastcgi,passenger
|
||||
|
|
72
src/test/resources/migration/hosting/emailaddr.csv
Normal file
72
src/test/resources/migration/hosting/emailaddr.csv
Normal file
@ -0,0 +1,72 @@
|
||||
emailaddr_id;domain_id;localpart;subdomain;target
|
||||
54746;4531;abuse;;lug00
|
||||
54747;4531;postmaster;;nomail
|
||||
54748;4531;webmaster;;bounce
|
||||
54745;4531;lugmaster;;nobody
|
||||
54749;4532;abuse;;lug00-mars
|
||||
54750;4532;postmaster;;m.hinsel@example.org
|
||||
54751;4532;webmaster;;m.hinsel@example.org
|
||||
54755;4534;abuse;;lug00-marl
|
||||
54756;4534;postmaster;;m.hinsel@example.org
|
||||
54757;4534;webmaster;;m.hinsel@example.org
|
||||
54760;4531;info;hamburg-west;peter.lottmann@example.com
|
||||
54761;4531;lugmaster;hamburg-west;raoul.lottmann@example.com
|
||||
54762;4531;postmaster;hamburg-west;raoul.lottmann@example.com
|
||||
54763;4531;webmaster;hamburg-west;raoul.lottmann@example.com peter.lottmann@example.com
|
||||
54764;4531;;eliza;eliza@example.net
|
||||
54765;4531;;;lug00
|
||||
54766;4532;;;nomail
|
||||
54767;4532;hostmaster;;hostmaster@example.net
|
||||
54795;4534;;;bounce
|
||||
54796;4534;hostmaster;;hostmaster@example.net
|
||||
54963;4581;abuse;;mim00
|
||||
54964;4581;postmaster;;mim00
|
||||
54965;4581;webmaster;;mim00
|
||||
54981;4587;abuse;;
|
||||
54982;4587;postmaster;;/dev/null
|
||||
54983;4587;webmaster;;mim00
|
||||
54987;4589;abuse;;""
|
||||
54988;4589;postmaster;;mim00
|
||||
54989;4589;webmaster;;mim00
|
||||
55020;4600;abuse;;mim00
|
||||
55021;4600;postmaster;;mim00
|
||||
55022;4600;webmaster;;mim00
|
||||
55032;4604;abuse;;mim00
|
||||
55033;4604;postmaster;;mim00
|
||||
55034;4604;webmaster;;mim00
|
||||
55037;4587;;eberhard;eberhard@mellis.de
|
||||
55038;4587;;marleen;marleen@mellis.de
|
||||
55039;4587;;michael;mh@dump.mellis.de
|
||||
55040;4587;lists;michael;mim00-lists
|
||||
55041;4587;ooo;michael;mim00-ooo
|
||||
55043;4587;;test;test@mellis.de
|
||||
55044;4587;;trap;mim00-spam
|
||||
55046;4587;anke;;anke@segelschule-jade.de
|
||||
55052;4587;eberhard;;mellis@example.org
|
||||
55053;4587;gitti;;gitta.mellis@gmx.de
|
||||
55054;4587;imap;;mim00-imap
|
||||
55057;4587;listar;;mim00-listar
|
||||
55059;4587;marleen;;marleen.mellis@t-online.de
|
||||
55060;4587;mime;;mh@dump.mellis.de
|
||||
55061;4587;michael;;mh@dump.mellis.de
|
||||
55062;4587;monika;;nomail
|
||||
55063;4587;nobody;;nobody
|
||||
55064;4587;palm;;mim00-imap
|
||||
55065;4587;procmail;;mim00-mail
|
||||
55066;4587;reporter.web.de;;nomail
|
||||
55067;4587;script;;mim00-script
|
||||
55068;4587;spamtrap;;mim00-spamtrap
|
||||
55069;4587;susanne;;susanne.mellis@example.net
|
||||
55070;4587;test;;mim00-test
|
||||
55071;4587;ursula;;01234wasauchimmer@example.net
|
||||
55072;4587;webcmstag;;mim00-webcmstag
|
||||
55073;4587;wichtig;;mim00-imap,01234567@smsmail.example.org
|
||||
55074;4604;;;@waera.de
|
||||
60601;4589;highlander;;mim00-highlander,michael@mellis.de
|
||||
65150;4589;little-sunshine;;mim00-marleen
|
||||
75964;4589;;mail;michael@mellis.de
|
||||
75965;4589;;;michael@mellis.de
|
||||
77726;4587;chat;michael;mim00-chat
|
||||
93790;7662;abuse;;dph00-dph
|
||||
93791;7662;postmaster;;dph00-dph
|
||||
93792;7662;webmaster;;dph00-dph
|
|
@ -1,10 +1,10 @@
|
||||
emailalias_id;pac_id;name;target
|
||||
2403;1094;lug00;michael.mellis@example.com
|
||||
2405;1094;lug00-wla-listar;|/home/pacs/lug00/users/in/mailinglist/listar
|
||||
2429;1112;mim00;mim12-mi@mim12.hostsharing.net
|
||||
2431;1112;mim00-abruf;michael.mellis@hostsharing.net
|
||||
2449;1112;mim00-hhfx;"mim00-hhfx,""|/usr/bin/formail -I 'Reply-To: hamburger-fx@example.net' | /usr/lib/sendmail mim00-hhfx-l"""
|
||||
2451;1112;mim00-hhfx-l;:include:/home/pacs/mim00/etc/hhfx.list
|
||||
2454;1112;mim00-dev.null; /dev/null
|
||||
2455;1112;mim00-1_with_space;" ""|/home/pacs/mim00/install/corpslistar/listar"""
|
||||
2456;1112;mim00-1_with_single_quotes;'|/home/pacs/rir00/mailinglist/ecartis -r kybs06-intern'
|
||||
2403;11094;lug00;michael.mellis@example.com
|
||||
2405;11094;lug00-wla-listar;|/home/pacs/lug00/users/in/mailinglist/listar
|
||||
2429;11112;mim00;mim12-mi@mim12.hostsharing.net
|
||||
2431;11112;mim00-abruf;michael.mellis@hostsharing.net
|
||||
2449;11112;mim00-hhfx;"mim00-hhfx,""|/usr/bin/formail -I 'Reply-To: hamburger-fx@example.net' | /usr/lib/sendmail mim00-hhfx-l"""
|
||||
2451;11112;mim00-hhfx-l;:include:/home/pacs/mim00/etc/hhfx.list
|
||||
2454;11112;mim00-dev.null; /dev/null
|
||||
2455;11112;mim00-1_with_space;" ""|/home/pacs/mim00/install/corpslistar/listar"""
|
||||
2456;11112;mim00-1_with_single_quotes;'|/home/pacs/rir00/mailinglist/ecartis -r kybs06-intern'
|
||||
|
|
@ -1,26 +1,26 @@
|
||||
hive_id;hive_name;inet_addr_id;description
|
||||
1;h00;358;
|
||||
2;h01;359;
|
||||
4;h02;360;
|
||||
7;h03;361;
|
||||
13;h04;430;
|
||||
14;h50;433;
|
||||
20;h05;354;
|
||||
21;h06;355;
|
||||
22;h07;357;
|
||||
28;h60;363;
|
||||
31;h63;431;
|
||||
37;h67;381;
|
||||
38;h97;537;
|
||||
39;h96;536;
|
||||
45;h74;485;
|
||||
50;h82;514;
|
||||
128;h19;565;
|
||||
148;h50;522;
|
||||
163;h92;457;
|
||||
173;h25;1759;
|
||||
192;h93;1778;
|
||||
193;h95;1779;
|
||||
205;vm1107;1861;
|
||||
208;vm1110;1864;
|
||||
210;vm1112;1833;
|
||||
1001;h00;358;
|
||||
1002;h01;359;
|
||||
1004;h02;360;
|
||||
1007;h03;361;
|
||||
1013;h04;430;
|
||||
1014;h50;433;
|
||||
1020;h05;354;
|
||||
1021;h06;355;
|
||||
1022;h07;357;
|
||||
1028;h60;363;
|
||||
1031;h63;431;
|
||||
1037;h67;381;
|
||||
1038;h97;537;
|
||||
1039;h96;536;
|
||||
1045;h74;485;
|
||||
1050;h82;514;
|
||||
1128;h19;565;
|
||||
1148;h50;522;
|
||||
1163;h92;457;
|
||||
1173;h25;1759;
|
||||
1192;h93;1778;
|
||||
1193;h95;1779;
|
||||
1205;vm1107;1861;
|
||||
1208;vm1110;1864;
|
||||
1210;vm1112;1833;
|
||||
|
|
@ -1,10 +1,10 @@
|
||||
packet_id;basepacket_code;packet_name;bp_id;hive_id;created;cancelled;cur_inet_addr_id;old_inet_addr_id;free
|
||||
630;PAC/WEB;hsh00;213;14;2001-06-01;;473;;1
|
||||
968;SRV/MGD;vm1061;132;28;2013-04-01;;363;;0
|
||||
978;SRV/MGD;vm1050;213;14;2013-04-01;;433;;1
|
||||
1061;SRV/MGD;vm1068;100;37;2013-08-19;;381;;f
|
||||
1094;PAC/WEB;lug00;100;37;2013-09-10;;1168;;1
|
||||
1112;PAC/WEB;mim00;100;37;2013-09-17;;402;;1
|
||||
1447;SRV/MGD;vm1093;213;163;2014-11-28;;457;;t
|
||||
19959;PAC/WEB;dph00;542;163;2021-06-02;;574;;0
|
||||
10630;PAC/WEB;hsh00;213;1014;2001-06-01;;473;;1
|
||||
10968;SRV/MGD;vm1061;132;1028;2013-04-01;;363;;0
|
||||