1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-05 20:51:07 +01:00

Add XMPPErrorException.getStanzaError()

Also deprecate getXMPPError and let StanzaError implement
ExtensionElement.
This commit is contained in:
Florian Schmaus 2018-06-20 15:55:48 +02:00
parent 651ee7b85e
commit 23bb5c5625
31 changed files with 108 additions and 75 deletions

View file

@ -73,8 +73,8 @@ public class MultiUserSubscriptionUseCases extends PubSubTestCase
}
catch (XMPPException exc)
{
assertEquals("bad-request", exc.getXMPPError().getCondition());
assertEquals(XMPPError.Type.MODIFY, exc.getXMPPError().getType());
assertEquals("bad-request", exc.getStanzaError().getCondition());
assertEquals(XMPPError.Type.MODIFY, exc.getStanzaError().getType());
}
List<Item> items = user2Node.getItems(sub1.getId());
assertTrue(items.size() == 5);

View file

@ -47,7 +47,7 @@ public class PublisherUseCases extends SingleUserTestCase
fail("Exception should be thrown when there is no payload");
}
catch (XMPPException e) {
XMPPError err = e.getXMPPError();
XMPPError err = e.getStanzaError();
assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));
@ -59,7 +59,7 @@ public class PublisherUseCases extends SingleUserTestCase
fail("Exception should be thrown when there is no payload");
}
catch (XMPPException e) {
XMPPError err = e.getXMPPError();
XMPPError err = e.getStanzaError();
assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));
@ -104,7 +104,7 @@ public class PublisherUseCases extends SingleUserTestCase
fail("Exception should be thrown when there is no payload");
}
catch (XMPPException e) {
XMPPError err = e.getXMPPError();
XMPPError err = e.getStanzaError();
assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));
@ -116,7 +116,7 @@ public class PublisherUseCases extends SingleUserTestCase
fail("Exception should be thrown when there is no payload");
}
catch (XMPPException e) {
XMPPError err = e.getXMPPError();
XMPPError err = e.getStanzaError();
assertTrue(err.getType().equals(XMPPError.Type.MODIFY));
assertTrue(err.getCondition().equals(Condition.bad_request.toString()));
assertNotNull(err.getExtension("payload-required", PubSubNamespace.ERROR.getXmlns()));

View file

@ -67,7 +67,7 @@ public class TestEvents extends SmackTestCase
}
catch (XMPPException e)
{
if (e.getXMPPError().getType() == Type.CANCEL && e.getXMPPError().getCondition().equals("item-not-found"))
if (e.getStanzaError().getType() == Type.CANCEL && e.getXMPPError().getCondition().equals("item-not-found"))
creatorNode = creatorMgr.createNode(nodeId);
else
throw e;