JBoss hornetq SVN: r12021 - branches/Branch_2_2_AS7.
by do-not-reply@jboss.org
Author: ataylor
Date: 2012-01-13 06:19:47 -0500 (Fri, 13 Jan 2012)
New Revision: 12021
Modified:
branches/Branch_2_2_AS7/hornetq.ipr
branches/Branch_2_2_AS7/hornetq.iws
Log:
version update
Modified: branches/Branch_2_2_AS7/hornetq.ipr
===================================================================
--- branches/Branch_2_2_AS7/hornetq.ipr 2012-01-12 20:02:37 UTC (rev 12020)
+++ branches/Branch_2_2_AS7/hornetq.ipr 2012-01-13 11:19:47 UTC (rev 12021)
@@ -273,6 +273,7 @@
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="jsp">
<option name="INDENT_SIZE" value="4" />
@@ -282,6 +283,7 @@
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="xml">
<option name="INDENT_SIZE" value="4" />
@@ -291,6 +293,7 @@
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
</value>
</option>
@@ -365,22 +368,22 @@
</facet-type>
<facet-type id="javaeeApplication">
<modules>
- <module name="messaging" />
<module name="hornetq-javaee-examples">
<files>
<file url="file://$PROJECT_DIR$/examples/javaee/servlet-transport/config/META-INF/application.xml" />
</files>
</module>
+ <module name="messaging" />
</modules>
</facet-type>
<facet-type id="web">
<modules>
- <module name="messaging" />
<module name="hornetq-javaee-examples">
<files>
<file url="file://$PROJECT_DIR$/examples/javaee/servlet-transport/config/WEB-INF/web.xml" />
</files>
</module>
+ <module name="messaging" />
</modules>
</facet-type>
</autodetection-disabled>
@@ -631,6 +634,9 @@
<module fileurl="file://$PROJECT_DIR$/tests/hornetq-tests.iml" filepath="$PROJECT_DIR$/tests/hornetq-tests.iml" />
</modules>
</component>
+ <component name="ProjectResources">
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
+ </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
@@ -701,6 +707,52 @@
</option>
</component>
<component name="libraryTable">
+ <library name="ant 1.7.1">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-contrib/lib/commons-logging-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-commons-logging.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-contrib/ant-contrib-1.0b3.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-jai.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-apache-log4j.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-javamail.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-trax.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-antlr.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-jmf.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-apache-resolver.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-jdepend.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-nodeps.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-contrib.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-starteam.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-apache-bsf.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-stylebook.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-apache-oro.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-contrib/lib/commons-httpclient-3.0.1.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-jsch.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-commons-net.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/xml-apis.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-junit.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-contrib/lib/ivy-1.3.1.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-swing.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-launcher.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-testutil.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-contrib/lib/bcel-5.1.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-apache-regexp.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-weblogic.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/xercesImpl.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-apache-bcel.jar!/" />
+ <root url="jar://$USER_HOME$/devtools/apache-ant-1.7.1/lib/ant-netrexx.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ <library name="etc">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/../etc" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
<library name="messaging">
<CLASSES>
<root url="file://$PROJECT_DIR$/src/config/common" />
@@ -712,6 +764,42 @@
<jarDirectory url="file://$PROJECT_DIR$/tests/etc" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/tests/jms-tests/etc" recursive="false" />
</library>
+ <library name="messaging-javaee-examples">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/src/config/common" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ <library name="messaging-jms-examples">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/examples/jms/common/config" />
+ <root url="file://$PROJECT_DIR$/src/config/common" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ <library name="messaging-jms-tests">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/tests/jms-tests/config" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ <library name="messaging-joram-tests">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/tests/joram-tests/config" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ <library name="messaging-tests">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/tests/config" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
<library name="messaging_jars">
<CLASSES>
<root url="jar://$PROJECT_DIR$/thirdparty/org/jboss/lib/jboss-mdr.jar!/" />
@@ -746,88 +834,6 @@
<JAVADOC />
<SOURCES />
</library>
- <library name="messaging-tests">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/tests/config" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="messaging-joram-tests">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/tests/joram-tests/config" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="messaging-jms-tests">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/tests/jms-tests/config" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="messaging-jms-examples">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/examples/jms/common/config" />
- <root url="file://$PROJECT_DIR$/src/config/common" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="messaging-javaee-examples">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/src/config/common" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="ant 1.7.1">
- <CLASSES>
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-contrib/lib/commons-logging-1.0.4.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-commons-logging.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-contrib/ant-contrib-1.0b3.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-jai.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-apache-log4j.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-javamail.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-trax.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-antlr.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-jmf.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-apache-resolver.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-jdepend.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-nodeps.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-contrib.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-starteam.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-apache-bsf.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-stylebook.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-apache-oro.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-contrib/lib/commons-httpclient-3.0.1.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-jsch.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-commons-net.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/xml-apis.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-junit.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-contrib/lib/ivy-1.3.1.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-swing.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-launcher.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-testutil.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-contrib/lib/bcel-5.1.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-apache-regexp.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-weblogic.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/xercesImpl.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-apache-bcel.jar!/" />
- <root url="jar://$PROJECT_DIR$/../../devtools/apache-ant-1.7.1/lib/ant-netrexx.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="etc">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/../etc" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
</component>
</project>
Modified: branches/Branch_2_2_AS7/hornetq.iws
===================================================================
--- branches/Branch_2_2_AS7/hornetq.iws 2012-01-12 20:02:37 UTC (rev 12020)
+++ branches/Branch_2_2_AS7/hornetq.iws 2012-01-13 11:19:47 UTC (rev 12021)
@@ -2,46 +2,15 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" readonly="true" id="a2aae645-dbcd-4d6e-9c99-efa05d93589a" name="Default" comment="">
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server/ra.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/server" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-configuration.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/readme.html" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/server/MDBQueue.java" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-jms.xml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/docs/user-manual/en/appserver-integration.xml" afterPath="$PROJECT_DIR$/docs/user-manual/en/appserver-integration.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/config/META-INF/application.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/build.sh" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/MDBRemoteServerClientExample.java" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/build.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/examples/javaee/common/build.xml" afterPath="$PROJECT_DIR$/examples/javaee/common/build.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/config/ant.properties" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src/org" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/build.bat" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-users.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server/hornetq-configuration.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server/hornetq-jms.xml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/docs/user-manual/en/examples.xml" afterPath="$PROJECT_DIR$/docs/user-manual/en/examples.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server/jms-ds.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/config/META-INF" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server0/client-jndi.properties" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server0" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-beans.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/config/client.jndi.properties" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/javaee/jca-remote/config" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/build-maven.xml" afterPath="$PROJECT_DIR$/build-maven.xml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/config/common/hornetq-version.properties" afterPath="$PROJECT_DIR$/src/config/common/hornetq-version.properties" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/org/hornetq/ra/recovery/RecoveryManager.java" afterPath="$PROJECT_DIR$/src/main/org/hornetq/ra/recovery/RecoveryManager.java" />
</list>
<list id="5341122e-b51c-4e90-b798-7086790ef7e8" name="intellij" comment="">
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/hornetq.iml" afterPath="$PROJECT_DIR$/hornetq.iml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/examples/javaee/hornetq-javaee-examples.iml" afterPath="$PROJECT_DIR$/examples/javaee/hornetq-javaee-examples.iml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/hornetq.iws" afterPath="$PROJECT_DIR$/hornetq.iws" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/examples/jms/hornetq-jms-examples.iml" afterPath="$PROJECT_DIR$/examples/jms/hornetq-jms-examples.iml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/hornetq.ipr" afterPath="$PROJECT_DIR$/hornetq.ipr" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/hornetq.iws" afterPath="$PROJECT_DIR$/hornetq.iws" />
</list>
+ <list id="0c941aa6-f00d-4064-a669-5627378e878f" name="recovery" comment="" />
<ignored path=".idea/workspace.xml" />
<ignored path="messaging.iws" />
<option name="TRACKING_ENABLED" value="true" />
@@ -73,7 +42,7 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
- <breakpoint url="file://$PROJECT_DIR$/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java" line="847" class="org.hornetq.core.server.cluster.impl.ClusterConnectionImpl.MessageFlowRecordImpl" package="org.hornetq.core.server.cluster.impl">
+ <breakpoint url="file://$PROJECT_DIR$/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java" line="847" class="org.hornetq.core.server.cluster.impl.ClusterConnectionImpl" package="org.hornetq.core.server.cluster.impl">
<option name="ENABLED" value="true" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
@@ -138,7 +107,7 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
- <breakpoint url="file://$PROJECT_DIR$/src/main/org/hornetq/integration/jboss/security/JBossASSecurityManager.java" line="145" class="org.hornetq.integration.jboss.security.JBossASSecurityManager" package="org.hornetq.integration.jboss.security">
+ <breakpoint url="file://$PROJECT_DIR$/src/main/org/hornetq/integration/jboss/security/JBossASSecurityManager.java" line="145" class="org.hornetq.integration.jboss.security.JBossASSecurityManager$1" package="org.hornetq.integration.jboss.security">
<option name="ENABLED" value="true" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
@@ -242,7 +211,7 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
- <breakpoint url="file://$PROJECT_DIR$/tests/src/org/hornetq/tests/integration/ra/HornetQMessageHandlerTest.java" line="234" class="org.hornetq.tests.integration.ra.HornetQMessageHandlerTest.DummyMessageEndpoint" package="org.hornetq.tests.integration.ra">
+ <breakpoint url="file://$PROJECT_DIR$/tests/src/org/hornetq/tests/integration/ra/HornetQMessageHandlerTest.java" line="234" class="org.hornetq.tests.integration.ra.HornetQMessageHandlerTest" package="org.hornetq.tests.integration.ra">
<option name="ENABLED" value="true" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
@@ -281,6 +250,19 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
+ <breakpoint url="file://$PROJECT_DIR$/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java" line="329" class="org.hornetq.core.protocol.core.impl.ChannelImpl" package="org.hornetq.core.protocol.core.impl">
+ <option name="ENABLED" value="true" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
</line_breakpoints>
<breakpoint_any>
<breakpoint>
@@ -320,42 +302,39 @@
<component name="FavoritesManager">
<favorites_list name="messaging" />
</component>
- <component name="FileColors" enabled="true" enabledForTabs="true" />
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="MDBRemoteServerClientExample.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/MDBRemoteServerClientExample.java">
+ <file leaf-file-name="examples.xml" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/docs/user-manual/en/examples.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="95" column="17" selection-start="3054" selection-end="3226" vertical-scroll-proportion="0.0">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <state line="534" column="124" selection-start="33768" selection-end="33768" vertical-scroll-proportion="0.0">
+ <folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="readme.html" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/readme.html">
+ <file leaf-file-name="Bridge.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/org/hornetq/core/server/cluster/Bridge.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="46" column="44" selection-start="2573" selection-end="3415" vertical-scroll-proportion="-16.304348">
+ <state line="32" column="17" selection-start="1156" selection-end="1156" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="appserver-integration.xml" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/docs/user-manual/en/appserver-integration.xml">
+ <file leaf-file-name="ClusterConnectionImpl.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="836" column="101" selection-start="48141" selection-end="48141" vertical-scroll-proportion="-15.04">
+ <state line="541" column="92" selection-start="17150" selection-end="17150" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="examples.xml" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/docs/user-manual/en/examples.xml">
+ <file leaf-file-name="ChannelImpl.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="534" column="124" selection-start="33920" selection-end="33920" vertical-scroll-proportion="0.4304762">
+ <state line="340" column="112" selection-start="9110" selection-end="9110" vertical-scroll-proportion="4.038058">
<folding />
</state>
</provider>
@@ -373,7 +352,7 @@
<file leaf-file-name="hornetq-configuration.xml" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-configuration.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="46" column="49" selection-start="1976" selection-end="1976" vertical-scroll-proportion="0.0">
+ <state line="46" column="49" selection-start="1871" selection-end="1871" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -383,9 +362,7 @@
<entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/server/MDBQueue.java">
<provider selected="true" editor-type-id="text-editor">
<state line="46" column="25" selection-start="1849" selection-end="1865" vertical-scroll-proportion="0.0">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <folding />
</state>
</provider>
</entry>
@@ -455,7 +432,7 @@
<profile-state />
</entry>
</component>
- <component name="ProjectLevelVcsManager">
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
@@ -1367,6 +1344,7 @@
<sortByType />
</navigator>
<panes>
+ <pane id="Favorites" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
@@ -1382,7 +1360,7 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -1392,11 +1370,11 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="mdb-bmt" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -1406,19 +1384,15 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="mdb-bmt" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="example" />
+ <option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -1428,13 +1402,21 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jca-remote" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="main" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="hornetq" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -1442,21 +1424,25 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jca-remote" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="src" />
+ <option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="example" />
+ <option name="myItemId" value="hornetq" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="core" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -1464,22 +1450,26 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jca-remote" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="src" />
+ <option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="example" />
+ <option name="myItemId" value="hornetq" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
+ <option name="myItemId" value="core" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
<option name="myItemId" value="server" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
@@ -1490,33 +1480,31 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jca-remote" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="server0" />
+ <option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hornetq" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jca-remote" />
+ <option name="myItemId" value="server" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="server" />
+ <option name="myItemId" value="cluster" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -1526,43 +1514,35 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jca-remote" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="config" />
+ <option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hornetq" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jca-config" />
+ <option name="myItemId" value="server" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="javaee" />
+ <option name="myItemId" value="cluster" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="common" />
+ <option name="myItemId" value="impl" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -1572,29 +1552,27 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq-jms-examples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jms" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemId" value="main" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq-jms-examples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ <option name="myItemId" value="hornetq" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jms" />
+ <option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="queue" />
+ <option name="myItemId" value="protocol" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -1604,37 +1582,31 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq-jms-examples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="jms" />
+ <option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="queue" />
+ <option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="src" />
+ <option name="myItemId" value="hornetq" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="example" />
+ <option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemId" value="protocol" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq-jms-examples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="common" />
+ <option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -1644,11 +1616,7 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq-jms-examples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="common" />
+ <option name="myItemId" value="Branch_2_2_AS7" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
@@ -1656,32 +1624,33 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="example" />
+ <option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hornetq" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="hornetq-jms-examples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ <option name="myItemId" value="core" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="common" />
+ <option name="myItemId" value="protocol" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="config" />
+ <option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="impl" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
- <pane id="Favorites" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -1765,6 +1734,7 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
@@ -1814,6 +1784,7 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="50830" />
<option name="TRANSPORT" value="0" />
@@ -1847,6 +1818,7 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
@@ -1874,17 +1846,11 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
- <configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
- <method>
- <option name="AntTarget" enabled="false" />
- <option name="BuildArtifacts" enabled="false" />
- <option name="Maven.BeforeRunTask" enabled="false" />
- </method>
- </configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
@@ -1953,6 +1919,7 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<method>
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
@@ -1983,6 +1950,7 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="52003" />
<option name="TRANSPORT" value="0" />
@@ -2016,6 +1984,7 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
@@ -2043,6 +2012,7 @@
<value defaultName="moduleWithDependencies" />
</option>
<envs />
+ <patterns />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="59963" />
<option name="TRANSPORT" value="0" />
@@ -2064,13 +2034,7 @@
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="false" />
</RunnerSettings>
- <RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="5005" />
- <option name="TRANSPORT" value="0" />
- <option name="LOCAL" value="false" />
- </RunnerSettings>
<ConfigurationWrapper RunnerId="Debug" />
- <ConfigurationWrapper RunnerId="Debug" />
<method />
</configuration>
<configuration default="false" name="EnqueueDurable" type="Application" factoryName="Application">
@@ -2116,16 +2080,19 @@
<component name="SvnConfiguration" maxAnnotateRevisions="500">
<option name="USER" value="" />
<option name="PASSWORD" value="" />
+ <option name="mySSHConnectionTimeout" value="30000" />
+ <option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" />
- <option name="UPDATE_RUN_STATUS" value="false" />
<option name="MERGE_DRY_RUN" value="false" />
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
<option name="DETECT_NESTED_COPIES" value="false" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
- <configuration useDefault="false">$PROJECT_DIR$/../../.subversion</configuration>
+ <option name="FORCE_UPDATE" value="false" />
+ <configuration useDefault="false">$USER_HOME$/.subversion</configuration>
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
<supportedVersion>125</supportedVersion>
</component>
@@ -2183,25 +2150,26 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
- <frame x="-3" y="25" width="1926" height="1033" extended-state="6" />
+ <frame x="0" y="25" width="1920" height="1150" extended-state="0" />
<editor active="false" />
<layout>
- <window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.34723788" sideWeight="0.0" order="7" side_tool="false" content_ui="tabs" />
+ <window_info id="simpleUML" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.1942231" sideWeight="0.0" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.48703495" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.17925592" sideWeight="0.0" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.17587373" sideWeight="0.0" order="7" side_tool="false" content_ui="tabs" />
- <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.16344294" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24959914" sideWeight="0.7006937" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.17263496" sideWeight="0.64487034" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.17185822" sideWeight="0.8057769" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.17925592" sideWeight="0.0" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20599613" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.17587373" sideWeight="0.0" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Find" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.4860558" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Dataflow to this" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.16344294" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
@@ -2210,6 +2178,15 @@
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="CHECK_NEW_TODO" value="true" />
+ <option name="myTodoPanelSettings">
+ <value>
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="false" />
+ </value>
+ </option>
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
@@ -2219,6 +2196,9 @@
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="true" />
<option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
+ <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
+ <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="LAST_COMMIT_MESSAGE" value="added jca example showing connecting to remote HQ server and doc updates" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
@@ -2860,118 +2840,96 @@
</buildFile>
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server0/client-jndi.properties">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/src/org/hornetq/javaee/example/server/MDBQueueA.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="14" column="43" selection-start="722" selection-end="722" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="36" column="13" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-jms.xml">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/readme.html">
<provider selected="true" editor-type-id="text-editor">
- <state line="17" column="29" selection-start="891" selection-end="908" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="149" column="19" selection-start="9467" selection-end="9815" vertical-scroll-proportion="-16.956522" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/MDBQueueB.java">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server/jms-ds.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="36" column="13" selection-start="1596" selection-end="1596" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="34" column="31" selection-start="960" selection-end="1628" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/src/org/hornetq/javaee/example/server/MDBQueueA.java">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/MDBRemoteServerClientExample.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="36" column="13" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="95" column="17" selection-start="3054" selection-end="3226" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/readme.html">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/readme.html">
<provider selected="true" editor-type-id="text-editor">
- <state line="149" column="19" selection-start="9467" selection-end="9815" vertical-scroll-proportion="-16.956522">
+ <state line="46" column="44" selection-start="2573" selection-end="3415" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server/jms-ds.xml">
+ <entry file="file://$PROJECT_DIR$/docs/user-manual/en/appserver-integration.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="34" column="31" selection-start="960" selection-end="1628" vertical-scroll-proportion="0.0">
+ <state line="836" column="101" selection-start="47929" selection-end="47929" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-configuration.xml">
+ <entry file="file://$PROJECT_DIR$/docs/user-manual/en/examples.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="46" column="49" selection-start="1976" selection-end="1976" vertical-scroll-proportion="0.0">
+ <state line="534" column="124" selection-start="33768" selection-end="33768" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSenderService.java">
+ <entry file="file://$PROJECT_DIR$/src/main/org/hornetq/core/server/cluster/Bridge.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="23" column="17" selection-start="806" selection-end="806" vertical-scroll-proportion="0.0">
+ <state line="32" column="17" selection-start="1156" selection-end="1156" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSender.java">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server/ra.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="50" column="59" selection-start="1556" selection-end="1609" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="61" column="27" selection-start="2184" selection-end="3025" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/mdb-bmt/src/org/hornetq/javaee/example/MDB_BMTClientExample.java">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server0/hornetq-configuration.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="71" column="32" selection-start="2239" selection-end="2468" vertical-scroll-proportion="0.0">
+ <state line="46" column="49" selection-start="1871" selection-end="1871" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/server/ra.xml">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/server/MDBQueue.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="61" column="27" selection-start="2184" selection-end="3025" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="46" column="25" selection-start="1849" selection-end="1865" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/MDBRemoteServerClientExample.java">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSenderService.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="95" column="17" selection-start="3054" selection-end="3226" vertical-scroll-proportion="0.0">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
+ <state line="23" column="17" selection-start="806" selection-end="806" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/src/org/hornetq/javaee/example/server/MDBQueue.java">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSender.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="46" column="25" selection-start="1849" selection-end="1865" vertical-scroll-proportion="0.0">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
+ <state line="50" column="59" selection-start="1556" selection-end="1609" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/examples/javaee/jca-remote/readme.html">
+ <entry file="file://$PROJECT_DIR$/examples/javaee/mdb-bmt/src/org/hornetq/javaee/example/MDB_BMTClientExample.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="46" column="44" selection-start="2573" selection-end="3415" vertical-scroll-proportion="-16.304348">
- <folding />
- </state>
+ <state line="71" column="32" selection-start="2239" selection-end="2468" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/docs/user-manual/en/appserver-integration.xml">
+ <entry file="file://$PROJECT_DIR$/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="836" column="101" selection-start="48141" selection-end="48141" vertical-scroll-proportion="-15.04">
+ <state line="541" column="92" selection-start="17150" selection-end="17150" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/docs/user-manual/en/examples.xml">
+ <entry file="file://$PROJECT_DIR$/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="534" column="124" selection-start="33920" selection-end="33920" vertical-scroll-proportion="0.4304762">
+ <state line="340" column="112" selection-start="9110" selection-end="9110" vertical-scroll-proportion="4.038058">
<folding />
</state>
</provider>
12 years, 5 months
JBoss hornetq SVN: r12020 - in branches/Branch_2_2_AS7/src/main/org/hornetq: core/protocol/stomp and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2012-01-12 15:02:37 -0500 (Thu, 12 Jan 2012)
New Revision: 12020
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java
branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
Log:
https://issues.jboss.org/browse/JBPAPP-7205 - merging changes into AS7 branch
Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2012-01-12 19:59:37 UTC (rev 12019)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2012-01-12 20:02:37 UTC (rev 12020)
@@ -361,7 +361,7 @@
callClosingListeners();
}
- public void disconnect()
+ public void disconnect(final boolean criticalError)
{
Channel channel0 = getChannel(0, -1);
@@ -371,13 +371,25 @@
Set<Channel> allChannels = new HashSet<Channel>(channels.values());
- removeAllChannels();
+ if (!criticalError)
+ {
+ removeAllChannels();
+ }
+ else
+ {
+ // We can't hold a lock if a critical error is happening...
+ // as other threads will be holding the lock while hanging on IO
+ channels.clear();
+ }
// Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
- for (Channel channel: allChannels)
+ if (!criticalError)
{
- channel.flushConfirmations();
+ for (Channel channel: allChannels)
+ {
+ channel.flushConfirmations();
+ }
}
Packet disconnect = new DisconnectMessage(nodeID);
Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java 2012-01-12 19:59:37 UTC (rev 12019)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java 2012-01-12 20:02:37 UTC (rev 12020)
@@ -209,7 +209,7 @@
manager.cleanup(this);
}
- public void disconnect()
+ public void disconnect(final boolean criticalError)
{
}
Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2012-01-12 19:59:37 UTC (rev 12019)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2012-01-12 20:02:37 UTC (rev 12020)
@@ -307,7 +307,7 @@
log.trace("Sending connection.disconnection packet to " + conn);
}
- conn.disconnect();
+ conn.disconnect(criticalError);
}
for (Acceptor acceptor : acceptors)
Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2012-01-12 19:59:37 UTC (rev 12019)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2012-01-12 20:02:37 UTC (rev 12020)
@@ -151,7 +151,7 @@
/**
* Disconnect the connection, closing all channels
*/
- void disconnect();
+ void disconnect(boolean criticalError);
/**
* returns true if any data has been received since the last time this method was called.
12 years, 5 months
JBoss hornetq SVN: r12019 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2012-01-12 14:59:37 -0500 (Thu, 12 Jan 2012)
New Revision: 12019
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
Log:
https://issues.jboss.org/browse/JBPAPP-7205 - just javadoc
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2012-01-12 12:11:22 UTC (rev 12018)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2012-01-12 19:59:37 UTC (rev 12019)
@@ -377,6 +377,8 @@
}
else
{
+ // We can't hold a lock if a critical error is happening...
+ // as other threads will be holding the lock while hanging on IO
channels.clear();
}
12 years, 5 months
JBoss hornetq SVN: r12018 - in trunk/hornetq-core/src/main/java/org/hornetq/core: server/impl and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-12 07:11:22 -0500 (Thu, 12 Jan 2012)
New Revision: 12018
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/LastValueQueue.java
Log:
Add hashCode/equals to classes w/ new fields that extend classes w/ equals/hashCode
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java 2012-01-12 12:10:54 UTC (rev 12017)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java 2012-01-12 12:11:22 UTC (rev 12018)
@@ -16,7 +16,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
@@ -25,18 +24,12 @@
*/
public class ClusterTopologyChangeMessage extends PacketImpl
{
- // Constants -----------------------------------------------------
+ private boolean exit;
- private static final Logger log = Logger.getLogger(ClusterTopologyChangeMessage.class);
+ private String nodeID;
- // Attributes ----------------------------------------------------
+ private Pair<TransportConfiguration, TransportConfiguration> pair;
- private boolean exit;
-
- private String nodeID;
-
- private Pair<TransportConfiguration, TransportConfiguration> pair;
-
private boolean last;
// Static --------------------------------------------------------
@@ -48,20 +41,20 @@
super(PacketImpl.CLUSTER_TOPOLOGY);
this.nodeID = nodeID;
-
+
this.pair = pair;
-
+
this.last = last;
-
+
this.exit = false;
}
-
+
public ClusterTopologyChangeMessage(final String nodeID)
{
super(PacketImpl.CLUSTER_TOPOLOGY);
-
+
this.exit = true;
-
+
this.nodeID = nodeID;
}
@@ -81,12 +74,12 @@
{
return pair;
}
-
+
public boolean isLast()
{
return last;
}
-
+
public boolean isExit()
{
return exit;
@@ -155,13 +148,64 @@
}
}
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + (exit ? 1231 : 1237);
+ result = prime * result + (last ? 1231 : 1237);
+ result = prime * result + ((nodeID == null) ? 0 : nodeID.hashCode());
+ result = prime * result + ((pair == null) ? 0 : pair.hashCode());
+ return result;
+ }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof ClusterTopologyChangeMessage))
+ {
+ return false;
+ }
+ ClusterTopologyChangeMessage other = (ClusterTopologyChangeMessage)obj;
+ if (exit != other.exit)
+ {
+ return false;
+ }
+ if (last != other.last)
+ {
+ return false;
+ }
+ if (nodeID == null)
+ {
+ if (other.nodeID != null)
+ {
+ return false;
+ }
+ }
+ else if (!nodeID.equals(other.nodeID))
+ {
+ return false;
+ }
+ if (pair == null)
+ {
+ if (other.pair != null)
+ {
+ return false;
+ }
+ }
+ else if (!pair.equals(other.pair))
+ {
+ return false;
+ }
+ return true;
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java 2012-01-12 12:10:54 UTC (rev 12017)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java 2012-01-12 12:11:22 UTC (rev 12018)
@@ -24,16 +24,12 @@
*/
public class ClusterTopologyChangeMessage_V2 extends PacketImpl
{
- // Constants -----------------------------------------------------
+ private boolean exit;
- // Attributes ----------------------------------------------------
+ private String nodeID;
- private boolean exit;
-
- private String nodeID;
-
private Pair<TransportConfiguration, TransportConfiguration> pair;
-
+
private long uniqueEventID;
private boolean last;
@@ -47,24 +43,24 @@
super(PacketImpl.CLUSTER_TOPOLOGY_V2);
this.nodeID = nodeID;
-
+
this.pair = pair;
-
+
this.last = last;
-
+
this.exit = false;
-
+
this.uniqueEventID = uniqueEventID;
}
-
+
public ClusterTopologyChangeMessage_V2(final long uniqueEventID, final String nodeID)
{
super(PacketImpl.CLUSTER_TOPOLOGY_V2);
-
+
this.exit = true;
-
+
this.nodeID = nodeID;
-
+
this.uniqueEventID = uniqueEventID;
}
@@ -84,12 +80,12 @@
{
return pair;
}
-
+
public boolean isLast()
{
return last;
}
-
+
/**
* @return the uniqueEventID
*/
@@ -97,14 +93,14 @@
{
return uniqueEventID;
}
-
+
public boolean isExit()
{
return exit;
}
-
-
+
+
@Override
public void encodeRest(final HornetQBuffer buffer)
{
@@ -170,13 +166,69 @@
}
}
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + (exit ? 1231 : 1237);
+ result = prime * result + (last ? 1231 : 1237);
+ result = prime * result + ((nodeID == null) ? 0 : nodeID.hashCode());
+ result = prime * result + ((pair == null) ? 0 : pair.hashCode());
+ result = prime * result + (int)(uniqueEventID ^ (uniqueEventID >>> 32));
+ return result;
+ }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof ClusterTopologyChangeMessage_V2))
+ {
+ return false;
+ }
+ ClusterTopologyChangeMessage_V2 other = (ClusterTopologyChangeMessage_V2)obj;
+ if (exit != other.exit)
+ {
+ return false;
+ }
+ if (last != other.last)
+ {
+ return false;
+ }
+ if (nodeID == null)
+ {
+ if (other.nodeID != null)
+ {
+ return false;
+ }
+ }
+ else if (!nodeID.equals(other.nodeID))
+ {
+ return false;
+ }
+ if (pair == null)
+ {
+ if (other.pair != null)
+ {
+ return false;
+ }
+ }
+ else if (!pair.equals(other.pair))
+ {
+ return false;
+ }
+ if (uniqueEventID != other.uniqueEventID)
+ {
+ return false;
+ }
+ return true;
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java 2012-01-12 12:10:54 UTC (rev 12017)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java 2012-01-12 12:11:22 UTC (rev 12018)
@@ -14,7 +14,6 @@
package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.Message;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageInternal;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -27,8 +26,6 @@
*/
public abstract class MessagePacket extends PacketImpl
{
- private static final Logger log = Logger.getLogger(MessagePacket.class);
-
protected MessageInternal message;
public MessagePacket(final byte type, final MessageInternal message)
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java 2012-01-12 12:10:54 UTC (rev 12017)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java 2012-01-12 12:11:22 UTC (rev 12018)
@@ -15,7 +15,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
@@ -24,18 +23,12 @@
*/
public class NodeAnnounceMessage extends PacketImpl
{
- // Constants -----------------------------------------------------
+ private String nodeID;
- private static final Logger log = Logger.getLogger(NodeAnnounceMessage.class);
+ private boolean backup;
- // Attributes ----------------------------------------------------
+ private long currentEventID;
- private String nodeID;
-
- private boolean backup;
-
- private long currentEventID;
-
private TransportConfiguration connector;
private TransportConfiguration backupConnector;
@@ -49,16 +42,16 @@
super(PacketImpl.NODE_ANNOUNCE);
this.currentEventID = currentEventID;
-
+
this.nodeID = nodeID;
-
+
this.backup = backup;
-
+
this.connector = tc;
-
+
this.backupConnector = backupConnector;
}
-
+
public NodeAnnounceMessage()
{
super(PacketImpl.NODE_ANNOUNCE);
@@ -71,17 +64,17 @@
{
return nodeID;
}
-
+
public boolean isBackup()
{
return backup;
}
-
+
public TransportConfiguration getConnector()
{
return connector;
}
-
+
public TransportConfiguration getBackupConnector()
{
return backupConnector;
@@ -139,9 +132,6 @@
}
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
@Override
public String toString()
{
@@ -155,13 +145,76 @@
"]";
}
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + (backup ? 1231 : 1237);
+ result = prime * result + ((backupConnector == null) ? 0 : backupConnector.hashCode());
+ result = prime * result + ((connector == null) ? 0 : connector.hashCode());
+ result = prime * result + (int)(currentEventID ^ (currentEventID >>> 32));
+ result = prime * result + ((nodeID == null) ? 0 : nodeID.hashCode());
+ return result;
+ }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof NodeAnnounceMessage))
+ {
+ return false;
+ }
+ NodeAnnounceMessage other = (NodeAnnounceMessage)obj;
+ if (backup != other.backup)
+ {
+ return false;
+ }
+ if (backupConnector == null)
+ {
+ if (other.backupConnector != null)
+ {
+ return false;
+ }
+ }
+ else if (!backupConnector.equals(other.backupConnector))
+ {
+ return false;
+ }
+ if (connector == null)
+ {
+ if (other.connector != null)
+ {
+ return false;
+ }
+ }
+ else if (!connector.equals(other.connector))
+ {
+ return false;
+ }
+ if (currentEventID != other.currentEventID)
+ {
+ return false;
+ }
+ if (nodeID == null)
+ {
+ if (other.nodeID != null)
+ {
+ return false;
+ }
+ }
+ else if (!nodeID.equals(other.nodeID))
+ {
+ return false;
+ }
+ return true;
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/LastValueQueue.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/LastValueQueue.java 2012-01-12 12:10:54 UTC (rev 12017)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/LastValueQueue.java 2012-01-12 12:11:22 UTC (rev 12018)
@@ -21,6 +21,7 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.filter.Filter;
import org.hornetq.core.logging.Logger;
+import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.paging.cursor.PageSubscription;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.PostOffice;
@@ -32,12 +33,12 @@
import org.hornetq.core.transaction.Transaction;
/**
- * A queue that will discard messages if a newer message with the same MessageImpl.HDR_LAST_VALUE_NAME property value.
- * In other words it only retains the last value
- *
+ * A queue that will discard messages if a newer message with the same
+ * {@link MessageImpl#HDR_LAST_VALUE_NAME} property value. In other words it only retains the last
+ * value
+ * <p>
* This is useful for example, for stock prices, where you're only interested in the latest value
* for a particular stock
- *
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a> rewrite
*/
@@ -229,17 +230,17 @@
{
ref.setScheduledDeliveryTime(scheduledDeliveryTime);
}
-
+
public void setPersistedCount(int count)
{
ref.setPersistedCount(count);
}
-
+
public int getPersistedCount()
{
return ref.getPersistedCount();
}
-
+
public boolean isPaged()
{
return false;
@@ -269,4 +270,43 @@
return ref.getMessage().getMemoryEstimate();
}
}
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof LastValueQueue))
+ {
+ return false;
+ }
+ LastValueQueue other = (LastValueQueue)obj;
+ if (map == null)
+ {
+ if (other.map != null)
+ {
+ return false;
+ }
+ }
+ else if (!map.equals(other.map))
+ {
+ return false;
+ }
+ return true;
+ }
}
12 years, 5 months
JBoss hornetq SVN: r12017 - in trunk: hornetq-core/src/test/java/org/hornetq/core and 5 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-12 07:10:54 -0500 (Thu, 12 Jan 2012)
New Revision: 12017
Added:
trunk/hornetq-core/src/test/java/org/hornetq/core/filter/
trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/
trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/FilterTest.java
trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/OperatorTest.java
trunk/hornetq-core/src/test/java/org/hornetq/util/
trunk/hornetq-core/src/test/java/org/hornetq/util/CompressionUtilTest.java
trunk/hornetq-core/src/test/java/org/hornetq/util/ConcurrentHashSetTest.java
trunk/hornetq-core/src/test/java/org/hornetq/util/TimeAndCounterIDGeneratorTest.java
trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesConversionTest.java
trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesTest.java
trunk/hornetq-core/src/test/java/org/hornetq/util/XMLUtilTest.java
Removed:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/FilterTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/OperatorTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/CompressionUtilTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/ConcurrentHashSetTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TimeAndCounterIDGeneratorTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/XMLUtilTest.java
Log:
Move tests into hq-core, avoid cluttering std.out
Copied: trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/FilterTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/FilterTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/FilterTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/FilterTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,699 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.core.filter.impl;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.filter.Filter;
+import org.hornetq.core.server.ServerMessage;
+import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.tests.util.RandomUtil;
+
+/**
+ * Tests the compliance with the HornetQ Filter syntax.
+ *
+ * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ */
+public class FilterTest extends TestCase
+{
+ private Filter filter;
+
+ private ServerMessage message;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ message = new ServerMessageImpl(1, 1000);
+ }
+
+ public void testFilterForgets() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("color = 'RED'"));
+
+ message.putStringProperty(new SimpleString("color"), new SimpleString("RED"));
+ Assert.assertTrue(filter.match(message));
+ message = new ServerMessageImpl();
+ Assert.assertFalse(filter.match(message));
+ }
+
+ public void testInvalidString() throws Exception
+ {
+ testInvalidFilter("color = 'red");
+ testInvalidFilter(new SimpleString("color = 'red"));
+
+ testInvalidFilter("3");
+ testInvalidFilter(new SimpleString("3"));
+ }
+
+ public void testNullFilter() throws Exception
+ {
+ Assert.assertNull(FilterImpl.createFilter((String)null));
+ Assert.assertNull(FilterImpl.createFilter(""));
+ Assert.assertNull(FilterImpl.createFilter((SimpleString)null));
+ Assert.assertNull(FilterImpl.createFilter(new SimpleString("")));
+ }
+
+ public void testHQDurable() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("HQDurable='DURABLE'"));
+
+ message.setDurable(true);
+
+ Assert.assertTrue(filter.match(message));
+
+ message.setDurable(false);
+
+ Assert.assertFalse(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("HQDurable='NON_DURABLE'"));
+
+ message = new ServerMessageImpl();
+ message.setDurable(true);
+
+ Assert.assertFalse(filter.match(message));
+
+ message.setDurable(false);
+
+ Assert.assertTrue(filter.match(message));
+
+ }
+
+ public void testHQSize() throws Exception
+ {
+ message.setAddress(RandomUtil.randomSimpleString());
+
+ int encodeSize = message.getEncodeSize();
+
+ Filter moreThanSmall = FilterImpl.createFilter(new SimpleString("HQSize > " + (encodeSize - 1)));
+ Filter lessThanLarge = FilterImpl.createFilter(new SimpleString("HQSize < " + (encodeSize + 1)));
+
+ Filter lessThanSmall = FilterImpl.createFilter(new SimpleString("HQSize < " + encodeSize));
+ Filter moreThanLarge = FilterImpl.createFilter(new SimpleString("HQSize > " + encodeSize));
+
+ Assert.assertTrue(moreThanSmall.match(message));
+ Assert.assertTrue(lessThanLarge.match(message));
+
+ Assert.assertFalse(lessThanSmall.match(message));
+ Assert.assertFalse(moreThanLarge.match(message));
+
+ }
+
+ public void testHQPriority() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("HQPriority=3"));
+
+ for (int i = 0; i < 10; i++)
+ {
+ message.setPriority((byte)i);
+
+ if (i == 3)
+ {
+ Assert.assertTrue(filter.match(message));
+ }
+ else
+ {
+ Assert.assertFalse(filter.match(message));
+ }
+ }
+ }
+
+ public void testHQTimestamp() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("HQTimestamp=12345678"));
+
+ message.setTimestamp(87654321);
+
+ Assert.assertFalse(filter.match(message));
+
+ message.setTimestamp(12345678);
+
+ Assert.assertTrue(filter.match(message));
+ }
+
+ public void testBooleanTrue() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("MyBoolean=true"));
+
+ testBoolean("MyBoolean", true);
+ }
+
+ public void testIdentifier() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("MyBoolean"));
+
+ testBoolean("MyBoolean", true);
+ }
+
+ public void testDifferentNullString() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("NOT (prop = 'foo')"));
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
+ doPutStringProperty("prop", "bar");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
+ doPutStringProperty("prop", "foo");
+ Assert.assertFalse(filter.match(message));
+ }
+
+ public void testBooleanFalse() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("MyBoolean=false"));
+ testBoolean("MyBoolean", false);
+ }
+
+ private void testBoolean(final String name, final boolean flag) throws Exception
+ {
+ message.putBooleanProperty(new SimpleString(name), flag);
+ Assert.assertTrue(filter.match(message));
+
+ message.putBooleanProperty(new SimpleString(name), !flag);
+ Assert.assertTrue(!filter.match(message));
+ }
+
+ public void testStringEquals() throws Exception
+ {
+ // First, simple test of string equality and inequality
+ filter = FilterImpl.createFilter(new SimpleString("MyString='astring'"));
+
+ doPutStringProperty("MyString", "astring");
+ Assert.assertTrue(filter.match(message));
+
+ doPutStringProperty("MyString", "NOTastring");
+ Assert.assertTrue(!filter.match(message));
+
+ // test empty string
+ filter = FilterImpl.createFilter(new SimpleString("MyString=''"));
+
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue("test 1", filter.match(message));
+
+ doPutStringProperty("MyString", "NOTastring");
+ Assert.assertTrue("test 2", !filter.match(message));
+
+ // test literal apostrophes (which are escaped using two apostrophes
+ // in selectors)
+ filter = FilterImpl.createFilter(new SimpleString("MyString='test JBoss''s filter'"));
+
+ // note: apostrophes are not escaped in string properties
+ doPutStringProperty("MyString", "test JBoss's filter");
+ // this test fails -- bug 530120
+ // assertTrue("test 3", filter.match(message));
+
+ doPutStringProperty("MyString", "NOTastring");
+ Assert.assertTrue("test 4", !filter.match(message));
+
+ }
+
+ public void testNOT_INWithNullProperty() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT IN ('foo','jms','test')"));
+
+ assertFalse(filter.match(message));
+
+ message.putStringProperty("myNullProp", "JMS");
+ assertTrue(filter.match(message));
+ }
+
+ public void testNOT_LIKEWithNullProperty() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT LIKE '1_3'"));
+
+ assertFalse(filter.match(message));
+
+ message.putStringProperty("myNullProp", "JMS");
+ assertTrue(filter.match(message));
+ }
+
+ public void testIS_NOT_NULLWithNullProperty() throws Exception
+ {
+ filter = FilterImpl.createFilter(new SimpleString("myNullProp IS NOT NULL"));
+
+ assertFalse(filter.match(message));
+
+ message.putStringProperty("myNullProp", "JMS");
+ assertTrue(filter.match(message));
+ }
+
+ public void testStringLike() throws Exception
+ {
+ // test LIKE operator with no wildcards
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'"));
+ Assert.assertFalse(filter.match(message));
+
+ // test where LIKE operand matches
+ doPutStringProperty("MyString", "astring");
+ Assert.assertTrue(filter.match(message));
+
+ // test one character string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a'"));
+ doPutStringProperty("MyString", "a");
+ Assert.assertTrue(filter.match(message));
+
+ // test empty string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE ''"));
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(filter.match(message));
+
+ // tests where operand does not match
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'"));
+
+ // test with extra characters at beginning
+ doPutStringProperty("MyString", "NOTastring");
+ Assert.assertTrue(!filter.match(message));
+
+ // test with extra characters at end
+ doPutStringProperty("MyString", "astringNOT");
+ Assert.assertTrue(!filter.match(message));
+
+ // test with extra characters in the middle
+ doPutStringProperty("MyString", "astNOTring");
+ Assert.assertTrue(!filter.match(message));
+
+ // test where operand is entirely different
+ doPutStringProperty("MyString", "totally different");
+ Assert.assertTrue(!filter.match(message));
+
+ // test case sensitivity
+ doPutStringProperty("MyString", "ASTRING");
+ Assert.assertTrue(!filter.match(message));
+
+ // test empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // test lower-case 'like' operator?
+ }
+
+ public void testStringLikeUnderbarWildcard() throws Exception
+ {
+ // test LIKE operator with the _ wildcard, which
+ // matches any single character
+
+ // first, some tests with the wildcard by itself
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_'"));
+ Assert.assertFalse(filter.match(message));
+
+ // test match against single character
+ doPutStringProperty("MyString", "a");
+ Assert.assertTrue(filter.match(message));
+
+ // test match failure against multiple characters
+ doPutStringProperty("MyString", "aaaaa");
+ Assert.assertTrue(!filter.match(message));
+
+ // test match failure against the empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // next, tests with wildcard at the beginning of the string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_bcdf'"));
+
+ // test match at beginning of string
+ doPutStringProperty("MyString", "abcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // match failure in first character after wildcard
+ doPutStringProperty("MyString", "aXcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in middle character
+ doPutStringProperty("MyString", "abXdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in last character
+ doPutStringProperty("MyString", "abcdX");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure with empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at beginning
+ doPutStringProperty("MyString", "XXXabcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at the end
+ doPutStringProperty("MyString", "abcdfXXX");
+ Assert.assertTrue(!filter.match(message));
+
+ // test that the _ wildcard does not match the 'empty' character
+ doPutStringProperty("MyString", "bcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // next, tests with wildcard at the end of the string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd_'"));
+
+ // test match at end of string
+ doPutStringProperty("MyString", "abcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // match failure in first character before wildcard
+ doPutStringProperty("MyString", "abcXf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in middle character
+ doPutStringProperty("MyString", "abXdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in first character
+ doPutStringProperty("MyString", "Xbcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure with empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at beginning
+ doPutStringProperty("MyString", "XXXabcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at the end
+ doPutStringProperty("MyString", "abcdfXXX");
+ Assert.assertTrue(!filter.match(message));
+
+ // test that the _ wildcard does not match the 'empty' character
+ doPutStringProperty("MyString", "abcd");
+ Assert.assertTrue(!filter.match(message));
+
+ // test match in middle of string
+
+ // next, tests with wildcard in the middle of the string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab_df'"));
+
+ // test match in the middle of string
+ doPutStringProperty("MyString", "abcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // match failure in first character before wildcard
+ doPutStringProperty("MyString", "aXcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in first character after wildcard
+ doPutStringProperty("MyString", "abcXf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in last character
+ doPutStringProperty("MyString", "abcdX");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure with empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at beginning
+ doPutStringProperty("MyString", "XXXabcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at the end
+ doPutStringProperty("MyString", "abcdfXXX");
+ Assert.assertTrue(!filter.match(message));
+
+ // test that the _ wildcard does not match the 'empty' character
+ doPutStringProperty("MyString", "abdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // test match failures
+ }
+
+ public void testNotLikeExpression() throws Exception
+ {
+ // Should evaluate to false when the property MyString is not set
+ filter = FilterImpl.createFilter(new SimpleString("NOT (MyString LIKE '%')"));
+
+ Assert.assertFalse(filter.match(message));
+ }
+
+ public void testStringLikePercentWildcard() throws Exception
+ {
+ // test LIKE operator with the % wildcard, which
+ // matches any sequence of characters
+ // note many of the tests are similar to those for _
+
+ // first, some tests with the wildcard by itself
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%'"));
+ Assert.assertFalse(filter.match(message));
+
+ // test match against single character
+ doPutStringProperty("MyString", "a");
+ Assert.assertTrue(filter.match(message));
+
+ // test match against multiple characters
+ doPutStringProperty("MyString", "aaaaa");
+ Assert.assertTrue(filter.match(message));
+
+ doPutStringProperty("MyString", "abcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // test match against the empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(filter.match(message));
+
+ // next, tests with wildcard at the beginning of the string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%bcdf'"));
+
+ // test match with single character at beginning of string
+ doPutStringProperty("MyString", "Xbcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // match with multiple characters at beginning
+ doPutStringProperty("MyString", "XXbcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // match failure in middle character
+ doPutStringProperty("MyString", "abXdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in last character
+ doPutStringProperty("MyString", "abcdX");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure with empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at the end
+ doPutStringProperty("MyString", "abcdfXXX");
+ Assert.assertTrue(!filter.match(message));
+
+ // test that the % wildcard matches the empty string
+ doPutStringProperty("MyString", "bcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // next, tests with wildcard at the end of the string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd%'"));
+
+ // test match of single character at end of string
+ doPutStringProperty("MyString", "abcdf");
+ Assert.assertTrue(filter.match(message));
+
+ // test match of multiple characters at end of string
+ doPutStringProperty("MyString", "abcdfgh");
+ Assert.assertTrue(filter.match(message));
+
+ // match failure in first character before wildcard
+ doPutStringProperty("MyString", "abcXf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in middle character
+ doPutStringProperty("MyString", "abXdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in first character
+ doPutStringProperty("MyString", "Xbcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure with empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at beginning
+ doPutStringProperty("MyString", "XXXabcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // test that the % wildcard matches the empty string
+ doPutStringProperty("MyString", "abcd");
+ Assert.assertTrue(filter.match(message));
+
+ // next, tests with wildcard in the middle of the string
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab%df'"));
+
+ // test match with single character in the middle of string
+ doPutStringProperty("MyString", "abXdf");
+ Assert.assertTrue(filter.match(message));
+
+ // test match with multiple characters in the middle of string
+ doPutStringProperty("MyString", "abXXXdf");
+ Assert.assertTrue(filter.match(message));
+
+ // match failure in first character before wildcard
+ doPutStringProperty("MyString", "aXcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in first character after wildcard
+ doPutStringProperty("MyString", "abcXf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure in last character
+ doPutStringProperty("MyString", "abcdX");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure with empty string
+ doPutStringProperty("MyString", "");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at beginning
+ doPutStringProperty("MyString", "XXXabcdf");
+ Assert.assertTrue(!filter.match(message));
+
+ // match failure due to extra characters at the end
+ doPutStringProperty("MyString", "abcdfXXX");
+ Assert.assertTrue(!filter.match(message));
+
+ // test that the % wildcard matches the empty string
+ doPutStringProperty("MyString", "abdf");
+ Assert.assertTrue(filter.match(message));
+
+ }
+
+ public void testStringLikePunctuation() throws Exception
+ {
+ // test proper handling of some punctuation characters.
+ // non-trivial since the underlying implementation might
+ // (and in fact currently does) use a general-purpose
+ // RE library, which has a different notion of which
+ // characters are wildcards
+
+ // the particular tests here are motivated by the
+ // wildcards of the current underlying RE engine,
+ // GNU regexp.
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a^$b'"));
+ Assert.assertFalse(filter.match(message));
+
+ doPutStringProperty("MyString", "a^$b");
+ Assert.assertTrue(filter.match(message));
+
+ // this one has a double backslash since backslash
+ // is interpreted specially by Java
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a\\dc'"));
+ doPutStringProperty("MyString", "a\\dc");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a.c'"));
+ doPutStringProperty("MyString", "abc");
+ Assert.assertTrue(!filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[abc]'"));
+ doPutStringProperty("MyString", "[abc]");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[^abc]'"));
+ doPutStringProperty("MyString", "[^abc]");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[a-c]'"));
+ doPutStringProperty("MyString", "[a-c]");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[:alpha]'"));
+ doPutStringProperty("MyString", "[:alpha]");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)'"));
+ doPutStringProperty("MyString", "(abc)");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a|bc'"));
+ doPutStringProperty("MyString", "a|bc");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)?'"));
+ doPutStringProperty("MyString", "(abc)?");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)*'"));
+ doPutStringProperty("MyString", "(abc)*");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)+'"));
+ doPutStringProperty("MyString", "(abc)+");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3}'"));
+ doPutStringProperty("MyString", "(abc){3}");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,5}'"));
+ doPutStringProperty("MyString", "(abc){3,5}");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,}'"));
+ doPutStringProperty("MyString", "(abc){3,}");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?=abc)'"));
+ doPutStringProperty("MyString", "(?=abc)");
+ Assert.assertTrue(filter.match(message));
+
+ filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?!abc)'"));
+ doPutStringProperty("MyString", "(?!abc)");
+ Assert.assertTrue(filter.match(message));
+ }
+
+ // Private -----------------------------------------------------------------------------------
+
+ private void doPutStringProperty(final String key, final String value)
+ {
+ message.putStringProperty(new SimpleString(key), new SimpleString(value));
+ }
+
+ private void testInvalidFilter(final String filterString) throws Exception
+ {
+ try
+ {
+ filter = FilterImpl.createFilter(filterString);
+ Assert.fail("Should throw exception");
+ }
+ catch (HornetQException e)
+ {
+ Assert.assertEquals(HornetQException.INVALID_FILTER_EXPRESSION, e.getCode());
+ }
+ }
+
+ private void testInvalidFilter(final SimpleString filterString) throws Exception
+ {
+ try
+ {
+ filter = FilterImpl.createFilter(filterString);
+ Assert.fail("Should throw exception");
+ }
+ catch (HornetQException e)
+ {
+ Assert.assertEquals(HornetQException.INVALID_FILTER_EXPRESSION, e.getCode());
+ }
+ }
+
+}
Copied: trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/OperatorTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/OperatorTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/OperatorTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/core/filter/impl/OperatorTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,459 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.core.filter.impl;
+
+import java.util.HashSet;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.filter.impl.Operator;
+
+/**
+ * A OperatorTest
+ *
+ * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
+ *
+ * Created 3 nov. 2008 17:22:22
+ *
+ *
+ */
+public class OperatorTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+ private static void assertSuccess(final int op, final Object arg1, final Object expectedResult) throws Exception
+ {
+ OperatorTest.assertOperationSuccess(new Operator(op, arg1), expectedResult);
+ }
+
+ private static void assertSuccess(final int op, final Object arg1, final Object arg2, final Object expectedResult) throws Exception
+ {
+ OperatorTest.assertOperationSuccess(new Operator(op, arg1, arg2), expectedResult);
+ }
+
+ private static void assertSuccess(final int op,
+ final Object arg1,
+ final Object arg2,
+ final Object arg3,
+ final Object expectedResult) throws Exception
+ {
+ OperatorTest.assertOperationSuccess(new Operator(op, arg1, arg2, arg3), expectedResult);
+ }
+
+ private static void assertOperationSuccess(final Operator operator, final Object expectedResult) throws Exception
+ {
+ Assert.assertEquals(expectedResult, operator.apply());
+ }
+
+ private static void assertFailure(final int op, final Object arg1) throws Exception
+ {
+ OperatorTest.assertOperationFailure(new Operator(op, arg1));
+ }
+
+ private static void assertFailure(final int op, final Object arg1, final Object arg2) throws Exception
+ {
+ OperatorTest.assertOperationFailure(new Operator(op, arg1, arg2));
+ }
+
+ private static void assertFailure(final int op, final Object arg1, final Object arg2, final Object arg3) throws Exception
+ {
+ OperatorTest.assertOperationFailure(new Operator(op, arg1, arg2, arg3));
+ }
+
+ private static void assertOperationFailure(final Operator operator)
+ {
+ try
+ {
+ operator.apply();
+ Assert.fail("expected to throw an exception");
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void test_EQUAL() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.EQUAL, 1, 1, true);
+ OperatorTest.assertSuccess(Operator.EQUAL, 1, 1.0, true);
+ OperatorTest.assertSuccess(Operator.EQUAL, 1, null, null);
+ OperatorTest.assertSuccess(Operator.EQUAL, 1.0, 1, true);
+ OperatorTest.assertSuccess(Operator.EQUAL, 1.0, 1.0, true);
+ OperatorTest.assertSuccess(Operator.EQUAL, 1.0, null, null);
+
+ OperatorTest.assertSuccess(Operator.EQUAL, false, false, true);
+ OperatorTest.assertSuccess(Operator.EQUAL, true, false, false);
+ OperatorTest.assertSuccess(Operator.EQUAL, false, true, false);
+ OperatorTest.assertSuccess(Operator.EQUAL, true, true, true);
+
+ SimpleString foo = new SimpleString("foo");
+ SimpleString foo2 = new SimpleString("foo");
+ SimpleString bar = new SimpleString("bar");
+ OperatorTest.assertSuccess(Operator.EQUAL, foo, foo, true);
+ OperatorTest.assertSuccess(Operator.EQUAL, foo, foo2, true);
+ OperatorTest.assertSuccess(Operator.EQUAL, foo, bar, false);
+ OperatorTest.assertSuccess(Operator.EQUAL, foo, null, false);
+
+ OperatorTest.assertSuccess(Operator.EQUAL, null, 1.0, false);
+ }
+
+ public void test_DIFFERENT() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.DIFFERENT, 2, 1, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, 2, 1.0, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, 2, null, null);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, 2.0, 1, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, 2.0, 1.0, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, 2.0, null, null);
+
+ OperatorTest.assertSuccess(Operator.DIFFERENT, false, false, false);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, true, false, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, false, true, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, true, true, false);
+
+ SimpleString foo = new SimpleString("foo");
+ SimpleString foo2 = new SimpleString("foo");
+ SimpleString bar = new SimpleString("bar");
+ OperatorTest.assertSuccess(Operator.DIFFERENT, foo, foo, false);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, foo, foo2, false);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, foo, bar, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, foo, null, null);
+
+ OperatorTest.assertSuccess(Operator.DIFFERENT, null, 1.0, true);
+ OperatorTest.assertSuccess(Operator.DIFFERENT, null, null, false);
+ }
+
+ public void test_IS_NULL() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.IS_NULL, null, true);
+ OperatorTest.assertSuccess(Operator.IS_NULL, 1, false);
+ }
+
+ public void test_IS_NOT_NULL() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.IS_NOT_NULL, null, false);
+ OperatorTest.assertSuccess(Operator.IS_NOT_NULL, 1, true);
+ }
+
+ public void test_ADD() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.ADD, 1, 1, 2L);
+ OperatorTest.assertSuccess(Operator.ADD, 1.0, 1, 2.0);
+ OperatorTest.assertSuccess(Operator.ADD, 1, 1.0, 2.0);
+ OperatorTest.assertSuccess(Operator.ADD, 1.0, 1.0, 2.0);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.ADD, true, 1.0);
+ OperatorTest.assertFailure(Operator.ADD, 1, true);
+ }
+
+ public void test_SUB() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.SUB, 2, 1, 1L);
+ OperatorTest.assertSuccess(Operator.SUB, 2.0, 1, 1.0);
+ OperatorTest.assertSuccess(Operator.SUB, 2, 1.0, 1.0);
+ OperatorTest.assertSuccess(Operator.SUB, 2.0, 1.0, 1.0);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.SUB, true, 1.0);
+ OperatorTest.assertFailure(Operator.SUB, 1, true);
+ }
+
+ public void test_MUL() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.MUL, 2, 1, 2L);
+ OperatorTest.assertSuccess(Operator.MUL, 2.0, 1, 2.0);
+ OperatorTest.assertSuccess(Operator.MUL, 2, 1.0, 2.0);
+ OperatorTest.assertSuccess(Operator.MUL, 2.0, 1.0, 2.0);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.MUL, 2, null, null);
+ OperatorTest.assertSuccess(Operator.MUL, null, 1.0, null);
+ OperatorTest.assertFailure(Operator.MUL, true, 1.0);
+ OperatorTest.assertFailure(Operator.MUL, 1, true);
+ }
+
+ public void test_DIV() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.DIV, 2, 2, 1L);
+ OperatorTest.assertSuccess(Operator.DIV, 2.0, 2, 1.0);
+ OperatorTest.assertSuccess(Operator.DIV, 2, 2.0, 1.0);
+ OperatorTest.assertSuccess(Operator.DIV, 2.0, 2.0, 1.0);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.DIV, 2, null, null);
+ OperatorTest.assertSuccess(Operator.DIV, null, 1.0, null);
+ OperatorTest.assertFailure(Operator.DIV, true, 1.0);
+ OperatorTest.assertFailure(Operator.DIV, 1, true);
+ }
+
+ public void test_NEG() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.NEG, 1, -1L);
+ OperatorTest.assertSuccess(Operator.NEG, -1.0, 1.0);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.NEG, true);
+ }
+
+ public void test_AND() throws Exception
+ {
+ // NULL and NULL -> NULL
+ OperatorTest.assertSuccess(Operator.AND, null, null, null);
+ // NULL and F -> F
+ OperatorTest.assertSuccess(Operator.AND, null, false, false);
+ // NULL and T -> NULL
+ OperatorTest.assertSuccess(Operator.AND, null, true, null);
+
+ // F and NULL -> F
+ OperatorTest.assertSuccess(Operator.AND, false, null, false);
+ // F and F -> F
+ OperatorTest.assertSuccess(Operator.AND, false, false, false);
+ // F and T -> F
+ OperatorTest.assertSuccess(Operator.AND, false, true, false);
+
+ // T and NULL -> NULL
+ OperatorTest.assertSuccess(Operator.AND, true, null, null);
+ // T and F -> F
+ OperatorTest.assertSuccess(Operator.AND, true, false, false);
+ // T and T -> T
+ OperatorTest.assertSuccess(Operator.AND, true, true, true);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.AND, 1.0, true);
+ OperatorTest.assertFailure(Operator.AND, true, 1.0);
+ OperatorTest.assertFailure(Operator.AND, null, 1.0);
+ }
+
+ public void test_OR() throws Exception
+ {
+ // NULL OR NULL -> NULL
+ OperatorTest.assertSuccess(Operator.OR, null, null, null);
+ // NULL OR F -> NULL
+ OperatorTest.assertSuccess(Operator.OR, null, false, null);
+ // NULL OR T -> T
+ OperatorTest.assertSuccess(Operator.OR, null, true, true);
+
+ // F or NULL -> NULL
+ OperatorTest.assertSuccess(Operator.OR, false, null, null);
+ // F or F -> F
+ OperatorTest.assertSuccess(Operator.OR, false, false, false);
+ // F or T -> F
+ OperatorTest.assertSuccess(Operator.OR, false, true, true);
+
+ // T or NULL -> T
+ OperatorTest.assertSuccess(Operator.OR, true, null, true);
+ // T or F -> T
+ OperatorTest.assertSuccess(Operator.OR, true, false, true);
+ // T or T -> T
+ OperatorTest.assertSuccess(Operator.OR, true, true, true);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.OR, 1.0, true);
+ OperatorTest.assertFailure(Operator.OR, false, 1.0);
+ OperatorTest.assertFailure(Operator.OR, null, 1.0);
+ }
+
+ public void test_NOT() throws Exception
+ {
+ // NOT NULL -> NULL
+ OperatorTest.assertSuccess(Operator.NOT, null, null);
+ // NOT F -> T
+ OperatorTest.assertSuccess(Operator.NOT, false, true);
+ // NOT T -> F
+ OperatorTest.assertSuccess(Operator.NOT, true, false);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.NOT, 1.0);
+ }
+
+ public void test_GT() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.GT, 2, 1, true);
+ OperatorTest.assertSuccess(Operator.GT, 2.0, 1, true);
+ OperatorTest.assertSuccess(Operator.GT, 2, 1.0, true);
+ OperatorTest.assertSuccess(Operator.GT, 2.0, 1.0, true);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.GT, 2.0, true, false);
+ OperatorTest.assertSuccess(Operator.GT, 2, null, null);
+ OperatorTest.assertSuccess(Operator.GT, true, 1.0, false);
+ OperatorTest.assertSuccess(Operator.GT, null, 1, null);
+ OperatorTest.assertSuccess(Operator.GT, true, true, false);
+ OperatorTest.assertSuccess(Operator.GT, null, null, null);
+ }
+
+ public void test_GE() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.GE, 1, 1, true);
+ OperatorTest.assertSuccess(Operator.GE, 1.0, 1, true);
+ OperatorTest.assertSuccess(Operator.GE, 1, 1.0, true);
+ OperatorTest.assertSuccess(Operator.GE, 1.0, 1.0, true);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.GE, 2.0, true, false);
+ OperatorTest.assertSuccess(Operator.GE, 2, null, null);
+ OperatorTest.assertSuccess(Operator.GE, true, 1.0, false);
+ OperatorTest.assertSuccess(Operator.GE, null, 1, null);
+ OperatorTest.assertSuccess(Operator.GE, true, true, false);
+ OperatorTest.assertSuccess(Operator.GE, null, null, null);
+ }
+
+ public void test_LT() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.LT, 1, 2, true);
+ OperatorTest.assertSuccess(Operator.LT, 1.0, 2, true);
+ OperatorTest.assertSuccess(Operator.LT, 1, 2.0, true);
+ OperatorTest.assertSuccess(Operator.LT, 1.0, 2.0, true);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.LT, 1.0, true, false);
+ OperatorTest.assertSuccess(Operator.LT, 1, null, null);
+ OperatorTest.assertSuccess(Operator.LT, true, 2.0, false);
+ OperatorTest.assertSuccess(Operator.LT, null, 2, null);
+ OperatorTest.assertSuccess(Operator.LT, true, true, false);
+ OperatorTest.assertSuccess(Operator.LT, null, null, null);
+ }
+
+ public void test_LE() throws Exception
+ {
+ OperatorTest.assertSuccess(Operator.LE, 1, 1, true);
+ OperatorTest.assertSuccess(Operator.LE, 1.0, 1, true);
+ OperatorTest.assertSuccess(Operator.LE, 1, 1.0, true);
+ OperatorTest.assertSuccess(Operator.LE, 1.0, 1.0, true);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.LE, 1.0, true, false);
+ OperatorTest.assertSuccess(Operator.LE, 1, null, null);
+ OperatorTest.assertSuccess(Operator.LE, true, 1.0, false);
+ OperatorTest.assertSuccess(Operator.LE, null, 1, null);
+ OperatorTest.assertSuccess(Operator.LE, true, true, false);
+ OperatorTest.assertSuccess(Operator.LE, null, null, null);
+ }
+
+ public void test_BETWEEN() throws Exception
+ {
+ // 2 BETWEEN 1 AND 3
+ OperatorTest.assertSuccess(Operator.BETWEEN, 2, 1, 3, true);
+ OperatorTest.assertSuccess(Operator.BETWEEN, 2.0, 1.0, 3.0, true);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.BETWEEN, true, 1, 3, false);
+ OperatorTest.assertSuccess(Operator.BETWEEN, null, null, 3, null);
+ }
+
+ public void test_NOT_BETWEEN() throws Exception
+ {
+ // 2 NOT BETWEEN 3 AND 4
+ OperatorTest.assertSuccess(Operator.NOT_BETWEEN, 2, 3, 4, true);
+ OperatorTest.assertSuccess(Operator.NOT_BETWEEN, 2.0, 3.0, 4.0, true);
+
+ // incompatible types
+ OperatorTest.assertSuccess(Operator.NOT_BETWEEN, true, 1, 3, false);
+ OperatorTest.assertSuccess(Operator.NOT_BETWEEN, null, null, 3, null);
+ }
+
+ public void test_IN() throws Exception
+ {
+ HashSet<SimpleString> set = new HashSet<SimpleString>();
+ set.add(new SimpleString("foo"));
+ set.add(new SimpleString("bar"));
+ set.add(new SimpleString("baz"));
+
+ SimpleString foo = new SimpleString("foo");
+
+ OperatorTest.assertSuccess(Operator.IN, foo, set, true);
+ OperatorTest.assertSuccess(Operator.IN, foo, new HashSet<SimpleString>(), false);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.IN, true, set);
+ }
+
+ public void test_NOT_IN() throws Exception
+ {
+ HashSet<SimpleString> set = new HashSet<SimpleString>();
+ set.add(new SimpleString("foo"));
+ set.add(new SimpleString("bar"));
+ set.add(new SimpleString("baz"));
+
+ SimpleString foo = new SimpleString("foo");
+
+ OperatorTest.assertSuccess(Operator.NOT_IN, foo, set, false);
+ OperatorTest.assertSuccess(Operator.NOT_IN, foo, new HashSet<SimpleString>(), true);
+
+ // incompatible types
+ OperatorTest.assertFailure(Operator.NOT_IN, true, set);
+ }
+
+ public void test_LIKE() throws Exception
+ {
+ SimpleString pattern = new SimpleString("12%3");
+ OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("123"), pattern, true);
+ OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("12993"), pattern, true);
+ OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("1234"), pattern, false);
+
+ pattern = new SimpleString("l_se");
+ OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("lose"), pattern, true);
+ OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("loose"), pattern, false);
+
+ OperatorTest.assertSuccess(Operator.LIKE, null, pattern, null);
+ }
+
+ public void test_LIKE_ESCAPE() throws Exception
+ {
+ SimpleString pattern = new SimpleString("\\_%");
+ SimpleString escapeChar = new SimpleString("\\");
+ OperatorTest.assertSuccess(Operator.LIKE_ESCAPE, new SimpleString("_foo"), pattern, escapeChar, true);
+ OperatorTest.assertSuccess(Operator.LIKE_ESCAPE, new SimpleString("bar"), pattern, escapeChar, false);
+ OperatorTest.assertSuccess(Operator.LIKE_ESCAPE, null, pattern, escapeChar, null);
+
+ OperatorTest.assertFailure(Operator.LIKE_ESCAPE,
+ new SimpleString("_foo"),
+ pattern,
+ new SimpleString("must be a single char"));
+ }
+
+ public void test_NOT_LIKE() throws Exception
+ {
+ SimpleString pattern = new SimpleString("12%3");
+ OperatorTest.assertSuccess(Operator.NOT_LIKE, new SimpleString("123"), pattern, false);
+ OperatorTest.assertSuccess(Operator.NOT_LIKE, new SimpleString("12993"), pattern, false);
+ OperatorTest.assertSuccess(Operator.NOT_LIKE, new SimpleString("1234"), pattern, true);
+ OperatorTest.assertSuccess(Operator.NOT_LIKE, null, pattern, null);
+ }
+
+ public void test_NOT_LIKE_ESCAPE() throws Exception
+ {
+ SimpleString pattern = new SimpleString("\\_%");
+ SimpleString escapeChar = new SimpleString("\\");
+ OperatorTest.assertSuccess(Operator.NOT_LIKE_ESCAPE, new SimpleString("_foo"), pattern, escapeChar, false);
+ OperatorTest.assertSuccess(Operator.NOT_LIKE_ESCAPE, new SimpleString("bar"), pattern, escapeChar, true);
+ OperatorTest.assertSuccess(Operator.NOT_LIKE_ESCAPE, null, pattern, escapeChar, null);
+
+ OperatorTest.assertFailure(Operator.NOT_LIKE_ESCAPE,
+ new SimpleString("_foo"),
+ pattern,
+ new SimpleString("must be a single char"));
+ }
+}
Copied: trunk/hornetq-core/src/test/java/org/hornetq/util/CompressionUtilTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/CompressionUtilTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/util/CompressionUtilTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/util/CompressionUtilTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.zip.Deflater;
+
+import junit.framework.TestCase;
+
+import org.hornetq.utils.DeflaterReader;
+import org.hornetq.utils.InflaterReader;
+import org.hornetq.utils.InflaterWriter;
+
+/**
+ * A CompressionUtilTest
+ *
+ * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
+ *
+ */
+public class CompressionUtilTest extends TestCase
+{
+
+ public void testDeflaterReader() throws Exception
+ {
+ String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+ byte[] input = inputString.getBytes("UTF-8");
+
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
+
+ AtomicLong counter = new AtomicLong(0);
+ DeflaterReader reader = new DeflaterReader(inputStream, counter);
+
+ ArrayList<Integer> zipHolder = new ArrayList<Integer>();
+ int b = reader.read();
+
+ while (b != -1)
+ {
+ zipHolder.add(b);
+ b = reader.read();
+ }
+
+ assertEquals(input.length, counter.get());
+
+ byte[] allCompressed = new byte[zipHolder.size()];
+ for (int i = 0; i < allCompressed.length; i++)
+ {
+ allCompressed[i] = (byte) zipHolder.get(i).intValue();
+ }
+
+ byte[] output = new byte[30];
+ Deflater compresser = new Deflater();
+ compresser.setInput(input);
+ compresser.finish();
+ int compressedDataLength = compresser.deflate(output);
+
+ compareByteArray(allCompressed, output, compressedDataLength);
+ }
+
+ public void testDeflaterReader2() throws Exception
+ {
+ String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+ byte[] input = inputString.getBytes("UTF-8");
+
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
+ AtomicLong counter = new AtomicLong(0);
+
+ DeflaterReader reader = new DeflaterReader(inputStream, counter);
+
+ byte[] buffer = new byte[7];
+ ArrayList<Integer> zipHolder = new ArrayList<Integer>();
+
+ int n = reader.read(buffer);
+ while (n != -1)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ zipHolder.add((int)buffer[i]);
+ }
+ n = reader.read(buffer);
+ }
+
+ assertEquals(input.length, counter.get());
+
+ byte[] allCompressed = new byte[zipHolder.size()];
+ for (int i = 0; i < allCompressed.length; i++)
+ {
+ allCompressed[i] = (byte) zipHolder.get(i).intValue();
+ }
+
+ byte[] output = new byte[30];
+ Deflater compresser = new Deflater();
+ compresser.setInput(input);
+ compresser.finish();
+ int compressedDataLength = compresser.deflate(output);
+
+ compareByteArray(allCompressed, output, compressedDataLength);
+ }
+
+ public void testInflaterReader() throws Exception
+ {
+ String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+ byte[] input = inputString.getBytes("UTF-8");
+ byte[] output = new byte[30];
+ Deflater compresser = new Deflater();
+ compresser.setInput(input);
+ compresser.finish();
+ int compressedDataLength = compresser.deflate(output);
+
+ byte[] zipBytes = new byte[compressedDataLength];
+
+ System.arraycopy(output, 0, zipBytes, 0, compressedDataLength);
+ ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes);
+
+ InflaterReader inflater = new InflaterReader(byteInput);
+ ArrayList<Integer> holder = new ArrayList<Integer>();
+ int read = inflater.read();
+
+ while (read != -1)
+ {
+ holder.add(read);
+ read = inflater.read();
+ }
+
+ byte[] result = new byte[holder.size()];
+
+ for (int i = 0; i < result.length; i++)
+ {
+ result[i] = holder.get(i).byteValue();
+ }
+
+ String txt = new String(result);
+
+ assertEquals(inputString, txt);
+
+ }
+
+ public void testInflaterWriter() throws Exception
+ {
+ String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+ byte[] input = inputString.getBytes("UTF-8");
+ byte[] output = new byte[30];
+ Deflater compresser = new Deflater();
+ compresser.setInput(input);
+ compresser.finish();
+ int compressedDataLength = compresser.deflate(output);
+
+ byte[] zipBytes = new byte[compressedDataLength];
+
+ System.arraycopy(output, 0, zipBytes, 0, compressedDataLength);
+ ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes);
+
+ ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
+ InflaterWriter writer = new InflaterWriter(byteOutput);
+
+ byte[] zipBuffer = new byte[12];
+
+ int n = byteInput.read(zipBuffer);
+ while (n > 0)
+ {
+ writer.write(zipBuffer, 0, n);
+ n = byteInput.read(zipBuffer);
+ }
+
+ writer.close();
+
+ byte[] outcome = byteOutput.toByteArray();
+ String outStr = new String(outcome);
+
+ assertEquals(inputString, outStr);
+ }
+
+ private void compareByteArray(byte[] first, byte[] second, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
+ assertEquals(first[i], second[i]);
+ }
+ }
+}
Copied: trunk/hornetq-core/src/test/java/org/hornetq/util/ConcurrentHashSetTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/ConcurrentHashSetTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/util/ConcurrentHashSetTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/util/ConcurrentHashSetTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.util;
+
+import java.util.Iterator;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.tests.util.RandomUtil;
+import org.hornetq.utils.ConcurrentHashSet;
+import org.hornetq.utils.ConcurrentSet;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class ConcurrentHashSetTest extends TestCase
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private ConcurrentSet<String> set;
+
+ private String element;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testAdd() throws Exception
+ {
+ Assert.assertTrue(set.add(element));
+ Assert.assertFalse(set.add(element));
+ }
+
+ public void testAddIfAbsent() throws Exception
+ {
+ Assert.assertTrue(set.addIfAbsent(element));
+ Assert.assertFalse(set.addIfAbsent(element));
+ }
+
+ public void testRemove() throws Exception
+ {
+ Assert.assertTrue(set.add(element));
+
+ Assert.assertTrue(set.remove(element));
+ Assert.assertFalse(set.remove(element));
+ }
+
+ public void testContains() throws Exception
+ {
+ Assert.assertFalse(set.contains(element));
+
+ Assert.assertTrue(set.add(element));
+ Assert.assertTrue(set.contains(element));
+
+ Assert.assertTrue(set.remove(element));
+ Assert.assertFalse(set.contains(element));
+ }
+
+ public void testSize() throws Exception
+ {
+ Assert.assertEquals(0, set.size());
+
+ Assert.assertTrue(set.add(element));
+ Assert.assertEquals(1, set.size());
+
+ Assert.assertTrue(set.remove(element));
+ Assert.assertEquals(0, set.size());
+ }
+
+ public void testClear() throws Exception
+ {
+ Assert.assertTrue(set.add(element));
+
+ Assert.assertTrue(set.contains(element));
+ set.clear();
+ Assert.assertFalse(set.contains(element));
+ }
+
+ public void testIsEmpty() throws Exception
+ {
+ Assert.assertTrue(set.isEmpty());
+
+ Assert.assertTrue(set.add(element));
+ Assert.assertFalse(set.isEmpty());
+
+ set.clear();
+ Assert.assertTrue(set.isEmpty());
+ }
+
+ public void testIterator() throws Exception
+ {
+ set.add(element);
+
+ Iterator<String> iterator = set.iterator();
+ while (iterator.hasNext())
+ {
+ String e = iterator.next();
+ Assert.assertEquals(element, e);
+ }
+ }
+
+ // TestCase overrides --------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ set = new ConcurrentHashSet<String>();
+ element = RandomUtil.randomString();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ set = null;
+ element = null;
+
+ super.tearDown();
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Copied: trunk/hornetq-core/src/test/java/org/hornetq/util/TimeAndCounterIDGeneratorTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TimeAndCounterIDGeneratorTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/util/TimeAndCounterIDGeneratorTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/util/TimeAndCounterIDGeneratorTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.util;
+
+import java.util.concurrent.CountDownLatch;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.utils.ConcurrentHashSet;
+import org.hornetq.utils.TimeAndCounterIDGenerator;
+
+/**
+ * A TimeAndCounterIDGeneratorTest
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a> Created 24-Sep-08 3:42:25 PM
+ */
+public class TimeAndCounterIDGeneratorTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testCalculation()
+ {
+ TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+ long max = 11000;
+
+ long lastNr = 0;
+
+ for (long i = 0; i < max; i++)
+ {
+ long seqNr = seq.generateID();
+
+ Assert.assertTrue("The sequence generator should aways generate crescent numbers", seqNr > lastNr);
+
+ lastNr = seqNr;
+ }
+
+ }
+
+ public void testCalculationRefresh()
+ {
+ TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+
+ long id1 = seq.generateID();
+ Assert.assertEquals(1, id1 & 0xffff);
+ Assert.assertEquals(2, seq.generateID() & 0xffff);
+
+ seq.refresh();
+
+ long id2 = seq.generateID();
+
+ Assert.assertTrue(id2 > id1);
+
+ Assert.assertEquals(1, id2 & 0xffff);
+
+ }
+
+ public void testCalculationOnMultiThread() throws Throwable
+ {
+ final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<Long>();
+
+ final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+
+ System.out.println("Time = " + TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + ", " + seq);
+
+ final int NUMBER_OF_THREADS = 100;
+
+ final int NUMBER_OF_IDS = 10;
+
+ final CountDownLatch latchAlign = new CountDownLatch(NUMBER_OF_THREADS);
+
+ final CountDownLatch latchStart = new CountDownLatch(1);
+
+ class T1 extends Thread
+ {
+ Throwable e;
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ latchAlign.countDown();
+ latchStart.await();
+
+ long lastValue = 0l;
+ for (int i = 0; i < NUMBER_OF_IDS; i++)
+ {
+ long value = seq.generateID();
+ Assert.assertTrue(TimeAndCounterIDGeneratorTest.hex(value) + " should be greater than " +
+ TimeAndCounterIDGeneratorTest.hex(lastValue) +
+ " on seq " +
+ seq.toString(), value > lastValue);
+ lastValue = value;
+
+ hashSet.add(value);
+ }
+ }
+ catch (Throwable e)
+ {
+ this.e = e;
+ }
+ }
+
+ };
+
+ T1[] arrays = new T1[NUMBER_OF_THREADS];
+
+ for (int i = 0; i < arrays.length; i++)
+ {
+ arrays[i] = new T1();
+ arrays[i].start();
+ }
+
+ latchAlign.await();
+
+ latchStart.countDown();
+
+ for (T1 t : arrays)
+ {
+ t.join();
+ if (t.e != null)
+ {
+ throw t.e;
+ }
+ }
+
+ Assert.assertEquals(NUMBER_OF_THREADS * NUMBER_OF_IDS, hashSet.size());
+
+ hashSet.clear();
+
+ }
+
+ public void testWrapID() throws Throwable
+ {
+ final ConcurrentHashSet<Long> hashSet = new org.hornetq.utils.ConcurrentHashSet<Long>();
+
+ TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+
+ System.out.println("Current Time = " + TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + " " + seq);
+
+ seq.setInternalDate(System.currentTimeMillis() + 10000l); // 10 seconds in the future
+
+ seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to explode
+
+ try
+ {
+ // This is simulating a situation where we generated more than 268 million messages on the same time interval
+ seq.generateID();
+ Assert.fail("It was supposed to throw an exception, as the counter was set to explode on this test");
+ }
+ catch (Exception e)
+ {
+ }
+
+ seq = new TimeAndCounterIDGenerator();
+
+ seq.setInternalDate(System.currentTimeMillis() - 10000l); // 10 seconds in the past
+
+ long timeMark = seq.getInternalTimeMark();
+
+ seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to explode
+
+ // This is ok... the time portion would be added to the next one generated 10 seconds ago
+ seq.generateID();
+
+ Assert.assertTrue(TimeAndCounterIDGeneratorTest.hex(timeMark) + " < " +
+ TimeAndCounterIDGeneratorTest.hex(seq.getInternalTimeMark()),
+ timeMark < seq.getInternalTimeMark());
+ }
+
+ private static String hex(final long value)
+ {
+ return String.format("%1$X", value);
+ }
+
+}
Copied: trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesConversionTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesConversionTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesConversionTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,364 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.util;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.api.core.PropertyConversionException;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.tests.util.RandomUtil;
+import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.utils.TypedProperties;
+
+/**
+ * A TypedPropertiesConversionTest
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class TypedPropertiesConversionTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private TypedProperties props;
+
+ private SimpleString key;
+
+ private final SimpleString unknownKey = new SimpleString("this.key.is.never.used");
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ key = RandomUtil.randomSimpleString();
+ props = new TypedProperties();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ key = null;
+ props = null;
+
+ super.tearDown();
+ }
+
+ public void testBooleanProperty() throws Exception
+ {
+ Boolean val = RandomUtil.randomBoolean();
+ props.putBooleanProperty(key, val);
+
+ Assert.assertEquals(val, props.getBooleanProperty(key));
+ Assert.assertEquals(new SimpleString(Boolean.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Boolean.toString(val)));
+ Assert.assertEquals(val, props.getBooleanProperty(key));
+
+ try
+ {
+ props.putByteProperty(key, RandomUtil.randomByte());
+ props.getBooleanProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ Assert.assertFalse(props.getBooleanProperty(unknownKey));
+ }
+
+ public void testCharProperty() throws Exception
+ {
+ Character val = RandomUtil.randomChar();
+ props.putCharProperty(key, val);
+
+ Assert.assertEquals(val, props.getCharProperty(key));
+ Assert.assertEquals(new SimpleString(Character.toString(val)), props.getSimpleStringProperty(key));
+
+ try
+ {
+ props.putByteProperty(key, RandomUtil.randomByte());
+ props.getCharProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getCharProperty(unknownKey);
+ Assert.fail();
+ }
+ catch (NullPointerException e)
+ {
+ }
+ }
+
+ public void testByteProperty() throws Exception
+ {
+ Byte val = RandomUtil.randomByte();
+ props.putByteProperty(key, val);
+
+ Assert.assertEquals(val, props.getByteProperty(key));
+ Assert.assertEquals(new SimpleString(Byte.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Byte.toString(val)));
+ Assert.assertEquals(val, props.getByteProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, RandomUtil.randomBoolean());
+ props.getByteProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getByteProperty(unknownKey);
+ Assert.fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testIntProperty() throws Exception
+ {
+ Integer val = RandomUtil.randomInt();
+ props.putIntProperty(key, val);
+
+ Assert.assertEquals(val, props.getIntProperty(key));
+ Assert.assertEquals(new SimpleString(Integer.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Integer.toString(val)));
+ Assert.assertEquals(val, props.getIntProperty(key));
+
+ Byte byteVal = RandomUtil.randomByte();
+ props.putByteProperty(key, byteVal);
+ Assert.assertEquals(Integer.valueOf(byteVal), props.getIntProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, RandomUtil.randomBoolean());
+ props.getIntProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getIntProperty(unknownKey);
+ Assert.fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testLongProperty() throws Exception
+ {
+ Long val = RandomUtil.randomLong();
+ props.putLongProperty(key, val);
+
+ Assert.assertEquals(val, props.getLongProperty(key));
+ Assert.assertEquals(new SimpleString(Long.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Long.toString(val)));
+ Assert.assertEquals(val, props.getLongProperty(key));
+
+ Byte byteVal = RandomUtil.randomByte();
+ props.putByteProperty(key, byteVal);
+ Assert.assertEquals(Long.valueOf(byteVal), props.getLongProperty(key));
+
+ Short shortVal = RandomUtil.randomShort();
+ props.putShortProperty(key, shortVal);
+ Assert.assertEquals(Long.valueOf(shortVal), props.getLongProperty(key));
+
+ Integer intVal = RandomUtil.randomInt();
+ props.putIntProperty(key, intVal);
+ Assert.assertEquals(Long.valueOf(intVal), props.getLongProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, RandomUtil.randomBoolean());
+ props.getLongProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getLongProperty(unknownKey);
+ Assert.fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testDoubleProperty() throws Exception
+ {
+ Double val = RandomUtil.randomDouble();
+ props.putDoubleProperty(key, val);
+
+ Assert.assertEquals(val, props.getDoubleProperty(key));
+ Assert.assertEquals(new SimpleString(Double.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Double.toString(val)));
+ Assert.assertEquals(val, props.getDoubleProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, RandomUtil.randomBoolean());
+ props.getDoubleProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getDoubleProperty(unknownKey);
+ Assert.fail();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ public void testFloatProperty() throws Exception
+ {
+ Float val = RandomUtil.randomFloat();
+ props.putFloatProperty(key, val);
+
+ Assert.assertEquals(val, props.getFloatProperty(key));
+ Assert.assertEquals(Double.valueOf(val), props.getDoubleProperty(key));
+ Assert.assertEquals(new SimpleString(Float.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Float.toString(val)));
+ Assert.assertEquals(val, props.getFloatProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, RandomUtil.randomBoolean());
+ props.getFloatProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getFloatProperty(unknownKey);
+ Assert.fail();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ public void testShortProperty() throws Exception
+ {
+ Short val = RandomUtil.randomShort();
+ props.putShortProperty(key, val);
+
+ Assert.assertEquals(val, props.getShortProperty(key));
+ Assert.assertEquals(Integer.valueOf(val), props.getIntProperty(key));
+ Assert.assertEquals(new SimpleString(Short.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Short.toString(val)));
+ Assert.assertEquals(val, props.getShortProperty(key));
+
+ Byte byteVal = RandomUtil.randomByte();
+ props.putByteProperty(key, byteVal);
+ Assert.assertEquals(Short.valueOf(byteVal), props.getShortProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, RandomUtil.randomBoolean());
+ props.getShortProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getShortProperty(unknownKey);
+ Assert.fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testSimpleStringProperty() throws Exception
+ {
+ SimpleString strVal = RandomUtil.randomSimpleString();
+ props.putSimpleStringProperty(key, strVal);
+ Assert.assertEquals(strVal, props.getSimpleStringProperty(key));
+ }
+
+ public void testBytesProperty() throws Exception
+ {
+ byte[] val = RandomUtil.randomBytes();
+ props.putBytesProperty(key, val);
+
+ UnitTestCase.assertEqualsByteArrays(val, props.getBytesProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, RandomUtil.randomBoolean());
+ props.getBytesProperty(key);
+ Assert.fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ Assert.assertNull(props.getBytesProperty(unknownKey));
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Copied: trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/util/TypedPropertiesTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.util;
+import java.util.Iterator;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.tests.util.RandomUtil;
+import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.utils.TypedProperties;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ */
+public class TypedPropertiesTest extends TestCase
+{
+
+ private static void assertEqualsTypeProperties(final TypedProperties expected, final TypedProperties actual)
+ {
+ Assert.assertNotNull(expected);
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(expected.getEncodeSize(), actual.getEncodeSize());
+ Assert.assertEquals(expected.getPropertyNames(), actual.getPropertyNames());
+ Iterator<SimpleString> iterator = actual.getPropertyNames().iterator();
+ while (iterator.hasNext())
+ {
+ SimpleString key = iterator.next();
+ Object expectedValue = expected.getProperty(key);
+ Object actualValue = actual.getProperty(key);
+ if (expectedValue instanceof byte[] && actualValue instanceof byte[])
+ {
+ byte[] expectedBytes = (byte[])expectedValue;
+ byte[] actualBytes = (byte[])actualValue;
+ UnitTestCase.assertEqualsByteArrays(expectedBytes, actualBytes);
+ }
+ else
+ {
+ Assert.assertEquals(expectedValue, actualValue);
+ }
+ }
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ private TypedProperties props;
+
+ private SimpleString key;
+
+ public void testCopyContructor() throws Exception
+ {
+ props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
+
+ TypedProperties copy = new TypedProperties(props);
+
+ Assert.assertEquals(props.getEncodeSize(), copy.getEncodeSize());
+ Assert.assertEquals(props.getPropertyNames(), copy.getPropertyNames());
+
+ Assert.assertTrue(copy.containsProperty(key));
+ Assert.assertEquals(props.getProperty(key), copy.getProperty(key));
+ }
+
+ public void testRemove() throws Exception
+ {
+ props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
+
+ Assert.assertTrue(props.containsProperty(key));
+ Assert.assertNotNull(props.getProperty(key));
+
+ props.removeProperty(key);
+
+ Assert.assertFalse(props.containsProperty(key));
+ Assert.assertNull(props.getProperty(key));
+ }
+
+ public void testClear() throws Exception
+ {
+ props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
+
+ Assert.assertTrue(props.containsProperty(key));
+ Assert.assertNotNull(props.getProperty(key));
+
+ props.clear();
+
+ Assert.assertFalse(props.containsProperty(key));
+ Assert.assertNull(props.getProperty(key));
+ }
+
+ public void testKey() throws Exception
+ {
+ props.putBooleanProperty(key, true);
+ boolean bool = (Boolean)props.getProperty(key);
+ Assert.assertEquals(true, bool);
+
+ props.putCharProperty(key, 'a');
+ char c = (Character)props.getProperty(key);
+ Assert.assertEquals('a', c);
+ }
+
+ public void testGetPropertyOnEmptyProperties() throws Exception
+ {
+ Assert.assertFalse(props.containsProperty(key));
+ Assert.assertNull(props.getProperty(key));
+ }
+
+ public void testRemovePropertyOnEmptyProperties() throws Exception
+ {
+ Assert.assertFalse(props.containsProperty(key));
+ Assert.assertNull(props.removeProperty(key));
+ }
+
+ public void testNullProperty() throws Exception
+ {
+ props.putSimpleStringProperty(key, null);
+ Assert.assertTrue(props.containsProperty(key));
+ Assert.assertNull(props.getProperty(key));
+ }
+
+ public void testBytesPropertyWithNull() throws Exception
+ {
+ props.putBytesProperty(key, null);
+
+ Assert.assertTrue(props.containsProperty(key));
+ byte[] bb = (byte[])props.getProperty(key);
+ Assert.assertNull(bb);
+ }
+
+ public void testTypedProperties() throws Exception
+ {
+ SimpleString longKey = RandomUtil.randomSimpleString();
+ long longValue = RandomUtil.randomLong();
+ SimpleString simpleStringKey = RandomUtil.randomSimpleString();
+ SimpleString simpleStringValue = RandomUtil.randomSimpleString();
+ TypedProperties otherProps = new TypedProperties();
+ otherProps.putLongProperty(longKey, longValue);
+ otherProps.putSimpleStringProperty(simpleStringKey, simpleStringValue);
+
+ props.putTypedProperties(otherProps);
+
+ long ll = props.getLongProperty(longKey);
+ Assert.assertEquals(longValue, ll);
+ SimpleString ss = props.getSimpleStringProperty(simpleStringKey);
+ Assert.assertEquals(simpleStringValue, ss);
+ }
+
+ public void testEmptyTypedProperties() throws Exception
+ {
+ Assert.assertEquals(0, props.getPropertyNames().size());
+
+ props.putTypedProperties(new TypedProperties());
+
+ Assert.assertEquals(0, props.getPropertyNames().size());
+ }
+
+ public void testNullTypedProperties() throws Exception
+ {
+ Assert.assertEquals(0, props.getPropertyNames().size());
+
+ props.putTypedProperties(null);
+
+ Assert.assertEquals(0, props.getPropertyNames().size());
+ }
+
+ public void testEncodeDecode() throws Exception
+ {
+ props.putByteProperty(RandomUtil.randomSimpleString(), RandomUtil.randomByte());
+ props.putBytesProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBytes());
+ props.putBytesProperty(RandomUtil.randomSimpleString(), null);
+ props.putBooleanProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBoolean());
+ props.putShortProperty(RandomUtil.randomSimpleString(), RandomUtil.randomShort());
+ props.putIntProperty(RandomUtil.randomSimpleString(), RandomUtil.randomInt());
+ props.putLongProperty(RandomUtil.randomSimpleString(), RandomUtil.randomLong());
+ props.putFloatProperty(RandomUtil.randomSimpleString(), RandomUtil.randomFloat());
+ props.putDoubleProperty(RandomUtil.randomSimpleString(), RandomUtil.randomDouble());
+ props.putCharProperty(RandomUtil.randomSimpleString(), RandomUtil.randomChar());
+ props.putSimpleStringProperty(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString());
+ props.putSimpleStringProperty(RandomUtil.randomSimpleString(), null);
+ SimpleString keyToRemove = RandomUtil.randomSimpleString();
+ props.putSimpleStringProperty(keyToRemove, RandomUtil.randomSimpleString());
+
+ HornetQBuffer buffer = HornetQBuffers.dynamicBuffer(1024);
+ props.encode(buffer);
+
+ Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
+
+ TypedProperties decodedProps = new TypedProperties();
+ decodedProps.decode(buffer);
+
+ TypedPropertiesTest.assertEqualsTypeProperties(props, decodedProps);
+
+ buffer.clear();
+
+ // After removing a property, you should still be able to encode the Property
+ props.removeProperty(keyToRemove);
+ props.encode(buffer);
+
+ Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
+ }
+
+ public void testEncodeDecodeEmpty() throws Exception
+ {
+ TypedProperties emptyProps = new TypedProperties();
+
+ HornetQBuffer buffer = HornetQBuffers.dynamicBuffer(1024);
+ emptyProps.encode(buffer);
+
+ Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
+
+ TypedProperties decodedProps = new TypedProperties();
+ decodedProps.decode(buffer);
+
+ TypedPropertiesTest.assertEqualsTypeProperties(emptyProps, decodedProps);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ props = new TypedProperties();
+ key = RandomUtil.randomSimpleString();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ key = null;
+ props = null;
+
+ super.tearDown();
+ }
+}
Copied: trunk/hornetq-core/src/test/java/org/hornetq/util/XMLUtilTest.java (from rev 12016, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/XMLUtilTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/util/XMLUtilTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/util/XMLUtilTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -0,0 +1,256 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.util;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.utils.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author <a href="mailto:ovidiu@feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class XMLUtilTest extends TestCase
+{
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testGetTextContext_1() throws Exception
+ {
+ String document = "<blah>foo</blah>";
+
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
+
+ Assert.assertEquals("foo", org.hornetq.utils.XMLUtil.getTextContent(e));
+ }
+
+ public void testGetTextContext_2() throws Exception
+ {
+ String document = "<blah someattribute=\"somevalue\">foo</blah>";
+
+ Element e = XMLUtil.stringToElement(document);
+
+ Assert.assertEquals("foo", org.hornetq.utils.XMLUtil.getTextContent(e));
+ }
+
+ public void testGetTextContext_3() throws Exception
+ {
+ String document = "<blah someattribute=\"somevalue\"><a/></blah>";
+
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
+
+ String s = org.hornetq.utils.XMLUtil.getTextContent(e);
+
+ Element subelement = org.hornetq.utils.XMLUtil.stringToElement(s);
+
+ Assert.assertEquals("a", subelement.getNodeName());
+ }
+
+ public void testGetTextContext_4() throws Exception
+ {
+ String document = "<blah someattribute=\"somevalue\"><a></a></blah>";
+
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
+
+ String s = org.hornetq.utils.XMLUtil.getTextContent(e);
+
+ Element subelement = org.hornetq.utils.XMLUtil.stringToElement(s);
+
+ Assert.assertEquals("a", subelement.getNodeName());
+ }
+
+ public void testGetTextContext_5() throws Exception
+ {
+ String document = "<blah someattribute=\"somevalue\"><a><b/></a></blah>";
+
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
+
+ String s = org.hornetq.utils.XMLUtil.getTextContent(e);
+
+ Element subelement = org.hornetq.utils.XMLUtil.stringToElement(s);
+
+ Assert.assertEquals("a", subelement.getNodeName());
+ NodeList nl = subelement.getChildNodes();
+
+ // try to find <b>
+ boolean found = false;
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ if ("b".equals(n.getNodeName()))
+ {
+ found = true;
+ }
+ }
+ Assert.assertTrue(found);
+ }
+
+ public void testEquivalent_1() throws Exception
+ {
+ String s = "<a/>";
+ String s2 = "<a/>";
+
+ XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.hornetq.utils.XMLUtil.stringToElement(s2));
+ }
+
+ public void testEquivalent_2() throws Exception
+ {
+ String s = "<a></a>";
+ String s2 = "<a/>";
+
+ XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.hornetq.utils.XMLUtil.stringToElement(s2));
+ }
+
+ public void testEquivalent_3() throws Exception
+ {
+ String s = "<a attr1=\"val1\" attr2=\"val2\"/>";
+ String s2 = "<a attr2=\"val2\"/>";
+
+ try
+ {
+ org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
+ XMLUtil.stringToElement(s2));
+ Assert.fail("this should throw exception");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ }
+
+ public void testEquivalent_4() throws Exception
+ {
+ String s = "<a attr1=\"val1\" attr2=\"val2\"/>";
+ String s2 = "<a attr2=\"val2\" attr1=\"val1\"/>";
+
+ org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
+ org.hornetq.utils.XMLUtil.stringToElement(s2));
+ }
+
+ public void testEquivalent_5() throws Exception
+ {
+ String s = "<a><b/></a>";
+ String s2 = "<a><b/></a>";
+
+ org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
+ org.hornetq.utils.XMLUtil.stringToElement(s2));
+ }
+
+ public void testEquivalent_6() throws Exception
+ {
+ String s = "<enclosing><a attr1=\"val1\" attr2=\"val2\"/></enclosing>";
+ String s2 = "<enclosing><a attr2=\"val2\" attr1=\"val1\"/></enclosing>";
+
+ org.hornetq.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s),
+ org.hornetq.utils.XMLUtil.stringToElement(s2));
+ }
+
+ public void testEquivalent_7() throws Exception
+ {
+ String s = "<a><b/><c/></a>";
+ String s2 = "<a><c/><b/></a>";
+
+ try
+ {
+ org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
+ org.hornetq.utils.XMLUtil.stringToElement(s2));
+ Assert.fail("this should throw exception");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // OK
+ }
+ }
+
+ public void testEquivalent_8() throws Exception
+ {
+ String s = "<a><!-- some comment --><b/><!--some other comment --><c/><!-- blah --></a>";
+ String s2 = "<a><b/><!--blah blah--><c/></a>";
+
+ org.hornetq.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s),
+ org.hornetq.utils.XMLUtil.stringToElement(s2));
+ }
+
+ public void testElementToString_1() throws Exception
+ {
+ String s = "<a b=\"something\">somethingelse</a>";
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
+ String tostring = org.hornetq.utils.XMLUtil.elementToString(e);
+ Element convertedAgain = org.hornetq.utils.XMLUtil.stringToElement(tostring);
+ org.hornetq.utils.XMLUtil.assertEquivalent(e, convertedAgain);
+ }
+
+ public void testElementToString_2() throws Exception
+ {
+ String s = "<a b=\"something\"></a>";
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
+ String tostring = XMLUtil.elementToString(e);
+ Element convertedAgain = XMLUtil.stringToElement(tostring);
+ XMLUtil.assertEquivalent(e, convertedAgain);
+ }
+
+ public void testElementToString_3() throws Exception
+ {
+ String s = "<a b=\"something\"/>";
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
+ String tostring = XMLUtil.elementToString(e);
+ Element convertedAgain = org.hornetq.utils.XMLUtil.stringToElement(tostring);
+ org.hornetq.utils.XMLUtil.assertEquivalent(e, convertedAgain);
+ }
+
+ public void testElementToString_4() throws Exception
+ {
+ String s = "<a><![CDATA[somedata]]></a>";
+ Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
+ String tostring = XMLUtil.elementToString(e);
+ Element convertedAgain = org.hornetq.utils.XMLUtil.stringToElement(tostring);
+ org.hornetq.utils.XMLUtil.assertEquivalent(e, convertedAgain);
+ }
+
+ public void testReplaceSystemProperties()
+ {
+ String before = "<configuration>\n" + " <test name=\"${sysprop1}\">content1</test>\n"
+ + " <test name=\"test2\">content2</test>\n"
+ + " <test name=\"test3\">content3</test>\n"
+ + " <test name=\"test4\">${sysprop2}</test>\n"
+ + " <test name=\"test5\">content5</test>\n"
+ + " <test name=\"test6\">content6</test>\n"
+ + "</configuration>";
+ String after = "<configuration>\n" + " <test name=\"test1\">content1</test>\n"
+ + " <test name=\"test2\">content2</test>\n"
+ + " <test name=\"test3\">content3</test>\n"
+ + " <test name=\"test4\">content4</test>\n"
+ + " <test name=\"test5\">content5</test>\n"
+ + " <test name=\"test6\">content6</test>\n"
+ + "</configuration>";
+ System.setProperty("sysprop1", "test1");
+ System.setProperty("sysprop2", "content4");
+ String replaced = org.hornetq.utils.XMLUtil.replaceSystemProps(before);
+ Assert.assertEquals(after, replaced);
+ }
+
+ public void testStripCDATA() throws Exception
+ {
+ String xml = "<![CDATA[somedata]]>";
+ String stripped = XMLUtil.stripCDATA(xml);
+
+ Assert.assertEquals("somedata", stripped);
+ }
+
+}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/FilterTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/FilterTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/FilterTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,703 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.core.filter.impl;
-
-import junit.framework.Assert;
-
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.filter.Filter;
-import org.hornetq.core.filter.impl.FilterImpl;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.ServerMessage;
-import org.hornetq.core.server.impl.ServerMessageImpl;
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.tests.util.UnitTestCase;
-
-/**
- * Tests the compliance with the HornetQ Filter syntax.
- *
- * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version $Revision: 3514 $
- */
-public class FilterTest extends UnitTestCase
-{
- private static final Logger log = Logger.getLogger(FilterTest.class);
-
- private Filter filter;
-
- private ServerMessage message;
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- message = new ServerMessageImpl(1, 1000);
- }
-
- public void testFilterForgets() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("color = 'RED'"));
-
- message.putStringProperty(new SimpleString("color"), new SimpleString("RED"));
- Assert.assertTrue(filter.match(message));
- message = new ServerMessageImpl();
- Assert.assertFalse(filter.match(message));
- }
-
- public void testInvalidString() throws Exception
- {
- testInvalidFilter("color = 'red");
- testInvalidFilter(new SimpleString("color = 'red"));
-
- testInvalidFilter("3");
- testInvalidFilter(new SimpleString("3"));
- }
-
- public void testNullFilter() throws Exception
- {
- Assert.assertNull(FilterImpl.createFilter((String)null));
- Assert.assertNull(FilterImpl.createFilter(""));
- Assert.assertNull(FilterImpl.createFilter((SimpleString)null));
- Assert.assertNull(FilterImpl.createFilter(new SimpleString("")));
- }
-
- public void testHQDurable() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("HQDurable='DURABLE'"));
-
- message.setDurable(true);
-
- Assert.assertTrue(filter.match(message));
-
- message.setDurable(false);
-
- Assert.assertFalse(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("HQDurable='NON_DURABLE'"));
-
- message = new ServerMessageImpl();
- message.setDurable(true);
-
- Assert.assertFalse(filter.match(message));
-
- message.setDurable(false);
-
- Assert.assertTrue(filter.match(message));
-
- }
-
- public void testHQSize() throws Exception
- {
- message.setAddress(RandomUtil.randomSimpleString());
-
- int encodeSize = message.getEncodeSize();
-
- Filter moreThanSmall = FilterImpl.createFilter(new SimpleString("HQSize > " + (encodeSize - 1)));
- Filter lessThanLarge = FilterImpl.createFilter(new SimpleString("HQSize < " + (encodeSize + 1)));
-
- Filter lessThanSmall = FilterImpl.createFilter(new SimpleString("HQSize < " + encodeSize));
- Filter moreThanLarge = FilterImpl.createFilter(new SimpleString("HQSize > " + encodeSize));
-
- Assert.assertTrue(moreThanSmall.match(message));
- Assert.assertTrue(lessThanLarge.match(message));
-
- Assert.assertFalse(lessThanSmall.match(message));
- Assert.assertFalse(moreThanLarge.match(message));
-
- }
-
- public void testHQPriority() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("HQPriority=3"));
-
- for (int i = 0; i < 10; i++)
- {
- message.setPriority((byte)i);
-
- if (i == 3)
- {
- Assert.assertTrue(filter.match(message));
- }
- else
- {
- Assert.assertFalse(filter.match(message));
- }
- }
- }
-
- public void testHQTimestamp() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("HQTimestamp=12345678"));
-
- message.setTimestamp(87654321);
-
- Assert.assertFalse(filter.match(message));
-
- message.setTimestamp(12345678);
-
- Assert.assertTrue(filter.match(message));
- }
-
- public void testBooleanTrue() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("MyBoolean=true"));
-
- testBoolean("MyBoolean", true);
- }
-
- public void testIdentifier() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("MyBoolean"));
-
- testBoolean("MyBoolean", true);
- }
-
- public void testDifferentNullString() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("NOT (prop = 'foo')"));
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
- doPutStringProperty("prop", "bar");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
- doPutStringProperty("prop", "foo");
- Assert.assertFalse(filter.match(message));
- }
-
- public void testBooleanFalse() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("MyBoolean=false"));
- testBoolean("MyBoolean", false);
- }
-
- private void testBoolean(final String name, final boolean flag) throws Exception
- {
- message.putBooleanProperty(new SimpleString(name), flag);
- Assert.assertTrue(filter.match(message));
-
- message.putBooleanProperty(new SimpleString(name), !flag);
- Assert.assertTrue(!filter.match(message));
- }
-
- public void testStringEquals() throws Exception
- {
- // First, simple test of string equality and inequality
- filter = FilterImpl.createFilter(new SimpleString("MyString='astring'"));
-
- doPutStringProperty("MyString", "astring");
- Assert.assertTrue(filter.match(message));
-
- doPutStringProperty("MyString", "NOTastring");
- Assert.assertTrue(!filter.match(message));
-
- // test empty string
- filter = FilterImpl.createFilter(new SimpleString("MyString=''"));
-
- doPutStringProperty("MyString", "");
- Assert.assertTrue("test 1", filter.match(message));
-
- doPutStringProperty("MyString", "NOTastring");
- Assert.assertTrue("test 2", !filter.match(message));
-
- // test literal apostrophes (which are escaped using two apostrophes
- // in selectors)
- filter = FilterImpl.createFilter(new SimpleString("MyString='test JBoss''s filter'"));
-
- // note: apostrophes are not escaped in string properties
- doPutStringProperty("MyString", "test JBoss's filter");
- // this test fails -- bug 530120
- // assertTrue("test 3", filter.match(message));
-
- doPutStringProperty("MyString", "NOTastring");
- Assert.assertTrue("test 4", !filter.match(message));
-
- }
-
- public void testNOT_INWithNullProperty() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT IN ('foo','jms','test')"));
-
- assertFalse(filter.match(message));
-
- message.putStringProperty("myNullProp", "JMS");
- assertTrue(filter.match(message));
- }
-
- public void testNOT_LIKEWithNullProperty() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT LIKE '1_3'"));
-
- assertFalse(filter.match(message));
-
- message.putStringProperty("myNullProp", "JMS");
- assertTrue(filter.match(message));
- }
-
- public void testIS_NOT_NULLWithNullProperty() throws Exception
- {
- filter = FilterImpl.createFilter(new SimpleString("myNullProp IS NOT NULL"));
-
- assertFalse(filter.match(message));
-
- message.putStringProperty("myNullProp", "JMS");
- assertTrue(filter.match(message));
- }
-
- public void testStringLike() throws Exception
- {
- // test LIKE operator with no wildcards
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'"));
- Assert.assertFalse(filter.match(message));
-
- // test where LIKE operand matches
- doPutStringProperty("MyString", "astring");
- Assert.assertTrue(filter.match(message));
-
- // test one character string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a'"));
- doPutStringProperty("MyString", "a");
- Assert.assertTrue(filter.match(message));
-
- // test empty string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE ''"));
- doPutStringProperty("MyString", "");
- Assert.assertTrue(filter.match(message));
-
- // tests where operand does not match
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'"));
-
- // test with extra characters at beginning
- doPutStringProperty("MyString", "NOTastring");
- Assert.assertTrue(!filter.match(message));
-
- // test with extra characters at end
- doPutStringProperty("MyString", "astringNOT");
- Assert.assertTrue(!filter.match(message));
-
- // test with extra characters in the middle
- doPutStringProperty("MyString", "astNOTring");
- Assert.assertTrue(!filter.match(message));
-
- // test where operand is entirely different
- doPutStringProperty("MyString", "totally different");
- Assert.assertTrue(!filter.match(message));
-
- // test case sensitivity
- doPutStringProperty("MyString", "ASTRING");
- Assert.assertTrue(!filter.match(message));
-
- // test empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // test lower-case 'like' operator?
- }
-
- public void testStringLikeUnderbarWildcard() throws Exception
- {
- // test LIKE operator with the _ wildcard, which
- // matches any single character
-
- // first, some tests with the wildcard by itself
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_'"));
- Assert.assertFalse(filter.match(message));
-
- // test match against single character
- doPutStringProperty("MyString", "a");
- Assert.assertTrue(filter.match(message));
-
- // test match failure against multiple characters
- doPutStringProperty("MyString", "aaaaa");
- Assert.assertTrue(!filter.match(message));
-
- // test match failure against the empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // next, tests with wildcard at the beginning of the string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_bcdf'"));
-
- // test match at beginning of string
- doPutStringProperty("MyString", "abcdf");
- Assert.assertTrue(filter.match(message));
-
- // match failure in first character after wildcard
- doPutStringProperty("MyString", "aXcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in middle character
- doPutStringProperty("MyString", "abXdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in last character
- doPutStringProperty("MyString", "abcdX");
- Assert.assertTrue(!filter.match(message));
-
- // match failure with empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at beginning
- doPutStringProperty("MyString", "XXXabcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at the end
- doPutStringProperty("MyString", "abcdfXXX");
- Assert.assertTrue(!filter.match(message));
-
- // test that the _ wildcard does not match the 'empty' character
- doPutStringProperty("MyString", "bcdf");
- Assert.assertTrue(!filter.match(message));
-
- // next, tests with wildcard at the end of the string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd_'"));
-
- // test match at end of string
- doPutStringProperty("MyString", "abcdf");
- Assert.assertTrue(filter.match(message));
-
- // match failure in first character before wildcard
- doPutStringProperty("MyString", "abcXf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in middle character
- doPutStringProperty("MyString", "abXdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in first character
- doPutStringProperty("MyString", "Xbcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure with empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at beginning
- doPutStringProperty("MyString", "XXXabcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at the end
- doPutStringProperty("MyString", "abcdfXXX");
- Assert.assertTrue(!filter.match(message));
-
- // test that the _ wildcard does not match the 'empty' character
- doPutStringProperty("MyString", "abcd");
- Assert.assertTrue(!filter.match(message));
-
- // test match in middle of string
-
- // next, tests with wildcard in the middle of the string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab_df'"));
-
- // test match in the middle of string
- doPutStringProperty("MyString", "abcdf");
- Assert.assertTrue(filter.match(message));
-
- // match failure in first character before wildcard
- doPutStringProperty("MyString", "aXcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in first character after wildcard
- doPutStringProperty("MyString", "abcXf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in last character
- doPutStringProperty("MyString", "abcdX");
- Assert.assertTrue(!filter.match(message));
-
- // match failure with empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at beginning
- doPutStringProperty("MyString", "XXXabcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at the end
- doPutStringProperty("MyString", "abcdfXXX");
- Assert.assertTrue(!filter.match(message));
-
- // test that the _ wildcard does not match the 'empty' character
- doPutStringProperty("MyString", "abdf");
- Assert.assertTrue(!filter.match(message));
-
- // test match failures
- }
-
- public void testNotLikeExpression() throws Exception
- {
- // Should evaluate to false when the property MyString is not set
- filter = FilterImpl.createFilter(new SimpleString("NOT (MyString LIKE '%')"));
-
- Assert.assertFalse(filter.match(message));
- }
-
- public void testStringLikePercentWildcard() throws Exception
- {
- // test LIKE operator with the % wildcard, which
- // matches any sequence of characters
- // note many of the tests are similar to those for _
-
- // first, some tests with the wildcard by itself
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%'"));
- Assert.assertFalse(filter.match(message));
-
- // test match against single character
- doPutStringProperty("MyString", "a");
- Assert.assertTrue(filter.match(message));
-
- // test match against multiple characters
- doPutStringProperty("MyString", "aaaaa");
- Assert.assertTrue(filter.match(message));
-
- doPutStringProperty("MyString", "abcdf");
- Assert.assertTrue(filter.match(message));
-
- // test match against the empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(filter.match(message));
-
- // next, tests with wildcard at the beginning of the string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%bcdf'"));
-
- // test match with single character at beginning of string
- doPutStringProperty("MyString", "Xbcdf");
- Assert.assertTrue(filter.match(message));
-
- // match with multiple characters at beginning
- doPutStringProperty("MyString", "XXbcdf");
- Assert.assertTrue(filter.match(message));
-
- // match failure in middle character
- doPutStringProperty("MyString", "abXdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in last character
- doPutStringProperty("MyString", "abcdX");
- Assert.assertTrue(!filter.match(message));
-
- // match failure with empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at the end
- doPutStringProperty("MyString", "abcdfXXX");
- Assert.assertTrue(!filter.match(message));
-
- // test that the % wildcard matches the empty string
- doPutStringProperty("MyString", "bcdf");
- Assert.assertTrue(filter.match(message));
-
- // next, tests with wildcard at the end of the string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd%'"));
-
- // test match of single character at end of string
- doPutStringProperty("MyString", "abcdf");
- Assert.assertTrue(filter.match(message));
-
- // test match of multiple characters at end of string
- doPutStringProperty("MyString", "abcdfgh");
- Assert.assertTrue(filter.match(message));
-
- // match failure in first character before wildcard
- doPutStringProperty("MyString", "abcXf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in middle character
- doPutStringProperty("MyString", "abXdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in first character
- doPutStringProperty("MyString", "Xbcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure with empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at beginning
- doPutStringProperty("MyString", "XXXabcdf");
- Assert.assertTrue(!filter.match(message));
-
- // test that the % wildcard matches the empty string
- doPutStringProperty("MyString", "abcd");
- Assert.assertTrue(filter.match(message));
-
- // next, tests with wildcard in the middle of the string
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab%df'"));
-
- // test match with single character in the middle of string
- doPutStringProperty("MyString", "abXdf");
- Assert.assertTrue(filter.match(message));
-
- // test match with multiple characters in the middle of string
- doPutStringProperty("MyString", "abXXXdf");
- Assert.assertTrue(filter.match(message));
-
- // match failure in first character before wildcard
- doPutStringProperty("MyString", "aXcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in first character after wildcard
- doPutStringProperty("MyString", "abcXf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure in last character
- doPutStringProperty("MyString", "abcdX");
- Assert.assertTrue(!filter.match(message));
-
- // match failure with empty string
- doPutStringProperty("MyString", "");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at beginning
- doPutStringProperty("MyString", "XXXabcdf");
- Assert.assertTrue(!filter.match(message));
-
- // match failure due to extra characters at the end
- doPutStringProperty("MyString", "abcdfXXX");
- Assert.assertTrue(!filter.match(message));
-
- // test that the % wildcard matches the empty string
- doPutStringProperty("MyString", "abdf");
- Assert.assertTrue(filter.match(message));
-
- }
-
- public void testStringLikePunctuation() throws Exception
- {
- // test proper handling of some punctuation characters.
- // non-trivial since the underlying implementation might
- // (and in fact currently does) use a general-purpose
- // RE library, which has a different notion of which
- // characters are wildcards
-
- // the particular tests here are motivated by the
- // wildcards of the current underlying RE engine,
- // GNU regexp.
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a^$b'"));
- Assert.assertFalse(filter.match(message));
-
- doPutStringProperty("MyString", "a^$b");
- Assert.assertTrue(filter.match(message));
-
- // this one has a double backslash since backslash
- // is interpreted specially by Java
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a\\dc'"));
- doPutStringProperty("MyString", "a\\dc");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a.c'"));
- doPutStringProperty("MyString", "abc");
- Assert.assertTrue(!filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[abc]'"));
- doPutStringProperty("MyString", "[abc]");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[^abc]'"));
- doPutStringProperty("MyString", "[^abc]");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[a-c]'"));
- doPutStringProperty("MyString", "[a-c]");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[:alpha]'"));
- doPutStringProperty("MyString", "[:alpha]");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)'"));
- doPutStringProperty("MyString", "(abc)");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a|bc'"));
- doPutStringProperty("MyString", "a|bc");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)?'"));
- doPutStringProperty("MyString", "(abc)?");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)*'"));
- doPutStringProperty("MyString", "(abc)*");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)+'"));
- doPutStringProperty("MyString", "(abc)+");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3}'"));
- doPutStringProperty("MyString", "(abc){3}");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,5}'"));
- doPutStringProperty("MyString", "(abc){3,5}");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,}'"));
- doPutStringProperty("MyString", "(abc){3,}");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?=abc)'"));
- doPutStringProperty("MyString", "(?=abc)");
- Assert.assertTrue(filter.match(message));
-
- filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?!abc)'"));
- doPutStringProperty("MyString", "(?!abc)");
- Assert.assertTrue(filter.match(message));
- }
-
- // Private -----------------------------------------------------------------------------------
-
- private void doPutStringProperty(final String key, final String value)
- {
- message.putStringProperty(new SimpleString(key), new SimpleString(value));
- }
-
- private void testInvalidFilter(final String filterString) throws Exception
- {
- try
- {
- filter = FilterImpl.createFilter(filterString);
- Assert.fail("Should throw exception");
- }
- catch (HornetQException e)
- {
- Assert.assertEquals(HornetQException.INVALID_FILTER_EXPRESSION, e.getCode());
- }
- }
-
- private void testInvalidFilter(final SimpleString filterString) throws Exception
- {
- try
- {
- filter = FilterImpl.createFilter(filterString);
- Assert.fail("Should throw exception");
- }
- catch (HornetQException e)
- {
- Assert.assertEquals(HornetQException.INVALID_FILTER_EXPRESSION, e.getCode());
- }
- }
-
-}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/OperatorTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/OperatorTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/filter/impl/OperatorTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,468 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.core.filter.impl;
-
-import java.util.HashSet;
-
-import junit.framework.Assert;
-
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.filter.impl.Operator;
-import org.hornetq.tests.util.UnitTestCase;
-
-/**
- * A OperatorTest
- *
- * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
- *
- * Created 3 nov. 2008 17:22:22
- *
- *
- */
-public class OperatorTest extends UnitTestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
- private static void assertSuccess(final int op, final Object arg1, final Object expectedResult) throws Exception
- {
- OperatorTest.assertOperationSuccess(new Operator(op, arg1), expectedResult);
- }
-
- private static void assertSuccess(final int op, final Object arg1, final Object arg2, final Object expectedResult) throws Exception
- {
- OperatorTest.assertOperationSuccess(new Operator(op, arg1, arg2), expectedResult);
- }
-
- private static void assertSuccess(final int op,
- final Object arg1,
- final Object arg2,
- final Object arg3,
- final Object expectedResult) throws Exception
- {
- OperatorTest.assertOperationSuccess(new Operator(op, arg1, arg2, arg3), expectedResult);
- }
-
- private static void assertOperationSuccess(final Operator operator, final Object expectedResult) throws Exception
- {
- Assert.assertEquals(expectedResult, operator.apply());
- }
-
- private static void assertFailure(final int op, final Object arg1) throws Exception
- {
- OperatorTest.assertOperationFailure(new Operator(op, arg1));
- }
-
- private static void assertFailure(final int op, final Object arg1, final Object arg2) throws Exception
- {
- OperatorTest.assertOperationFailure(new Operator(op, arg1, arg2));
- }
-
- private static void assertFailure(final int op, final Object arg1, final Object arg2, final Object arg3) throws Exception
- {
- OperatorTest.assertOperationFailure(new Operator(op, arg1, arg2, arg3));
- }
-
- private static void assertOperationFailure(final Operator operator)
- {
- try
- {
- operator.apply();
- Assert.fail("expected to throw an exception");
- }
- catch (Exception e)
- {
- }
- }
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void test_EQUAL() throws Exception
- {
- OperatorTest.assertSuccess(Operator.EQUAL, 1, 1, true);
- OperatorTest.assertSuccess(Operator.EQUAL, 1, 1.0, true);
- OperatorTest.assertSuccess(Operator.EQUAL, 1, null, null);
- OperatorTest.assertSuccess(Operator.EQUAL, 1.0, 1, true);
- OperatorTest.assertSuccess(Operator.EQUAL, 1.0, 1.0, true);
- OperatorTest.assertSuccess(Operator.EQUAL, 1.0, null, null);
-
- OperatorTest.assertSuccess(Operator.EQUAL, false, false, true);
- OperatorTest.assertSuccess(Operator.EQUAL, true, false, false);
- OperatorTest.assertSuccess(Operator.EQUAL, false, true, false);
- OperatorTest.assertSuccess(Operator.EQUAL, true, true, true);
-
- SimpleString foo = new SimpleString("foo");
- SimpleString foo2 = new SimpleString("foo");
- SimpleString bar = new SimpleString("bar");
- OperatorTest.assertSuccess(Operator.EQUAL, foo, foo, true);
- OperatorTest.assertSuccess(Operator.EQUAL, foo, foo2, true);
- OperatorTest.assertSuccess(Operator.EQUAL, foo, bar, false);
- OperatorTest.assertSuccess(Operator.EQUAL, foo, null, false);
-
- OperatorTest.assertSuccess(Operator.EQUAL, null, 1.0, false);
- }
-
- public void test_DIFFERENT() throws Exception
- {
- OperatorTest.assertSuccess(Operator.DIFFERENT, 2, 1, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, 2, 1.0, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, 2, null, null);
- OperatorTest.assertSuccess(Operator.DIFFERENT, 2.0, 1, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, 2.0, 1.0, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, 2.0, null, null);
-
- OperatorTest.assertSuccess(Operator.DIFFERENT, false, false, false);
- OperatorTest.assertSuccess(Operator.DIFFERENT, true, false, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, false, true, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, true, true, false);
-
- SimpleString foo = new SimpleString("foo");
- SimpleString foo2 = new SimpleString("foo");
- SimpleString bar = new SimpleString("bar");
- OperatorTest.assertSuccess(Operator.DIFFERENT, foo, foo, false);
- OperatorTest.assertSuccess(Operator.DIFFERENT, foo, foo2, false);
- OperatorTest.assertSuccess(Operator.DIFFERENT, foo, bar, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, foo, null, null);
-
- OperatorTest.assertSuccess(Operator.DIFFERENT, null, 1.0, true);
- OperatorTest.assertSuccess(Operator.DIFFERENT, null, null, false);
- }
-
- public void test_IS_NULL() throws Exception
- {
- OperatorTest.assertSuccess(Operator.IS_NULL, null, true);
- OperatorTest.assertSuccess(Operator.IS_NULL, 1, false);
- }
-
- public void test_IS_NOT_NULL() throws Exception
- {
- OperatorTest.assertSuccess(Operator.IS_NOT_NULL, null, false);
- OperatorTest.assertSuccess(Operator.IS_NOT_NULL, 1, true);
- }
-
- public void test_ADD() throws Exception
- {
- OperatorTest.assertSuccess(Operator.ADD, 1, 1, 2L);
- OperatorTest.assertSuccess(Operator.ADD, 1.0, 1, 2.0);
- OperatorTest.assertSuccess(Operator.ADD, 1, 1.0, 2.0);
- OperatorTest.assertSuccess(Operator.ADD, 1.0, 1.0, 2.0);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.ADD, true, 1.0);
- OperatorTest.assertFailure(Operator.ADD, 1, true);
- }
-
- public void test_SUB() throws Exception
- {
- OperatorTest.assertSuccess(Operator.SUB, 2, 1, 1L);
- OperatorTest.assertSuccess(Operator.SUB, 2.0, 1, 1.0);
- OperatorTest.assertSuccess(Operator.SUB, 2, 1.0, 1.0);
- OperatorTest.assertSuccess(Operator.SUB, 2.0, 1.0, 1.0);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.SUB, true, 1.0);
- OperatorTest.assertFailure(Operator.SUB, 1, true);
- }
-
- public void test_MUL() throws Exception
- {
- OperatorTest.assertSuccess(Operator.MUL, 2, 1, 2L);
- OperatorTest.assertSuccess(Operator.MUL, 2.0, 1, 2.0);
- OperatorTest.assertSuccess(Operator.MUL, 2, 1.0, 2.0);
- OperatorTest.assertSuccess(Operator.MUL, 2.0, 1.0, 2.0);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.MUL, 2, null, null);
- OperatorTest.assertSuccess(Operator.MUL, null, 1.0, null);
- OperatorTest.assertFailure(Operator.MUL, true, 1.0);
- OperatorTest.assertFailure(Operator.MUL, 1, true);
- }
-
- public void test_DIV() throws Exception
- {
- OperatorTest.assertSuccess(Operator.DIV, 2, 2, 1L);
- OperatorTest.assertSuccess(Operator.DIV, 2.0, 2, 1.0);
- OperatorTest.assertSuccess(Operator.DIV, 2, 2.0, 1.0);
- OperatorTest.assertSuccess(Operator.DIV, 2.0, 2.0, 1.0);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.DIV, 2, null, null);
- OperatorTest.assertSuccess(Operator.DIV, null, 1.0, null);
- OperatorTest.assertFailure(Operator.DIV, true, 1.0);
- OperatorTest.assertFailure(Operator.DIV, 1, true);
- }
-
- public void test_NEG() throws Exception
- {
- OperatorTest.assertSuccess(Operator.NEG, 1, -1L);
- OperatorTest.assertSuccess(Operator.NEG, -1.0, 1.0);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.NEG, true);
- }
-
- public void test_AND() throws Exception
- {
- // NULL and NULL -> NULL
- OperatorTest.assertSuccess(Operator.AND, null, null, null);
- // NULL and F -> F
- OperatorTest.assertSuccess(Operator.AND, null, false, false);
- // NULL and T -> NULL
- OperatorTest.assertSuccess(Operator.AND, null, true, null);
-
- // F and NULL -> F
- OperatorTest.assertSuccess(Operator.AND, false, null, false);
- // F and F -> F
- OperatorTest.assertSuccess(Operator.AND, false, false, false);
- // F and T -> F
- OperatorTest.assertSuccess(Operator.AND, false, true, false);
-
- // T and NULL -> NULL
- OperatorTest.assertSuccess(Operator.AND, true, null, null);
- // T and F -> F
- OperatorTest.assertSuccess(Operator.AND, true, false, false);
- // T and T -> T
- OperatorTest.assertSuccess(Operator.AND, true, true, true);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.AND, 1.0, true);
- OperatorTest.assertFailure(Operator.AND, true, 1.0);
- OperatorTest.assertFailure(Operator.AND, null, 1.0);
- }
-
- public void test_OR() throws Exception
- {
- // NULL OR NULL -> NULL
- OperatorTest.assertSuccess(Operator.OR, null, null, null);
- // NULL OR F -> NULL
- OperatorTest.assertSuccess(Operator.OR, null, false, null);
- // NULL OR T -> T
- OperatorTest.assertSuccess(Operator.OR, null, true, true);
-
- // F or NULL -> NULL
- OperatorTest.assertSuccess(Operator.OR, false, null, null);
- // F or F -> F
- OperatorTest.assertSuccess(Operator.OR, false, false, false);
- // F or T -> F
- OperatorTest.assertSuccess(Operator.OR, false, true, true);
-
- // T or NULL -> T
- OperatorTest.assertSuccess(Operator.OR, true, null, true);
- // T or F -> T
- OperatorTest.assertSuccess(Operator.OR, true, false, true);
- // T or T -> T
- OperatorTest.assertSuccess(Operator.OR, true, true, true);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.OR, 1.0, true);
- OperatorTest.assertFailure(Operator.OR, false, 1.0);
- OperatorTest.assertFailure(Operator.OR, null, 1.0);
- }
-
- public void test_NOT() throws Exception
- {
- // NOT NULL -> NULL
- OperatorTest.assertSuccess(Operator.NOT, null, null);
- // NOT F -> T
- OperatorTest.assertSuccess(Operator.NOT, false, true);
- // NOT T -> F
- OperatorTest.assertSuccess(Operator.NOT, true, false);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.NOT, 1.0);
- }
-
- public void test_GT() throws Exception
- {
- OperatorTest.assertSuccess(Operator.GT, 2, 1, true);
- OperatorTest.assertSuccess(Operator.GT, 2.0, 1, true);
- OperatorTest.assertSuccess(Operator.GT, 2, 1.0, true);
- OperatorTest.assertSuccess(Operator.GT, 2.0, 1.0, true);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.GT, 2.0, true, false);
- OperatorTest.assertSuccess(Operator.GT, 2, null, null);
- OperatorTest.assertSuccess(Operator.GT, true, 1.0, false);
- OperatorTest.assertSuccess(Operator.GT, null, 1, null);
- OperatorTest.assertSuccess(Operator.GT, true, true, false);
- OperatorTest.assertSuccess(Operator.GT, null, null, null);
- }
-
- public void test_GE() throws Exception
- {
- OperatorTest.assertSuccess(Operator.GE, 1, 1, true);
- OperatorTest.assertSuccess(Operator.GE, 1.0, 1, true);
- OperatorTest.assertSuccess(Operator.GE, 1, 1.0, true);
- OperatorTest.assertSuccess(Operator.GE, 1.0, 1.0, true);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.GE, 2.0, true, false);
- OperatorTest.assertSuccess(Operator.GE, 2, null, null);
- OperatorTest.assertSuccess(Operator.GE, true, 1.0, false);
- OperatorTest.assertSuccess(Operator.GE, null, 1, null);
- OperatorTest.assertSuccess(Operator.GE, true, true, false);
- OperatorTest.assertSuccess(Operator.GE, null, null, null);
- }
-
- public void test_LT() throws Exception
- {
- OperatorTest.assertSuccess(Operator.LT, 1, 2, true);
- OperatorTest.assertSuccess(Operator.LT, 1.0, 2, true);
- OperatorTest.assertSuccess(Operator.LT, 1, 2.0, true);
- OperatorTest.assertSuccess(Operator.LT, 1.0, 2.0, true);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.LT, 1.0, true, false);
- OperatorTest.assertSuccess(Operator.LT, 1, null, null);
- OperatorTest.assertSuccess(Operator.LT, true, 2.0, false);
- OperatorTest.assertSuccess(Operator.LT, null, 2, null);
- OperatorTest.assertSuccess(Operator.LT, true, true, false);
- OperatorTest.assertSuccess(Operator.LT, null, null, null);
- }
-
- public void test_LE() throws Exception
- {
- OperatorTest.assertSuccess(Operator.LE, 1, 1, true);
- OperatorTest.assertSuccess(Operator.LE, 1.0, 1, true);
- OperatorTest.assertSuccess(Operator.LE, 1, 1.0, true);
- OperatorTest.assertSuccess(Operator.LE, 1.0, 1.0, true);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.LE, 1.0, true, false);
- OperatorTest.assertSuccess(Operator.LE, 1, null, null);
- OperatorTest.assertSuccess(Operator.LE, true, 1.0, false);
- OperatorTest.assertSuccess(Operator.LE, null, 1, null);
- OperatorTest.assertSuccess(Operator.LE, true, true, false);
- OperatorTest.assertSuccess(Operator.LE, null, null, null);
- }
-
- public void test_BETWEEN() throws Exception
- {
- // 2 BETWEEN 1 AND 3
- OperatorTest.assertSuccess(Operator.BETWEEN, 2, 1, 3, true);
- OperatorTest.assertSuccess(Operator.BETWEEN, 2.0, 1.0, 3.0, true);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.BETWEEN, true, 1, 3, false);
- OperatorTest.assertSuccess(Operator.BETWEEN, null, null, 3, null);
- }
-
- public void test_NOT_BETWEEN() throws Exception
- {
- // 2 NOT BETWEEN 3 AND 4
- OperatorTest.assertSuccess(Operator.NOT_BETWEEN, 2, 3, 4, true);
- OperatorTest.assertSuccess(Operator.NOT_BETWEEN, 2.0, 3.0, 4.0, true);
-
- // incompatible types
- OperatorTest.assertSuccess(Operator.NOT_BETWEEN, true, 1, 3, false);
- OperatorTest.assertSuccess(Operator.NOT_BETWEEN, null, null, 3, null);
- }
-
- public void test_IN() throws Exception
- {
- HashSet set = new HashSet();
- set.add(new SimpleString("foo"));
- set.add(new SimpleString("bar"));
- set.add(new SimpleString("baz"));
-
- SimpleString foo = new SimpleString("foo");
-
- OperatorTest.assertSuccess(Operator.IN, foo, set, true);
- OperatorTest.assertSuccess(Operator.IN, foo, new HashSet(), false);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.IN, true, set);
- }
-
- public void test_NOT_IN() throws Exception
- {
- HashSet set = new HashSet();
- set.add(new SimpleString("foo"));
- set.add(new SimpleString("bar"));
- set.add(new SimpleString("baz"));
-
- SimpleString foo = new SimpleString("foo");
-
- OperatorTest.assertSuccess(Operator.NOT_IN, foo, set, false);
- OperatorTest.assertSuccess(Operator.NOT_IN, foo, new HashSet(), true);
-
- // incompatible types
- OperatorTest.assertFailure(Operator.NOT_IN, true, set);
- }
-
- public void test_LIKE() throws Exception
- {
- SimpleString pattern = new SimpleString("12%3");
- OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("123"), pattern, true);
- OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("12993"), pattern, true);
- OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("1234"), pattern, false);
-
- pattern = new SimpleString("l_se");
- OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("lose"), pattern, true);
- OperatorTest.assertSuccess(Operator.LIKE, new SimpleString("loose"), pattern, false);
-
- OperatorTest.assertSuccess(Operator.LIKE, null, pattern, null);
- }
-
- public void test_LIKE_ESCAPE() throws Exception
- {
- SimpleString pattern = new SimpleString("\\_%");
- SimpleString escapeChar = new SimpleString("\\");
- OperatorTest.assertSuccess(Operator.LIKE_ESCAPE, new SimpleString("_foo"), pattern, escapeChar, true);
- OperatorTest.assertSuccess(Operator.LIKE_ESCAPE, new SimpleString("bar"), pattern, escapeChar, false);
- OperatorTest.assertSuccess(Operator.LIKE_ESCAPE, null, pattern, escapeChar, null);
-
- OperatorTest.assertFailure(Operator.LIKE_ESCAPE,
- new SimpleString("_foo"),
- pattern,
- new SimpleString("must be a single char"));
- }
-
- public void test_NOT_LIKE() throws Exception
- {
- SimpleString pattern = new SimpleString("12%3");
- OperatorTest.assertSuccess(Operator.NOT_LIKE, new SimpleString("123"), pattern, false);
- OperatorTest.assertSuccess(Operator.NOT_LIKE, new SimpleString("12993"), pattern, false);
- OperatorTest.assertSuccess(Operator.NOT_LIKE, new SimpleString("1234"), pattern, true);
- OperatorTest.assertSuccess(Operator.NOT_LIKE, null, pattern, null);
- }
-
- public void test_NOT_LIKE_ESCAPE() throws Exception
- {
- SimpleString pattern = new SimpleString("\\_%");
- SimpleString escapeChar = new SimpleString("\\");
- OperatorTest.assertSuccess(Operator.NOT_LIKE_ESCAPE, new SimpleString("_foo"), pattern, escapeChar, false);
- OperatorTest.assertSuccess(Operator.NOT_LIKE_ESCAPE, new SimpleString("bar"), pattern, escapeChar, true);
- OperatorTest.assertSuccess(Operator.NOT_LIKE_ESCAPE, null, pattern, escapeChar, null);
-
- OperatorTest.assertFailure(Operator.NOT_LIKE_ESCAPE,
- new SimpleString("_foo"),
- pattern,
- new SimpleString("must be a single char"));
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/CompressionUtilTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/CompressionUtilTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/CompressionUtilTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,192 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.zip.Deflater;
-
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.DeflaterReader;
-import org.hornetq.utils.InflaterReader;
-import org.hornetq.utils.InflaterWriter;
-
-/**
- * A CompressionUtilTest
- *
- * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
- *
- */
-public class CompressionUtilTest extends UnitTestCase
-{
-
- public void testDeflaterReader() throws Exception
- {
- String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
- byte[] input = inputString.getBytes("UTF-8");
-
- ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
-
- AtomicLong counter = new AtomicLong(0);
- DeflaterReader reader = new DeflaterReader(inputStream, counter);
-
- ArrayList<Integer> zipHolder = new ArrayList<Integer>();
- int b = reader.read();
-
- while (b != -1)
- {
- zipHolder.add(b);
- b = reader.read();
- }
-
- assertEquals(input.length, counter.get());
-
- byte[] allCompressed = new byte[zipHolder.size()];
- for (int i = 0; i < allCompressed.length; i++)
- {
- allCompressed[i] = (byte) zipHolder.get(i).intValue();
- }
-
- byte[] output = new byte[30];
- Deflater compresser = new Deflater();
- compresser.setInput(input);
- compresser.finish();
- int compressedDataLength = compresser.deflate(output);
-
- compareByteArray(allCompressed, output, compressedDataLength);
- }
-
- public void testDeflaterReader2() throws Exception
- {
- String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
- byte[] input = inputString.getBytes("UTF-8");
-
- ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
- AtomicLong counter = new AtomicLong(0);
-
- DeflaterReader reader = new DeflaterReader(inputStream, counter);
-
- byte[] buffer = new byte[7];
- ArrayList<Integer> zipHolder = new ArrayList<Integer>();
-
- int n = reader.read(buffer);
- while (n != -1)
- {
- for (int i = 0; i < n; i++)
- {
- zipHolder.add((int)buffer[i]);
- }
- n = reader.read(buffer);
- }
-
- assertEquals(input.length, counter.get());
-
- byte[] allCompressed = new byte[zipHolder.size()];
- for (int i = 0; i < allCompressed.length; i++)
- {
- allCompressed[i] = (byte) zipHolder.get(i).intValue();
- }
-
- byte[] output = new byte[30];
- Deflater compresser = new Deflater();
- compresser.setInput(input);
- compresser.finish();
- int compressedDataLength = compresser.deflate(output);
-
- compareByteArray(allCompressed, output, compressedDataLength);
- }
-
- public void testInflaterReader() throws Exception
- {
- String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
- byte[] input = inputString.getBytes("UTF-8");
- byte[] output = new byte[30];
- Deflater compresser = new Deflater();
- compresser.setInput(input);
- compresser.finish();
- int compressedDataLength = compresser.deflate(output);
-
- byte[] zipBytes = new byte[compressedDataLength];
-
- System.arraycopy(output, 0, zipBytes, 0, compressedDataLength);
- ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes);
-
- InflaterReader inflater = new InflaterReader(byteInput);
- ArrayList<Integer> holder = new ArrayList<Integer>();
- int read = inflater.read();
-
- while (read != -1)
- {
- holder.add(read);
- read = inflater.read();
- }
-
- byte[] result = new byte[holder.size()];
-
- for (int i = 0; i < result.length; i++)
- {
- result[i] = holder.get(i).byteValue();
- }
-
- String txt = new String(result);
-
- assertEquals(inputString, txt);
-
- }
-
- public void testInflaterWriter() throws Exception
- {
- String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
- byte[] input = inputString.getBytes("UTF-8");
- byte[] output = new byte[30];
- Deflater compresser = new Deflater();
- compresser.setInput(input);
- compresser.finish();
- int compressedDataLength = compresser.deflate(output);
-
- byte[] zipBytes = new byte[compressedDataLength];
-
- System.arraycopy(output, 0, zipBytes, 0, compressedDataLength);
- ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes);
-
- ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
- InflaterWriter writer = new InflaterWriter(byteOutput);
-
- byte[] zipBuffer = new byte[12];
-
- int n = byteInput.read(zipBuffer);
- while (n > 0)
- {
- writer.write(zipBuffer, 0, n);
- n = byteInput.read(zipBuffer);
- }
-
- writer.close();
-
- byte[] outcome = byteOutput.toByteArray();
- String outStr = new String(outcome);
-
- assertEquals(inputString, outStr);
- }
-
- private void compareByteArray(byte[] first, byte[] second, int length)
- {
- for (int i = 0; i < length; i++)
- {
- assertEquals(first[i], second[i]);
- }
- }
-}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/ConcurrentHashSetTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/ConcurrentHashSetTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/ConcurrentHashSetTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,147 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.util;
-
-import java.util.Iterator;
-
-import junit.framework.Assert;
-
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.ConcurrentHashSet;
-import org.hornetq.utils.ConcurrentSet;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class ConcurrentHashSetTest extends UnitTestCase
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private ConcurrentSet<String> set;
-
- private String element;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testAdd() throws Exception
- {
- Assert.assertTrue(set.add(element));
- Assert.assertFalse(set.add(element));
- }
-
- public void testAddIfAbsent() throws Exception
- {
- Assert.assertTrue(set.addIfAbsent(element));
- Assert.assertFalse(set.addIfAbsent(element));
- }
-
- public void testRemove() throws Exception
- {
- Assert.assertTrue(set.add(element));
-
- Assert.assertTrue(set.remove(element));
- Assert.assertFalse(set.remove(element));
- }
-
- public void testContains() throws Exception
- {
- Assert.assertFalse(set.contains(element));
-
- Assert.assertTrue(set.add(element));
- Assert.assertTrue(set.contains(element));
-
- Assert.assertTrue(set.remove(element));
- Assert.assertFalse(set.contains(element));
- }
-
- public void testSize() throws Exception
- {
- Assert.assertEquals(0, set.size());
-
- Assert.assertTrue(set.add(element));
- Assert.assertEquals(1, set.size());
-
- Assert.assertTrue(set.remove(element));
- Assert.assertEquals(0, set.size());
- }
-
- public void testClear() throws Exception
- {
- Assert.assertTrue(set.add(element));
-
- Assert.assertTrue(set.contains(element));
- set.clear();
- Assert.assertFalse(set.contains(element));
- }
-
- public void testIsEmpty() throws Exception
- {
- Assert.assertTrue(set.isEmpty());
-
- Assert.assertTrue(set.add(element));
- Assert.assertFalse(set.isEmpty());
-
- set.clear();
- Assert.assertTrue(set.isEmpty());
- }
-
- public void testIterator() throws Exception
- {
- set.add(element);
-
- Iterator<String> iterator = set.iterator();
- while (iterator.hasNext())
- {
- String e = iterator.next();
- Assert.assertEquals(element, e);
- }
- }
-
- // TestCase overrides --------------------------------------------
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- set = new ConcurrentHashSet<String>();
- element = RandomUtil.randomString();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- set = null;
- element = null;
-
- super.tearDown();
- }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TimeAndCounterIDGeneratorTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TimeAndCounterIDGeneratorTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TimeAndCounterIDGeneratorTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,197 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.util;
-
-import java.util.concurrent.CountDownLatch;
-
-import junit.framework.Assert;
-
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.ConcurrentHashSet;
-import org.hornetq.utils.TimeAndCounterIDGenerator;
-
-/**
- * A TimeAndCounterIDGeneratorTest
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a> Created 24-Sep-08 3:42:25 PM
- */
-public class TimeAndCounterIDGeneratorTest extends UnitTestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testCalculation()
- {
- TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
- long max = 11000;
-
- long lastNr = 0;
-
- for (long i = 0; i < max; i++)
- {
- long seqNr = seq.generateID();
-
- Assert.assertTrue("The sequence generator should aways generate crescent numbers", seqNr > lastNr);
-
- lastNr = seqNr;
- }
-
- }
-
- public void testCalculationRefresh()
- {
- TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
-
- long id1 = seq.generateID();
- Assert.assertEquals(1, id1 & 0xffff);
- Assert.assertEquals(2, seq.generateID() & 0xffff);
-
- seq.refresh();
-
- long id2 = seq.generateID();
-
- Assert.assertTrue(id2 > id1);
-
- Assert.assertEquals(1, id2 & 0xffff);
-
- }
-
- public void testCalculationOnMultiThread() throws Throwable
- {
- final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<Long>();
-
- final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
-
- System.out.println("Time = " + TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + ", " + seq);
-
- final int NUMBER_OF_THREADS = 100;
-
- final int NUMBER_OF_IDS = 10;
-
- final CountDownLatch latchAlign = new CountDownLatch(NUMBER_OF_THREADS);
-
- final CountDownLatch latchStart = new CountDownLatch(1);
-
- class T1 extends Thread
- {
- Throwable e;
-
- @Override
- public void run()
- {
- try
- {
- latchAlign.countDown();
- latchStart.await();
-
- long lastValue = 0l;
- for (int i = 0; i < NUMBER_OF_IDS; i++)
- {
- long value = seq.generateID();
- Assert.assertTrue(TimeAndCounterIDGeneratorTest.hex(value) + " should be greater than " +
- TimeAndCounterIDGeneratorTest.hex(lastValue) +
- " on seq " +
- seq.toString(), value > lastValue);
- lastValue = value;
-
- hashSet.add(value);
- }
- }
- catch (Throwable e)
- {
- this.e = e;
- }
- }
-
- };
-
- T1[] arrays = new T1[NUMBER_OF_THREADS];
-
- for (int i = 0; i < arrays.length; i++)
- {
- arrays[i] = new T1();
- arrays[i].start();
- }
-
- latchAlign.await();
-
- latchStart.countDown();
-
- for (T1 t : arrays)
- {
- t.join();
- if (t.e != null)
- {
- throw t.e;
- }
- }
-
- Assert.assertEquals(NUMBER_OF_THREADS * NUMBER_OF_IDS, hashSet.size());
-
- hashSet.clear();
-
- }
-
- public void testWrapID() throws Throwable
- {
- final ConcurrentHashSet<Long> hashSet = new org.hornetq.utils.ConcurrentHashSet<Long>();
-
- TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
-
- System.out.println("Current Time = " + TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + " " + seq);
-
- seq.setInternalDate(System.currentTimeMillis() + 10000l); // 10 seconds in the future
-
- seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to explode
-
- try
- {
- // This is simulating a situation where we generated more than 268 million messages on the same time interval
- seq.generateID();
- Assert.fail("It was supposed to throw an exception, as the counter was set to explode on this test");
- }
- catch (Exception e)
- {
- }
-
- seq = new TimeAndCounterIDGenerator();
-
- seq.setInternalDate(System.currentTimeMillis() - 10000l); // 10 seconds in the past
-
- long timeMark = seq.getInternalTimeMark();
-
- seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to explode
-
- // This is ok... the time portion would be added to the next one generated 10 seconds ago
- seq.generateID();
-
- Assert.assertTrue(TimeAndCounterIDGeneratorTest.hex(timeMark) + " < " +
- TimeAndCounterIDGeneratorTest.hex(seq.getInternalTimeMark()),
- timeMark < seq.getInternalTimeMark());
- }
-
- private static String hex(final long value)
- {
- return String.format("%1$X", value);
- }
-
-}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,364 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.util;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.hornetq.api.core.PropertyConversionException;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.TypedProperties;
-
-/**
- * A TypedPropertiesConversionTest
- *
- * @author jmesnil
- *
- *
- */
-public class TypedPropertiesConversionTest extends TestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private TypedProperties props;
-
- private SimpleString key;
-
- private final SimpleString unknownKey = new SimpleString("this.key.is.never.used");
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- key = RandomUtil.randomSimpleString();
- props = new TypedProperties();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- key = null;
- props = null;
-
- super.tearDown();
- }
-
- public void testBooleanProperty() throws Exception
- {
- Boolean val = RandomUtil.randomBoolean();
- props.putBooleanProperty(key, val);
-
- Assert.assertEquals(val, props.getBooleanProperty(key));
- Assert.assertEquals(new SimpleString(Boolean.toString(val)), props.getSimpleStringProperty(key));
-
- props.putSimpleStringProperty(key, new SimpleString(Boolean.toString(val)));
- Assert.assertEquals(val, props.getBooleanProperty(key));
-
- try
- {
- props.putByteProperty(key, RandomUtil.randomByte());
- props.getBooleanProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- Assert.assertFalse(props.getBooleanProperty(unknownKey));
- }
-
- public void testCharProperty() throws Exception
- {
- Character val = RandomUtil.randomChar();
- props.putCharProperty(key, val);
-
- Assert.assertEquals(val, props.getCharProperty(key));
- Assert.assertEquals(new SimpleString(Character.toString(val)), props.getSimpleStringProperty(key));
-
- try
- {
- props.putByteProperty(key, RandomUtil.randomByte());
- props.getCharProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- props.getCharProperty(unknownKey);
- Assert.fail();
- }
- catch (NullPointerException e)
- {
- }
- }
-
- public void testByteProperty() throws Exception
- {
- Byte val = RandomUtil.randomByte();
- props.putByteProperty(key, val);
-
- Assert.assertEquals(val, props.getByteProperty(key));
- Assert.assertEquals(new SimpleString(Byte.toString(val)), props.getSimpleStringProperty(key));
-
- props.putSimpleStringProperty(key, new SimpleString(Byte.toString(val)));
- Assert.assertEquals(val, props.getByteProperty(key));
-
- try
- {
- props.putBooleanProperty(key, RandomUtil.randomBoolean());
- props.getByteProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- props.getByteProperty(unknownKey);
- Assert.fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testIntProperty() throws Exception
- {
- Integer val = RandomUtil.randomInt();
- props.putIntProperty(key, val);
-
- Assert.assertEquals(val, props.getIntProperty(key));
- Assert.assertEquals(new SimpleString(Integer.toString(val)), props.getSimpleStringProperty(key));
-
- props.putSimpleStringProperty(key, new SimpleString(Integer.toString(val)));
- Assert.assertEquals(val, props.getIntProperty(key));
-
- Byte byteVal = RandomUtil.randomByte();
- props.putByteProperty(key, byteVal);
- Assert.assertEquals(Integer.valueOf(byteVal), props.getIntProperty(key));
-
- try
- {
- props.putBooleanProperty(key, RandomUtil.randomBoolean());
- props.getIntProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- props.getIntProperty(unknownKey);
- Assert.fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testLongProperty() throws Exception
- {
- Long val = RandomUtil.randomLong();
- props.putLongProperty(key, val);
-
- Assert.assertEquals(val, props.getLongProperty(key));
- Assert.assertEquals(new SimpleString(Long.toString(val)), props.getSimpleStringProperty(key));
-
- props.putSimpleStringProperty(key, new SimpleString(Long.toString(val)));
- Assert.assertEquals(val, props.getLongProperty(key));
-
- Byte byteVal = RandomUtil.randomByte();
- props.putByteProperty(key, byteVal);
- Assert.assertEquals(Long.valueOf(byteVal), props.getLongProperty(key));
-
- Short shortVal = RandomUtil.randomShort();
- props.putShortProperty(key, shortVal);
- Assert.assertEquals(Long.valueOf(shortVal), props.getLongProperty(key));
-
- Integer intVal = RandomUtil.randomInt();
- props.putIntProperty(key, intVal);
- Assert.assertEquals(Long.valueOf(intVal), props.getLongProperty(key));
-
- try
- {
- props.putBooleanProperty(key, RandomUtil.randomBoolean());
- props.getLongProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- props.getLongProperty(unknownKey);
- Assert.fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testDoubleProperty() throws Exception
- {
- Double val = RandomUtil.randomDouble();
- props.putDoubleProperty(key, val);
-
- Assert.assertEquals(val, props.getDoubleProperty(key));
- Assert.assertEquals(new SimpleString(Double.toString(val)), props.getSimpleStringProperty(key));
-
- props.putSimpleStringProperty(key, new SimpleString(Double.toString(val)));
- Assert.assertEquals(val, props.getDoubleProperty(key));
-
- try
- {
- props.putBooleanProperty(key, RandomUtil.randomBoolean());
- props.getDoubleProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- props.getDoubleProperty(unknownKey);
- Assert.fail();
- }
- catch (Exception e)
- {
- }
- }
-
- public void testFloatProperty() throws Exception
- {
- Float val = RandomUtil.randomFloat();
- props.putFloatProperty(key, val);
-
- Assert.assertEquals(val, props.getFloatProperty(key));
- Assert.assertEquals(Double.valueOf(val), props.getDoubleProperty(key));
- Assert.assertEquals(new SimpleString(Float.toString(val)), props.getSimpleStringProperty(key));
-
- props.putSimpleStringProperty(key, new SimpleString(Float.toString(val)));
- Assert.assertEquals(val, props.getFloatProperty(key));
-
- try
- {
- props.putBooleanProperty(key, RandomUtil.randomBoolean());
- props.getFloatProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- props.getFloatProperty(unknownKey);
- Assert.fail();
- }
- catch (Exception e)
- {
- }
- }
-
- public void testShortProperty() throws Exception
- {
- Short val = RandomUtil.randomShort();
- props.putShortProperty(key, val);
-
- Assert.assertEquals(val, props.getShortProperty(key));
- Assert.assertEquals(Integer.valueOf(val), props.getIntProperty(key));
- Assert.assertEquals(new SimpleString(Short.toString(val)), props.getSimpleStringProperty(key));
-
- props.putSimpleStringProperty(key, new SimpleString(Short.toString(val)));
- Assert.assertEquals(val, props.getShortProperty(key));
-
- Byte byteVal = RandomUtil.randomByte();
- props.putByteProperty(key, byteVal);
- Assert.assertEquals(Short.valueOf(byteVal), props.getShortProperty(key));
-
- try
- {
- props.putBooleanProperty(key, RandomUtil.randomBoolean());
- props.getShortProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- props.getShortProperty(unknownKey);
- Assert.fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testSimpleStringProperty() throws Exception
- {
- SimpleString strVal = RandomUtil.randomSimpleString();
- props.putSimpleStringProperty(key, strVal);
- Assert.assertEquals(strVal, props.getSimpleStringProperty(key));
- }
-
- public void testBytesProperty() throws Exception
- {
- byte[] val = RandomUtil.randomBytes();
- props.putBytesProperty(key, val);
-
- UnitTestCase.assertEqualsByteArrays(val, props.getBytesProperty(key));
-
- try
- {
- props.putBooleanProperty(key, RandomUtil.randomBoolean());
- props.getBytesProperty(key);
- Assert.fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- Assert.assertNull(props.getBytesProperty(unknownKey));
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/TypedPropertiesTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,264 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.util;
-
-import java.util.Iterator;
-
-import junit.framework.Assert;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQBuffers;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.TypedProperties;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class TypedPropertiesTest extends UnitTestCase
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- private static void assertEqualsTypeProperties(final TypedProperties expected, final TypedProperties actual)
- {
- Assert.assertNotNull(expected);
- Assert.assertNotNull(actual);
- Assert.assertEquals(expected.getEncodeSize(), actual.getEncodeSize());
- Assert.assertEquals(expected.getPropertyNames(), actual.getPropertyNames());
- Iterator<SimpleString> iterator = actual.getPropertyNames().iterator();
- while (iterator.hasNext())
- {
- SimpleString key = iterator.next();
- Object expectedValue = expected.getProperty(key);
- Object actualValue = actual.getProperty(key);
- if (expectedValue instanceof byte[] && actualValue instanceof byte[])
- {
- byte[] expectedBytes = (byte[])expectedValue;
- byte[] actualBytes = (byte[])actualValue;
- UnitTestCase.assertEqualsByteArrays(expectedBytes, actualBytes);
- }
- else
- {
- Assert.assertEquals(expectedValue, actualValue);
- }
- }
- }
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- private TypedProperties props;
-
- private SimpleString key;
-
- public void testCopyContructor() throws Exception
- {
- props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
-
- TypedProperties copy = new TypedProperties(props);
-
- Assert.assertEquals(props.getEncodeSize(), copy.getEncodeSize());
- Assert.assertEquals(props.getPropertyNames(), copy.getPropertyNames());
-
- Assert.assertTrue(copy.containsProperty(key));
- Assert.assertEquals(props.getProperty(key), copy.getProperty(key));
- }
-
- public void testRemove() throws Exception
- {
- props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
-
- Assert.assertTrue(props.containsProperty(key));
- Assert.assertNotNull(props.getProperty(key));
-
- props.removeProperty(key);
-
- Assert.assertFalse(props.containsProperty(key));
- Assert.assertNull(props.getProperty(key));
- }
-
- public void testClear() throws Exception
- {
- props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
-
- Assert.assertTrue(props.containsProperty(key));
- Assert.assertNotNull(props.getProperty(key));
-
- props.clear();
-
- Assert.assertFalse(props.containsProperty(key));
- Assert.assertNull(props.getProperty(key));
- }
-
- public void testKey() throws Exception
- {
- props.putBooleanProperty(key, true);
- boolean bool = (Boolean)props.getProperty(key);
- Assert.assertEquals(true, bool);
-
- props.putCharProperty(key, 'a');
- char c = (Character)props.getProperty(key);
- Assert.assertEquals('a', c);
- }
-
- public void testGetPropertyOnEmptyProperties() throws Exception
- {
- Assert.assertFalse(props.containsProperty(key));
- Assert.assertNull(props.getProperty(key));
- }
-
- public void testRemovePropertyOnEmptyProperties() throws Exception
- {
- Assert.assertFalse(props.containsProperty(key));
- Assert.assertNull(props.removeProperty(key));
- }
-
- public void testNullProperty() throws Exception
- {
- props.putSimpleStringProperty(key, null);
- Assert.assertTrue(props.containsProperty(key));
- Assert.assertNull(props.getProperty(key));
- }
-
- public void testBytesPropertyWithNull() throws Exception
- {
- props.putBytesProperty(key, null);
-
- Assert.assertTrue(props.containsProperty(key));
- byte[] bb = (byte[])props.getProperty(key);
- Assert.assertNull(bb);
- }
-
- public void testTypedProperties() throws Exception
- {
- SimpleString longKey = RandomUtil.randomSimpleString();
- long longValue = RandomUtil.randomLong();
- SimpleString simpleStringKey = RandomUtil.randomSimpleString();
- SimpleString simpleStringValue = RandomUtil.randomSimpleString();
- TypedProperties otherProps = new TypedProperties();
- otherProps.putLongProperty(longKey, longValue);
- otherProps.putSimpleStringProperty(simpleStringKey, simpleStringValue);
-
- props.putTypedProperties(otherProps);
-
- long ll = props.getLongProperty(longKey);
- Assert.assertEquals(longValue, ll);
- SimpleString ss = props.getSimpleStringProperty(simpleStringKey);
- Assert.assertEquals(simpleStringValue, ss);
- }
-
- public void testEmptyTypedProperties() throws Exception
- {
- Assert.assertEquals(0, props.getPropertyNames().size());
-
- props.putTypedProperties(new TypedProperties());
-
- Assert.assertEquals(0, props.getPropertyNames().size());
- }
-
- public void testNullTypedProperties() throws Exception
- {
- Assert.assertEquals(0, props.getPropertyNames().size());
-
- props.putTypedProperties(null);
-
- Assert.assertEquals(0, props.getPropertyNames().size());
- }
-
- public void testEncodeDecode() throws Exception
- {
- props.putByteProperty(RandomUtil.randomSimpleString(), RandomUtil.randomByte());
- props.putBytesProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBytes());
- props.putBytesProperty(RandomUtil.randomSimpleString(), null);
- props.putBooleanProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBoolean());
- props.putShortProperty(RandomUtil.randomSimpleString(), RandomUtil.randomShort());
- props.putIntProperty(RandomUtil.randomSimpleString(), RandomUtil.randomInt());
- props.putLongProperty(RandomUtil.randomSimpleString(), RandomUtil.randomLong());
- props.putFloatProperty(RandomUtil.randomSimpleString(), RandomUtil.randomFloat());
- props.putDoubleProperty(RandomUtil.randomSimpleString(), RandomUtil.randomDouble());
- props.putCharProperty(RandomUtil.randomSimpleString(), RandomUtil.randomChar());
- props.putSimpleStringProperty(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString());
- props.putSimpleStringProperty(RandomUtil.randomSimpleString(), null);
- SimpleString keyToRemove = RandomUtil.randomSimpleString();
- props.putSimpleStringProperty(keyToRemove, RandomUtil.randomSimpleString());
-
- HornetQBuffer buffer = HornetQBuffers.dynamicBuffer(1024);
- props.encode(buffer);
-
- Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
-
- TypedProperties decodedProps = new TypedProperties();
- decodedProps.decode(buffer);
-
- TypedPropertiesTest.assertEqualsTypeProperties(props, decodedProps);
-
- buffer.clear();
-
- // After removing a property, you should still be able to encode the Property
- props.removeProperty(keyToRemove);
- props.encode(buffer);
-
- Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
- }
-
- public void testEncodeDecodeEmpty() throws Exception
- {
- TypedProperties emptyProps = new TypedProperties();
-
- HornetQBuffer buffer = HornetQBuffers.dynamicBuffer(1024);
- emptyProps.encode(buffer);
-
- Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
-
- TypedProperties decodedProps = new TypedProperties();
- decodedProps.decode(buffer);
-
- TypedPropertiesTest.assertEqualsTypeProperties(emptyProps, decodedProps);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- props = new TypedProperties();
- key = RandomUtil.randomSimpleString();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- key = null;
- props = null;
-
- super.tearDown();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/XMLUtilTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/XMLUtilTest.java 2012-01-12 12:10:11 UTC (rev 12016)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/XMLUtilTest.java 2012-01-12 12:10:54 UTC (rev 12017)
@@ -1,258 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.tests.unit.util;
-
-import junit.framework.Assert;
-
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.XMLUtil;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author <a href="mailto:ovidiu@feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- */
-public class XMLUtilTest extends UnitTestCase
-{
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testGetTextContext_1() throws Exception
- {
- String document = "<blah>foo</blah>";
-
- Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
-
- Assert.assertEquals("foo", org.hornetq.utils.XMLUtil.getTextContent(e));
- }
-
- public void testGetTextContext_2() throws Exception
- {
- String document = "<blah someattribute=\"somevalue\">foo</blah>";
-
- Element e = XMLUtil.stringToElement(document);
-
- Assert.assertEquals("foo", org.hornetq.utils.XMLUtil.getTextContent(e));
- }
-
- public void testGetTextContext_3() throws Exception
- {
- String document = "<blah someattribute=\"somevalue\"><a/></blah>";
-
- Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
-
- String s = org.hornetq.utils.XMLUtil.getTextContent(e);
-
- Element subelement = org.hornetq.utils.XMLUtil.stringToElement(s);
-
- Assert.assertEquals("a", subelement.getNodeName());
- }
-
- public void testGetTextContext_4() throws Exception
- {
- String document = "<blah someattribute=\"somevalue\"><a></a></blah>";
-
- Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
-
- String s = org.hornetq.utils.XMLUtil.getTextContent(e);
-
- Element subelement = org.hornetq.utils.XMLUtil.stringToElement(s);
-
- Assert.assertEquals("a", subelement.getNodeName());
- }
-
- public void testGetTextContext_5() throws Exception
- {
- String document = "<blah someattribute=\"somevalue\"><a><b/></a></blah>";
-
- Element e = org.hornetq.utils.XMLUtil.stringToElement(document);
-
- String s = org.hornetq.utils.XMLUtil.getTextContent(e);
-
- Element subelement = org.hornetq.utils.XMLUtil.stringToElement(s);
-
- Assert.assertEquals("a", subelement.getNodeName());
- NodeList nl = subelement.getChildNodes();
-
- // try to find <b>
- boolean found = false;
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
- if ("b".equals(n.getNodeName()))
- {
- found = true;
- }
- }
- Assert.assertTrue(found);
- }
-
- public void testEquivalent_1() throws Exception
- {
- String s = "<a/>";
- String s2 = "<a/>";
-
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.hornetq.utils.XMLUtil.stringToElement(s2));
- }
-
- public void testEquivalent_2() throws Exception
- {
- String s = "<a></a>";
- String s2 = "<a/>";
-
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), org.hornetq.utils.XMLUtil.stringToElement(s2));
- }
-
- public void testEquivalent_3() throws Exception
- {
- String s = "<a attr1=\"val1\" attr2=\"val2\"/>";
- String s2 = "<a attr2=\"val2\"/>";
-
- try
- {
- org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
- XMLUtil.stringToElement(s2));
- Assert.fail("this should throw exception");
- }
- catch (IllegalArgumentException e)
- {
- // OK
- e.printStackTrace();
- }
- }
-
- public void testEquivalent_4() throws Exception
- {
- String s = "<a attr1=\"val1\" attr2=\"val2\"/>";
- String s2 = "<a attr2=\"val2\" attr1=\"val1\"/>";
-
- org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
- org.hornetq.utils.XMLUtil.stringToElement(s2));
- }
-
- public void testEquivalent_5() throws Exception
- {
- String s = "<a><b/></a>";
- String s2 = "<a><b/></a>";
-
- org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
- org.hornetq.utils.XMLUtil.stringToElement(s2));
- }
-
- public void testEquivalent_6() throws Exception
- {
- String s = "<enclosing><a attr1=\"val1\" attr2=\"val2\"/></enclosing>";
- String s2 = "<enclosing><a attr2=\"val2\" attr1=\"val1\"/></enclosing>";
-
- org.hornetq.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s),
- org.hornetq.utils.XMLUtil.stringToElement(s2));
- }
-
- public void testEquivalent_7() throws Exception
- {
- String s = "<a><b/><c/></a>";
- String s2 = "<a><c/><b/></a>";
-
- try
- {
- org.hornetq.utils.XMLUtil.assertEquivalent(org.hornetq.utils.XMLUtil.stringToElement(s),
- org.hornetq.utils.XMLUtil.stringToElement(s2));
- Assert.fail("this should throw exception");
- }
- catch (IllegalArgumentException e)
- {
- // OK
- e.printStackTrace();
- }
- }
-
- public void testEquivalent_8() throws Exception
- {
- String s = "<a><!-- some comment --><b/><!--some other comment --><c/><!-- blah --></a>";
- String s2 = "<a><b/><!--blah blah--><c/></a>";
-
- org.hornetq.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s),
- org.hornetq.utils.XMLUtil.stringToElement(s2));
- }
-
- public void testElementToString_1() throws Exception
- {
- String s = "<a b=\"something\">somethingelse</a>";
- Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
- String tostring = org.hornetq.utils.XMLUtil.elementToString(e);
- Element convertedAgain = org.hornetq.utils.XMLUtil.stringToElement(tostring);
- org.hornetq.utils.XMLUtil.assertEquivalent(e, convertedAgain);
- }
-
- public void testElementToString_2() throws Exception
- {
- String s = "<a b=\"something\"></a>";
- Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
- String tostring = XMLUtil.elementToString(e);
- Element convertedAgain = XMLUtil.stringToElement(tostring);
- XMLUtil.assertEquivalent(e, convertedAgain);
- }
-
- public void testElementToString_3() throws Exception
- {
- String s = "<a b=\"something\"/>";
- Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
- String tostring = XMLUtil.elementToString(e);
- Element convertedAgain = org.hornetq.utils.XMLUtil.stringToElement(tostring);
- org.hornetq.utils.XMLUtil.assertEquivalent(e, convertedAgain);
- }
-
- public void testElementToString_4() throws Exception
- {
- String s = "<a><![CDATA[somedata]]></a>";
- Element e = org.hornetq.utils.XMLUtil.stringToElement(s);
- String tostring = XMLUtil.elementToString(e);
- Element convertedAgain = org.hornetq.utils.XMLUtil.stringToElement(tostring);
- org.hornetq.utils.XMLUtil.assertEquivalent(e, convertedAgain);
- }
-
- public void testReplaceSystemProperties()
- {
- String before = "<configuration>\n" + " <test name=\"${sysprop1}\">content1</test>\n"
- + " <test name=\"test2\">content2</test>\n"
- + " <test name=\"test3\">content3</test>\n"
- + " <test name=\"test4\">${sysprop2}</test>\n"
- + " <test name=\"test5\">content5</test>\n"
- + " <test name=\"test6\">content6</test>\n"
- + "</configuration>";
- String after = "<configuration>\n" + " <test name=\"test1\">content1</test>\n"
- + " <test name=\"test2\">content2</test>\n"
- + " <test name=\"test3\">content3</test>\n"
- + " <test name=\"test4\">content4</test>\n"
- + " <test name=\"test5\">content5</test>\n"
- + " <test name=\"test6\">content6</test>\n"
- + "</configuration>";
- System.setProperty("sysprop1", "test1");
- System.setProperty("sysprop2", "content4");
- String replaced = org.hornetq.utils.XMLUtil.replaceSystemProps(before);
- Assert.assertEquals(after, replaced);
- }
-
- public void testStripCDATA() throws Exception
- {
- String xml = "<![CDATA[somedata]]>";
- String stripped = XMLUtil.stripCDATA(xml);
-
- Assert.assertEquals("somedata", stripped);
- }
-
-}
12 years, 5 months
JBoss hornetq SVN: r12016 - trunk.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-12 07:10:11 -0500 (Thu, 12 Jan 2012)
New Revision: 12016
Modified:
trunk/pom.xml
Log:
mvn: fix surefire-report version, stop forking jvm (as it seems to hit a surefire bug)
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-12 12:10:02 UTC (rev 12015)
+++ trunk/pom.xml 2012-01-12 12:10:11 UTC (rev 12016)
@@ -472,8 +472,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<configuration>
- <forkMode>always</forkMode>
- <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+ <forkMode>once</forkMode>
<testFailureIgnore>true</testFailureIgnore>
<runOrder>alphabetical</runOrder>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
@@ -649,7 +648,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.8.1</version>
+ <version>2.11</version>
</plugin>
</plugins>
</reporting>
12 years, 5 months
JBoss hornetq SVN: r12015 - trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-12 07:10:02 -0500 (Thu, 12 Jan 2012)
New Revision: 12015
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientConsumerImpl.java
Log:
Make synchronization consistent.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientConsumerImpl.java 2012-01-12 12:09:47 UTC (rev 12014)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientConsumerImpl.java 2012-01-12 12:10:02 UTC (rev 12015)
@@ -267,7 +267,7 @@
{
// forced delivery messages are discarded, nothing has been delivered by the queue
resetIfSlowConsumer();
-
+
if (isTrace)
{
log.trace("There was nothing on the queue, leaving it now:: returning null");
@@ -315,7 +315,7 @@
{
largeMessageReceived = m;
}
-
+
if (isTrace)
{
log.trace("Returning " + m);
@@ -367,7 +367,7 @@
return receive(0, true);
}
- public MessageHandler getMessageHandler() throws HornetQException
+ public synchronized MessageHandler getMessageHandler() throws HornetQException
{
checkClosed();
@@ -479,7 +479,7 @@
{
return session;
}
-
+
public SessionQueueQueryResponseMessage getQueueInfo()
{
return queueInfo;
@@ -621,7 +621,7 @@
try
{
ClientMessageInternal message = iter.next();
-
+
if (message.isLargeMessage())
{
ClientLargeMessageInternal largeMessage = (ClientLargeMessageInternal)message;
@@ -637,7 +637,7 @@
}
clearBuffer();
-
+
try
{
if (currentLargeMessageController != null)
@@ -704,11 +704,11 @@
}
}
- /**
- *
+ /**
+ *
* LargeMessageBuffer will call flowcontrol here, while other handleMessage will also be calling flowControl.
* So, this operation needs to be atomic.
- *
+ *
* @param discountSlowConsumer When dealing with slowConsumers, we need to discount one credit that was pre-sent when the first receive was called. For largeMessage that is only done at the latest packet
*/
public void flowControl(final int messageBytes, final boolean discountSlowConsumer) throws HornetQException
@@ -716,7 +716,7 @@
if (clientWindowSize >= 0)
{
creditsToSend += messageBytes;
-
+
if (log.isTraceEnabled())
{
log.trace(this + "::FlowControl::creditsToSend=" + creditsToSend + ", clientWindowSize = " + clientWindowSize + " messageBytes = " + messageBytes);
@@ -774,7 +774,7 @@
// Private
// ---------------------------------------------------------------------------------------
- /**
+ /**
* Sending a initial credit for slow consumers
* */
private void startSlowConsumer()
@@ -808,7 +808,7 @@
{
ClientConsumerImpl.log.trace("Adding Runner on Executor for delivery");
}
-
+
sessionExecutor.execute(runner);
}
@@ -891,7 +891,7 @@
//Ignore, this could be a relic from a previous receiveImmediate();
return;
}
-
+
boolean expired = message.isExpired();
flowControlBeforeConsumption(message);
12 years, 5 months
JBoss hornetq SVN: r12014 - in trunk: hornetq-journal/src/main/java/org/hornetq/core/journal/impl and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-12 07:09:47 -0500 (Thu, 12 Jan 2012)
New Revision: 12014
Modified:
trunk/hornetq-bootstrap/src/main/java/org/hornetq/integration/bootstrap/HornetQBootstrapServer.java
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java
Log:
Log error if file fails to delete.
Modified: trunk/hornetq-bootstrap/src/main/java/org/hornetq/integration/bootstrap/HornetQBootstrapServer.java
===================================================================
--- trunk/hornetq-bootstrap/src/main/java/org/hornetq/integration/bootstrap/HornetQBootstrapServer.java 2012-01-12 12:09:19 UTC (rev 12013)
+++ trunk/hornetq-bootstrap/src/main/java/org/hornetq/integration/bootstrap/HornetQBootstrapServer.java 2012-01-12 12:09:47 UTC (rev 12014)
@@ -32,9 +32,8 @@
import org.jboss.kernel.spi.deployment.KernelDeployment;
/**
- * This is the method in which the HornetQ server can be deployed externall outside of jBoss. Alternatively a user can embed
- * by using the same code as in main
- *
+ * This is the method in which the HornetQ server can be deployed externally outside of jBoss.
+ * Alternatively a user can embed by using the same code as in main
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
*/
public class HornetQBootstrapServer extends BasicBootstrap
@@ -84,7 +83,10 @@
final File file = new File(dirName + "/STOP_ME");
if (file.exists())
{
- file.delete();
+ if (!file.delete())
+ {
+ log.error("Failed to delete " + file.getAbsolutePath());
+ }
}
final Timer timer = new Timer("HornetQ Server Shutdown Timer", true);
timer.scheduleAtFixedRate(new TimerTask()
Modified: trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java
===================================================================
--- trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java 2012-01-12 12:09:19 UTC (rev 12013)
+++ trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/AbstractSequentialFile.java 2012-01-12 12:09:47 UTC (rev 12014)
@@ -103,7 +103,10 @@
close();
}
- file.delete();
+ if (!file.delete())
+ {
+ log.error("Failed to delete file " + this);
+ }
}
public void copyTo(SequentialFile newFileName) throws Exception
Modified: trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java
===================================================================
--- trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java 2012-01-12 12:09:19 UTC (rev 12013)
+++ trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java 2012-01-12 12:09:47 UTC (rev 12014)
@@ -28,7 +28,7 @@
/**
* A SyncSpeedTest
- *
+ *
* This class just provides some diagnostics on how fast your disk can sync
* Useful when determining performance issues
*
@@ -168,7 +168,11 @@
if (file.exists())
{
- file.delete();
+ if (!file.delete())
+ {
+ log.error("failed to delete file " + file);
+ }
+
}
file.createNewFile();
12 years, 5 months
JBoss hornetq SVN: r12013 - in trunk: hornetq-core/src/main/java/org/hornetq/core/deployers/impl and 2 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-12 07:09:19 -0500 (Thu, 12 Jan 2012)
New Revision: 12013
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java
Log:
Use URI instead of URL: URL.(equals|hashCode) require internet access.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java 2012-01-12 12:08:26 UTC (rev 12012)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/Deployer.java 2012-01-12 12:09:19 UTC (rev 12013)
@@ -13,7 +13,7 @@
package org.hornetq.core.deployers;
-import java.net.URL;
+import java.net.URI;
import org.hornetq.core.server.HornetQComponent;
@@ -33,24 +33,22 @@
/**
* Deploy the URL for the first time
- *
- * @param url The resource todeploy
+ * @param uri The resource todeploy
* @throws Exception .
*/
- void deploy(URL url) throws Exception;
+ void deploy(URI uri) throws Exception;
/**
* Redeploys a URL if changed
- *
- * @param url The resource to redeploy
+ * @param uri The resource to redeploy
* @throws Exception .
*/
- void redeploy(URL url) throws Exception;
+ void redeploy(URI uri) throws Exception;
/**
* Undeploys a resource that has been removed
- * @param url The Resource that was deleted
+ * @param uri The Resource that was deleted
* @throws Exception .
*/
- void undeploy(URL url) throws Exception;
+ void undeploy(URI uri) throws Exception;
}
\ No newline at end of file
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java 2012-01-12 12:08:26 UTC (rev 12012)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/AddressSettingsDeployer.java 2012-01-12 12:09:19 UTC (rev 12013)
@@ -29,7 +29,7 @@
private static final Logger log = Logger.getLogger(AddressSettingsDeployer.class);
private final HierarchicalRepository<AddressSettings> addressSettingsRepository;
-
+
private final FileConfigurationParser parser = new FileConfigurationParser();
public AddressSettingsDeployer(final DeploymentManager deploymentManager,
@@ -41,7 +41,7 @@
/**
* the names of the elements to deploy
- * @return the names of the elements todeploy
+ * @return the names of the elements to deploy
*/
@Override
public String[] getElementTagName()
@@ -63,7 +63,7 @@
@Override
public void deploy(final Node node) throws Exception
{
-
+
Pair<String, AddressSettings> setting = parser.parseAddressSettings(node);
addressSettingsRepository.addMatch(setting.getA(), setting.getB());
@@ -76,7 +76,7 @@
}
/**
- * undeploys an element
+ * Undeploys an element.
* @param node the element to undeploy
* @throws Exception .
*/
@@ -89,7 +89,7 @@
}
/**
- * the key attribute for theelement, usually 'name' but can be overridden
+ * the key attribute for the element, usually 'name' but can be overridden
* @return the key attribute
*/
@Override
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java 2012-01-12 12:08:26 UTC (rev 12012)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/FileDeploymentManager.java 2012-01-12 12:09:19 UTC (rev 12013)
@@ -16,6 +16,9 @@
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
@@ -43,7 +46,7 @@
private final List<Deployer> deployers = new ArrayList<Deployer>();
- private final Map<Pair<URL, Deployer>, DeployInfo> deployed = new HashMap<Pair<URL, Deployer>, DeployInfo>();
+ private final Map<Pair<URI, Deployer>, DeployInfo> deployed = new HashMap<Pair<URI, Deployer>, DeployInfo>();
private ScheduledExecutorService scheduler;
@@ -122,28 +125,29 @@
while (urls.hasMoreElements())
{
- URL url = urls.nextElement();
+ URI uri = urls.nextElement().toURI();
- FileDeploymentManager.log.debug("Got url " + url);
+ FileDeploymentManager.log.debug("Got URI " + uri);
try
{
- FileDeploymentManager.log.debug("Deploying " + url + " for " + deployer.getClass().getSimpleName());
- deployer.deploy(url);
+ FileDeploymentManager.log.debug("Deploying " + uri + " for " + deployer.getClass().getSimpleName());
+ deployer.deploy(uri);
}
catch (Exception e)
{
- FileDeploymentManager.log.error("Error deploying " + url, e);
+ FileDeploymentManager.log.error("Error deploying " + uri, e);
}
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(uri, deployer);
- deployed.put(pair, new DeployInfo(deployer, getFileFromURL(url).lastModified()));
+ deployed.put(pair, new DeployInfo(deployer, getFileFromURI(uri).lastModified()));
}
}
}
}
+ @Override
public synchronized void unregisterDeployer(final Deployer deployer) throws Exception
{
if (deployers.remove(deployer))
@@ -154,9 +158,9 @@
Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(filename);
while (urls.hasMoreElements())
{
- URL url = urls.nextElement();
+ URI url = urls.nextElement().toURI();
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(url, deployer);
deployed.remove(pair);
}
@@ -164,9 +168,9 @@
}
}
- private File getFileFromURL(final URL url) throws UnsupportedEncodingException
+ private File getFileFromURI(final URI uri) throws MalformedURLException, UnsupportedEncodingException
{
- return new File(URLDecoder.decode(url.getFile(), "UTF-8"));
+ return new File(URLDecoder.decode(uri.toURL().getFile(), "UTF-8"));
}
/**
@@ -192,62 +196,74 @@
while (urls.hasMoreElements())
{
URL url = urls.nextElement();
+ URI uri;
+ try
+ {
+ uri = url.toURI();
+ } catch (URISyntaxException e) {
+ log.error("Error deploying " + url + ": " + e.getMessage(), e);
+ continue;
+ }
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(uri, deployer);
DeployInfo info = deployed.get(pair);
- long newLastModified = getFileFromURL(url).lastModified();
+ long newLastModified = getFileFromURI(uri).lastModified();
if (info == null)
{
try
{
- deployer.deploy(url);
+ deployer.deploy(uri);
- deployed.put(pair, new DeployInfo(deployer, getFileFromURL(url).lastModified()));
+ deployed.put(pair, new DeployInfo(deployer, getFileFromURI(uri).lastModified()));
}
catch (Exception e)
{
- FileDeploymentManager.log.error("Error deploying " + url, e);
+ FileDeploymentManager.log.error("Error deploying " + uri, e);
}
}
else if (newLastModified > info.lastModified)
{
try
{
- deployer.redeploy(url);
+ deployer.redeploy(uri);
- deployed.put(pair, new DeployInfo(deployer, getFileFromURL(url).lastModified()));
+ deployed.put(pair, new DeployInfo(deployer, getFileFromURI(uri).lastModified()));
}
catch (Exception e)
{
- FileDeploymentManager.log.error("Error redeploying " + url, e);
+ FileDeploymentManager.log.error("Error redeploying " + uri, e);
}
}
}
}
}
- List<Pair<URL, Deployer>> toRemove = new ArrayList<Pair<URL, Deployer>>();
- for (Map.Entry<Pair<URL, Deployer>, DeployInfo> entry : deployed.entrySet())
+ List<Pair<URI, Deployer>> toRemove = new ArrayList<Pair<URI, Deployer>>();
+ for (Map.Entry<Pair<URI, Deployer>, DeployInfo> entry : deployed.entrySet())
{
- Pair<URL, Deployer> pair = entry.getKey();
- if (!fileExists(pair.getA()))
+ Pair<URI, Deployer> pair = entry.getKey();
+ try
{
- try
+ if (!fileExists(pair.getA()))
{
Deployer deployer = entry.getValue().deployer;
FileDeploymentManager.log.debug("Undeploying " + deployer + " with url " + pair.getA());
deployer.undeploy(pair.getA());
toRemove.add(pair);
}
- catch (Exception e)
- {
- FileDeploymentManager.log.error("Error undeploying " + pair.getA(), e);
- }
}
+ catch (URISyntaxException e)
+ {
+ FileDeploymentManager.log.error("Error undeploying " + pair.getA() + ": " + e.getMessage(), e);
+ }
+ catch (Exception e)
+ {
+ FileDeploymentManager.log.error("Error undeploying " + pair.getA(), e);
+ }
}
- for (Pair<URL, Deployer> pair : toRemove)
+ for (Pair<URI, Deployer> pair : toRemove)
{
deployed.remove(pair);
}
@@ -263,7 +279,7 @@
return deployers;
}
- public synchronized Map<Pair<URL, Deployer>, DeployInfo> getDeployed()
+ public synchronized Map<Pair<URI, Deployer>, DeployInfo> getDeployed()
{
return deployed;
}
@@ -271,22 +287,25 @@
// Private -------------------------------------------------------
/**
- * Checks if the URL is among the current thread context class loader's resources.
- *
- * We do not check that the corresponding file exists using File.exists() directly as it would fail
- * in the case the resource is loaded from inside an EAR file (see https://jira.jboss.org/jira/browse/HORNETQ-122)
+ * Checks if the URI is among the current thread context class loader's resources.
+ * <p>
+ * We do not check that the corresponding file exists using File.exists() directly as it would
+ * fail in the case the resource is loaded from inside an EAR file (see
+ * https://jira.jboss.org/jira/browse/HORNETQ-122)
+ * @throws URISyntaxException
*/
- private boolean fileExists(final URL resourceURL)
+ private boolean fileExists(final URI resourceURI) throws URISyntaxException
{
try
{
- File f = getFileFromURL(resourceURL); // this was the orginal line, which doesnt work for File-URLs with white
- // spaces: File f = new File(resourceURL.getPath());
+ File f = getFileFromURI(resourceURI); // this was the original line, which doesn't work for
+ // File-URLs with white spaces: File f = new
+ // File(resourceURL.getPath());
Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(f.getName());
while (resources.hasMoreElements())
{
- URL url = resources.nextElement();
- if (url.equals(resourceURL))
+ URI url = resources.nextElement().toURI();
+ if (url.equals(resourceURI))
{
return true;
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java 2012-01-12 12:08:26 UTC (rev 12012)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java 2012-01-12 12:09:19 UTC (rev 12013)
@@ -15,7 +15,7 @@
import java.io.InputStreamReader;
import java.io.Reader;
-import java.net.URL;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -40,7 +40,7 @@
protected static final String NAME_ATTR = "name";
- private final Map<URL, Map<String, Node>> configuration = new HashMap<URL, Map<String, Node>>();
+ private final Map<URI, Map<String, Node>> configuration = new HashMap<URI, Map<String, Node>>();
private final DeploymentManager deploymentManager;
@@ -60,7 +60,7 @@
* @param name the name of the element
* @param e .
*/
- public synchronized void addToConfiguration(final URL url, final String name, final Node e)
+ public synchronized void addToConfiguration(final URI url, final String name, final Node e)
{
Map<String, Node> map = configuration.get(url);
if (map == null)
@@ -77,7 +77,8 @@
* @param url The resource to redeploy
* @throws Exception .
*/
- public synchronized void redeploy(final URL url) throws Exception
+ @Override
+ public synchronized void redeploy(final URI url) throws Exception
{
Element e = getRootElement(url);
List<String> added = new ArrayList<String>();
@@ -129,26 +130,27 @@
/**
* Undeploys a resource that has been removed
- * @param url The Resource that was deleted
+ * @param uri The Resource that was deleted
* @throws Exception .
*/
- public synchronized void undeploy(final URL url) throws Exception
+ @Override
+ public synchronized void undeploy(final URI uri) throws Exception
{
- Set<String> keys = configuration.get(url).keySet();
+ Set<String> keys = configuration.get(uri).keySet();
for (String key : keys)
{
- undeploy(configuration.get(url).get(key));
+ undeploy(configuration.get(uri).get(key));
}
- configuration.remove(url);
+ configuration.remove(uri);
}
/**
* Deploy the URL for the first time
- *
- * @param url The resource todeploy
+ * @param url The resource to deploy
* @throws Exception .
*/
- public synchronized void deploy(final URL url) throws Exception
+ @Override
+ public synchronized void deploy(final URI url) throws Exception
{
Element e = getRootElement(url);
@@ -271,7 +273,7 @@
public abstract void deploy(final Node node) throws Exception;
/**
- * Validate the DOM
+ * Validate the DOM
*/
public abstract void validate(final Node rootNode) throws Exception;
@@ -282,15 +284,15 @@
*/
public abstract void undeploy(final Node node) throws Exception;
- protected Element getRootElement(final URL url) throws Exception
+ protected Element getRootElement(final URI url) throws Exception
{
- Reader reader = new InputStreamReader(url.openStream());
+ Reader reader = new InputStreamReader(url.toURL().openStream());
String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
xml = org.hornetq.utils.XMLUtil.replaceSystemProps(xml);
return org.hornetq.utils.XMLUtil.stringToElement(xml);
}
- private boolean hasNodeChanged(final URL url, final Node child, final String name)
+ private boolean hasNodeChanged(final URI url, final Node child, final String name)
{
String newTextContent = child.getTextContent();
String origTextContent = configuration.get(url).get(name).getTextContent();
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2012-01-12 12:08:26 UTC (rev 12012)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2012-01-12 12:09:19 UTC (rev 12013)
@@ -13,7 +13,7 @@
package org.hornetq.tests.integration.jms.server;
-import java.net.URL;
+import java.net.URI;
import javax.jms.Queue;
import javax.jms.Topic;
@@ -24,7 +24,6 @@
import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.FileDeploymentManager;
import org.hornetq.core.logging.Logger;
@@ -161,7 +160,7 @@
JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager);
String conf = "hornetq-jms-for-JMSServerDeployerTest.xml";
- URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
+ URI confURL = Thread.currentThread().getContextClassLoader().getResource(conf).toURI();
String[] connectionFactoryBindings = new String[] { "/fullConfigurationConnectionFactory",
"/acme/fullConfigurationConnectionFactory",
@@ -240,13 +239,13 @@
Assert.assertEquals("fullConfigurationTopic", topic.getTopicName());
}
}
-
+
public void testDeployFullConfiguration2() throws Exception
{
JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager);
String conf = "hornetq-jms-for-JMSServerDeployerTest2.xml";
- URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
+ URI confURL = Thread.currentThread().getContextClassLoader().getResource(conf).toURI();
String[] connectionFactoryBindings = new String[] { "/fullConfigurationConnectionFactory",
"/acme/fullConfigurationConnectionFactory",
@@ -338,7 +337,7 @@
config = createBasicConfig();
config.getConnectorConfigurations().put("netty",
new TransportConfiguration(NettyConnectorFactory.class.getName()));
-
+
DiscoveryGroupConfiguration dcg = new DiscoveryGroupConfiguration("mygroup", "172.16.8.10",
"243.7.7.7", 12345,
5432, 5432);
Modified: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java 2012-01-12 12:08:26 UTC (rev 12012)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java 2012-01-12 12:09:19 UTC (rev 12013)
@@ -14,7 +14,7 @@
package org.hornetq.tests.unit.core.deployers.impl;
import java.io.File;
-import java.net.URL;
+import java.net.URI;
import junit.framework.Assert;
@@ -25,9 +25,9 @@
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* A FileDeploymentManagerTest
- *
+ *
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*
*/
@@ -84,12 +84,12 @@
fdm.start();
try
{
- URL expected = file.toURI().toURL();
- URL deployedUrl = deployer.deployedUrl;
+ URI expected = file.toURI();
+ URI deployedUrl = deployer.deployedUri;
Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
- deployer.deployedUrl = null;
+ deployer.deployedUri = null;
fdm.start();
- Assert.assertNull(deployer.deployedUrl);
+ Assert.assertNull(deployer.deployedUri);
fdm.stop();
}
@@ -123,12 +123,12 @@
try
{
fdm.registerDeployer(deployer);
- URL expected = file.toURI().toURL();
- URL deployedUrl = deployer.deployedUrl;
+ URI expected = file.toURI();
+ URI deployedUrl = deployer.deployedUri;
Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
- deployer.deployedUrl = null;
+ deployer.deployedUri = null;
fdm.start();
- Assert.assertNull(deployer.deployedUrl);
+ Assert.assertNull(deployer.deployedUri);
fdm.stop();
}
finally
@@ -170,13 +170,13 @@
FakeDeployer deployer4 = new FakeDeployer(filename3); // Can have multiple deployers on the same file
try
{
- URL url1 = file1.toURI().toURL();
+ URI url1 = file1.toURI();
deployer1.deploy(url1);
- URL url2 = file2.toURI().toURL();
+ URI url2 = file2.toURI();
deployer2.deploy(url2);
- URL url3 = file3.toURI().toURL();
+ URI url3 = file3.toURI();
deployer3.deploy(url3);
deployer4.deploy(url3);
@@ -193,10 +193,10 @@
Assert.assertTrue(fdm.getDeployers().contains(deployer4));
Assert.assertEquals(4, fdm.getDeployed().size());
- Assert.assertEquals(file1.toURI().toURL(), deployer1.deployedUrl);
- Assert.assertEquals(file2.toURI().toURL(), deployer2.deployedUrl);
- Assert.assertEquals(file3.toURI().toURL(), deployer3.deployedUrl);
- Assert.assertEquals(file3.toURI().toURL(), deployer4.deployedUrl);
+ Assert.assertEquals(file1.toURI(), deployer1.deployedUri);
+ Assert.assertEquals(file2.toURI(), deployer2.deployedUri);
+ Assert.assertEquals(file3.toURI(), deployer3.deployedUri);
+ Assert.assertEquals(file3.toURI(), deployer4.deployedUri);
// Registering same again should do nothing
fdm.registerDeployer(deployer1);
@@ -265,11 +265,11 @@
FakeDeployer deployer = new FakeDeployer(filename);
try
{
- URL url = file.toURI().toURL();
+ URI url = file.toURI();
deployer.deploy(url);
fdm.registerDeployer(deployer);
- Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
+ Assert.assertEquals(file.toURI(), deployer.deployedUri);
// Touch the file
file.setLastModified(oldLastModified + 1000);
@@ -280,18 +280,18 @@
Assert.assertEquals(1, fdm.getDeployers().size());
Assert.assertTrue(fdm.getDeployers().contains(deployer));
Assert.assertEquals(1, fdm.getDeployed().size());
- URL expected = file.toURI().toURL();
- URL deployedUrl = deployer.deployedUrl;
+ URI expected = file.toURI();
+ URI deployedUrl = deployer.deployedUri;
Assert.assertTrue(expected.toString().equalsIgnoreCase(deployedUrl.toString()));
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
+ Pair<URI, Deployer> pair = new Pair<URI, Deployer>(url, deployer);
Assert.assertEquals(oldLastModified + 1000, fdm.getDeployed().get(pair).lastModified);
- deployer.reDeployedUrl = null;
+ deployer.reDeployedUri = null;
// Scanning again should not redeploy
fdm.run();
Assert.assertEquals(oldLastModified + 1000, fdm.getDeployed().get(pair).lastModified);
- Assert.assertNull(deployer.reDeployedUrl);
+ Assert.assertNull(deployer.reDeployedUri);
}
finally
{
@@ -319,22 +319,22 @@
FakeDeployer deployer = new FakeDeployer(filename);
try
{
- URL url = file.toURI().toURL();
- deployer.deploy(url);
+ URI uri = file.toURI();
+ deployer.deploy(uri);
fdm.registerDeployer(deployer);
Assert.assertEquals(1, fdm.getDeployers().size());
Assert.assertTrue(fdm.getDeployers().contains(deployer));
Assert.assertEquals(1, fdm.getDeployed().size());
- Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
- deployer.deployedUrl = null;
+ Assert.assertEquals(file.toURI(), deployer.deployedUri);
+ deployer.deployedUri = null;
file.delete();
// This should cause undeployment
- deployer.undeploy(url);
- Assert.assertEquals(file.toURI().toURL(), deployer.unDeployedUrl);
+ deployer.undeploy(uri);
+ Assert.assertEquals(file.toURI(), deployer.unDeployedUri);
fdm.run();
@@ -346,7 +346,7 @@
file.createNewFile();
- deployer.deploy(url);
+ deployer.deploy(uri);
fdm.run();
@@ -354,7 +354,7 @@
Assert.assertTrue(fdm.getDeployers().contains(deployer));
Assert.assertEquals(1, fdm.getDeployed().size());
- Assert.assertEquals(file.toURI().toURL(), deployer.deployedUrl);
+ Assert.assertEquals(file.toURI(), deployer.deployedUri);
}
finally
{
@@ -365,11 +365,11 @@
class FakeDeployer implements Deployer
{
- URL deployedUrl;
+ URI deployedUri;
- URL unDeployedUrl;
+ URI unDeployedUri;
- URL reDeployedUrl;
+ URI reDeployedUri;
boolean started;
@@ -385,31 +385,37 @@
return new String[] { file };
}
- public void deploy(final URL url) throws Exception
+ @Override
+ public void deploy(final URI url) throws Exception
{
- deployedUrl = url;
+ deployedUri = url;
}
- public void redeploy(final URL url) throws Exception
+ @Override
+ public void redeploy(final URI url) throws Exception
{
- reDeployedUrl = url;
+ reDeployedUri = url;
}
- public void undeploy(final URL url) throws Exception
+ @Override
+ public void undeploy(final URI url) throws Exception
{
- unDeployedUrl = url;
+ unDeployedUri = url;
}
+ @Override
public void start() throws Exception
{
started = true;
}
+ @Override
public void stop() throws Exception
{
started = false;
}
+ @Override
public boolean isStarted()
{
return started;
Modified: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java 2012-01-12 12:08:26 UTC (rev 12012)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/deployers/impl/XMLDeployerTest.java 2012-01-12 12:09:19 UTC (rev 12013)
@@ -13,7 +13,7 @@
package org.hornetq.tests.unit.core.deployers.impl;
-import java.net.URL;
+import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
@@ -55,13 +55,13 @@
+ " <test name=\"test6\">content6</test>\n"
+ "</configuration>";
- private URL url;
+ private URI url;
@Override
protected void setUp() throws Exception
{
super.setUp();
- url = new URL("http://localhost");
+ url = new URI("http://localhost");
}
public void testDeploy() throws Exception
@@ -248,7 +248,7 @@
}
@Override
- protected Element getRootElement(final URL url)
+ protected Element getRootElement(final URI url)
{
return element;
}
12 years, 5 months
JBoss hornetq SVN: r12012 - in trunk: hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal and 8 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-12 07:08:26 -0500 (Thu, 12 Jan 2012)
New Revision: 12012
Added:
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageInSync.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicatedLargeMessage.java
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/LargeServerMessage.java
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/DeleteMessagesOnStartupTest.java
Log:
HORNETQ-720 Fix synchronization issues with Large Messages
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -26,6 +26,7 @@
import org.hornetq.core.journal.IOAsyncTask;
import org.hornetq.core.journal.Journal;
import org.hornetq.core.journal.JournalLoadInformation;
+import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.message.impl.MessageInternal;
import org.hornetq.core.paging.PageTransactionInfo;
import org.hornetq.core.paging.PagedMessage;
@@ -161,6 +162,8 @@
*/
LargeServerMessage createLargeMessage(long id, MessageInternal message) throws Exception;
+ SequentialFile createFileForLargeMessage(final long messageID, String extension);
+
void prepare(long txID, Xid xid) throws Exception;
void commit(long txID) throws Exception;
@@ -274,4 +277,11 @@
* Typical scenario is a broken connection.
*/
void stopReplication();
+
+ /**
+ * @param appendFile
+ * @param messageID
+ * @param bytes
+ */
+ void addBytesToLargeMessage(SequentialFile appendFile, long messageID, byte[] bytes) throws Exception;
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -381,7 +381,7 @@
messageFiles = prepareJournalForCopy(originalMessageJournal, JournalContent.MESSAGES, nodeID);
bindingsFiles = prepareJournalForCopy(originalBindingsJournal, JournalContent.BINDINGS, nodeID);
pageFilesToSync = getPageInformationForSync(pagingManager);
- largeMessageFilesToSync = getLargeMessageInformation();
+ largeMessageFilesToSync = getLargeMessageInformation();
}
finally
{
@@ -469,14 +469,14 @@
private Map<SimpleString, Collection<Integer>> getPageInformationForSync(PagingManager pagingManager)
throws Exception
{
- Map<SimpleString, Collection<Integer>> info = new HashMap<SimpleString, Collection<Integer>>();
- for (SimpleString storeName : pagingManager.getStoreNames())
- {
- PagingStore store = pagingManager.getPageStore(storeName);
- info.put(storeName, store.getCurrentIds());
- store.forceAnotherPage();
- }
- return info;
+ Map<SimpleString, Collection<Integer>> info = new HashMap<SimpleString, Collection<Integer>>();
+ for (SimpleString storeName : pagingManager.getStoreNames())
+ {
+ PagingStore store = pagingManager.getPageStore(storeName);
+ info.put(storeName, store.getCurrentIds());
+ store.forceAnotherPage();
+ }
+ return info;
}
private void sendLargeMessageFiles(Map<String, Long> largeMessageFilesToSync) throws Exception
@@ -509,30 +509,35 @@
*/
private Map<String, Long> getLargeMessageInformation() throws Exception
{
- Map<String, Long> largeMessages = new HashMap<String, Long>();
- List<String> filenames = largeMessagesFactory.listFiles("msg");
- for (String filename : filenames)
- {
- SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename, 1);
- long size = seqFile.size();
- largeMessages.put(filename, size);
- }
- return largeMessages;
+ final String prefix = "msg";
+ Map<String, Long> largeMessages = new HashMap<String, Long>();
+ List<String> filenames = largeMessagesFactory.listFiles(prefix);
+
+ List<Long> idList = new ArrayList<Long>();
+ for (String filename : filenames)
+ {
+ idList.add(Long.valueOf(filename.substring(0, filename.length() - (prefix.length() + 1))));
+ SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename, 1);
+ long size = seqFile.size();
+ largeMessages.put(filename, size);
+ }
+ replicator.sendLargeMessageIdListMessage(idList);
+ return largeMessages;
}
/**
* Send an entire journal file to a replicating backup server.
*/
private void sendJournalFile(JournalFile[] journalFiles, JournalContent type) throws Exception
- {
- for (JournalFile jf : journalFiles)
- {
- if (!started)
- return;
- replicator.syncJournalFile(jf, type);
- jf.setCanReclaim(true);
- }
- }
+ {
+ for (JournalFile jf : journalFiles)
+ {
+ if (!started)
+ return;
+ replicator.syncJournalFile(jf, type);
+ jf.setCanReclaim(true);
+ }
+ }
private JournalFile[]
prepareJournalForCopy(Journal journal, JournalContent contentType, String nodeID) throws Exception
@@ -546,23 +551,23 @@
@Override
public void waitOnOperations() throws Exception
{
- if (!started)
- {
- JournalStorageManager.log.warn("Server is stopped");
- throw new IllegalStateException("Server is stopped");
- }
- waitOnOperations(0);
+ if (!started)
+ {
+ JournalStorageManager.log.warn("Server is stopped");
+ throw new IllegalStateException("Server is stopped");
+ }
+ waitOnOperations(0);
}
@Override
public boolean waitOnOperations(final long timeout) throws Exception
{
- if (!started)
- {
- JournalStorageManager.log.warn("Server is stopped");
- throw new IllegalStateException("Server is stopped");
- }
- return getContext().waitCompletion(timeout);
+ if (!started)
+ {
+ JournalStorageManager.log.warn("Server is stopped");
+ throw new IllegalStateException("Server is stopped");
+ }
+ return getContext().waitCompletion(timeout);
}
@Override
@@ -665,7 +670,8 @@
return new LargeServerMessageImpl(this);
}
- protected final void addBytesToLargeMessage(final SequentialFile file, final long messageId, final byte[] bytes)
+ public final void
+ addBytesToLargeMessage(final SequentialFile file, final long messageId, final byte[] bytes)
throws Exception
{
readLock();
@@ -2241,7 +2247,7 @@
* @param messageID
* @return
*/
- SequentialFile createFileForLargeMessage(final long messageID, String extension)
+ public SequentialFile createFileForLargeMessage(final long messageID, String extension)
{
return largeMessagesFactory.createSequentialFile(messageID + extension, -1);
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -54,7 +54,6 @@
private long pendingRecordID = -1;
private boolean paged;
- private boolean replicationSync;
// We should only use the NIO implementation on the Journal
private SequentialFile file;
@@ -107,9 +106,7 @@
paged = true;
}
- /* (non-Javadoc)
- * @see org.hornetq.core.server.LargeServerMessage#addBytes(byte[])
- */
+ @Override
public synchronized void addBytes(final byte[] bytes) throws Exception
{
validateFile();
@@ -239,6 +236,7 @@
return true;
}
+ @Override
public synchronized void deleteFile() throws Exception
{
validateFile();
@@ -430,14 +428,10 @@
private String getExtension()
{
- if (replicationSync)
- return ".sync";
return durable ? ".msg" : ".tmp";
}
- /* (non-Javadoc)
- * @see org.hornetq.core.server.LargeServerMessage#setLinkedMessage(org.hornetq.core.server.LargeServerMessage)
- */
+ @Override
public void setLinkedMessage(final LargeServerMessage message)
{
if (file != null)
@@ -521,18 +515,10 @@
return bytesRead;
}
- /* (non-Javadoc)
- * @see org.hornetq.core.message.BodyEncoder#getLargeBodySize()
- */
+ @Override
public long getLargeBodySize()
{
return bodySize;
}
}
-
- @Override
- public void setReplicationSync(boolean sync)
- {
- replicationSync = sync;
- }
}
Added: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageInSync.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageInSync.java (rev 0)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/LargeServerMessageInSync.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -0,0 +1,135 @@
+/**
+ *
+ */
+package org.hornetq.core.persistence.impl.journal;
+
+import java.nio.ByteBuffer;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.journal.SequentialFile;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.replication.ReplicatedLargeMessage;
+import org.hornetq.core.server.LargeServerMessage;
+
+public final class LargeServerMessageInSync implements ReplicatedLargeMessage
+{
+ private static final Logger log = Logger.getLogger(LargeServerMessageInSync.class);
+
+ private static final String SYNC_EXTENSION = ".sync";
+ private final LargeServerMessage mainLM;
+ private final StorageManager storageManager;
+ private SequentialFile appendFile;
+ private boolean syncDone;
+
+ /**
+ * @param storageManager
+ */
+ public LargeServerMessageInSync(StorageManager storageManager)
+ {
+ mainLM = storageManager.createLargeMessage();
+ this.storageManager = storageManager;
+ }
+
+ public synchronized void joinSyncedData(ByteBuffer buffer) throws Exception
+ {
+ SequentialFile mainSeqFile = mainLM.getFile();
+ if (appendFile != null)
+ {
+ for (;;)
+ {
+ buffer.rewind();
+ int size = appendFile.read(buffer);
+ mainSeqFile.writeInternal(buffer);
+ if (size < buffer.capacity())
+ {
+ break;
+ }
+ }
+ deleteAppendFile();
+ }
+ syncDone = true;
+ }
+
+ public SequentialFile getSyncFile() throws HornetQException
+ {
+ return mainLM.getFile();
+ }
+
+ @Override
+ public void setDurable(boolean durable)
+ {
+ mainLM.setDurable(durable);
+ }
+
+ @Override
+ public synchronized void setMessageID(long id)
+ {
+ mainLM.setMessageID(id);
+ }
+
+ @Override
+ public synchronized void releaseResources()
+ {
+ mainLM.releaseResources();
+ if (appendFile != null && appendFile.isOpen())
+ {
+ try
+ {
+ appendFile.close();
+ }
+ catch (Exception e)
+ {
+ log.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ @Override
+ public synchronized void deleteFile() throws Exception
+ {
+ try
+ {
+ mainLM.deleteFile();
+ }
+ finally
+ {
+ deleteAppendFile();
+ }
+ }
+
+ /**
+ * @throws Exception
+ */
+ private void deleteAppendFile() throws Exception
+ {
+ if (appendFile != null)
+ {
+ if (appendFile.isOpen())
+ appendFile.close();
+ appendFile.delete();
+ }
+ }
+
+ @Override
+ public synchronized void addBytes(byte[] bytes) throws Exception
+ {
+ if (syncDone)
+ {
+ mainLM.addBytes(bytes);
+ return;
+ }
+
+ if (appendFile == null)
+ {
+ appendFile = storageManager.createFileForLargeMessage(mainLM.getMessageID(), SYNC_EXTENSION);
+ }
+
+ if (!appendFile.isOpen())
+ {
+ appendFile.open();
+ }
+ storageManager.addBytesToLargeMessage(appendFile, mainLM.getMessageID(), bytes);
+ }
+
+}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -138,9 +138,7 @@
}
- /* (non-Javadoc)
- * @see org.hornetq.core.server.LargeServerMessage#incrementDelayDeletionCount()
- */
+ @Override
public void incrementDelayDeletionCount()
{
@@ -158,51 +156,25 @@
return "LargeServerMessage[messageID=" + messageID + ", durable=" + durable + ", address=" + getAddress() + ",properties=" + properties.toString() + "]";
}
- /* (non-Javadoc)
- * @see org.hornetq.core.server.LargeServerMessage#setPaged()
- */
+ @Override
public void setPaged()
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.server.LargeServerMessage#setPendingRecordID(long)
- */
+ @Override
public void setPendingRecordID(long pendingRecordID)
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.server.LargeServerMessage#getPendingRecordID()
- */
+ @Override
public long getPendingRecordID()
{
return -1;
}
- /*
- * (non-Javadoc)
- * @see org.hornetq.core.server.LargeServerMessage#setReplicationSync(boolean)
- */
@Override
- public void setReplicationSync(boolean sync)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
public SequentialFile getFile()
{
return null;
}
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -28,6 +28,7 @@
import org.hornetq.core.journal.IOAsyncTask;
import org.hornetq.core.journal.Journal;
import org.hornetq.core.journal.JournalLoadInformation;
+import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.message.impl.MessageInternal;
import org.hornetq.core.paging.PageTransactionInfo;
import org.hornetq.core.paging.PagedMessage;
@@ -351,92 +352,67 @@
return true;
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#setReplicator(org.hornetq.core.replication.ReplicationManager)
- */
public void setReplicator(final ReplicationManager replicator)
{
throw new IllegalStateException("Null Persistence should never be used as replicated");
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#afterCompleteOperations(org.hornetq.core.journal.IOCompletion)
- */
public void afterCompleteOperations(final IOAsyncTask run)
{
run.done();
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#waitOnOperations()
- */
+ @Override
public void waitOnOperations() throws Exception
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#getContext()
- */
+ @Override
public OperationContext getContext()
{
return dummyContext;
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#newContext()
- */
+ @Override
public OperationContext newContext(final Executor executor)
{
return dummyContext;
}
-
+ @Override
public OperationContext newSingleThreadContext()
{
return dummyContext;
}
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#setContext(org.hornetq.core.persistence.OperationContext)
- */
+ @Override
public void setContext(final OperationContext context)
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#clearContext()
- */
+ @Override
public void clearContext()
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#recoverAddressSettings()
- */
+ @Override
public List<PersistedAddressSetting> recoverAddressSettings() throws Exception
{
return Collections.emptyList();
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeAddressSetting(org.hornetq.core.persistconfig.PersistedAddressSetting)
- */
+ @Override
public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#recoverPersistedRoles()
- */
+ @Override
public List<PersistedRoles> recoverPersistedRoles() throws Exception
{
return Collections.emptyList();
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
- */
+ @Override
public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
{
}
@@ -512,54 +488,44 @@
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deletePageCounter(long, long)
- */
+ @Override
public void deletePageCounter(long txID, long recordID) throws Exception
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, long, int)
- */
+ @Override
public long storePageCounterInc(long txID, long queueID, int add) throws Exception
{
return 0;
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, int)
- */
+ @Override
public long storePageCounterInc(long queueID, int add) throws Exception
{
return 0;
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#commit(long, boolean)
- */
+ @Override
public void commit(long txID, boolean lineUpContext) throws Exception
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#lineUpContext()
- */
+ @Override
public void lineUpContext()
{
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#confirmPendingLargeMessageTX(org.hornetq.core.transaction.Transaction, long, long)
- */
+ @Override
public void confirmPendingLargeMessageTX(Transaction transaction, long messageID, long recordID) throws Exception
{
}
+ @Override
public void confirmPendingLargeMessage(long recordID) throws Exception
{
}
+ @Override
public void stop(boolean ioCriticalError) throws Exception
{
}
@@ -598,4 +564,16 @@
{
// no-op
}
+
+ @Override
+ public SequentialFile createFileForLargeMessage(long messageID, String extension)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addBytesToLargeMessage(SequentialFile appendFile, long messageID, byte[] bytes) throws Exception
+ {
+ // no-op
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -1,5 +1,9 @@
package org.hornetq.core.protocol.core.impl.wireformat;
+import java.security.InvalidParameterException;
+import java.util.Arrays;
+import java.util.List;
+
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.impl.JournalFile;
import org.hornetq.core.persistence.impl.journal.JournalStorageManager.JournalContent;
@@ -14,15 +18,57 @@
public class ReplicationStartSyncMessage extends PacketImpl
{
private long[] ids;
- private JournalContent journalType;
+ private SyncDataType dataType;
private boolean synchronizationIsFinished;
private String nodeID;
+ public enum SyncDataType
+ {
+ JournalBindings(JournalContent.BINDINGS.typeByte),
+ JournalMessages(JournalContent.MESSAGES.typeByte),
+ LargeMessages((byte)2);
+
+ private byte code;
+
+ private SyncDataType(byte code)
+ {
+ this.code = code;
+ }
+
+ public static JournalContent getJournalContentType(SyncDataType dataType)
+ {
+ return JournalContent.getType(dataType.code);
+ }
+
+ public static SyncDataType getDataType(byte code)
+ {
+ if (code == JournalBindings.code)
+ return JournalBindings;
+ if (code == JournalMessages.code)
+ return JournalMessages;
+ if (code == LargeMessages.code)
+ return LargeMessages;
+ throw new InvalidParameterException("invalid byte: " + code);
+ }
+ }
+
public ReplicationStartSyncMessage()
{
super(REPLICATION_START_FINISH_SYNC);
}
+ public ReplicationStartSyncMessage(List<Long> filenames)
+ {
+ this();
+ ids = new long[filenames.size()];
+ for (int i = 0; i < filenames.size(); i++)
+ {
+ ids[i] = filenames.get(i);
+ }
+ dataType = SyncDataType.LargeMessages;
+ nodeID = ""; // this value will be ignored
+ }
+
public ReplicationStartSyncMessage(String nodeID)
{
this();
@@ -40,7 +86,17 @@
{
ids[i] = datafiles[i].getFileID();
}
- journalType = contentType;
+ switch (contentType)
+ {
+ case MESSAGES:
+ dataType = SyncDataType.JournalMessages;
+ break;
+ case BINDINGS:
+ dataType = SyncDataType.JournalBindings;
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
}
@Override
@@ -50,7 +106,7 @@
buffer.writeString(nodeID);
if (synchronizationIsFinished)
return;
- buffer.writeByte(journalType.typeByte);
+ buffer.writeByte(dataType.code);
buffer.writeInt(ids.length);
for (long id : ids)
{
@@ -67,7 +123,7 @@
{
return;
}
- journalType = JournalContent.getType(buffer.readByte());
+ dataType = SyncDataType.getDataType(buffer.readByte());
int length = buffer.readInt();
ids = new long[length];
for (int i = 0; i < length; i++)
@@ -85,9 +141,9 @@
return synchronizationIsFinished;
}
- public JournalContent getJournalContentType()
+ public SyncDataType getDataType()
{
- return journalType;
+ return dataType;
}
public long[] getFileIds()
@@ -99,4 +155,58 @@
{
return nodeID;
}
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(ids);
+ result = prime * result + ((dataType == null) ? 0 : dataType.hashCode());
+ result = prime * result + ((nodeID == null) ? 0 : nodeID.hashCode());
+ result = prime * result + (synchronizationIsFinished ? 1231 : 1237);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof ReplicationStartSyncMessage))
+ {
+ return false;
+ }
+ ReplicationStartSyncMessage other = (ReplicationStartSyncMessage)obj;
+ if (!Arrays.equals(ids, other.ids))
+ {
+ return false;
+ }
+ if (dataType != other.dataType)
+ {
+ return false;
+ }
+ if (nodeID == null)
+ {
+ if (other.nodeID != null)
+ {
+ return false;
+ }
+ }
+ else if (!nodeID.equals(other.nodeID))
+ {
+ return false;
+ }
+ if (synchronizationIsFinished != other.synchronizationIsFinished)
+ {
+ return false;
+ }
+ return true;
+ }
}
Added: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicatedLargeMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicatedLargeMessage.java (rev 0)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicatedLargeMessage.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -0,0 +1,38 @@
+/**
+ *
+ */
+package org.hornetq.core.replication;
+
+import org.hornetq.core.server.LargeServerMessage;
+
+/**
+ *
+ */
+public interface ReplicatedLargeMessage
+{
+ /**
+ * @see LargeServerMessage#setDurable(boolean)
+ */
+ void setDurable(boolean b);
+
+ /**
+ * @see LargeServerMessage#setMessageID(long)
+ */
+ void setMessageID(long id);
+
+ /**
+ * @see LargeServerMessage#releaseResources()
+ */
+ void releaseResources();
+
+ /**
+ * @see LargeServerMessage#deleteFile()
+ */
+ void deleteFile() throws Exception;
+
+ /**
+ * @see LargeServerMessage#addBytes(byte[])
+ */
+ void addBytes(byte[] body) throws Exception;
+
+}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -44,6 +44,7 @@
import org.hornetq.core.paging.impl.PagingStoreFactoryNIO;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.persistence.impl.journal.JournalStorageManager.JournalContent;
+import org.hornetq.core.persistence.impl.journal.LargeServerMessageInSync;
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.Packet;
@@ -64,9 +65,9 @@
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationStartSyncMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationStartSyncMessage.SyncDataType;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationSyncFileMessage;
import org.hornetq.core.server.HornetQComponent;
-import org.hornetq.core.server.LargeServerMessage;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.impl.HornetQServerImpl;
import org.hornetq.core.server.impl.QuorumManager;
@@ -97,7 +98,6 @@
/** Files reserved in each journal for synchronization of existing data from the 'live' server. */
private final Map<JournalContent, Map<Long, JournalSyncFile>> filesReservedForSync =
new HashMap<JournalContent, Map<Long, JournalSyncFile>>();
- private final Map<Long, LargeServerMessage> largeMessagesOnSync = new HashMap<Long, LargeServerMessage>();
/**
* Used to hold the real Journals before the backup is synchronized. This field should be
@@ -111,8 +111,8 @@
private final ConcurrentMap<SimpleString, ConcurrentMap<Integer, Page>> pageIndex =
new ConcurrentHashMap<SimpleString, ConcurrentMap<Integer, Page>>();
- private final ConcurrentMap<Long, LargeServerMessage> largeMessages =
- new ConcurrentHashMap<Long, LargeServerMessage>();
+ private final ConcurrentMap<Long, ReplicatedLargeMessage> largeMessages =
+ new ConcurrentHashMap<Long, ReplicatedLargeMessage>();
// Used on tests, to simulate failures on delete pages
private boolean deletePages = true;
@@ -285,8 +285,7 @@
return;
}
- // This could be null if the backup server is being
- // shut down without any live server connecting here
+ // Channel may be null if there isn't a connection to a live server
if (channel != null)
{
channel.close();
@@ -309,18 +308,12 @@
pageIndex.clear();
- for (LargeServerMessage largeMessage : largeMessages.values())
+ for (ReplicatedLargeMessage largeMessage : largeMessages.values())
{
largeMessage.releaseResources();
}
largeMessages.clear();
- for (LargeServerMessage largeMessage : largeMessagesOnSync.values())
- {
- largeMessage.releaseResources();
- }
- largeMessagesOnSync.clear();
-
for (Entry<JournalContent, Map<Long, JournalSyncFile>> entry : filesReservedForSync.entrySet())
{
for (JournalSyncFile filesReserved : entry.getValue().values())
@@ -444,42 +437,17 @@
journal.synchronizationUnlock();
}
}
- synchronized (largeMessagesOnSync)
+ ByteBuffer buffer = ByteBuffer.allocate(4 * 1024);
+ for (Entry<Long, ReplicatedLargeMessage> entry : largeMessages.entrySet())
{
- synchronized (largeMessages)
+ ReplicatedLargeMessage lm = entry.getValue();
+ if (lm instanceof LargeServerMessageInSync)
{
- ByteBuffer buffer = ByteBuffer.allocate(10 * 1024);
- for (Entry<Long, LargeServerMessage> entry : largeMessages.entrySet())
- {
- Long id = entry.getKey();
- LargeServerMessage lm = entry.getValue();
- if (largeMessagesOnSync.containsKey(id))
- {
- SequentialFile sq = lm.getFile();
- LargeServerMessage mainLM = largeMessagesOnSync.get(id);
- SequentialFile mainSeqFile = mainLM.getFile();
- for (;;)
- {
- buffer.rewind();
- int size = sq.read(buffer);
- mainSeqFile.writeInternal(buffer);
- if (size < buffer.capacity())
- {
- break;
- }
- }
- }
- else
- {
- // these are large-messages created after sync started
- largeMessagesOnSync.put(id, lm);
- }
- }
- largeMessages.clear();
- largeMessages.putAll(largeMessagesOnSync);
- largeMessagesOnSync.clear();
+ LargeServerMessageInSync lmSync = (LargeServerMessageInSync)lm;
+ lmSync.joinSyncedData(buffer);
}
}
+
journalsHolder = null;
quorumManager.setLiveID(liveID);
server.setRemoteBackupUpToDate(liveID);
@@ -487,7 +455,7 @@
return;
}
- private void handleReplicationSynchronization(ReplicationSyncFileMessage msg) throws Exception
+ private synchronized void handleReplicationSynchronization(ReplicationSyncFileMessage msg) throws Exception
{
Long id = Long.valueOf(msg.getId());
byte[] data = msg.getData();
@@ -496,24 +464,19 @@
{
case LARGE_MESSAGE:
{
- synchronized (largeMessagesOnSync)
+ ReplicatedLargeMessage largeMessage = lookupLargeMessage(id, false);
+ if (!(largeMessage instanceof LargeServerMessageInSync))
{
- LargeServerMessage largeMessage = largeMessagesOnSync.get(id);
- if (largeMessage == null)
- {
- largeMessage = storage.createLargeMessage();
- largeMessage.setDurable(true);
- largeMessage.setMessageID(id);
- largeMessagesOnSync.put(id, largeMessage);
- }
- channel = largeMessage.getFile();
+ log.error("large message sync: largeMessage instance is incompatible with it, ignoring data");
+ return;
}
+ LargeServerMessageInSync largeMessageInSync=(LargeServerMessageInSync)largeMessage;
+ channel = largeMessageInSync.getSyncFile();
break;
}
case PAGE:
{
Page page = getPage(msg.getPageStore(), (int)msg.getId());
-
channel = page.getFile();
break;
}
@@ -565,31 +528,51 @@
return;
}
- final Journal journal = journalsHolder.get(packet.getJournalContentType());
+
synchronized (this)
{
if (!started)
return;
- if (packet.getNodeID() != null)
+ switch (packet.getDataType())
{
- quorumManager.setLiveID(packet.getNodeID());
- }
- Map<Long, JournalSyncFile> mapToFill = filesReservedForSync.get(packet.getJournalContentType());
- log.info("Journal " + packet.getJournalContentType() + ". Reserving fileIDs for synchronization: " +
- Arrays.toString(packet.getFileIds()));
+ case LargeMessages:
+ for (long msgID : packet.getFileIds())
+ {
+ createLargeMessage(msgID, true);
+ }
+ break;
+ case JournalBindings:
+ case JournalMessages:
- for (Entry<Long, JournalFile> entry : journal.createFilesForBackupSync(packet.getFileIds()).entrySet())
- {
- mapToFill.put(entry.getKey(), new JournalSyncFile(entry.getValue()));
+ final JournalContent journalContent = SyncDataType.getJournalContentType(packet.getDataType());
+ final Journal journal = journalsHolder.get(journalContent);
+
+ if (packet.getNodeID() != null)
+ {
+ // At the start of replication, we still do not know which is the nodeID that the live uses.
+ // This is the point where the backup gets this information.
+ quorumManager.setLiveID(packet.getNodeID());
+ }
+ Map<Long, JournalSyncFile> mapToFill = filesReservedForSync.get(journalContent);
+ log.info("Journal " + journalContent + ". Reserving fileIDs for synchronization: " +
+ Arrays.toString(packet.getFileIds()));
+
+ for (Entry<Long, JournalFile> entry : journal.createFilesForBackupSync(packet.getFileIds()).entrySet())
+ {
+ mapToFill.put(entry.getKey(), new JournalSyncFile(entry.getValue()));
+ }
+ FileWrapperJournal syncJournal = new FileWrapperJournal(journal);
+ registerJournal(journalContent.typeByte, syncJournal);
+ break;
+ default:
+ throw new HornetQException(HornetQException.INTERNAL_ERROR, "unhandled data type!");
}
- FileWrapperJournal syncJournal = new FileWrapperJournal(journal);
- registerJournal(packet.getJournalContentType().typeByte, syncJournal);
}
}
private void handleLargeMessageEnd(final ReplicationLargeMessageEndMessage packet)
{
- LargeServerMessage message = lookupLargeMessage(packet.getMessageId(), true);
+ ReplicatedLargeMessage message = lookupLargeMessage(packet.getMessageId(), true);
if (message != null)
{
@@ -609,7 +592,7 @@
*/
private void handleLargeMessageWrite(final ReplicationLargeMessageWriteMessage packet) throws Exception
{
- LargeServerMessage message = lookupLargeMessage(packet.getMessageId(), false);
+ ReplicatedLargeMessage message = lookupLargeMessage(packet.getMessageId(), false);
if (message != null)
{
message.addBytes(packet.getBody());
@@ -624,9 +607,9 @@
compareJournalInformation(request.getJournalInformation());
}
- private LargeServerMessage lookupLargeMessage(final long messageId, final boolean delete)
+ private ReplicatedLargeMessage lookupLargeMessage(final long messageId, final boolean delete)
{
- LargeServerMessage message;
+ ReplicatedLargeMessage message;
if (delete)
{
@@ -635,18 +618,6 @@
else
{
message = largeMessages.get(messageId);
- if (message == null)
- {
- synchronized (largeMessages)
- {
- if (!server.isRemoteBackupUpToDate())
- {
- // in case we need to append data to a file while still sync'ing the backup
- createLargeMessage(messageId, true);
- message = largeMessages.get(messageId);
- }
- }
- }
}
if (message == null)
@@ -671,10 +642,14 @@
private void createLargeMessage(final long id, boolean sync)
{
- LargeServerMessage msg = storage.createLargeMessage();
+ ReplicatedLargeMessage msg;
+ if (sync)
+ msg = new LargeServerMessageInSync(storage);
+ else
+ msg = storage.createLargeMessage();
+
msg.setDurable(true);
msg.setMessageID(id);
- msg.setReplicationSync(sync);
largeMessages.put(id, msg);
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationManager.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationManager.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -13,6 +13,7 @@
package org.hornetq.core.replication;
+import java.util.List;
import java.util.Set;
import org.hornetq.api.core.HornetQException;
@@ -125,4 +126,13 @@
* @throws Exception
*/
void syncPages(SequentialFile file, long id, SimpleString pageStore) throws Exception;
+
+ /**
+ * Reserves several LargeMessage IDs in the backup.
+ * <p>
+ * Doing this before hand removes the need of synchronizing large-message deletes with the
+ * largeMessageSyncList.
+ * @param largeMessageIDs
+ */
+ void sendLargeMessageIdListMessage(List<Long> largeMessageIDs);
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -17,6 +17,7 @@
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -251,9 +252,7 @@
}
}
- /* (non-Javadoc)
- * @see org.hornetq.core.replication.ReplicationManager#largeMessageBegin(byte[])
- */
+ @Override
public void largeMessageBegin(final long messageId)
{
if (enabled)
@@ -270,9 +269,7 @@
}
}
- /* (non-Javadoc)
- * @see org.hornetq.core.replication.ReplicationManager#largeMessageWrite(long, byte[])
- */
+ @Override
public void largeMessageWrite(final long messageId, final byte[] body)
{
if (enabled)
@@ -596,4 +593,12 @@
if (enabled)
sendReplicatePacket(new ReplicationStartSyncMessage(nodeID));
}
+
+ @Override
+ public void sendLargeMessageIdListMessage(List<Long> largeMessageIDs)
+ {
+ if (enabled)
+ sendReplicatePacket(new ReplicationStartSyncMessage(largeMessageIDs));
+
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/LargeServerMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/LargeServerMessage.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/LargeServerMessage.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -15,21 +15,22 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.journal.SequentialFile;
+import org.hornetq.core.replication.ReplicatedLargeMessage;
/**
* A LargeMessage
*
* @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*/
-public interface LargeServerMessage extends ServerMessage
+public interface LargeServerMessage extends ServerMessage, ReplicatedLargeMessage
{
void addBytes(byte[] bytes) throws Exception;
/** When a large message is copied (e.g. ExpiryQueue) instead of copying the file, we specify a link between the messages */
void setLinkedMessage(LargeServerMessage message);
-
+
void setPendingRecordID(long pendingRecordID);
-
+
long getPendingRecordID();
boolean isFileExists() throws Exception;
@@ -50,13 +51,6 @@
void decrementDelayDeletionCount() throws Exception;
/**
- * This method only has relevance in a backup server.
- * @param sync {@code true} if this file is meant for appends of a message that needs to be
- * sync'ed with the live.
- */
- void setReplicationSync(boolean sync);
-
- /**
* @return
* @throws HornetQException
*/
Modified: trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -2725,12 +2725,13 @@
/**
* @param completeTransaction If the appendRecord is for a prepare or commit, where we should
* update the number of pendingTransactions on the current file
+ * @throws Exception
*/
private JournalFile appendRecord(final JournalInternalRecord encoder,
final boolean completeTransaction,
final boolean sync,
final JournalTransaction tx,
- final IOAsyncTask parameterCallback) throws Exception
+ final IOAsyncTask parameterCallback) throws Exception
{
checkJournalIsLoaded();
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -24,7 +24,7 @@
private static final int BACKUP_WAIT_TIME = 20;
private ServerLocatorInternal locator;
- private ClientSessionFactoryInternal sessionFactory;
+ protected ClientSessionFactoryInternal sessionFactory;
private ClientSession session;
private ClientProducer producer;
private BackupSyncDelay syncDelay;
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -40,12 +40,27 @@
getAllMessageFileIds(dir).size());
createProducerSendSomeMessages();
startBackupFinishSyncing();
- // File dir = new
- // File(backupServer.getServer().getConfiguration().getLargeMessagesDirectory());
receiveMsgsInRange(0, n_msgs / 2);
assertEquals("we really ought to delete these after delivery", n_msgs / 2, getAllMessageFileIds(dir).size());
}
+ public void testDeleteLargeMessagesDuringSync() throws Exception
+ {
+ File dir = new File(backupServer.getServer().getConfiguration().getLargeMessagesDirectory());
+ assertEquals("Should not have any large messages... previous test failed to clean up?", 0,
+ getAllMessageFileIds(dir).size());
+ createProducerSendSomeMessages();
+
+ backupServer.start();
+ waitForComponent(backupServer.getServer(), 5);
+ receiveMsgsInRange(0, n_msgs / 2);
+
+ startBackupFinishSyncing();
+ backupServer.stop();
+
+ assertEquals("we really ought to delete these after delivery", n_msgs / 2, getAllMessageFileIds(dir).size());
+ }
+
private Set<Long> getAllMessageFileIds(File dir)
{
Set<Long> idsOnBkp = new HashSet<Long>();
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/DeleteMessagesOnStartupTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/DeleteMessagesOnStartupTest.java 2012-01-12 12:07:32 UTC (rev 12011)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/DeleteMessagesOnStartupTest.java 2012-01-12 12:08:26 UTC (rev 12012)
@@ -101,14 +101,4 @@
};
}
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-
}
12 years, 5 months