mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-06 05:01:12 +01:00
Use XmlEnvironment in parsing/provider subsystem
This commit is contained in:
parent
43bb418d99
commit
8df69bd3ce
188 changed files with 486 additions and 264 deletions
|
|
@ -22,6 +22,7 @@ import static org.junit.Assert.assertThat;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.provider.ProviderManager;
|
||||
import org.jivesoftware.smack.test.util.TestUtils;
|
||||
|
|
@ -79,7 +80,7 @@ public class ParsingExceptionTest {
|
|||
public static final String NAMESPACE = "http://smack.jivesoftware.org/exception";
|
||||
|
||||
@Override
|
||||
public ExtensionElement parse(XmlPullParser parser, int initialDepth) throws IOException {
|
||||
public ExtensionElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
|
||||
throw new IOException("Test Exception");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.util.FileUtils;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
|
@ -62,7 +63,7 @@ public class ProviderConfigTest {
|
|||
public static class TestIQProvider extends IQProvider<IQ> {
|
||||
|
||||
@Override
|
||||
public IQ parse(XmlPullParser parser, int initialDepth) {
|
||||
public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014 Florian Schmaus
|
||||
* Copyright © 2014-2019 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
|
@ -38,7 +39,7 @@ public class ProviderManagerTest {
|
|||
public static class TestIQProvider extends IQProvider<IQ> {
|
||||
|
||||
@Override
|
||||
public IQ parse(XmlPullParser parser, int initialDepth) {
|
||||
public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.io.Reader;
|
|||
import java.io.StringReader;
|
||||
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
|
||||
|
|
@ -80,15 +81,15 @@ public final class TestUtils {
|
|||
|
||||
public static <EE extends ExtensionElement> EE parseExtensionElement(String elementString)
|
||||
throws Exception {
|
||||
return parseExtensionElement(getParser(elementString));
|
||||
return parseExtensionElement(getParser(elementString), null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser)
|
||||
public static <EE extends ExtensionElement> EE parseExtensionElement(XmlPullParser parser, XmlEnvironment outerXmlEnvironment)
|
||||
throws Exception {
|
||||
ParserUtils.assertAtStartTag(parser);
|
||||
final String elementName = parser.getName();
|
||||
final String namespace = parser.getNamespace();
|
||||
return (EE) PacketParserUtils.parseExtensionElement(elementName, namespace, parser);
|
||||
return (EE) PacketParserUtils.parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue