Updated Branches: refs/heads/master 2d8055e1f -> 9799e6b5a
Removed libraries that caused license problems and weren't really being used Signed-off-by: williamstw <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/9799e6b5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/9799e6b5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/9799e6b5 Branch: refs/heads/master Commit: 9799e6b5a22e618196e458556b91444a96da0ac4 Parents: 2d8055e Author: Chris Rohr <[email protected]> Authored: Tue Aug 27 22:27:33 2013 -0400 Committer: williamstw <[email protected]> Committed: Tue Aug 27 23:07:52 2013 -0400 ---------------------------------------------------------------------- contrib/blur-console/blur-admin/Gemfile.lock | 48 -------- .../app/assets/javascripts/hdfs_metrics.js | 67 ++++++----- .../assets/javascripts/jquery.rangeslider.js | 91 -------------- .../smack/smack/3.2.2/smack-3.2.2.jar | Bin 309784 -> 0 bytes .../smack/smack/3.2.2/smack-3.2.2.pom | 50 -------- .../smack/smackx/3.2.2/smackx-3.2.2.jar | Bin 666724 -> 0 bytes contrib/blur-console/blur-agent/pom.xml | 10 -- .../blur/agent/notifications/Messenger.java | 99 ---------------- .../blur/agent/notifications/Notifier.java | 3 - .../blur/agent/notifications/MessengerTest.java | 118 ------------------- 10 files changed, 33 insertions(+), 453 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-admin/Gemfile.lock ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-admin/Gemfile.lock b/contrib/blur-console/blur-admin/Gemfile.lock index 36e4071..53b4810 100644 --- a/contrib/blur-console/blur-admin/Gemfile.lock +++ b/contrib/blur-console/blur-admin/Gemfile.lock @@ -1,20 +1,3 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - PATH remote: vendor/gems/cancan specs: @@ -69,24 +52,7 @@ GEM json childprocess (0.3.1) ffi (~> 1.0.6) - ci_reporter (1.7.0) - builder (>= 2.1.2) - coffee-rails (3.2.2) - coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.2.0) - columnize (0.3.6) daemons (1.1.9) - debugger (1.2.0) - columnize (>= 0.3.1) - debugger-linecache (~> 1.1.1) - debugger-ruby_core_source (~> 1.1.3) - debugger-linecache (1.1.2) - debugger-ruby_core_source (>= 1.1.1) - debugger-ruby_core_source (1.1.3) diff-lcs (1.1.3) ejs (1.0.0) erubis (2.7.0) @@ -140,10 +106,6 @@ GEM activesupport (= 3.2.2) bundler (~> 1.0) railties (= 3.2.2) - rails-erd (0.4.5) - activerecord (~> 3.0) - activesupport (~> 3.0) - ruby-graphviz (~> 0.9.18) railties (3.2.2) actionpack (= 3.2.2) activesupport (= 3.2.2) @@ -167,7 +129,6 @@ GEM activesupport (>= 3.0) railties (>= 3.0) rspec (~> 2.8.0) - ruby-graphviz (0.9.21) rubyzip (0.9.6.1) sass (3.1.15) sass-rails (3.2.4) @@ -179,10 +140,6 @@ GEM ffi (~> 1.0) multi_json (~> 1.0) rubyzip - simplecov (0.6.4) - multi_json (~> 1.0) - simplecov-html (~> 0.5.3) - simplecov-html (0.5.3) sprockets (2.1.2) hike (~> 1.2) rack (~> 1.0) @@ -218,9 +175,6 @@ DEPENDENCIES cancan (= 2.0.0.alpha)! capybara capybara-webkit - ci_reporter - coffee-rails (~> 3.2.1) - debugger ejs factory_girl_rails haml-rails @@ -229,10 +183,8 @@ DEPENDENCIES launchy mysql2 rails (= 3.2.2) - rails-erd rspec-rails sass-rails (~> 3.2.3) - simplecov thin thrift_client twitter_bootstrap_form_for http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-admin/app/assets/javascripts/hdfs_metrics.js ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-admin/app/assets/javascripts/hdfs_metrics.js b/contrib/blur-console/blur-admin/app/assets/javascripts/hdfs_metrics.js index 3b8b1ec..c5f0bc3 100644 --- a/contrib/blur-console/blur-admin/app/assets/javascripts/hdfs_metrics.js +++ b/contrib/blur-console/blur-admin/app/assets/javascripts/hdfs_metrics.js @@ -20,7 +20,6 @@ //= require flot/jquery.flot.selection.min //= require flot/jquery.flot.crosshair.min //= require jquery.timepicker -//= require jquery.rangeslider.js //= require underscore //= require_self @@ -240,7 +239,7 @@ $(document).ready(function(){ var sync_slider = function(hdfs_id){ // the range values are stored as slider offsets simply set the slider to those values var range_values = [hdfs_data[hdfs_id].min, hdfs_data[hdfs_id].max] - $('.graph_instance#' + hdfs_id + ' .slider').dragslider('option', 'values', range_values); + //$('.graph_instance#' + hdfs_id + ' .slider').dragslider('option', 'values', range_values); }; /* @@ -347,38 +346,38 @@ $(document).ready(function(){ /* * Creates the date slider */ - $(".slider").dragslider({ - range: true, - // allows for dragging of the range - rangeDrag: true, - // Max range - min: -1 * 60 * 24 * num_days_back, - // Min range (now) - max: 0, - // Starting selected range is the default - values: [-1 * default_range, 0], - // A new value has been picked - stop: function(event, ui) { - // grab the current hdfs_id - var hdfs_id = $(this).closest('.graph_instance').attr('id'); - // set the values for the hdfs - hdfs_data[hdfs_id].min = ui.values[0]; - hdfs_data[hdfs_id].max = ui.values[1]; - // set the updating to false because a range was selected - hdfs_data[hdfs_id].updating = false; - // Sync the date fields with the range selected - sync_date_fields(hdfs_id); - // update the graph for this hdfs - update_live_graphs(hdfs_id); - }, - // Update the date values while sliding (feedback for user) - slide: function(event, ui){ - // grab the current hdfs_id - var hdfs_id = $(this).closest('.graph_instance').attr('id'); - // Sync the date fields with the range selected - sync_date_fields(hdfs_id, ui.values[0], ui.values[1]); - } - }); + // $(".slider").dragslider({ + // range: true, + // // allows for dragging of the range + // rangeDrag: true, + // // Max range + // min: -1 * 60 * 24 * num_days_back, + // // Min range (now) + // max: 0, + // // Starting selected range is the default + // values: [-1 * default_range, 0], + // // A new value has been picked + // stop: function(event, ui) { + // // grab the current hdfs_id + // var hdfs_id = $(this).closest('.graph_instance').attr('id'); + // // set the values for the hdfs + // hdfs_data[hdfs_id].min = ui.values[0]; + // hdfs_data[hdfs_id].max = ui.values[1]; + // // set the updating to false because a range was selected + // hdfs_data[hdfs_id].updating = false; + // // Sync the date fields with the range selected + // sync_date_fields(hdfs_id); + // // update the graph for this hdfs + // update_live_graphs(hdfs_id); + // }, + // // Update the date values while sliding (feedback for user) + // slide: function(event, ui){ + // // grab the current hdfs_id + // var hdfs_id = $(this).closest('.graph_instance').attr('id'); + // // Sync the date fields with the range selected + // sync_date_fields(hdfs_id, ui.values[0], ui.values[1]); + // } + // }); $(".min-date").datetimepicker({ minDate: -1 * num_days_back, http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-admin/vendor/assets/javascripts/jquery.rangeslider.js ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-admin/vendor/assets/javascripts/jquery.rangeslider.js b/contrib/blur-console/blur-admin/vendor/assets/javascripts/jquery.rangeslider.js deleted file mode 100644 index 0019e30..0000000 --- a/contrib/blur-console/blur-admin/vendor/assets/javascripts/jquery.rangeslider.js +++ /dev/null @@ -1,91 +0,0 @@ -//Jquery Range Slider -(function( $, undefined ) { - -$.widget("ui.dragslider", $.ui.slider, { - - options: $.extend({},$.ui.slider.prototype.options,{rangeDrag:false}), - - _create: function() { - $.ui.slider.prototype._create.apply(this,arguments); - this._rangeCapture = false; - }, - - _mouseCapture: function( event ) { - var o = this.options; - - if ( o.disabled ) return false; - - if(event.target == this.range.get(0) && o.rangeDrag == true && o.range == true) { - this._rangeCapture = true; - this._rangeStart = null; - } - else { - this._rangeCapture = false; - } - - $.ui.slider.prototype._mouseCapture.apply(this,arguments); - - if(this._rangeCapture == true) { - this.handles.removeClass("ui-state-active").blur(); - } - - return true; - }, - - _mouseStop: function( event ) { - this._rangeStart = null; - return $.ui.slider.prototype._mouseStop.apply(this,arguments); - }, - - _slide: function( event, index, newVal ) { - if(!this._rangeCapture) { - return $.ui.slider.prototype._slide.apply(this,arguments); - } - - if(this._rangeStart == null) { - this._rangeStart = newVal; - } - - var oldValLeft = this.options.values[0], - oldValRight = this.options.values[1], - slideDist = newVal - this._rangeStart, - newValueLeft = oldValLeft + slideDist, - newValueRight = oldValRight + slideDist, - allowed; - - if ( this.options.values && this.options.values.length ) { - if(newValueRight > this._valueMax() && slideDist > 0) { - slideDist -= (newValueRight-this._valueMax()); - newValueLeft = oldValLeft + slideDist; - newValueRight = oldValRight + slideDist; - } - - if(newValueLeft < this._valueMin()) { - slideDist += (this._valueMin()-newValueLeft); - newValueLeft = oldValLeft + slideDist; - newValueRight = oldValRight + slideDist; - } - - if ( slideDist != 0 ) { - newValues = this.values(); - newValues[ 0 ] = newValueLeft; - newValues[ 1 ] = newValueRight; - - // A slide can be canceled by returning false from the slide callback - allowed = this._trigger( "slide", event, { - handle: this.handles[ index ], - value: slideDist, - values: newValues - } ); - - if ( allowed !== false ) { - this.values( 0, newValueLeft, true ); - this.values( 1, newValueRight, true ); - } - this._rangeStart = newVal; - } - } - } - }); - -})(jQuery); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.jar ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.jar b/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.jar deleted file mode 100644 index f9cb4da..0000000 Binary files a/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.jar and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.pom ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.pom b/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.pom deleted file mode 100644 index e26d843..0000000 --- a/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smack/3.2.2/smack-3.2.2.pom +++ /dev/null @@ -1,50 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.igniterealtime.smack</groupId> - <artifactId>smack</artifactId> - <packaging>jar</packaging> - <name>smack</name> - <version>3.2.2</version> - <description>Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. This library provides the client side functionality as specified in the core XMPP specifications as related to the client side of said specifications.</description> - <parent> - <groupId>org.sonatype.oss</groupId> - <artifactId>oss-parent</artifactId> - <version>5</version> - </parent> - <organization> - <name>Ignite Realtime</name> - <url>http://www.igniterealtime.org</url> - </organization> - <url>http://www.igniterealtime.org/projects/smack/</url> - <developers> - <developer> - <name>Robin Collier</name> - <timezone>-5</timezone> - <roles> - <role>Project Lead</role> - </roles> - </developer> - </developers> - <licenses> - <license> - <name>The Apache Software License, Version 2.0</name> - <url>http://www.apache.org/licenses/LICENSE-2.0</url> - <distribution>repo</distribution> - </license> - </licenses> - <issueManagement> - <system>jira</system> - <url>http://www.igniterealtime.org/issues/browse/SMACK</url> - </issueManagement> - <scm> - <connection>scm:svn:http://svn.igniterealtime.org/svn/repos/smack</connection> - <developerConnection>scm:svn:https://svn.igniterealtime.org/svn/repos/smack</developerConnection> - <url>http://svn.igniterealtime.org/svn/repos/smack</url> - </scm> - - <modules> - </modules> - - -</project> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smackx/3.2.2/smackx-3.2.2.jar ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smackx/3.2.2/smackx-3.2.2.jar b/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smackx/3.2.2/smackx-3.2.2.jar deleted file mode 100644 index 4853caf..0000000 Binary files a/contrib/blur-console/blur-agent/lib/org/igniterealtime/smack/smackx/3.2.2/smackx-3.2.2.jar and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-agent/pom.xml ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-agent/pom.xml b/contrib/blur-console/blur-agent/pom.xml index 67b9dc2..5dac677 100644 --- a/contrib/blur-console/blur-agent/pom.xml +++ b/contrib/blur-console/blur-agent/pom.xml @@ -109,16 +109,6 @@ under the License. <artifactId>mail</artifactId> <version>1.4</version> </dependency> - <dependency> - <groupId>org.igniterealtime.smack</groupId> - <artifactId>smack</artifactId> - <version>3.2.2</version> - </dependency> - <dependency> - <groupId>org.igniterealtime.smack</groupId> - <artifactId>smackx</artifactId> - <version>3.2.2</version> - </dependency> <!-- COMPILE DEPENDENCIES --> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Messenger.java ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Messenger.java b/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Messenger.java deleted file mode 100644 index 2a3e413..0000000 --- a/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Messenger.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.apache.blur.agent.notifications; - -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import java.util.HashSet; -import java.util.Properties; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jivesoftware.smack.Chat; -import org.jivesoftware.smack.ChatManager; -import org.jivesoftware.smack.Connection; -import org.jivesoftware.smack.ConnectionConfiguration; -import org.jivesoftware.smack.MessageListener; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.packet.Message; - -public class Messenger { - private static final Log log = LogFactory.getLog(Messenger.class); - - private String host; - private int port; - private String username; - private String password; - private Set<String> recipients; - private boolean sendMessage = false; - - public Messenger(Properties props) { - if (props.containsKey("messenger.enabled") && props.getProperty("messenger.enabled").equals("true")) { - sendMessage = true; - host = props.getProperty("messenger.host"); - port = Integer.parseInt(props.getProperty("messenger.port", "5222")); - username = props.getProperty("messenger.user"); - password = props.getProperty("messenger.password"); - - recipients = new HashSet<String>(); - for (String recip : props.getProperty("messenger.recipients", "").split("\\|")) { - if (StringUtils.isNotBlank(recip)) { - recipients.add(recip); - } - } - } - } - - public void sendMessage(String message) { - if (sendMessage && !recipients.isEmpty()) { - try { - // Create the configuration for this new connection - ConnectionConfiguration config = new ConnectionConfiguration(host, port); - config.setCompressionEnabled(true); - config.setSASLAuthenticationEnabled(true); - config.setSendPresence(false); - config.setRosterLoadedAtLogin(false); - - Connection connection = new XMPPConnection(config); - // Connect to the server - connection.connect(); - // Log into the server - connection.login(username, password); - ChatManager manager = connection.getChatManager(); - for (String recipient : recipients) { - Chat chat = manager.createChat(recipient, new MessageListener() { - - @Override - public void processMessage(Chat chat, Message message) { - try { - chat.sendMessage("Sorry I'm just a bot"); - } catch (XMPPException e) { - //Ignore response - } - } - }); - chat.sendMessage(message); - } - // Disconnect from the server - connection.disconnect(); - } catch (Exception e) { - log.warn("Unable to send Instant Message: " + e.getMessage()); - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Notifier.java ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Notifier.java b/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Notifier.java index a669b12..2c547fc 100644 --- a/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Notifier.java +++ b/contrib/blur-console/blur-agent/src/main/java/org/apache/blur/agent/notifications/Notifier.java @@ -33,11 +33,9 @@ public class Notifier { private static Notifier notifier; private Mailer mailer; - private Messenger messenger; private Notifier(Properties props) { mailer = new Mailer(props); - messenger = new Messenger(props); } public void notifyZookeeperOffline(String zookeeperName) { @@ -57,7 +55,6 @@ public class Notifier { String message = MessageFormat.format(MESSAGE, nodeType, StringUtils.join(nodeNames, "\n")); mailer.sendMessage(subject, message); - messenger.sendMessage(message); } public static Notifier getNotifier(Properties props, boolean forceNew) { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/9799e6b5/contrib/blur-console/blur-agent/src/test/java/org/apache/blur/agent/notifications/MessengerTest.java ---------------------------------------------------------------------- diff --git a/contrib/blur-console/blur-agent/src/test/java/org/apache/blur/agent/notifications/MessengerTest.java b/contrib/blur-console/blur-agent/src/test/java/org/apache/blur/agent/notifications/MessengerTest.java deleted file mode 100644 index 851e661..0000000 --- a/contrib/blur-console/blur-agent/src/test/java/org/apache/blur/agent/notifications/MessengerTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.apache.blur.agent.notifications; - -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Field; -import java.util.Collection; -import java.util.Properties; - -import javax.mail.MessagingException; - -import org.apache.blur.agent.notifications.Messenger; -import org.junit.Test; -import org.springframework.util.ReflectionUtils; - - -public class MessengerTest { - - @Test - public void testSingletons() { - // getter no props - Messenger mailer = new Messenger(new Properties()); - assertFieldEquals("Send message should be false", mailer, "sendMessage", false); - assertFieldEquals("Recipients shouldn't have been set because sendMessage is false.", mailer, "recipients", null); - - // getter with props - Properties props = new Properties(); - props.setProperty("messenger.enabled", "true"); - props.setProperty("messenger.host", "localhost"); - props.setProperty("messenger.port", "25"); - props.setProperty("messenger.user", "crohr"); - props.setProperty("messenger.password", "password"); - props.setProperty("messenger.recipients", "[email protected]|[email protected]"); - mailer = new Messenger(props); - assertFieldEquals("Send messenger should be true", mailer, "sendMessage", true); - assertCollectionFieldEquals("There should be 2 valid recipients", mailer, "recipients", 2); - } - - - @Test - public void testSendMessageMessengerDisabled() { - XMPPEmbeddedServer.startServer(2500); - - Properties props = new Properties(); - props.setProperty("messenger.enabled", "false"); - Messenger mailer = new Messenger(props); - mailer.sendMessage("Test Message"); - - XMPPEmbeddedServer.stopServer(); - assertTrue(XMPPEmbeddedServer.getMessages().size() == 0); - } - - @Test - public void testSendMessageNoRecipients() { - XMPPEmbeddedServer.startServer(2500); - - Properties props = new Properties(); - props.setProperty("messenger.enabled", "true"); - props.setProperty("messenger.host", "localhost"); - props.setProperty("messenger.port", "2500"); - props.setProperty("messenger.user", "crohr"); - props.setProperty("messenger.password", "password"); - Messenger mailer = new Messenger(props); - mailer.sendMessage("Test Message"); - - XMPPEmbeddedServer.stopServer(); - assertTrue(XMPPEmbeddedServer.getMessages().size() == 0); - } - - @Test - public void testSendMessage() throws MessagingException { - XMPPEmbeddedServer.startServer(2500); - - Properties props = new Properties(); - props.setProperty("messenger.enabled", "true"); - props.setProperty("messenger.host", "localhost"); - props.setProperty("messenger.port", "2500"); - props.setProperty("messenger.user", "crohr"); - props.setProperty("messenger.password", "password"); - props.setProperty("messenger.recipients", "[email protected]|[email protected]"); - Messenger mailer = new Messenger(props); - mailer.sendMessage("Test Message"); - - XMPPEmbeddedServer.stopServer(); - assertTrue(XMPPEmbeddedServer.getMessages().size() == 0); - //assertEquals("Test Message", XMPPEmbeddedServer.getMessages().get(0)); - } - - private void assertFieldEquals(String message, Object object, String fieldName, Object value) { - Field field = ReflectionUtils.findField(object.getClass(), fieldName); - ReflectionUtils.makeAccessible(field); - assertEquals(message, value, ReflectionUtils.getField(field, object)); - } - - @SuppressWarnings("unchecked") - private void assertCollectionFieldEquals(String message, Object object, String fieldName, int expectedCollectionSize) { - Field field = ReflectionUtils.findField(object.getClass(), fieldName); - ReflectionUtils.makeAccessible(field); - assertEquals(message, expectedCollectionSize, ((Collection<Object>) ReflectionUtils.getField(field, object)).size()); - } - -}
