From 312f2f7508b4096f5f7684f10e6b2d9abb13900f Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 18 Feb 2014 10:24:59 +0100 Subject: [PATCH] Move EntityCaps and Bookmarks API in correct package Also move ProviderConfigTest into core, since it tests core functionality, nothing provided by extensions. Found the reason the test was failing since the gradle migration (provider entry test.providers), and activated it again. \o/ New API design as of SMACK-545 --- .../smack}/provider/ProviderConfigTest.java | 19 ++++++++----------- core/src/test/resources/.dummy | 0 .../src/test/resources}/test.providers | 2 +- .../BookmarkManager.java | 2 +- .../BookmarkedConference.java | 2 +- .../BookmarkedURL.java | 2 +- .../{bookmark => bookmarks}/Bookmarks.java | 2 +- .../SharedBookmark.java | 2 +- .../EntityCapsManager.java | 6 +++--- .../cache/EntityCapsPersistentCache.java | 2 +- .../cache/SimpleDirectoryPersistentCache.java | 4 ++-- .../packet/CapsExtension.java | 4 ++-- .../provider/CapsExtensionProvider.java | 7 +++---- .../smackx/disco/ServiceDiscoveryManager.java | 2 +- .../extensions.providers | 2 +- .../EntityCapsManagerTest.java | 7 ++++--- .../provider/DelayInformationTest.java | 2 +- 17 files changed, 32 insertions(+), 35 deletions(-) rename {extensions/src/test/java/org/jivesoftware/smackx => core/src/test/java/org/jivesoftware/smack}/provider/ProviderConfigTest.java (88%) delete mode 100644 core/src/test/resources/.dummy rename {extensions/src/test/java/org/jivesoftware/smackx/provider => core/src/test/resources}/test.providers (71%) rename extensions/src/main/java/org/jivesoftware/smackx/{bookmark => bookmarks}/BookmarkManager.java (99%) rename extensions/src/main/java/org/jivesoftware/smackx/{bookmark => bookmarks}/BookmarkedConference.java (98%) rename extensions/src/main/java/org/jivesoftware/smackx/{bookmark => bookmarks}/BookmarkedURL.java (98%) rename extensions/src/main/java/org/jivesoftware/smackx/{bookmark => bookmarks}/Bookmarks.java (99%) rename extensions/src/main/java/org/jivesoftware/smackx/{bookmark => bookmarks}/SharedBookmark.java (95%) rename extensions/src/main/java/org/jivesoftware/smackx/{entitycaps => caps}/EntityCapsManager.java (99%) rename extensions/src/main/java/org/jivesoftware/smackx/{entitycaps => caps}/cache/EntityCapsPersistentCache.java (95%) rename extensions/src/main/java/org/jivesoftware/smackx/{entitycaps => caps}/cache/SimpleDirectoryPersistentCache.java (98%) rename extensions/src/main/java/org/jivesoftware/smackx/{entitycaps => caps}/packet/CapsExtension.java (94%) rename extensions/src/main/java/org/jivesoftware/smackx/{entitycaps => caps}/provider/CapsExtensionProvider.java (92%) rename extensions/src/test/java/org/jivesoftware/smackx/{entitycaps => caps}/EntityCapsManagerTest.java (97%) rename extensions/src/test/java/org/jivesoftware/smackx/{ => delay}/provider/DelayInformationTest.java (99%) diff --git a/extensions/src/test/java/org/jivesoftware/smackx/provider/ProviderConfigTest.java b/core/src/test/java/org/jivesoftware/smack/provider/ProviderConfigTest.java similarity index 88% rename from extensions/src/test/java/org/jivesoftware/smackx/provider/ProviderConfigTest.java rename to core/src/test/java/org/jivesoftware/smack/provider/ProviderConfigTest.java index f9325fa9b..c6ef02b05 100644 --- a/extensions/src/test/java/org/jivesoftware/smackx/provider/ProviderConfigTest.java +++ b/core/src/test/java/org/jivesoftware/smack/provider/ProviderConfigTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.provider; +package org.jivesoftware.smack.provider; import java.util.ArrayList; import java.util.Collection; -import junit.framework.Assert; +import org.junit.Assert; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.provider.ExtensionProviderInfo; @@ -29,13 +29,11 @@ import org.jivesoftware.smack.provider.ProviderFileLoader; import org.jivesoftware.smack.provider.ProviderLoader; import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.util.FileUtils; -import org.junit.Ignore; import org.junit.Test; import org.xmlpull.v1.XmlPullParser; -@SuppressWarnings("deprecation") public class ProviderConfigTest { - + @Test public void addGenericLoaderProvider() { ProviderManager.getInstance().addLoader(new ProviderLoader() { @@ -46,20 +44,19 @@ public class ProviderConfigTest { l.add(new IQProviderInfo("provider", "test:provider", new TestIQProvider())); return l; } - + @Override public Collection getExtensionProviderInfo() { return null; } }); - + Assert.assertNotNull(ProviderManager.getInstance().getIQProvider("provider", "test:provider")); } - - @Ignore // gradle migration + @Test public void addClasspathFileLoaderProvider() throws Exception{ - ProviderManager.getInstance().addLoader(new ProviderFileLoader(FileUtils.getStreamForUrl("classpath:org/jivesoftware/smackx/provider/test.providers", null))); + ProviderManager.getInstance().addLoader(new ProviderFileLoader(FileUtils.getStreamForUrl("classpath:test.providers", null))); Assert.assertNotNull(ProviderManager.getInstance().getIQProvider("provider", "test:file_provider")); } @@ -69,6 +66,6 @@ public class ProviderConfigTest { public IQ parseIQ(XmlPullParser parser) throws Exception { return null; } - + } } diff --git a/core/src/test/resources/.dummy b/core/src/test/resources/.dummy deleted file mode 100644 index e69de29bb..000000000 diff --git a/extensions/src/test/java/org/jivesoftware/smackx/provider/test.providers b/core/src/test/resources/test.providers similarity index 71% rename from extensions/src/test/java/org/jivesoftware/smackx/provider/test.providers rename to core/src/test/resources/test.providers index 4c6ef142b..8eeb6b3a6 100644 --- a/extensions/src/test/java/org/jivesoftware/smackx/provider/test.providers +++ b/core/src/test/resources/test.providers @@ -5,7 +5,7 @@ provider test:file_provider - org.jivesoftware.smackx.provider.ProviderConfigTest$TestIQProvider + org.jivesoftware.smack.provider.ProviderConfigTest$TestIQProvider diff --git a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkManager.java b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java similarity index 99% rename from extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkManager.java rename to extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java index e52a6fc25..c7547fffc 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.jivesoftware.smackx.bookmark; +package org.jivesoftware.smackx.bookmarks; import org.jivesoftware.smack.Connection; import org.jivesoftware.smack.XMPPException; diff --git a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkedConference.java b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedConference.java similarity index 98% rename from extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkedConference.java rename to extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedConference.java index 76df30c0a..68e335b2e 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkedConference.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedConference.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.jivesoftware.smackx.bookmark; +package org.jivesoftware.smackx.bookmarks; /** * Respresents a Conference Room bookmarked on the server using JEP-0048 Bookmark Storage JEP. diff --git a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkedURL.java b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedURL.java similarity index 98% rename from extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkedURL.java rename to extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedURL.java index e696c310e..70e9d67fc 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/BookmarkedURL.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedURL.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.jivesoftware.smackx.bookmark; +package org.jivesoftware.smackx.bookmarks; /** * Respresents one instance of a URL defined using JEP-0048 Bookmark Storage JEP. diff --git a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/Bookmarks.java b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java similarity index 99% rename from extensions/src/main/java/org/jivesoftware/smackx/bookmark/Bookmarks.java rename to extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java index f27b19e6b..3b3d68c3a 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/Bookmarks.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.bookmark; +package org.jivesoftware.smackx.bookmarks; import org.jivesoftware.smackx.iqprivate.packet.PrivateData; import org.jivesoftware.smackx.iqprivate.provider.PrivateDataProvider; diff --git a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/SharedBookmark.java b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/SharedBookmark.java similarity index 95% rename from extensions/src/main/java/org/jivesoftware/smackx/bookmark/SharedBookmark.java rename to extensions/src/main/java/org/jivesoftware/smackx/bookmarks/SharedBookmark.java index 0beddefee..45d77ba60 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/bookmark/SharedBookmark.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/SharedBookmark.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.jivesoftware.smackx.bookmark; +package org.jivesoftware.smackx.bookmarks; /** * Interface to indicate if a bookmark is shared across the server. diff --git a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/EntityCapsManager.java b/extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java similarity index 99% rename from extensions/src/main/java/org/jivesoftware/smackx/entitycaps/EntityCapsManager.java rename to extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java index c19f401ea..eeba8fe9a 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/EntityCapsManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.entitycaps; +package org.jivesoftware.smackx.caps; import org.jivesoftware.smack.Connection; import org.jivesoftware.smack.ConnectionCreationListener; @@ -34,14 +34,14 @@ import org.jivesoftware.smack.filter.PacketTypeFilter; import org.jivesoftware.smack.filter.PacketExtensionFilter; import org.jivesoftware.smack.util.Base64; import org.jivesoftware.smack.util.Cache; +import org.jivesoftware.smackx.caps.cache.EntityCapsPersistentCache; +import org.jivesoftware.smackx.caps.packet.CapsExtension; import org.jivesoftware.smackx.disco.NodeInformationProvider; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Feature; import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity; import org.jivesoftware.smackx.disco.packet.DiscoverItems.Item; -import org.jivesoftware.smackx.entitycaps.cache.EntityCapsPersistentCache; -import org.jivesoftware.smackx.entitycaps.packet.CapsExtension; import org.jivesoftware.smackx.xdata.Form; import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.packet.DataForm; diff --git a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/cache/EntityCapsPersistentCache.java b/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/EntityCapsPersistentCache.java similarity index 95% rename from extensions/src/main/java/org/jivesoftware/smackx/entitycaps/cache/EntityCapsPersistentCache.java rename to extensions/src/main/java/org/jivesoftware/smackx/caps/cache/EntityCapsPersistentCache.java index 801bab054..fe1285e04 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/cache/EntityCapsPersistentCache.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/EntityCapsPersistentCache.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.entitycaps.cache; +package org.jivesoftware.smackx.caps.cache; import java.io.IOException; diff --git a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/cache/SimpleDirectoryPersistentCache.java b/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java similarity index 98% rename from extensions/src/main/java/org/jivesoftware/smackx/entitycaps/cache/SimpleDirectoryPersistentCache.java rename to extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java index 90198b70c..592a984fd 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/cache/SimpleDirectoryPersistentCache.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.entitycaps.cache; +package org.jivesoftware.smackx.caps.cache; import java.io.DataInputStream; import java.io.DataOutputStream; @@ -31,9 +31,9 @@ import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.Base32Encoder; import org.jivesoftware.smack.util.StringEncoder; +import org.jivesoftware.smackx.caps.EntityCapsManager; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.provider.DiscoverInfoProvider; -import org.jivesoftware.smackx.entitycaps.EntityCapsManager; import org.xmlpull.mxp1.MXParser; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; diff --git a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/packet/CapsExtension.java b/extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java similarity index 94% rename from extensions/src/main/java/org/jivesoftware/smackx/entitycaps/packet/CapsExtension.java rename to extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java index 194e385c1..5dbdb5dc4 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/packet/CapsExtension.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.jivesoftware.smackx.entitycaps.packet; +package org.jivesoftware.smackx.caps.packet; import org.jivesoftware.smack.packet.PacketExtension; -import org.jivesoftware.smackx.entitycaps.EntityCapsManager; +import org.jivesoftware.smackx.caps.EntityCapsManager; public class CapsExtension implements PacketExtension { diff --git a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/provider/CapsExtensionProvider.java b/extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java similarity index 92% rename from extensions/src/main/java/org/jivesoftware/smackx/entitycaps/provider/CapsExtensionProvider.java rename to extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java index 38b295a04..9f27301ee 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/entitycaps/provider/CapsExtensionProvider.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java @@ -14,16 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.entitycaps.provider; +package org.jivesoftware.smackx.caps.provider; import java.io.IOException; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.PacketExtension; import org.jivesoftware.smack.provider.PacketExtensionProvider; -import org.jivesoftware.smackx.entitycaps.EntityCapsManager; -import org.jivesoftware.smackx.entitycaps.packet.CapsExtension; - +import org.jivesoftware.smackx.caps.EntityCapsManager; +import org.jivesoftware.smackx.caps.packet.CapsExtension; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; diff --git a/extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java index ae915f5ff..c23f1689c 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java @@ -25,10 +25,10 @@ import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.PacketExtension; import org.jivesoftware.smack.packet.XMPPError; +import org.jivesoftware.smackx.caps.EntityCapsManager; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverItems; import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity; -import org.jivesoftware.smackx.entitycaps.EntityCapsManager; import org.jivesoftware.smackx.xdata.packet.DataForm; import java.lang.ref.WeakReference; diff --git a/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers b/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers index 054dd5381..afa8a1414 100644 --- a/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers +++ b/extensions/src/main/resources/org.jivesoftware.smackx/extensions.providers @@ -432,7 +432,7 @@ c http://jabber.org/protocol/caps - org.jivesoftware.smackx.entitycaps.provider.CapsExtensionProvider + org.jivesoftware.smackx.caps.provider.CapsExtensionProvider diff --git a/extensions/src/test/java/org/jivesoftware/smackx/entitycaps/EntityCapsManagerTest.java b/extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java similarity index 97% rename from extensions/src/test/java/org/jivesoftware/smackx/entitycaps/EntityCapsManagerTest.java rename to extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java index 525d0f77c..2d7fb70d5 100644 --- a/extensions/src/test/java/org/jivesoftware/smackx/entitycaps/EntityCapsManagerTest.java +++ b/extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.entitycaps; +package org.jivesoftware.smackx.caps; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -29,9 +29,10 @@ import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.util.Base32Encoder; import org.jivesoftware.smack.util.Base64FileUrlEncoder; import org.jivesoftware.smack.util.StringEncoder; +import org.jivesoftware.smackx.caps.EntityCapsManager; +import org.jivesoftware.smackx.caps.cache.EntityCapsPersistentCache; +import org.jivesoftware.smackx.caps.cache.SimpleDirectoryPersistentCache; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; -import org.jivesoftware.smackx.entitycaps.cache.EntityCapsPersistentCache; -import org.jivesoftware.smackx.entitycaps.cache.SimpleDirectoryPersistentCache; import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.packet.DataForm; import org.junit.Ignore; diff --git a/extensions/src/test/java/org/jivesoftware/smackx/provider/DelayInformationTest.java b/extensions/src/test/java/org/jivesoftware/smackx/delay/provider/DelayInformationTest.java similarity index 99% rename from extensions/src/test/java/org/jivesoftware/smackx/provider/DelayInformationTest.java rename to extensions/src/test/java/org/jivesoftware/smackx/delay/provider/DelayInformationTest.java index 5cb016ca4..04d580bae 100644 --- a/extensions/src/test/java/org/jivesoftware/smackx/provider/DelayInformationTest.java +++ b/extensions/src/test/java/org/jivesoftware/smackx/delay/provider/DelayInformationTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.provider; +package org.jivesoftware.smackx.delay.provider; import static org.junit.Assert.*;