mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 18:48:00 +01:00
[sinttest] Add "compatibility mode" setting
This commit is contained in:
parent
48c057ab10
commit
a0b9279441
2 changed files with 35 additions and 1 deletions
|
@ -117,6 +117,13 @@ public final class Configuration {
|
||||||
|
|
||||||
public final DnsResolver dnsResolver;
|
public final DnsResolver dnsResolver;
|
||||||
|
|
||||||
|
public enum CompatibilityMode {
|
||||||
|
standardsCompliant,
|
||||||
|
ejabberd,
|
||||||
|
}
|
||||||
|
|
||||||
|
public final CompatibilityMode compatibilityMode;
|
||||||
|
|
||||||
private Configuration(Configuration.Builder builder) throws KeyManagementException, NoSuchAlgorithmException {
|
private Configuration(Configuration.Builder builder) throws KeyManagementException, NoSuchAlgorithmException {
|
||||||
service = Objects.requireNonNull(builder.service,
|
service = Objects.requireNonNull(builder.service,
|
||||||
"'service' must be set. Either via 'properties' files or via system property 'sinttest.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.verbose = builder.verbose;
|
||||||
|
|
||||||
this.dnsResolver = builder.dnsResolver;
|
this.dnsResolver = builder.dnsResolver;
|
||||||
|
this.compatibilityMode = builder.compatibilityMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAccountRegistrationPossible() {
|
public boolean isAccountRegistrationPossible() {
|
||||||
|
@ -246,6 +254,8 @@ public final class Configuration {
|
||||||
|
|
||||||
private DnsResolver dnsResolver = DnsResolver.minidns;
|
private DnsResolver dnsResolver = DnsResolver.minidns;
|
||||||
|
|
||||||
|
private CompatibilityMode compatibilityMode = CompatibilityMode.standardsCompliant;
|
||||||
|
|
||||||
private Builder() {
|
private Builder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,6 +437,20 @@ public final class Configuration {
|
||||||
return setDnsResolver(dnsResolver);
|
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 {
|
public Configuration build() throws KeyManagementException, NoSuchAlgorithmException {
|
||||||
return new Configuration(this);
|
return new Configuration(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -838,6 +838,16 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
|
||||||
|
|
||||||
createModeratedMuc(mucAsSeenByOne, nicknameOne);
|
createModeratedMuc(mucAsSeenByOne, nicknameOne);
|
||||||
|
|
||||||
|
final MUCRole threeRole;
|
||||||
|
switch (sinttestConfiguration.compatibilityMode) {
|
||||||
|
default:
|
||||||
|
threeRole = MUCRole.visitor;
|
||||||
|
break;
|
||||||
|
case ejabberd:
|
||||||
|
threeRole = MUCRole.participant;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mucAsSeenByTwo.join(nicknameTwo);
|
mucAsSeenByTwo.join(nicknameTwo);
|
||||||
mucAsSeenByThree.join(nicknameThree);
|
mucAsSeenByThree.join(nicknameThree);
|
||||||
|
@ -849,7 +859,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
|
||||||
JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole());
|
JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole());
|
||||||
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(
|
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(
|
||||||
JidCreate.entityFullFrom(mucAddress, nicknameTwo)).getRole());
|
JidCreate.entityFullFrom(mucAddress, nicknameTwo)).getRole());
|
||||||
assertEquals(MUCRole.visitor, mucAsSeenByOne.getOccupant(
|
assertEquals(threeRole, mucAsSeenByOne.getOccupant(
|
||||||
JidCreate.entityFullFrom(mucAddress, nicknameThree)).getRole());
|
JidCreate.entityFullFrom(mucAddress, nicknameThree)).getRole());
|
||||||
} finally {
|
} finally {
|
||||||
tryDestroy(mucAsSeenByOne);
|
tryDestroy(mucAsSeenByOne);
|
||||||
|
|
Loading…
Reference in a new issue