Author: timfox
Date: 2009-12-02 09:23:04 -0500 (Wed, 02 Dec 2009)
New Revision: 8502
Modified:
trunk/src/config/common/schema/hornetq-configuration.xsd
trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java
Log:
fixed incomplete test
Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd 2009-12-02 14:01:22 UTC (rev
8501)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd 2009-12-02 14:23:04 UTC (rev
8502)
@@ -437,8 +437,6 @@
<xsd:element name="address-setting">
<xsd:complexType>
<xsd:all>
- <xsd:element maxOccurs="1" minOccurs="0"
name="clustered" type="xsd:boolean">
- </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="dead-letter-address" type="xsd:string">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="expiry-address" type="xsd:string">
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java 2009-12-02
14:01:22 UTC (rev 8501)
+++
trunk/tests/src/org/hornetq/tests/unit/core/deployers/impl/AddressSettingsDeployerTest.java 2009-12-02
14:23:04 UTC (rev 8502)
@@ -9,13 +9,14 @@
* 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.deployers.impl;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.AddressSettingsDeployer;
import org.hornetq.core.settings.HierarchicalRepository;
+import org.hornetq.core.settings.impl.AddressFullMessagePolicy;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.core.settings.impl.HierarchicalObjectRepository;
import org.hornetq.tests.util.UnitTestCase;
@@ -29,13 +30,18 @@
*/
public class AddressSettingsDeployerTest extends UnitTestCase
{
- private String conf = "<address-settings
match=\"queues.*\">\n" +
- "
<dead-letter-address>DLQtest</dead-letter-address>\n" +
- "
<expiry-address>ExpiryQueueTest</expiry-address>\n" +
- " <redelivery-delay>100</redelivery-delay>\n" +
- " <max-size-bytes>-100</max-size-bytes>\n" +
- "
<message-counter-history-day-limit>1000</message-counter-history-day-limit>\n"
+
- " </address-settings>";
+ private String conf = "<address-setting
match=\"queues.*\">\n" + "
<dead-letter-address>DLQtest</dead-letter-address>\n"
+ + "
<expiry-address>ExpiryQueueTest</expiry-address>\n"
+ + "
<redelivery-delay>100</redelivery-delay>\n"
+ + "
<max-delivery-attempts>32</max-delivery-attempts>\n"
+ + "
<max-size-bytes>182381723</max-size-bytes>\n"
+ + "
<page-size-bytes>2387273</page-size-bytes>\n"
+ + "
<address-full-policy>DROP</address-full-policy>\n"
+ + "
<message-counter-history-day-limit>1000</message-counter-history-day-limit>\n"
+ + "
<last-value-queue>true</last-value-queue>\n"
+ + "
<redistribution-delay>38383</redistribution-delay>\n"
+ + "
<send-to-dla-on-no-route>true</send-to-dla-on-no-route>\n"
+ + " </address-setting>";
private AddressSettingsDeployer addressSettingsDeployer;
@@ -44,7 +50,7 @@
protected void setUp() throws Exception
{
super.setUp();
-
+
repository = new HierarchicalObjectRepository<AddressSettings>();
DeploymentManager deploymentManager = new FakeDeploymentManager();
addressSettingsDeployer = new AddressSettingsDeployer(deploymentManager,
repository);
@@ -55,27 +61,27 @@
addressSettingsDeployer.deploy(XMLUtil.stringToElement(conf));
AddressSettings as = repository.getMatch("queues.aq");
assertNotNull(as);
+ assertEquals(new SimpleString("DLQtest"), as.getDeadLetterAddress());
+ assertEquals(new SimpleString("ExpiryQueueTest"),
as.getExpiryAddress());
assertEquals(100, as.getRedeliveryDelay());
- assertEquals(-100, as.getMaxSizeBytes());
+ assertEquals(32, as.getMaxDeliveryAttempts());
+ assertEquals(182381723, as.getMaxSizeBytes());
+ assertEquals(2387273, as.getPageSizeBytes());
+ assertEquals(AddressFullMessagePolicy.DROP, as.getAddressFullMessagePolicy());
assertEquals(1000, as.getMessageCounterHistoryDayLimit());
- assertEquals(new SimpleString("DLQtest"), as.getDeadLetterAddress());
- assertEquals(new SimpleString("ExpiryQueueTest"),
as.getExpiryAddress());
+ assertTrue(as.isLastValueQueue());
+ assertEquals(38383, as.getRedistributionDelay());
+ assertTrue(as.isSendToDLAOnNoRoute());
+
}
-
+
public void testDeployFromConfigurationFile() throws Exception
{
- String xml = "<configuration xmlns='urn:hornetq'> "
- + "<address-settings>"
- + " <address-setting match=\"queues.*\">"
- + "
<dead-letter-address>DLQtest</dead-letter-address>\n"
- + "
<expiry-address>ExpiryQueueTest</expiry-address>\n"
- + "
<redelivery-delay>100</redelivery-delay>\n"
- + " <max-size-bytes>-100</max-size-bytes>\n"
- + "
<message-counter-history-day-limit>1000</message-counter-history-day-limit>"
- + " </address-setting>"
- + "</address-settings>"
- + "</configuration>";
-
+ String xml = "<configuration xmlns='urn:hornetq'> " +
"<address-settings>" +
+ conf +
+ "</address-settings>" +
+ "</configuration>";
+
Element rootNode = org.hornetq.utils.XMLUtil.stringToElement(xml);
addressSettingsDeployer.validate(rootNode);
NodeList addressSettingsNode =
rootNode.getElementsByTagName("address-setting");
@@ -84,11 +90,17 @@
addressSettingsDeployer.deploy(addressSettingsNode.item(0));
AddressSettings as = repository.getMatch("queues.aq");
assertNotNull(as);
+ assertEquals(new SimpleString("DLQtest"), as.getDeadLetterAddress());
+ assertEquals(new SimpleString("ExpiryQueueTest"),
as.getExpiryAddress());
assertEquals(100, as.getRedeliveryDelay());
- assertEquals(-100, as.getMaxSizeBytes());
+ assertEquals(32, as.getMaxDeliveryAttempts());
+ assertEquals(182381723, as.getMaxSizeBytes());
+ assertEquals(2387273, as.getPageSizeBytes());
+ assertEquals(AddressFullMessagePolicy.DROP, as.getAddressFullMessagePolicy());
assertEquals(1000, as.getMessageCounterHistoryDayLimit());
- assertEquals(new SimpleString("DLQtest"), as.getDeadLetterAddress());
- assertEquals(new SimpleString("ExpiryQueueTest"),
as.getExpiryAddress());
+ assertTrue(as.isLastValueQueue());
+ assertEquals(38383, as.getRedistributionDelay());
+ assertTrue(as.isSendToDLAOnNoRoute());
}
public void testUndeploy() throws Exception
Show replies by date