[jboss-svn-commits] JBL Code SVN: r14271 - in labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb: esb/persistence and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 15 19:03:25 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-08-15 19:03:25 -0400 (Wed, 15 Aug 2007)
New Revision: 14271
Added:
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.xml
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverClient.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/ScheduledRedeliveryUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/config-01.xml
Removed:
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.xml
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverClient.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/ScheduledRedeliveryUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/config-01.xml
Log:
JBESB-828, fixing package structure.
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions (from rev 14256, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions)
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.java 2007-08-15 14:29:36 UTC (rev 14256)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -1,161 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.esb.persistence.actions;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Map;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
-import org.jboss.soa.esb.actions.MessagePersister;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.persistence.manager.ConnectionManager;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Testing the MessagePersister.
- *
- * @author <a href="mailto:kurt.stam at redhat.com">Kurt Stam</a>
- *
- */
-public class MessagePersisterTest
-{
- /**
- * Testing the MessagePersister.
- */
- @Test
- public void sendMessage()
- {
- try
- {
- Date now = new Date();
- String body = "<message>First Message " + now + " </message>";
- Message msg = MessageFactory.getInstance().getMessage();
- msg.getBody().setByteArray(body.getBytes());
-
-
- InputStream inputStream = ClassUtil.getResourceAsStream("MessagePersisterTest.xml", this.getClass());
- ConfigTree config = ConfigTree.fromInputStream(inputStream);
-
- MessagePersister persister = new MessagePersister(config);
- persister.initialise();
- persister.process(msg);
-
- //now we can check the messageStore to see if our message made it in there.
- System.out.println("Reading the messages in the messageStore");
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- Map<URI, Message> messages = store.getAllMessages("TEST");
- messages = store.getAllMessages("TEST");
- Iterator<Message> iter=messages.values().iterator();
- while (iter.hasNext()) {
- Message message=iter.next();
- String bodyFromStore = new String(message.getBody().getByteArray());
- System.out.println("Body=" + bodyFromStore);
- }
- System.out.println("Getting message for classification TEST:" + messages);
- assertEquals(1, messages.size());
-
- //Now check if it is the same message
- Message message=messages.values().iterator().next();
- String bodyFromStore = new String(message.getBody().getByteArray());
- assertEquals(body, bodyFromStore);
- }
- catch (Exception re)
- {
- re.printStackTrace();
- assertTrue(false);
- }
- }
-
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(MessagePersisterTest.class);
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- try {
- File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
- System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
- DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
- File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
- File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
- System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
- if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
- HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
-
- //Drop what is there now, if exists. We want to start fresh.
- String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
- String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- mgr.init();
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
- }
- } catch (Throwable e) {
- e.printStackTrace();
- System.out.println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
-
- }
-
- @AfterClass
- public static void runAfterAllTests() throws Exception{
- Thread.sleep(2000);
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
- HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
- Configuration.getStoreUser(),Configuration.getStorePwd() );
- }
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.java (from rev 14270, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.persistence.actions;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.soa.esb.actions.MessagePersister;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Testing the MessagePersister.
+ *
+ * @author <a href="mailto:kurt.stam at redhat.com">Kurt Stam</a>
+ *
+ */
+public class MessagePersisterTest
+{
+ /**
+ * Testing the MessagePersister.
+ */
+ @Test
+ public void sendMessage()
+ {
+ try
+ {
+ Date now = new Date();
+ String body = "<message>First Message " + now + " </message>";
+ Message msg = MessageFactory.getInstance().getMessage();
+ msg.getBody().setByteArray(body.getBytes());
+
+
+ InputStream inputStream = ClassUtil.getResourceAsStream("MessagePersisterTest.xml", this.getClass());
+ ConfigTree config = ConfigTree.fromInputStream(inputStream);
+
+ MessagePersister persister = new MessagePersister(config);
+ persister.initialise();
+ persister.process(msg);
+
+ //now we can check the messageStore to see if our message made it in there.
+ System.out.println("Reading the messages in the messageStore");
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ Map<URI, Message> messages = store.getAllMessages("TEST");
+ messages = store.getAllMessages("TEST");
+ Iterator<Message> iter=messages.values().iterator();
+ while (iter.hasNext()) {
+ Message message=iter.next();
+ String bodyFromStore = new String(message.getBody().getByteArray());
+ System.out.println("Body=" + bodyFromStore);
+ }
+ System.out.println("Getting message for classification TEST:" + messages);
+ assertEquals(1, messages.size());
+
+ //Now check if it is the same message
+ Message message=messages.values().iterator().next();
+ String bodyFromStore = new String(message.getBody().getByteArray());
+ assertEquals(body, bodyFromStore);
+ }
+ catch (Exception re)
+ {
+ re.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(MessagePersisterTest.class);
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ try {
+ File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
+ System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
+ DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
+ File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
+ File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
+ System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
+ if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
+ HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
+
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+
+ }
+
+ @AfterClass
+ public static void runAfterAllTests() throws Exception{
+ Thread.sleep(2000);
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(),Configuration.getStorePwd() );
+ }
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.xml 2007-08-15 14:29:36 UTC (rev 14256)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.xml 2007-08-15 23:03:25 UTC (rev 14271)
@@ -1,6 +0,0 @@
-<action
- name="PersistAction"
- class="org.jboss.soa.esb.actions.MessagePersister"
- classification="TEST"
- message-store-class="org.jboss.internal.soa.esb.persistence.format.db.DBMessageStoreImpl"/>
-
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.xml (from rev 14270, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.xml)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterTest.xml 2007-08-15 23:03:25 UTC (rev 14271)
@@ -0,0 +1,6 @@
+<action
+ name="PersistAction"
+ class="org.jboss.soa.esb.actions.MessagePersister"
+ classification="TEST"
+ message-store-class="org.jboss.internal.soa.esb.persistence.format.db.DBMessageStoreImpl"/>
+
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests (from rev 14256, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests)
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java 2007-08-15 14:29:36 UTC (rev 14256)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -1,298 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.soa.esb.esb.persistence.tests;
-
-/**
- * @author dbrum
- *
- *
- */
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.Map;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.persistence.manager.ConnectionManager;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerException;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class MessageStoreUnitTest
-{
-
- private static Logger log = Logger.getLogger(MessageStoreUnitTest.class);
-
- @Test
- public void testDefaultMessageStore ()
- {
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
- }
-
- @Test
- public void testURIMessageStore ()
- {
- // only DB supported for now
- MessageStore store1 = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store1 != null), true);
- }
-
- @Test
- public void testSettingUndeliverable () throws Exception
- {
- //test setting one message to undelivered status
-// add new messages
- Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
- assertEquals((msg != null), true);
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
-
- URI uid = store.addMessage(msg, MessageStore.CLASSIFICATION_DEFAULT);
- store.setUndelivered(uid);
-
- }
-
- @Test
- public void testSettingDeliverable() throws Exception
- {
- //test setting one message to delivered status
-// add new messages
- Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
- assertEquals((msg != null), true);
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
-
- URI uid = store.addMessage(msg,MessageStore.CLASSIFICATION_DEFAULT);
- store.setDelivered(uid);
-
- }
-
- @Test
- public void testManyUndeliveredMessages() throws Exception {
- Message msg1, msg2, msg3, msg4;
- msg1 = MessageFactory.getInstance().getMessage(
- MessageType.JBOSS_XML);
- msg2 = MessageFactory.getInstance().getMessage(
- MessageType.JAVA_SERIALIZED);
- msg3 = MessageFactory.getInstance().getMessage(
- MessageType.JBOSS_XML);
- msg4 = MessageFactory.getInstance().getMessage(
- MessageType.JAVA_SERIALIZED);
-
- assertEquals((msg1 != null), true);
- assertEquals((msg2 != null), true);
- assertEquals((msg3 != null), true);
- assertEquals((msg4 != null), true);
-
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
-
- URI uid1 = store.addMessage(msg1,MessageStore.CLASSIFICATION_DEFAULT);
- URI uid2 = store.addMessage(msg2,MessageStore.CLASSIFICATION_DEFAULT);
- URI uid3 = store.addMessage(msg3,MessageStore.CLASSIFICATION_DEFAULT);
- URI uid4 = store.addMessage(msg4,MessageStore.CLASSIFICATION_DEFAULT);
-
- store.setUndelivered(uid1);
- store.setUndelivered(uid2);
- store.setUndelivered(uid3);
- store.setUndelivered(uid4);
-
- Map<URI, Message> messages = store.getUndeliveredMessages(MessageStore.CLASSIFICATION_DEFAULT);
- assertEquals((messages != null), true);
-
- }
-
- @Test
- public void testStoreAndRetrieve () throws Exception
- {
- // add new messages
- Message msg1 = MessageFactory.getInstance().getMessage(
- MessageType.JBOSS_XML);
- Message msg2 = MessageFactory.getInstance().getMessage(
- MessageType.JAVA_SERIALIZED);
- assertEquals((msg1 != null), true);
- assertEquals((msg2 != null), true);
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
-
- // set some properties inside the Message
- msg1.getProperties().setProperty("prop1", "val1");
- msg2.getProperties().setProperty("prop1", "val1");
- msg1.getProperties().setProperty("prop2", "val2");
- msg2.getProperties().setProperty("prop2", "val2");
-
- // set the body inside the Message
- msg1.getBody().setByteArray(("TEST BODY").getBytes());
- msg2.getBody().setByteArray(("TEST BODY").getBytes());
-
- // set some object attachments inside the Message
- msg1.getAttachment().addItem(new String("TEST ATTACHMENT1"));
- msg1.getAttachment().addItem(new String("TEST ATTACHMENT2"));
- msg2.getAttachment().addItem(new String("TEST ATTACHMENT1"));
- msg2.getAttachment().addItem(new String("TEST ATTACHMENT2"));
-
- // keep track of the UID to use in retrieving the Message
- URI uid1 = null;
- uid1 = store.addMessage(msg1, MessageStore.CLASSIFICATION_DEFAULT);
-// System.out.println(uid1);
- assertEquals((uid1 != null), true);
-
- URI uid2 = null;
- uid2 = store.addMessage(msg2,MessageStore.CLASSIFICATION_DEFAULT);
-// System.out.println(uid2);
- assertEquals((uid2 != null), true);
-
- // now retrieve the messages
- try
- {
- Message msgIn1 = store.getMessage(uid1);
- assertEquals((msgIn1 != null), true);
-
- Message msgIn2 = store.getMessage(uid2);
- assertEquals((msgIn2 != null), true);
- }
- catch (Exception e)
- {
- log.error( e );
- }
- }
-
- @Test
- public void testDBConnectionManager ()
- {
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
- ConnectionManager mgr=null;
- try {
- mgr = ConnectionManagerFactory.getConnectionManager();
- } catch (ConnectionManagerException e) {
- // TODO Auto-generated catch block
-// e.printStackTrace();
- }
- assertEquals((mgr != null), true);
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- try {
- File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
- System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
- DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
- File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
- File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
- System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
- if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
- HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
-
- //Drop what is there now, if exists. We want to start fresh.
- String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
- String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- mgr.init();
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
- }
- } catch (Throwable e) {
- e.printStackTrace();
- System.out.println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
-
- }
- @AfterClass
- public static void runAfterAllTests ()
- {
-
- try
- {
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
- HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
- Configuration.getStoreUser(), Configuration
- .getStorePwd());
- }
- catch (Exception e)
- { //
- log.error( e );
- }
- }
-
- /**
- * Read the file into a String.
- *
- * @param file -
- * the file to be read
- * @return String with the content of the file
- * @throws IOException -
- * when we can't read the file
- */
- public static String readTextFile (File file) throws IOException
- {
- StringBuffer sb = new StringBuffer(1024);
- BufferedReader reader = new BufferedReader(new FileReader(file
- .getPath()));
- char[] chars = new char[1];
- while ((reader.read(chars)) > -1)
- {
- sb.append(String.valueOf(chars));
- chars = new char[1];
- }
- reader.close();
- return sb.toString();
- }
-
- public static junit.framework.Test suite ()
- {
- return new JUnit4TestAdapter(MessageStoreUnitTest.class);
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java (from rev 14270, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -0,0 +1,298 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+package org.jboss.soa.esb.persistence.tests;
+
+/**
+ * @author dbrum
+ *
+ *
+ */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.Map;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerException;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MessageStoreUnitTest
+{
+
+ private static Logger log = Logger.getLogger(MessageStoreUnitTest.class);
+
+ @Test
+ public void testDefaultMessageStore ()
+ {
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ }
+
+ @Test
+ public void testURIMessageStore ()
+ {
+ // only DB supported for now
+ MessageStore store1 = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store1 != null), true);
+ }
+
+ @Test
+ public void testSettingUndeliverable () throws Exception
+ {
+ //test setting one message to undelivered status
+// add new messages
+ Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
+ assertEquals((msg != null), true);
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ URI uid = store.addMessage(msg, MessageStore.CLASSIFICATION_DEFAULT);
+ store.setUndelivered(uid);
+
+ }
+
+ @Test
+ public void testSettingDeliverable() throws Exception
+ {
+ //test setting one message to delivered status
+// add new messages
+ Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
+ assertEquals((msg != null), true);
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ URI uid = store.addMessage(msg,MessageStore.CLASSIFICATION_DEFAULT);
+ store.setDelivered(uid);
+
+ }
+
+ @Test
+ public void testManyUndeliveredMessages() throws Exception {
+ Message msg1, msg2, msg3, msg4;
+ msg1 = MessageFactory.getInstance().getMessage(
+ MessageType.JBOSS_XML);
+ msg2 = MessageFactory.getInstance().getMessage(
+ MessageType.JAVA_SERIALIZED);
+ msg3 = MessageFactory.getInstance().getMessage(
+ MessageType.JBOSS_XML);
+ msg4 = MessageFactory.getInstance().getMessage(
+ MessageType.JAVA_SERIALIZED);
+
+ assertEquals((msg1 != null), true);
+ assertEquals((msg2 != null), true);
+ assertEquals((msg3 != null), true);
+ assertEquals((msg4 != null), true);
+
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ URI uid1 = store.addMessage(msg1,MessageStore.CLASSIFICATION_DEFAULT);
+ URI uid2 = store.addMessage(msg2,MessageStore.CLASSIFICATION_DEFAULT);
+ URI uid3 = store.addMessage(msg3,MessageStore.CLASSIFICATION_DEFAULT);
+ URI uid4 = store.addMessage(msg4,MessageStore.CLASSIFICATION_DEFAULT);
+
+ store.setUndelivered(uid1);
+ store.setUndelivered(uid2);
+ store.setUndelivered(uid3);
+ store.setUndelivered(uid4);
+
+ Map<URI, Message> messages = store.getUndeliveredMessages(MessageStore.CLASSIFICATION_DEFAULT);
+ assertEquals((messages != null), true);
+
+ }
+
+ @Test
+ public void testStoreAndRetrieve () throws Exception
+ {
+ // add new messages
+ Message msg1 = MessageFactory.getInstance().getMessage(
+ MessageType.JBOSS_XML);
+ Message msg2 = MessageFactory.getInstance().getMessage(
+ MessageType.JAVA_SERIALIZED);
+ assertEquals((msg1 != null), true);
+ assertEquals((msg2 != null), true);
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ // set some properties inside the Message
+ msg1.getProperties().setProperty("prop1", "val1");
+ msg2.getProperties().setProperty("prop1", "val1");
+ msg1.getProperties().setProperty("prop2", "val2");
+ msg2.getProperties().setProperty("prop2", "val2");
+
+ // set the body inside the Message
+ msg1.getBody().setByteArray(("TEST BODY").getBytes());
+ msg2.getBody().setByteArray(("TEST BODY").getBytes());
+
+ // set some object attachments inside the Message
+ msg1.getAttachment().addItem(new String("TEST ATTACHMENT1"));
+ msg1.getAttachment().addItem(new String("TEST ATTACHMENT2"));
+ msg2.getAttachment().addItem(new String("TEST ATTACHMENT1"));
+ msg2.getAttachment().addItem(new String("TEST ATTACHMENT2"));
+
+ // keep track of the UID to use in retrieving the Message
+ URI uid1 = null;
+ uid1 = store.addMessage(msg1, MessageStore.CLASSIFICATION_DEFAULT);
+// System.out.println(uid1);
+ assertEquals((uid1 != null), true);
+
+ URI uid2 = null;
+ uid2 = store.addMessage(msg2,MessageStore.CLASSIFICATION_DEFAULT);
+// System.out.println(uid2);
+ assertEquals((uid2 != null), true);
+
+ // now retrieve the messages
+ try
+ {
+ Message msgIn1 = store.getMessage(uid1);
+ assertEquals((msgIn1 != null), true);
+
+ Message msgIn2 = store.getMessage(uid2);
+ assertEquals((msgIn2 != null), true);
+ }
+ catch (Exception e)
+ {
+ log.error( e );
+ }
+ }
+
+ @Test
+ public void testDBConnectionManager ()
+ {
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ ConnectionManager mgr=null;
+ try {
+ mgr = ConnectionManagerFactory.getConnectionManager();
+ } catch (ConnectionManagerException e) {
+ // TODO Auto-generated catch block
+// e.printStackTrace();
+ }
+ assertEquals((mgr != null), true);
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ try {
+ File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
+ System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
+ DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
+ File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
+ File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
+ System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
+ if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
+ HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
+
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+
+ }
+ @AfterClass
+ public static void runAfterAllTests ()
+ {
+
+ try
+ {
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(), Configuration
+ .getStorePwd());
+ }
+ catch (Exception e)
+ { //
+ log.error( e );
+ }
+ }
+
+ /**
+ * Read the file into a String.
+ *
+ * @param file -
+ * the file to be read
+ * @return String with the content of the file
+ * @throws IOException -
+ * when we can't read the file
+ */
+ public static String readTextFile (File file) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new FileReader(file
+ .getPath()));
+ char[] chars = new char[1];
+ while ((reader.read(chars)) > -1)
+ {
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+
+ public static junit.framework.Test suite ()
+ {
+ return new JUnit4TestAdapter(MessageStoreUnitTest.class);
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverClient.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/RedeliverClient.java 2007-08-15 14:29:36 UTC (rev 14256)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverClient.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.soa.esb.esb.persistence.tests;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.persistence.MessageStoreException;
-import org.jboss.soa.esb.services.persistence.RedeliverStore;
-
-/**
- * @author dbrum
- *
- */
-public class RedeliverClient implements Runnable
-{
- private volatile int count;
- private volatile boolean isDone;
-
- public void run ()
- {
- try {
- RedeliverStore store = MessageStoreFactory.getInstance().getRedeliverStore();
- Map<URI, Message> messages = store.getAllMessages("RDLVR");
- for (URI uid : messages.keySet()) {
- if (store.redeliver(uid)) {
- count++;
- }
- }
- setDone(true);
- } catch (MessageStoreException e) {
- e.printStackTrace();
- }
- }
-
- public int getCount() {
- return count;
- }
-
- public void setCount(int count) {
- this.count = count;
- }
-
- public boolean isDone() {
- return isDone;
- }
-
- public void setDone(boolean isDone) {
- this.isDone = isDone;
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverClient.java (from rev 14270, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/RedeliverClient.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverClient.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverClient.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+package org.jboss.soa.esb.persistence.tests;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.persistence.MessageStoreException;
+import org.jboss.soa.esb.services.persistence.RedeliverStore;
+
+/**
+ * @author kstam
+ *
+ */
+public class RedeliverClient implements Runnable
+{
+ private volatile int count;
+ private volatile boolean isDone;
+
+ public void run ()
+ {
+ try {
+ RedeliverStore store = MessageStoreFactory.getInstance().getRedeliverStore();
+ Map<URI, Message> messages = store.getAllMessages("RDLVR");
+ for (URI uid : messages.keySet()) {
+ if (store.redeliver(uid)) {
+ count++;
+ }
+ }
+ setDone(true);
+ } catch (MessageStoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public boolean isDone() {
+ return isDone;
+ }
+
+ public void setDone(boolean isDone) {
+ this.isDone = isDone;
+ }
+}
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/RedeliverUnitTest.java 2007-08-15 14:29:36 UTC (rev 14256)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverUnitTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -1,323 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.soa.esb.esb.persistence.tests;
-
-/**
- * @author kstam
- *
- *
- */
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.Statement;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.Service;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.persistence.manager.ConnectionManager;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreException;
-import org.jboss.soa.esb.services.persistence.RedeliverStore;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class RedeliverUnitTest
-{
-
- private static Logger log = Logger.getLogger(RedeliverUnitTest.class);
-
- /*
- * Should succesfully deliver the message, and then remove the message from the store.
- */
- @Test
- public void redeliverOne() throws Exception
- {
- log.info("** redeliverOne");
- RedeliverStore store = MessageStoreFactory.getInstance().getRedeliverStore();
- assertEquals((store != null), true);
- //first lets create an undeliverable message
- Service service = new Service("cat", "service");
- URI uid = createMessages(1, service, store);
-
- store.redeliver(uid);
- Message message = store.getMessage(uid);
- //the message should no longer be in the store.
- assertNull(message);
- }
- /*
- * Adding a message to the store then, the selecting ALL and deliver it with one redeliver thread.
- */
- @Test
- public void redeliverOneThread() throws Exception
- {
- log.info("** redeliverOneThreads");
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
- //first lets create an undeliverable message
- Service service = new Service("cat", "service");
- URI uid = createMessages(1, service, store);
- RedeliverClient redeliverClient = new RedeliverClient();
- Thread t1 = new Thread(redeliverClient, "CLIENT-1");
- t1.start();
-
- long deadline=System.currentTimeMillis() + 20000;
- boolean waiting=true;
- while(waiting) {
- if (redeliverClient.isDone()) {
- waiting=false;
- } else if (System.currentTimeMillis() > deadline){
- //We're timing out for some reason. This is bad.
- assertTrue(false);
- }
- }
- assertEquals(redeliverClient.getCount(),1);
- Message message = store.getMessage(uid);
- assertNull(message);
- }
- /*
- * Adding a message to the store then, the selecting ALL and deliver it with two redeliver threads.
- */
- @Test
- public void redeliverTwoThreads() throws Exception
- {
- log.info("** redeliverTwoThreads");
- //first lets create an undeliverable message
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
- //first lets create an undeliverable message
- Service service = new Service("cat", "service");
- URI uid = createMessages(1, service, store);
- RedeliverClient client1 = new RedeliverClient();
- RedeliverClient client2 = new RedeliverClient();
- Thread t1 = new Thread(client1, "CLIENT-1");
- Thread t2 = new Thread(client2, "CLIENT-2");
- t1.start();
- t2.start();
-
- long deadline=System.currentTimeMillis() + 20000;
- boolean waiting=true;
- while(waiting) {
-
- if (client1.isDone() && client2.isDone()) {
- waiting=false;
- } else if (System.currentTimeMillis() > deadline){
- //We're timing out for some reason. This is bad.
- assertTrue(false);
- }
- }
- log.info("Client1 processed " + client1.getCount() + " messages");
- log.info("Client2 processed " + client2.getCount() + " messages");
- //only *one* message should be delivered
- assertEquals(1, client1.getCount() + client2.getCount());
- //the message is delivered so should no longer be in the store
- Message message = store.getMessage(uid);
- assertNull(message);
- }
-
- @Test
- public void redeliverFiftyTwoThreads() throws Exception
- {
- int numberOfMessages=50;
- log.info("** redeliverFiftyTwoThreads");
- //first lets create an undeliverable message
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
- //first lets create an undeliverable message
- Service service = new Service("cat", "service");
- URI uid = createMessages(numberOfMessages, service, store);
- RedeliverClient client1 = new RedeliverClient();
- RedeliverClient client2 = new RedeliverClient();
- Thread t1 = new Thread(client1, "CLIENT-1");
- Thread t2 = new Thread(client2, "CLIENT-2");
- t1.start();
- t2.start();
-
- final long deadline = System.currentTimeMillis() + 20000 ;
- waitForThread(t1, deadline) ;
- waitForThread(t2, deadline) ;
- if (!client1.isDone() || !client2.isDone()) {
- //We're timing out for some reason. This is bad.
- fail("Timeout waiting for client threads to terminate");
- }
- log.info("Client1 processed " + client1.getCount() + " messages");
- log.info("Client2 processed " + client2.getCount() + " messages");
- assertEquals(numberOfMessages, client1.getCount() + client2.getCount());
- //make sure the last message was send (and removed from the store)
- Message message = store.getMessage(uid);
- assertNull(message);
- }
-
- private static final void waitForThread(final Thread th, final long deadline) {
- final long period = deadline - System.currentTimeMillis() ;
- if (period > 0) {
- try {
- th.join(period) ;
- } catch (final InterruptedException ie) {
- Thread.currentThread().interrupt() ;
- }
- }
- }
- /*
- * Deliver to undeliverable Service
- */
- @Test
- public void redeliverOneUnreachable() throws Exception
- {
- log.info("** redeliverOneUnreachable");
- RedeliverStore store = MessageStoreFactory.getInstance().getRedeliverStore();
- assertEquals((store != null), true);
- //first lets create an undeliverable message
- Service service = new Service("cat", "unreachable_service");
- URI uid = createMessages(1, service, store);
-
- int maxRedeliveryCount = store.getMaxRedeliverCount();
- for (int i=0; i<maxRedeliveryCount; i++) {
- store.redeliver(uid);
- Message message = store.getMessage(uid);
- //the message should have a redeliveryCount of i+1
- assertNotNull(message);
- Integer deliverCount = (Integer) message.getProperties().getProperty(RedeliverStore.DELIVER_COUNT);
- assertEquals(deliverCount, i+1);
- }
- //Now redelivering one more time should put it in the DLQ
- store.redeliver(uid);
- Message message = store.getMessage(uid, MessageStore.CLASSIFICATION_DLQ);
- assertNotNull(message);
- message = store.getMessage(uid, MessageStore.CLASSIFICATION_RDLVR);
- assertNull(message);
- }
-
-
- private URI createMessages(int numberOfMessages, Service service, MessageStore store) throws MessageStoreException
- {
- URI uid=null;
- for (int i=0; i<numberOfMessages; i++) {
- Message msg = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- assertEquals((msg != null), true);
- msg.getProperties().setProperty(ServiceInvoker.DELIVER_TO, service);
- uid = store.addMessage(msg, MessageStore.CLASSIFICATION_RDLVR);
- }
- return uid;
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- MockCourierFactory.install();
- MockRegistry.install();
- MockCourier courier1 = new MockCourier(true);
- MockRegistry.register("cat", "service", courier1);
- MockCourier courier2 = new MockCourier(false);
- MockRegistry.register("cat", "unreachable_service", courier2);
-
- try {
- File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
- System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
- DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
- File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
- File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
- System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
- if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
- HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
-
- //Drop what is there now, if exists. We want to start fresh.
- String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
- String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- mgr.init();
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
- } else if ("com.mysql.jdbc.Driver".equals(Configuration.getStoreDriver())) {
-
- String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/create_database.sql"));
- String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/drop_database.sql"));
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- mgr.init();
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
-
- }
- } catch (Throwable e) {
- e.printStackTrace();
- System.out.println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
-
- }
- @AfterClass
- public static void runAfterAllTests ()
- {
-
- try
- {
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
- HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
- Configuration.getStoreUser(), Configuration
- .getStorePwd());
- }
- catch (Exception e)
- { //
- log.error( e );
- }
-
- MockRegistry.uninstall();
- MockCourierFactory.uninstall();
- }
-
- public static junit.framework.Test suite ()
- {
- return new JUnit4TestAdapter(RedeliverUnitTest.class);
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverUnitTest.java (from rev 14270, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/RedeliverUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/RedeliverUnitTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -0,0 +1,323 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+package org.jboss.soa.esb.persistence.tests;
+
+/**
+ * @author kstam
+ *
+ *
+ */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.Statement;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.services.persistence.MessageStoreException;
+import org.jboss.soa.esb.services.persistence.RedeliverStore;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RedeliverUnitTest
+{
+
+ private static Logger log = Logger.getLogger(RedeliverUnitTest.class);
+
+ /*
+ * Should succesfully deliver the message, and then remove the message from the store.
+ */
+ @Test
+ public void redeliverOne() throws Exception
+ {
+ log.info("** redeliverOne");
+ RedeliverStore store = MessageStoreFactory.getInstance().getRedeliverStore();
+ assertEquals((store != null), true);
+ //first lets create an undeliverable message
+ Service service = new Service("cat", "service");
+ URI uid = createMessages(1, service, store);
+
+ store.redeliver(uid);
+ Message message = store.getMessage(uid);
+ //the message should no longer be in the store.
+ assertNull(message);
+ }
+ /*
+ * Adding a message to the store then, the selecting ALL and deliver it with one redeliver thread.
+ */
+ @Test
+ public void redeliverOneThread() throws Exception
+ {
+ log.info("** redeliverOneThreads");
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ //first lets create an undeliverable message
+ Service service = new Service("cat", "service");
+ URI uid = createMessages(1, service, store);
+ RedeliverClient redeliverClient = new RedeliverClient();
+ Thread t1 = new Thread(redeliverClient, "CLIENT-1");
+ t1.start();
+
+ long deadline=System.currentTimeMillis() + 20000;
+ boolean waiting=true;
+ while(waiting) {
+ if (redeliverClient.isDone()) {
+ waiting=false;
+ } else if (System.currentTimeMillis() > deadline){
+ //We're timing out for some reason. This is bad.
+ assertTrue(false);
+ }
+ }
+ assertEquals(redeliverClient.getCount(),1);
+ Message message = store.getMessage(uid);
+ assertNull(message);
+ }
+ /*
+ * Adding a message to the store then, the selecting ALL and deliver it with two redeliver threads.
+ */
+ @Test
+ public void redeliverTwoThreads() throws Exception
+ {
+ log.info("** redeliverTwoThreads");
+ //first lets create an undeliverable message
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ //first lets create an undeliverable message
+ Service service = new Service("cat", "service");
+ URI uid = createMessages(1, service, store);
+ RedeliverClient client1 = new RedeliverClient();
+ RedeliverClient client2 = new RedeliverClient();
+ Thread t1 = new Thread(client1, "CLIENT-1");
+ Thread t2 = new Thread(client2, "CLIENT-2");
+ t1.start();
+ t2.start();
+
+ long deadline=System.currentTimeMillis() + 20000;
+ boolean waiting=true;
+ while(waiting) {
+
+ if (client1.isDone() && client2.isDone()) {
+ waiting=false;
+ } else if (System.currentTimeMillis() > deadline){
+ //We're timing out for some reason. This is bad.
+ assertTrue(false);
+ }
+ }
+ log.info("Client1 processed " + client1.getCount() + " messages");
+ log.info("Client2 processed " + client2.getCount() + " messages");
+ //only *one* message should be delivered
+ assertEquals(1, client1.getCount() + client2.getCount());
+ //the message is delivered so should no longer be in the store
+ Message message = store.getMessage(uid);
+ assertNull(message);
+ }
+
+ @Test
+ public void redeliverFiftyTwoThreads() throws Exception
+ {
+ int numberOfMessages=50;
+ log.info("** redeliverFiftyTwoThreads");
+ //first lets create an undeliverable message
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ //first lets create an undeliverable message
+ Service service = new Service("cat", "service");
+ URI uid = createMessages(numberOfMessages, service, store);
+ RedeliverClient client1 = new RedeliverClient();
+ RedeliverClient client2 = new RedeliverClient();
+ Thread t1 = new Thread(client1, "CLIENT-1");
+ Thread t2 = new Thread(client2, "CLIENT-2");
+ t1.start();
+ t2.start();
+
+ final long deadline = System.currentTimeMillis() + 20000 ;
+ waitForThread(t1, deadline) ;
+ waitForThread(t2, deadline) ;
+ if (!client1.isDone() || !client2.isDone()) {
+ //We're timing out for some reason. This is bad.
+ fail("Timeout waiting for client threads to terminate");
+ }
+ log.info("Client1 processed " + client1.getCount() + " messages");
+ log.info("Client2 processed " + client2.getCount() + " messages");
+ assertEquals(numberOfMessages, client1.getCount() + client2.getCount());
+ //make sure the last message was send (and removed from the store)
+ Message message = store.getMessage(uid);
+ assertNull(message);
+ }
+
+ private static final void waitForThread(final Thread th, final long deadline) {
+ final long period = deadline - System.currentTimeMillis() ;
+ if (period > 0) {
+ try {
+ th.join(period) ;
+ } catch (final InterruptedException ie) {
+ Thread.currentThread().interrupt() ;
+ }
+ }
+ }
+ /*
+ * Deliver to undeliverable Service
+ */
+ @Test
+ public void redeliverOneUnreachable() throws Exception
+ {
+ log.info("** redeliverOneUnreachable");
+ RedeliverStore store = MessageStoreFactory.getInstance().getRedeliverStore();
+ assertEquals((store != null), true);
+ //first lets create an undeliverable message
+ Service service = new Service("cat", "unreachable_service");
+ URI uid = createMessages(1, service, store);
+
+ int maxRedeliveryCount = store.getMaxRedeliverCount();
+ for (int i=0; i<maxRedeliveryCount; i++) {
+ store.redeliver(uid);
+ Message message = store.getMessage(uid);
+ //the message should have a redeliveryCount of i+1
+ assertNotNull(message);
+ Integer deliverCount = (Integer) message.getProperties().getProperty(RedeliverStore.DELIVER_COUNT);
+ assertEquals(deliverCount, i+1);
+ }
+ //Now redelivering one more time should put it in the DLQ
+ store.redeliver(uid);
+ Message message = store.getMessage(uid, MessageStore.CLASSIFICATION_DLQ);
+ assertNotNull(message);
+ message = store.getMessage(uid, MessageStore.CLASSIFICATION_RDLVR);
+ assertNull(message);
+ }
+
+
+ private URI createMessages(int numberOfMessages, Service service, MessageStore store) throws MessageStoreException
+ {
+ URI uid=null;
+ for (int i=0; i<numberOfMessages; i++) {
+ Message msg = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ assertEquals((msg != null), true);
+ msg.getProperties().setProperty(ServiceInvoker.DELIVER_TO, service);
+ uid = store.addMessage(msg, MessageStore.CLASSIFICATION_RDLVR);
+ }
+ return uid;
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ MockCourierFactory.install();
+ MockRegistry.install();
+ MockCourier courier1 = new MockCourier(true);
+ MockRegistry.register("cat", "service", courier1);
+ MockCourier courier2 = new MockCourier(false);
+ MockRegistry.register("cat", "unreachable_service", courier2);
+
+ try {
+ File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
+ System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
+ DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
+ File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
+ File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
+ System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
+ if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
+ HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
+
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+ } else if ("com.mysql.jdbc.Driver".equals(Configuration.getStoreDriver())) {
+
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+
+ }
+ @AfterClass
+ public static void runAfterAllTests ()
+ {
+
+ try
+ {
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(), Configuration
+ .getStorePwd());
+ }
+ catch (Exception e)
+ { //
+ log.error( e );
+ }
+
+ MockRegistry.uninstall();
+ MockCourierFactory.uninstall();
+ }
+
+ public static junit.framework.Test suite ()
+ {
+ return new JUnit4TestAdapter(RedeliverUnitTest.class);
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/ScheduledRedeliveryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/ScheduledRedeliveryUnitTest.java 2007-08-15 14:29:36 UTC (rev 14256)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/ScheduledRedeliveryUnitTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -1,205 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.esb.persistence.tests;
-
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.Map;
-
-import junit.framework.JUnit4TestAdapter;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.Service;
-import org.jboss.soa.esb.actions.MessageRedeliverer;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.parameters.ParamRepositoryException;
-import org.jboss.soa.esb.persistence.manager.ConnectionManager;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreException;
-import org.jboss.soa.esb.services.persistence.RedeliverStore;
-import org.jboss.soa.esb.testutils.ESBConfigUtil;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.xml.sax.SAXException;
-
-/**
- * Scheduled Redelivery unit test.
- *
- * @author <a href="mailto:kurt.stam at jboss.com">kurt.stam at jboss.com</a>
- */
-public class ScheduledRedeliveryUnitTest{
-
- @Test
- public void test_listener_config() throws UnsupportedEncodingException {
- ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config-01.xml"));
- String config = configUtil.getListenerConfig("simple-schedule-listener").toString();
- assertNotNull(config);
- try {
- ConfigTree tree = ConfigTree.fromXml(config);
- String maxDeliveries = tree.getFirstChild("action").getAttribute(MessageRedeliverer.MAX_REDELIVER_ATTR);
- assertEquals(maxDeliveries, "9");
- } catch (SAXException e) {
- fail(e.getMessage());
- }
- }
-
- @Test
- public void test_simple_schedule_01() {
-
- try {
- int numberOfMessages=200;
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
- assertEquals((store != null), true);
- //first lets create an undeliverable message
- Service service = new Service("cat", "service");
- URI uid = createMessages(numberOfMessages, service, store);
- Map<URI, Message> messageMap = store.getAllMessages(RedeliverStore.CLASSIFICATION_RDLVR);
- assertEquals(messageMap.size(), numberOfMessages);
- runTestConfig("config-01.xml", 5000);
- Message message2 = store.getMessage(uid);
- assertNull(message2);
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- private void runTestConfig(String configName, long upTime) throws ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
- ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream(configName));
-
- configUtil.startController();
- Thread.sleep(upTime);
- configUtil.stopController();
- }
-
- private URI createMessages(int numberOfMessages, Service service, MessageStore store) throws MessageStoreException
- {
- URI uid=null;
- for (int i=0; i<numberOfMessages; i++) {
- Message msg = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- assertEquals((msg != null), true);
- msg.getProperties().setProperty(ServiceInvoker.DELIVER_TO, service);
- uid = store.addMessage(msg, MessageStore.CLASSIFICATION_RDLVR);
- }
- return uid;
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- MockCourierFactory.install();
- MockRegistry.install();
- MockCourier courier1 = new MockCourier(true);
- MockRegistry.register("cat", "service", courier1);
-
- try {
- File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
- System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
- DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
- File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
- File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
- System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
- if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
- HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
-
- //Drop what is there now, if exists. We want to start fresh.
- String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
- String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- mgr.init();
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
- } else if ("com.mysql.jdbc.Driver".equals(Configuration.getStoreDriver())) {
-
- String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/create_database.sql"));
- String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/drop_database.sql"));
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- mgr.init();
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
-
- }
- } catch (Throwable e) {
- e.printStackTrace();
- System.out.println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
-
- }
-
- @AfterClass
- public static void runAfterAllTests ()
- {
-
- try
- {
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
- HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
- Configuration.getStoreUser(), Configuration
- .getStorePwd());
- }
- catch (Exception e)
- { //
- e.printStackTrace();
- }
-
- MockRegistry.uninstall();
- MockCourierFactory.uninstall();
- }
-
- public static junit.framework.Test suite ()
- {
- return new JUnit4TestAdapter(ScheduledRedeliveryUnitTest.class);
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/ScheduledRedeliveryUnitTest.java (from rev 14270, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/ScheduledRedeliveryUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/ScheduledRedeliveryUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/ScheduledRedeliveryUnitTest.java 2007-08-15 23:03:25 UTC (rev 14271)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.persistence.tests;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.Map;
+
+import junit.framework.JUnit4TestAdapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.actions.MessageRedeliverer;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.parameters.ParamRepositoryException;
+import org.jboss.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.services.persistence.MessageStoreException;
+import org.jboss.soa.esb.services.persistence.RedeliverStore;
+import org.jboss.soa.esb.testutils.ESBConfigUtil;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+/**
+ * Scheduled Redelivery unit test.
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">kurt.stam at jboss.com</a>
+ */
+public class ScheduledRedeliveryUnitTest{
+
+ @Test
+ public void test_listener_config() throws UnsupportedEncodingException {
+ ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config-01.xml"));
+ String config = configUtil.getListenerConfig("simple-schedule-listener").toString();
+ assertNotNull(config);
+ try {
+ ConfigTree tree = ConfigTree.fromXml(config);
+ String maxDeliveries = tree.getFirstChild("action").getAttribute(MessageRedeliverer.MAX_REDELIVER_ATTR);
+ assertEquals(maxDeliveries, "9");
+ } catch (SAXException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test_simple_schedule_01() {
+
+ try {
+ int numberOfMessages=200;
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ //first lets create an undeliverable message
+ Service service = new Service("cat", "service");
+ URI uid = createMessages(numberOfMessages, service, store);
+ Map<URI, Message> messageMap = store.getAllMessages(RedeliverStore.CLASSIFICATION_RDLVR);
+ assertEquals(messageMap.size(), numberOfMessages);
+ runTestConfig("config-01.xml", 5000);
+ Thread.sleep(500);
+ Message message2 = store.getMessage(uid);
+ assertNull(message2);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ private void runTestConfig(String configName, long upTime) throws ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
+ ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream(configName));
+
+ configUtil.startController();
+ Thread.sleep(upTime);
+ configUtil.stopController();
+ }
+
+ private URI createMessages(int numberOfMessages, Service service, MessageStore store) throws MessageStoreException
+ {
+ URI uid=null;
+ for (int i=0; i<numberOfMessages; i++) {
+ Message msg = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ assertEquals((msg != null), true);
+ msg.getProperties().setProperty(ServiceInvoker.DELIVER_TO, service);
+ uid = store.addMessage(msg, MessageStore.CLASSIFICATION_RDLVR);
+ }
+ return uid;
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ MockCourierFactory.install();
+ MockRegistry.install();
+ MockCourier courier1 = new MockCourier(true);
+ MockRegistry.register("cat", "service", courier1);
+
+ try {
+ File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
+ System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
+ DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
+ File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
+ File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
+ System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
+ if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
+ HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
+
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+ } else if ("com.mysql.jdbc.Driver".equals(Configuration.getStoreDriver())) {
+
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/mysql/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+
+ }
+
+ @AfterClass
+ public static void runAfterAllTests ()
+ {
+
+ try
+ {
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(), Configuration
+ .getStorePwd());
+ }
+ catch (Exception e)
+ { //
+ e.printStackTrace();
+ }
+
+ MockRegistry.uninstall();
+ MockCourierFactory.uninstall();
+ }
+
+ public static junit.framework.Test suite ()
+ {
+ return new JUnit4TestAdapter(ScheduledRedeliveryUnitTest.class);
+ }
+}
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/config-01.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/config-01.xml 2007-08-15 14:29:36 UTC (rev 14256)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/config-01.xml 2007-08-15 23:03:25 UTC (rev 14271)
@@ -1,23 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
-
- <providers>
- <schedule-provider name="schedule">
- <simple-schedule scheduleid="1-sec-trigger" frequency="1" repeatCount="2"/>
- </schedule-provider>
- </providers>
-
- <services>
- <service category="ServiceCat" name="ServiceName" description="Test Service">
- <listeners>
- <scheduled-listener name="simple-schedule-listener" scheduleidref="1-sec-trigger" composer="org.jboss.soa.esb.schedule.RedeliverEventMessageComposer" />
- </listeners>
- <actions>
- <action name="RedeliverMessagesAction" class="org.jboss.soa.esb.actions.MessageRedeliverer">
- <property name="max-redeliveries" value="9"/>
- </action>
- </actions>
- </service>
- </services>
-
-</jbossesb>
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/config-01.xml (from rev 14270, labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/config-01.xml)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/config-01.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/config-01.xml 2007-08-15 23:03:25 UTC (rev 14271)
@@ -0,0 +1,23 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+ <providers>
+ <schedule-provider name="schedule">
+ <simple-schedule scheduleid="1-sec-trigger" frequency="1" repeatCount="2"/>
+ </schedule-provider>
+ </providers>
+
+ <services>
+ <service category="ServiceCat" name="ServiceName" description="Test Service">
+ <listeners>
+ <scheduled-listener name="simple-schedule-listener" scheduleidref="1-sec-trigger" composer="org.jboss.soa.esb.schedule.RedeliverEventMessageComposer" />
+ </listeners>
+ <actions>
+ <action name="RedeliverMessagesAction" class="org.jboss.soa.esb.actions.MessageRedeliverer">
+ <property name="max-redeliveries" value="9"/>
+ </action>
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list