1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

Make ProviderManager static

also remove initialize() from ProviderFileLoader, by simply putting the
code into the constructor.
This commit is contained in:
Florian Schmaus 2014-05-11 09:27:41 +02:00
parent 0111be1a04
commit 90ea9ba2fc
12 changed files with 46 additions and 96 deletions

View file

@ -31,7 +31,6 @@ import org.junit.Test;
import org.xmlpull.v1.XmlPullParser;
public class ParsingExceptionTest {
private final static ProviderManager PM = ProviderManager.getInstance();
private final static String EXTENSION2 =
"<extension2 xmlns='namespace'>" +
@ -43,12 +42,12 @@ public class ParsingExceptionTest {
@Before
public void init() {
PM.addExtensionProvider(ThrowException.ELEMENT, ThrowException.NAMESPACE, new ThrowException());
ProviderManager.addExtensionProvider(ThrowException.ELEMENT, ThrowException.NAMESPACE, new ThrowException());
}
@After
public void tini() {
PM.removeExtensionProvider(ThrowException.ELEMENT, ThrowException.NAMESPACE);
ProviderManager.removeExtensionProvider(ThrowException.ELEMENT, ThrowException.NAMESPACE);
}
@Test

View file

@ -36,7 +36,7 @@ public class ProviderConfigTest {
@Test
public void addGenericLoaderProvider() {
ProviderManager.getInstance().addLoader(new ProviderLoader() {
ProviderManager.addLoader(new ProviderLoader() {
@Override
public Collection<IQProviderInfo> getIQProviderInfo() {
@ -51,13 +51,13 @@ public class ProviderConfigTest {
}
});
Assert.assertNotNull(ProviderManager.getInstance().getIQProvider("provider", "test:provider"));
Assert.assertNotNull(ProviderManager.getIQProvider("provider", "test:provider"));
}
@Test
public void addClasspathFileLoaderProvider() throws Exception{
ProviderManager.getInstance().addLoader(new ProviderFileLoader(FileUtils.getStreamForUrl("classpath:test.providers", null)));
Assert.assertNotNull(ProviderManager.getInstance().getIQProvider("provider", "test:file_provider"));
ProviderManager.addLoader(new ProviderFileLoader(FileUtils.getStreamForUrl("classpath:test.providers", null)));
Assert.assertNotNull(ProviderManager.getIQProvider("provider", "test:file_provider"));
}
public static class TestIQProvider implements IQProvider {