1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-04 23:55:58 +01:00

[sinttest] Add "compatibility mode" setting

This commit is contained in:
Florian Schmaus 2021-08-22 16:16:03 +02:00
parent 48c057ab10
commit a0b9279441
2 changed files with 35 additions and 1 deletions

View file

@ -117,6 +117,13 @@ public final class Configuration {
public final DnsResolver dnsResolver;
public enum CompatibilityMode {
standardsCompliant,
ejabberd,
}
public final CompatibilityMode compatibilityMode;
private Configuration(Configuration.Builder builder) throws KeyManagementException, NoSuchAlgorithmException {
service = Objects.requireNonNull(builder.service,
"'service' must be set. Either via 'properties' files or via system property 'sinttest.service'.");
@ -192,6 +199,7 @@ public final class Configuration {
this.verbose = builder.verbose;
this.dnsResolver = builder.dnsResolver;
this.compatibilityMode = builder.compatibilityMode;
}
public boolean isAccountRegistrationPossible() {
@ -246,6 +254,8 @@ public final class Configuration {
private DnsResolver dnsResolver = DnsResolver.minidns;
private CompatibilityMode compatibilityMode = CompatibilityMode.standardsCompliant;
private Builder() {
}
@ -427,6 +437,20 @@ public final class Configuration {
return setDnsResolver(dnsResolver);
}
public Builder setCompatibilityMode(CompatibilityMode compatibilityMode) {
this.compatibilityMode = compatibilityMode;
return this;
}
public Builder setCompatibilityMode(String compatibilityModeString) {
if (compatibilityModeString == null) {
return this;
}
CompatibilityMode compatibilityMode = CompatibilityMode.valueOf(compatibilityModeString);
return setCompatibilityMode(compatibilityMode);
}
public Configuration build() throws KeyManagementException, NoSuchAlgorithmException {
return new Configuration(this);
}

View file

@ -838,6 +838,16 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
createModeratedMuc(mucAsSeenByOne, nicknameOne);
final MUCRole threeRole;
switch (sinttestConfiguration.compatibilityMode) {
default:
threeRole = MUCRole.visitor;
break;
case ejabberd:
threeRole = MUCRole.participant;
break;
}
try {
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByThree.join(nicknameThree);
@ -849,7 +859,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole());
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(
JidCreate.entityFullFrom(mucAddress, nicknameTwo)).getRole());
assertEquals(MUCRole.visitor, mucAsSeenByOne.getOccupant(
assertEquals(threeRole, mucAsSeenByOne.getOccupant(
JidCreate.entityFullFrom(mucAddress, nicknameThree)).getRole());
} finally {
tryDestroy(mucAsSeenByOne);