cerberus 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Authors.txt +4 -0
- data/Changelog.txt +11 -0
- data/Copyright.txt +16 -0
- data/Rakefile +16 -25
- data/Readme.markdown +1 -3
- data/bin/cerberus +5 -0
- data/lib/cerberus/builder/bjam.rb +1 -3
- data/lib/cerberus/builder/maven2.rb +0 -1
- data/lib/cerberus/builder/rake.rb +1 -1
- data/lib/cerberus/builder/rspec.rb +0 -1
- data/lib/cerberus/builder/ruby_base.rb +0 -1
- data/lib/cerberus/component_lazy_loader.rb +6 -2
- data/lib/cerberus/config.example.yml +1 -0
- data/lib/cerberus/constants.rb +2 -2
- data/lib/cerberus/manager.rb +7 -1
- data/lib/cerberus/publisher/mail.rb +4 -4
- data/lib/cerberus/publisher/twitter.rb +0 -1
- data/lib/cerberus/scm/base.rb +19 -0
- data/lib/cerberus/scm/bzr.rb +62 -0
- data/lib/cerberus/scm/cvs.rb +2 -7
- data/lib/cerberus/scm/darcs.rb +2 -11
- data/lib/cerberus/scm/git.rb +6 -14
- data/lib/cerberus/scm/perforce.rb +4 -4
- data/lib/cerberus/scm/svn.rb +2 -7
- data/lib/cerberus/utils.rb +5 -0
- data/lib/vendor/irc/README +23 -0
- data/lib/vendor/irc/lib/IRC.rb +164 -0
- data/lib/vendor/irc/lib/IRCChannel.rb +33 -0
- data/lib/vendor/irc/lib/IRCConnection.rb +134 -0
- data/lib/vendor/irc/lib/IRCEvent.rb +91 -0
- data/lib/vendor/irc/lib/IRCUser.rb +23 -0
- data/lib/vendor/irc/lib/IRCUtil.rb +49 -0
- data/lib/vendor/irc/lib/eventmap.yml +247 -0
- data/lib/vendor/twitter/CHANGES +129 -0
- data/lib/vendor/twitter/MIT-LICENSE +20 -0
- data/lib/vendor/twitter/README +37 -0
- data/lib/vendor/twitter/TODO +7 -0
- data/lib/vendor/twitter/lib/twitter.rb +34 -0
- data/lib/vendor/twitter/lib/twitter/client.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/account.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/auth.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/base.rb +93 -0
- data/lib/vendor/twitter/lib/twitter/client/blocks.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/favorites.rb +53 -0
- data/lib/vendor/twitter/lib/twitter/client/friendship.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/graph.rb +37 -0
- data/lib/vendor/twitter/lib/twitter/client/messaging.rb +79 -0
- data/lib/vendor/twitter/lib/twitter/client/profile.rb +29 -0
- data/lib/vendor/twitter/lib/twitter/client/search.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/status.rb +51 -0
- data/lib/vendor/twitter/lib/twitter/client/timeline.rb +72 -0
- data/lib/vendor/twitter/lib/twitter/client/user.rb +65 -0
- data/lib/vendor/twitter/lib/twitter/config.rb +77 -0
- data/lib/vendor/twitter/lib/twitter/console.rb +31 -0
- data/lib/vendor/twitter/lib/twitter/core.rb +137 -0
- data/lib/vendor/twitter/lib/twitter/ext.rb +2 -0
- data/lib/vendor/twitter/lib/twitter/ext/stdlib.rb +52 -0
- data/lib/vendor/twitter/lib/twitter/extras.rb +39 -0
- data/lib/vendor/twitter/lib/twitter/meta.rb +56 -0
- data/lib/vendor/twitter/lib/twitter/model.rb +360 -0
- data/lib/vendor/twitter/lib/twitter/version.rb +19 -0
- data/lib/vendor/twitter/spec/twitter/client/account_spec.rb +28 -0
- data/lib/vendor/twitter/spec/twitter/client/auth_spec.rb +34 -0
- data/lib/vendor/twitter/spec/twitter/client/base_spec.rb +242 -0
- data/lib/vendor/twitter/spec/twitter/client/blocks_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/favorites_spec.rb +183 -0
- data/lib/vendor/twitter/spec/twitter/client/friendship_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/graph_spec.rb +67 -0
- data/lib/vendor/twitter/spec/twitter/client/messaging_spec.rb +135 -0
- data/lib/vendor/twitter/spec/twitter/client/profile_spec.rb +91 -0
- data/lib/vendor/twitter/spec/twitter/client/search_spec.rb +68 -0
- data/lib/vendor/twitter/spec/twitter/client/status_spec.rb +119 -0
- data/lib/vendor/twitter/spec/twitter/client/timeline_spec.rb +79 -0
- data/lib/vendor/twitter/spec/twitter/client/user_spec.rb +203 -0
- data/lib/vendor/twitter/spec/twitter/client_spec.rb +2 -0
- data/lib/vendor/twitter/spec/twitter/config_spec.rb +86 -0
- data/lib/vendor/twitter/spec/twitter/console_spec.rb +15 -0
- data/lib/vendor/twitter/spec/twitter/core_spec.rb +127 -0
- data/lib/vendor/twitter/spec/twitter/ext/stdlib_spec.rb +59 -0
- data/lib/vendor/twitter/spec/twitter/extras_spec.rb +46 -0
- data/lib/vendor/twitter/spec/twitter/meta_spec.rb +90 -0
- data/lib/vendor/twitter/spec/twitter/model_spec.rb +508 -0
- data/lib/vendor/twitter/spec/twitter/version_spec.rb +19 -0
- data/lib/vendor/xmpp4r/CHANGELOG +83 -0
- data/lib/vendor/xmpp4r/COPYING +340 -0
- data/lib/vendor/xmpp4r/LICENSE +59 -0
- data/lib/vendor/xmpp4r/README.rdoc +110 -0
- data/lib/vendor/xmpp4r/README_ruby19.txt +43 -0
- data/lib/vendor/xmpp4r/Rakefile +262 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb +70 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/component.rb +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/register.rb +42 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r.rb +116 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/base64.rb +32 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/callbacks.rb +124 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/c.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/generator.rb +160 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb +87 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/client.rb +317 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/helper/responder.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/iq/command.rb +154 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/component.rb +103 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/connection.rb +219 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms/x/data.rb +297 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/debuglog.rb +42 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay/x/delay.rb +99 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/helper/responder.rb +165 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/errors.rb +281 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/base.rb +55 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/bot.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding/client.rb +285 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/idgenerator.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/iq.rb +221 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/jid.rb +167 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/message.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc.rb +14 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/item.rb +143 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/muc.rb +70 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/presence.rb +232 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub.rb +8 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/event.rb +49 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/item.rb +35 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/items.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/publish.rb +24 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/query.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rexmladdons.rb +151 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/helper/roster.rb +519 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/iq/roster.rb +215 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/x/roster.rb +138 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/client.rb +123 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/server.rb +74 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/sasl.rb +237 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/semaphore.rb +38 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/stream.rb +497 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/streamparser.rb +77 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/helper/helper.rb +58 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/tune.rb +113 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard.rb +6 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/responder.rb +72 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/iq/version.rb +105 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/x.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml/html.rb +115 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmpp4r.rb +18 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppelement.rb +168 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppstanza.rb +162 -0
- data/lib/vendor/xmpp4r/setup.rb +1586 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_ibb.rb +186 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_socks5bytestreams.rb +113 -0
- data/lib/vendor/xmpp4r/test/caps/tc_helper.rb +156 -0
- data/lib/vendor/xmpp4r/test/dataforms/tc_data.rb +81 -0
- data/lib/vendor/xmpp4r/test/delay/tc_xdelay.rb +51 -0
- data/lib/vendor/xmpp4r/test/discovery/tc_responder.rb +91 -0
- data/lib/vendor/xmpp4r/test/lib/assert_equal_xml.rb +14 -0
- data/lib/vendor/xmpp4r/test/lib/clienttester.rb +120 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_mucclient.rb +830 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_simplemucclient.rb +114 -0
- data/lib/vendor/xmpp4r/test/muc/tc_mucowner.rb +50 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_helper.rb +662 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_nodeconfig.rb +54 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_subscriptionconfig.rb +41 -0
- data/lib/vendor/xmpp4r/test/roster/tc_helper.rb +514 -0
- data/lib/vendor/xmpp4r/test/roster/tc_iqqueryroster.rb +173 -0
- data/lib/vendor/xmpp4r/test/roster/tc_xroster.rb +73 -0
- data/lib/vendor/xmpp4r/test/rpc/tc_helper.rb +96 -0
- data/lib/vendor/xmpp4r/test/tc_callbacks.rb +129 -0
- data/lib/vendor/xmpp4r/test/tc_class_names.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_client.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_errors.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_idgenerator.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_iq.rb +113 -0
- data/lib/vendor/xmpp4r/test/tc_iqquery.rb +31 -0
- data/lib/vendor/xmpp4r/test/tc_jid.rb +204 -0
- data/lib/vendor/xmpp4r/test/tc_message.rb +116 -0
- data/lib/vendor/xmpp4r/test/tc_presence.rb +150 -0
- data/lib/vendor/xmpp4r/test/tc_rexml.rb +139 -0
- data/lib/vendor/xmpp4r/test/tc_stream.rb +229 -0
- data/lib/vendor/xmpp4r/test/tc_streamComponent.rb +95 -0
- data/lib/vendor/xmpp4r/test/tc_streamError.rb +131 -0
- data/lib/vendor/xmpp4r/test/tc_streamSend.rb +59 -0
- data/lib/vendor/xmpp4r/test/tc_streamparser.rb +112 -0
- data/lib/vendor/xmpp4r/test/tc_xmppstanza.rb +135 -0
- data/lib/vendor/xmpp4r/test/ts_xmpp4r.rb +53 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_recv.rb +84 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_send.rb +74 -0
- data/lib/vendor/xmpp4r/test/tune/tc_tune.rb +79 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_helper.rb +49 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb +62 -0
- data/lib/vendor/xmpp4r/test/version/tc_helper.rb +60 -0
- data/lib/vendor/xmpp4r/test/version/tc_iqqueryversion.rb +97 -0
- data/lib/vendor/xmpp4r/test/xhtml/tc_html.rb +41 -0
- data/lib/vendor/xmpp4r/tools/gen_requires.bash +31 -0
- data/lib/vendor/xmpp4r/tools/xmpp4r-gemspec-test.rb +11 -0
- data/lib/vendor/xmpp4r/xmpp4r.gemspec +291 -0
- data/test/jabber_publisher_test.rb +1 -1
- data/test/mail_publisher_test.rb +2 -2
- data/test/mock/twitter.rb +0 -1
- data/test/rspec_builder_test.rb +39 -2
- data/test/rss_publisher_test.rb +1 -1
- data/test/twitter_publisher_test.rb +1 -1
- metadata +268 -53
- data/lib/cerberus/publisher/gmailer.rb +0 -17
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift '../lib'
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'xmpp4r/rexmladdons'
|
7
|
+
require 'xmpp4r/query'
|
8
|
+
include Jabber
|
9
|
+
|
10
|
+
class IqQueryTest < Test::Unit::TestCase
|
11
|
+
def test_create
|
12
|
+
x = IqQuery.new()
|
13
|
+
assert_equal("query", x.name)
|
14
|
+
assert_equal("<query/>", x.to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_import
|
18
|
+
q = IqQuery.new
|
19
|
+
assert_equal(IqQuery, q.class)
|
20
|
+
|
21
|
+
e = REXML::Element.new('query')
|
22
|
+
e.add_namespace('jabber:iq:roster')
|
23
|
+
# kind_of? only checks that the class belongs to the IqQuery class
|
24
|
+
# hierarchy. See IqQueryRosterTest#test_import for a more strict
|
25
|
+
# check.
|
26
|
+
assert_kind_of(IqQuery, IqQuery.import(e))
|
27
|
+
|
28
|
+
# Importing specific derivates is to be tested in the test case of the derivate
|
29
|
+
# (e.g. tc_iqqueryroster.rb)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,204 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift '../lib'
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'xmpp4r/jid'
|
7
|
+
require 'xmpp4r/xmppelement'
|
8
|
+
require 'xmpp4r/errors'
|
9
|
+
include Jabber
|
10
|
+
|
11
|
+
class JIDTest < Test::Unit::TestCase
|
12
|
+
def test_create1
|
13
|
+
j = JID.new('a', 'b', 'c')
|
14
|
+
assert_equal('a', j.node)
|
15
|
+
assert_equal('b', j.domain)
|
16
|
+
assert_equal('c', j.resource)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_create2
|
20
|
+
j = JID.new('a', 'b', 'c')
|
21
|
+
j2 = JID.new(j)
|
22
|
+
assert_equal('a', j2.node)
|
23
|
+
assert_equal('b', j2.domain)
|
24
|
+
assert_equal('c', j2.resource)
|
25
|
+
assert_equal('a@b/c', j.to_s)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_create3
|
29
|
+
j = JID.new('a@b/c')
|
30
|
+
assert_equal('a', j.node)
|
31
|
+
assert_equal('b', j.domain)
|
32
|
+
assert_equal('c', j.resource)
|
33
|
+
assert_equal('a@b/c', j.to_s)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_create4
|
37
|
+
j = JID.new('a@b')
|
38
|
+
assert_equal('a', j.node)
|
39
|
+
assert_equal('b', j.domain)
|
40
|
+
assert_equal(nil, j.resource)
|
41
|
+
assert_equal('a@b', j.to_s)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_create5
|
45
|
+
j = JID.new
|
46
|
+
assert_equal(nil, j.node)
|
47
|
+
assert_equal(nil, j.domain)
|
48
|
+
assert_equal(nil, j.resource)
|
49
|
+
assert_equal('', j.to_s)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_create6
|
53
|
+
j = JID.new('dom')
|
54
|
+
assert_equal(nil, j.node)
|
55
|
+
assert_equal('dom', j.domain)
|
56
|
+
assert_equal(nil, j.resource)
|
57
|
+
assert_equal('dom', j.to_s)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_create7
|
61
|
+
j = JID.new('dom/res')
|
62
|
+
assert_equal(nil, j.node)
|
63
|
+
assert_equal('dom', j.domain)
|
64
|
+
assert_equal('res', j.resource)
|
65
|
+
assert_equal('dom/res', j.to_s)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_create8
|
69
|
+
j = JID.new('dom/a@b')
|
70
|
+
assert_equal(nil, j.node)
|
71
|
+
assert_equal('dom', j.domain)
|
72
|
+
assert_equal('a@b', j.resource)
|
73
|
+
assert_equal('dom/a@b', j.to_s)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_create9
|
77
|
+
assert_nothing_raised { JID.new("#{'n'*1023}@#{'d'*1023}/#{'r'*1023}") }
|
78
|
+
assert_raises(Jabber::ArgumentError) { JID.new("#{'n'*1024}@#{'d'*1023}/#{'r'*1023}") }
|
79
|
+
assert_raises(Jabber::ArgumentError) { JID.new("#{'n'*1023}@#{'d'*1024}/#{'r'*1023}") }
|
80
|
+
assert_raises(Jabber::ArgumentError) { JID.new("#{'n'*1023}@#{'d'*1023}/#{'r'*1024}") }
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_create10
|
84
|
+
j = JID.new('@b/c')
|
85
|
+
assert_equal('', j.node)
|
86
|
+
assert_equal('b', j.domain)
|
87
|
+
assert_equal('c', j.resource)
|
88
|
+
assert_equal('@b/c', j.to_s)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_create11
|
92
|
+
j = JID.new('@b')
|
93
|
+
assert_equal('', j.node)
|
94
|
+
assert_equal('b', j.domain)
|
95
|
+
assert_equal(nil, j.resource)
|
96
|
+
assert_equal('@b', j.to_s)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_create12
|
100
|
+
j = JID.new('@b/')
|
101
|
+
assert_equal('', j.node)
|
102
|
+
assert_equal('b', j.domain)
|
103
|
+
assert_equal('', j.resource)
|
104
|
+
assert_equal('@b/', j.to_s)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_create13
|
108
|
+
j = JID.new('a@b/')
|
109
|
+
assert_equal('a', j.node)
|
110
|
+
assert_equal('b', j.domain)
|
111
|
+
assert_equal('', j.resource)
|
112
|
+
assert_equal('a@b/', j.to_s)
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_create14
|
116
|
+
j = JID.new('nOdE@dOmAiN/rEsOuRcE')
|
117
|
+
assert_equal('node', j.node)
|
118
|
+
assert_equal('domain', j.domain)
|
119
|
+
assert_equal('rEsOuRcE', j.resource)
|
120
|
+
assert_equal('node@domain/rEsOuRcE', j.to_s)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_tos
|
124
|
+
assert_equal('', JID.new.to_s)
|
125
|
+
assert_equal('domain.fr', JID.new('domain.fr').to_s)
|
126
|
+
assert_equal('l@domain.fr', JID.new('l','domain.fr').to_s)
|
127
|
+
assert_equal('l@domain.fr/res', JID.new('l','domain.fr','res').to_s)
|
128
|
+
assert_equal('domain.fr/res', JID.new(nil,'domain.fr','res').to_s)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_equal
|
132
|
+
assert_equal(JID.new('domain.fr'), JID.new('domain.fr'))
|
133
|
+
assert_equal(JID.new('domain.fr'), JID.new(nil, 'domain.fr'))
|
134
|
+
assert_equal(JID.new('l@domain.fr'), JID.new('l@domain.fr'))
|
135
|
+
assert_equal(JID.new('l@domain.fr'), JID.new('l', 'domain.fr'))
|
136
|
+
assert_equal(JID.new('l@domain.fr/res'), JID.new('l@domain.fr/res'))
|
137
|
+
assert_equal(JID.new('l@domain.fr/res'), JID.new('l', 'domain.fr', 'res'))
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_hash
|
141
|
+
h = {}
|
142
|
+
j = JID.new('l@domain.fr/res')
|
143
|
+
h[j] = 'a'
|
144
|
+
assert_equal(h[j], h[JID.new('l@domain.fr/res')])
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_strip
|
148
|
+
assert_equal(JID.new('l@domain.fr'), JID.new('l@domain.fr/res').strip)
|
149
|
+
assert_equal(JID.new('l@domain.fr'), JID.new('l@domain.fr').strip)
|
150
|
+
assert_equal(JID.new('l@domain.fr'), JID.new('l@domain.fr/res').bare)
|
151
|
+
jid = JID.new('l@domain.fr/res')
|
152
|
+
jid.strip!
|
153
|
+
assert_equal(JID.new('l@domain.fr'), jid)
|
154
|
+
|
155
|
+
jid = JID.new('l@domain.fr/res')
|
156
|
+
jid.bare!
|
157
|
+
assert_equal(JID.new('l@domain.fr'), jid)
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_change1
|
161
|
+
j = JID.new('a@b/c')
|
162
|
+
j.node = 'd'
|
163
|
+
assert_equal('d@b/c', j.to_s)
|
164
|
+
j.domain = 'e'
|
165
|
+
assert_equal('d@e/c', j.to_s)
|
166
|
+
j.resource = 'f'
|
167
|
+
assert_equal('d@e/f', j.to_s)
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_escaping
|
171
|
+
j = JID.new('user1@server1')
|
172
|
+
j2 = JID.new(JID::escape(j), 'server2', 'res2')
|
173
|
+
assert_equal('user1%server1@server2/res2', j2.to_s)
|
174
|
+
end
|
175
|
+
|
176
|
+
if defined?(libidnbug) # this crashes the interpreter
|
177
|
+
def test_invalidnode
|
178
|
+
# assert_raises(IDN::Stringprep::StringprepError) { JID.new('toto@a/a', 'server', 'res') }
|
179
|
+
assert_raises(IDN::Stringprep::StringprepError) { IDN::Stringprep.nodeprep('toto@a/a') }
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_empty
|
184
|
+
assert(JID.new.empty?)
|
185
|
+
assert(!JID.new("test").empty?)
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_stripped
|
189
|
+
assert(JID.new("node@domain").stripped?)
|
190
|
+
assert(!JID.new("node@domain/res").stripped?)
|
191
|
+
assert(JID.new("node@domain").bared?)
|
192
|
+
assert(!JID.new("node@domain/res").bared?)
|
193
|
+
end
|
194
|
+
|
195
|
+
def test_sort
|
196
|
+
assert_equal(-1, JID.new('a@b') <=> JID.new('b@b'))
|
197
|
+
assert_equal(0, JID.new('a@b') <=> JID.new('a@b'))
|
198
|
+
assert_equal(1, JID.new('a@b/r') <=> JID.new('a@b'))
|
199
|
+
|
200
|
+
jids = [JID.new('b@b'), JID.new('a@b/r'), JID.new('a@b')]
|
201
|
+
jids.sort!
|
202
|
+
assert_equal([JID.new('a@b'), JID.new('a@b/r'), JID.new('b@b')], jids)
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift '../lib'
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'socket'
|
7
|
+
require 'xmpp4r/rexmladdons'
|
8
|
+
require 'xmpp4r/message'
|
9
|
+
require 'xmpp4r/errors'
|
10
|
+
include Jabber
|
11
|
+
|
12
|
+
class MessageTest < Test::Unit::TestCase
|
13
|
+
def test_create
|
14
|
+
x = Message.new()
|
15
|
+
assert_equal("message", x.name)
|
16
|
+
assert_equal("jabber:client", x.namespace)
|
17
|
+
assert_equal(nil, x.to)
|
18
|
+
assert_equal(nil, x.body)
|
19
|
+
|
20
|
+
x = Message.new("lucas@linux.ensimag.fr", "coucou")
|
21
|
+
assert_equal("message", x.name)
|
22
|
+
assert_equal("lucas@linux.ensimag.fr", x.to.to_s)
|
23
|
+
assert_equal("coucou", x.body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_import
|
27
|
+
x = Message.new
|
28
|
+
assert_kind_of(REXML::Element, x.typed_add(REXML::Element.new('thread')))
|
29
|
+
assert_kind_of(X, x.typed_add(REXML::Element.new('x')))
|
30
|
+
assert_kind_of(X, x.x)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_type
|
34
|
+
x = Message.new
|
35
|
+
assert_equal(nil, x.type)
|
36
|
+
x.type = :chat
|
37
|
+
assert_equal(:chat, x.type)
|
38
|
+
assert_equal(x, x.set_type(:error))
|
39
|
+
assert_equal(:error, x.type)
|
40
|
+
x.type = :groupchat
|
41
|
+
assert_equal(:groupchat, x.type)
|
42
|
+
x.type = :headline
|
43
|
+
assert_equal(:headline, x.type)
|
44
|
+
x.type = :normal
|
45
|
+
assert_equal(:normal, x.type)
|
46
|
+
x.type = :invalid
|
47
|
+
assert_equal(nil, x.type)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_body
|
51
|
+
x = Message.new()
|
52
|
+
assert_equal(nil, x.body)
|
53
|
+
assert_equal(x, x.set_body("trezrze ezfrezr ezr zer ezr ezrezrez ezr z"))
|
54
|
+
assert_equal("trezrze ezfrezr ezr zer ezr ezrezrez ezr z", x.body)
|
55
|
+
x.body = "2"
|
56
|
+
assert_equal("2", x.body)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_subject
|
60
|
+
x = Message.new
|
61
|
+
assert_equal(nil, x.subject)
|
62
|
+
subject = REXML::Element.new('subject')
|
63
|
+
subject.text = 'A'
|
64
|
+
x.add(subject)
|
65
|
+
assert_equal('A', x.subject)
|
66
|
+
x.subject = 'Test message'
|
67
|
+
assert_equal('Test message', x.subject)
|
68
|
+
x.each_element('subject') { |s| assert_equal('Test message', s.text) }
|
69
|
+
assert_equal(x, x.set_subject('Breaking news'))
|
70
|
+
assert_equal('Breaking news', x.subject)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_thread
|
74
|
+
x = Message.new
|
75
|
+
assert_equal(nil, x.thread)
|
76
|
+
thread = REXML::Element.new('thread')
|
77
|
+
thread.text = '123'
|
78
|
+
x.add(thread)
|
79
|
+
assert_equal('123', x.thread)
|
80
|
+
x.thread = '321'
|
81
|
+
assert_equal('321', x.thread)
|
82
|
+
x.each_element('thread') { |s| assert_equal('321', s.text) }
|
83
|
+
assert_equal(x, x.set_thread('abc'))
|
84
|
+
assert_equal('abc', x.thread)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_error
|
88
|
+
x = Message.new()
|
89
|
+
assert_equal(nil, x.error)
|
90
|
+
e = REXML::Element.new('error')
|
91
|
+
x.add(e)
|
92
|
+
# test if, after an import, the error element is successfully changed
|
93
|
+
# into an ErrorResponse object.
|
94
|
+
x2 = Message.new.import(x)
|
95
|
+
assert_equal(ErrorResponse, x2.first_element('error').class)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_answer
|
99
|
+
orig = Message.new
|
100
|
+
orig.from = 'a@b'
|
101
|
+
orig.to = 'b@a'
|
102
|
+
orig.id = '123'
|
103
|
+
orig.type = :chat
|
104
|
+
orig.add(REXML::Element.new('x'))
|
105
|
+
|
106
|
+
answer = orig.answer
|
107
|
+
assert_equal(JID.new('b@a'), answer.from)
|
108
|
+
assert_equal(JID.new('a@b'), answer.to)
|
109
|
+
assert_equal('123', answer.id)
|
110
|
+
assert_equal(:chat, answer.type)
|
111
|
+
answer.each_element { |e|
|
112
|
+
assert_equal('x', e.name)
|
113
|
+
assert_kind_of(X, e)
|
114
|
+
}
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift '../lib'
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'socket'
|
7
|
+
require 'xmpp4r/rexmladdons'
|
8
|
+
require 'xmpp4r/presence'
|
9
|
+
require 'xmpp4r/errors'
|
10
|
+
include Jabber
|
11
|
+
|
12
|
+
class PresenceTest < Test::Unit::TestCase
|
13
|
+
def test_create
|
14
|
+
x = Presence.new()
|
15
|
+
assert_equal("presence", x.name)
|
16
|
+
assert_equal("jabber:client", x.namespace)
|
17
|
+
assert_equal(nil, x.to)
|
18
|
+
assert_equal(nil, x.show)
|
19
|
+
assert_equal(nil, x.status)
|
20
|
+
assert_equal(nil, x.priority)
|
21
|
+
|
22
|
+
x = Presence.new(:away, "I am away", 23)
|
23
|
+
assert_equal("presence", x.name)
|
24
|
+
assert_equal(:away, x.show)
|
25
|
+
assert_equal("away", x.show.to_s)
|
26
|
+
assert_equal("I am away", x.status)
|
27
|
+
assert_equal(23, x.priority)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_show
|
31
|
+
x = Presence.new()
|
32
|
+
assert_equal(nil, x.show)
|
33
|
+
assert_raise(RuntimeError) { x.show = "a" }
|
34
|
+
assert_equal(nil, x.show)
|
35
|
+
assert_raise(RuntimeError) { x.show = 'away' }
|
36
|
+
assert_equal(nil, x.show)
|
37
|
+
x.show = :away
|
38
|
+
assert_equal(:away, x.show)
|
39
|
+
x.each_element('show') { |e| assert(e.class == REXML::Element, "<show/> is not REXML::Element") }
|
40
|
+
x.show = nil
|
41
|
+
assert_equal(nil, x.show)
|
42
|
+
x.each_element('show') { |e| assert(true, "<show/> exists after 'show=nil'") }
|
43
|
+
x.show = nil
|
44
|
+
assert_equal(nil, x.show)
|
45
|
+
|
46
|
+
showelement = REXML::Element.new('show')
|
47
|
+
showelement.text = 'chat'
|
48
|
+
x.add(showelement)
|
49
|
+
assert_equal(:chat, x.show)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_status
|
53
|
+
x = Presence.new()
|
54
|
+
assert_equal(nil, x.status)
|
55
|
+
x.status = "b"
|
56
|
+
assert_equal("b", x.status)
|
57
|
+
x.each_element('status') { |e| assert(e.class == REXML::Element, "<status/> is not REXML::Element") }
|
58
|
+
x.status = nil
|
59
|
+
assert_equal(nil, x.status)
|
60
|
+
x.each_element('status') { |e| assert(true, "<status/> exists after 'status=nil'") }
|
61
|
+
x.status = nil
|
62
|
+
assert_equal(nil, x.status)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_priority
|
66
|
+
x = Presence.new()
|
67
|
+
assert_equal(nil, x.priority)
|
68
|
+
x.priority = 5
|
69
|
+
assert_equal(5, x.priority)
|
70
|
+
x.each_element('priority') { |e| assert(e.class == REXML::Element, "<priority/> is not REXML::Element") }
|
71
|
+
x.priority = "5"
|
72
|
+
assert_equal(5, x.priority)
|
73
|
+
x.priority = nil
|
74
|
+
assert_equal(nil, x.priority)
|
75
|
+
x.each_element('priority') { |e| assert(true, "<priority/> exists after 'priority=nil'") }
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_type
|
79
|
+
x = Presence.new()
|
80
|
+
assert_equal(nil, x.type)
|
81
|
+
x.type = :delete
|
82
|
+
assert_equal(nil, x.type)
|
83
|
+
x.type = nil
|
84
|
+
assert_equal(nil, x.type)
|
85
|
+
x.type = nil
|
86
|
+
assert_equal(nil, x.type)
|
87
|
+
[:error, :probe, :subscribe, :subscribed, :unavailable, :unsubscribe, :unsubscribed, nil].each { |type|
|
88
|
+
x.type = type
|
89
|
+
assert_equal(type, x.type)
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_chaining
|
94
|
+
x = Presence.new()
|
95
|
+
x.set_show(:xa).set_status("Plundering the fridge.").set_priority(0)
|
96
|
+
assert_equal(:xa, x.show)
|
97
|
+
assert_equal("Plundering the fridge.", x.status)
|
98
|
+
assert_equal(0, x.priority)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_error
|
102
|
+
x = Presence.new()
|
103
|
+
e = REXML::Element.new('error')
|
104
|
+
x.add(e)
|
105
|
+
x2 = Presence.new.import(x)
|
106
|
+
# test if, after an import, the error element is successfully changed
|
107
|
+
# into an ErrorResponse object.
|
108
|
+
assert_equal(ErrorResponse, x2.first_element('error').class)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_sample
|
112
|
+
x = Presence.new
|
113
|
+
require 'rexml/document'
|
114
|
+
d = REXML::Document.new("<presence from='astro@spaceboyz.net/versionbot' to='astro@spaceboyz.net/edgarr' xmlns='jabber:client'>\n <x from='astro@spaceboyz.net/versionbot' stamp='20050823T02:18:42' xmlns='jabber:x:delay'/><show>xa</show>\n <status>I am the evil fingerprinting robot</status>\n </presence>")
|
115
|
+
x.import(d.root)
|
116
|
+
num = 0
|
117
|
+
x.each_element('show') { num += 1 }
|
118
|
+
assert_equal(1, num)
|
119
|
+
assert_equal(:xa, x.show)
|
120
|
+
assert_equal('I am the evil fingerprinting robot', x.status)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_xpathbug
|
124
|
+
require 'rexml/document'
|
125
|
+
d = REXML::Document.new("<tag1 xmlns='ns1'><tag2 xmlns='ns2'/><tada>xa</tada></tag1>")
|
126
|
+
x = d.root
|
127
|
+
num = 0
|
128
|
+
x.each_element('tada') { num += 1 }
|
129
|
+
assert_equal(1, num)
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_compare_prio
|
133
|
+
assert_equal(0, Presence.new(:chat, '', 5) <=> Presence.new(:chat, '', 5))
|
134
|
+
assert_equal(-1, Presence.new(:chat, '', 4) <=> Presence.new(:chat, '', 5))
|
135
|
+
assert_equal(1, Presence.new(:chat, '', 4) <=> Presence.new(:chat, '', 3))
|
136
|
+
assert_equal(-1, Presence.new(:chat, '', nil) <=> Presence.new(:chat, '', 3))
|
137
|
+
assert_equal(1, Presence.new(:chat, '', 10) <=> Presence.new(:chat, '', nil))
|
138
|
+
assert_equal(0, Presence.new(:chat, '', nil) <=> Presence.new(:chat, '', nil))
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_compare_interest
|
142
|
+
unav = Presence.new.set_type(:unavailable)
|
143
|
+
assert_equal(0, unav.cmp_interest(unav))
|
144
|
+
assert_equal(1, unav.cmp_interest(Presence.new))
|
145
|
+
assert_equal(-1, Presence.new.cmp_interest(unav))
|
146
|
+
assert_equal(1, Presence.new(:chat).cmp_interest(Presence.new))
|
147
|
+
assert_equal(-1, Presence.new(:away).cmp_interest(Presence.new(:dnd)))
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|