mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-15 03:59:38 +02:00
Rework XMPP Error class design
Introduce AbstractError, change 'Conditions' to enums. Because of AbstractError, it was necessary that PlainStreamElement and TopLevelStreamElement becomes an interface. Thus the implementation of TopLevelStreamElement.toString() had to be removed. This adds - policy-violation - unexpected-request to XMPPError.Condition, and removes the - payment-required - remote-server-error - unexpected-condition - request-timeout Conditions The file transfer code does now no longer throw XMPPErrorExceptions, but SmackExceptions. Fixes SMACK-608. Makes it possible to resolves SMACK-386.
This commit is contained in:
parent
cc09192095
commit
9286a1decb
31 changed files with 582 additions and 548 deletions
|
@ -73,7 +73,7 @@ public class CloseListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found.toString(),
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class DataListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found.toString(),
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ public class InBandBytestreamManagerTest {
|
|||
fail("exception should be thrown");
|
||||
}
|
||||
catch (XMPPErrorException e) {
|
||||
assertEquals(XMPPError.Condition.feature_not_implemented.toString(),
|
||||
assertEquals(XMPPError.Condition.feature_not_implemented,
|
||||
e.getXMPPError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class InBandBytestreamRequestTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable.toString(),
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ public class InBandBytestreamSessionTest {
|
|||
protocol.addResponse(null, Verification.requestTypeERROR, new Verification<IQ, IQ>() {
|
||||
|
||||
public void verify(IQ request, IQ response) {
|
||||
assertEquals(XMPPError.Condition.unexpected_request.toString(),
|
||||
assertEquals(XMPPError.Condition.unexpected_request,
|
||||
request.getError().getCondition());
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ public class InBandBytestreamSessionTest {
|
|||
protocol.addResponse(null, Verification.requestTypeERROR, new Verification<IQ, IQ>() {
|
||||
|
||||
public void verify(IQ request, IQ response) {
|
||||
assertEquals(XMPPError.Condition.bad_request.toString(),
|
||||
assertEquals(XMPPError.Condition.bad_request,
|
||||
request.getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class InitiationListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable.toString(),
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class InitiationListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.resource_constraint.toString(),
|
||||
assertEquals(XMPPError.Condition.resource_constraint,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public class InitiationListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable.toString(),
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public class InitiationListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable.toString(),
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ public class InitiationListenerTest {
|
|||
// assert that reply is the correct error packet
|
||||
assertEquals(initiatorJID, argument.getValue().getTo());
|
||||
assertEquals(IQ.Type.error, argument.getValue().getType());
|
||||
assertEquals(XMPPError.Condition.not_acceptable.toString(),
|
||||
assertEquals(XMPPError.Condition.not_acceptable,
|
||||
argument.getValue().getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found.toString(),
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
((IQ) targetResponse).getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found.toString(),
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
((IQ) targetResponse).getError().getCondition());
|
||||
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found.toString(),
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
((IQ) targetResponse).getError().getCondition());
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
assertEquals(XMPPError.Condition.item_not_found.toString(),
|
||||
assertEquals(XMPPError.Condition.item_not_found,
|
||||
((IQ) targetResponse).getError().getCondition());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue