JBoss hornetq SVN: r10124 - branches.
by do-not-reply@jboss.org
Author: igarashitm
Date: 2011-01-19 01:45:14 -0500 (Wed, 19 Jan 2011)
New Revision: 10124
Added:
branches/HORNETQ-316/
Log:
made a branch for HORNETQ-316 from trunk
Copied: branches/HORNETQ-316 (from rev 10123, trunk)
13 years, 11 months
JBoss hornetq SVN: r10123 - branches.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-14 10:44:54 -0500 (Fri, 14 Jan 2011)
New Revision: 10123
Added:
branches/Branch_2_2_EAP/
Log:
EAP Branch Creation
Copied: branches/Branch_2_2_EAP (from rev 10122, trunk)
13 years, 11 months
JBoss hornetq SVN: r10122 - in trunk: tests/src/org/hornetq/tests/integration/stomp and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-13 11:47:41 -0500 (Thu, 13 Jan 2011)
New Revision: 10122
Modified:
trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java
trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
Log:
HORNETQ-560 - committing fix contributed by Roger Strom
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java 2011-01-13 16:43:12 UTC (rev 10121)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompUtils.java 2011-01-13 16:47:41 UTC (rev 10122)
@@ -35,6 +35,7 @@
class StompUtils
{
// Constants -----------------------------------------------------
+ private static final String DEFAULT_MESSAGE_PRIORITY= "4";
private static final Logger log = Logger.getLogger(StompUtils.class);
@@ -51,6 +52,8 @@
if (priority != null)
{
msg.setPriority(Byte.parseByte(priority));
+ } else {
+ msg.setPriority(Byte.parseByte(DEFAULT_MESSAGE_PRIORITY));
}
String persistent = (String)headers.remove(Stomp.Headers.Send.PERSISTENT);
if (persistent != null)
Modified: trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2011-01-13 16:43:12 UTC (rev 10121)
+++ trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2011-01-13 16:47:41 UTC (rev 10122)
@@ -143,6 +143,8 @@
TextMessage message = (TextMessage)consumer.receive(1000);
Assert.assertNotNull(message);
Assert.assertEquals("Hello World", message.getText());
+ // Assert default priority 4 is used when priority header is not set
+ Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
// Make sure that the timestamp is valid - should
// be very close to the current time.
13 years, 11 months
JBoss hornetq SVN: r10121 - trunk/docs/user-manual/en.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-13 11:43:12 -0500 (Thu, 13 Jan 2011)
New Revision: 10121
Modified:
trunk/docs/user-manual/en/configuration-index.xml
Log:
fixing doc
Modified: trunk/docs/user-manual/en/configuration-index.xml
===================================================================
--- trunk/docs/user-manual/en/configuration-index.xml 2011-01-13 11:54:18 UTC (rev 10120)
+++ trunk/docs/user-manual/en/configuration-index.xml 2011-01-13 16:43:12 UTC (rev 10121)
@@ -151,7 +151,7 @@
>journal-file-size</link></entry>
<entry>Long</entry>
<entry>the size (in bytes) of each journal file</entry>
- <entry>128 * 1024</entry>
+ <entry>10 * 1024 * 1024 (10 MiB)</entry>
</row>
<row>
<entry><link linkend="configuring.message.journal.journal-max-io"
13 years, 11 months
JBoss hornetq SVN: r10120 - trunk/src/main/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-01-13 06:54:18 -0500 (Thu, 13 Jan 2011)
New Revision: 10120
Modified:
trunk/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java
Log:
https://issues.jboss.org/browse/JBPAPP-5759 - stopping server set state back to 'L' which was incorrect
Modified: trunk/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java 2011-01-13 08:59:53 UTC (rev 10119)
+++ trunk/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java 2011-01-13 11:54:18 UTC (rev 10120)
@@ -172,6 +172,7 @@
}
else if (state == LIVE)
{
+ log.debug("acquired live node lock state = " + (char)state);
break;
}
}
@@ -210,8 +211,6 @@
public void crashLiveServer() throws Exception
{
- //overkill as already set to live
- setLive();
liveLock.release();
}
13 years, 11 months
JBoss hornetq SVN: r10119 - in trunk: tests/src/org/hornetq/tests/integration/xa and 1 other directories.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2011-01-13 03:59:53 -0500 (Thu, 13 Jan 2011)
New Revision: 10119
Modified:
trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java
trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java
Log:
HORNETQ-609
Modified: trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-01-13 00:23:58 UTC (rev 10118)
+++ trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-01-13 08:59:53 UTC (rev 10119)
@@ -740,6 +740,9 @@
}
getRefsOperation(tx).addAck(ref);
+
+ //https://issues.jboss.org/browse/HORNETQ-609
+ deliveringCount.incrementAndGet();
}
private final RefsOperation getRefsOperation(final Transaction tx)
Modified: trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java 2011-01-13 00:23:58 UTC (rev 10118)
+++ trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java 2011-01-13 08:59:53 UTC (rev 10119)
@@ -16,6 +16,8 @@
import java.util.HashMap;
import java.util.Map;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
@@ -24,6 +26,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.management.QueueControl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -31,6 +34,7 @@
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQBytesMessage;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.tests.integration.management.ManagementControlHelper;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.UUIDGenerator;
@@ -60,6 +64,8 @@
private final SimpleString atestq = new SimpleString("atestq");
private ServerLocator locator;
+
+ private MBeanServer mbeanServer;
@Override
protected void setUp() throws Exception
@@ -72,8 +78,11 @@
configuration.setSecurityEnabled(false);
configuration.setJournalMinFiles(2);
configuration.setPagingDirectory(getPageDir());
+ configuration.setJMXManagementEnabled(true);
+
+ mbeanServer = MBeanServerFactory.createMBeanServer();
- server = createServer(true, configuration, -1, -1, addressSettings);
+ server = createServer(true, configuration, -1, -1, addressSettings, mbeanServer);
// start the server
server.start();
@@ -85,6 +94,10 @@
@Override
protected void tearDown() throws Exception
{
+ MBeanServerFactory.releaseMBeanServer(mbeanServer);
+
+ mbeanServer = null;
+
if (clientSession != null)
{
try
@@ -933,8 +946,20 @@
clientSession.start();
m = clientConsumer.receiveImmediate();
Assert.assertNull(m);
+
+ //check deliveringCount Zero
+ checkQueueDeliveryCount(atestq, 0);
}
+ private void checkQueueDeliveryCount(SimpleString thequeue, int expectedCount) throws Exception
+ {
+ QueueControl queueControl = ManagementControlHelper.createQueueControl(thequeue, thequeue, mbeanServer);
+
+ int actualCount = queueControl.getDeliveringCount();
+
+ assertEquals(expectedCount, actualCount);
+ }
+
public void testBasicReceiveWithRollback(final boolean stopServer) throws Exception
{
Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -1208,7 +1233,7 @@
clientSession = null;
server.stop();
server = null;
- server = createServer(true, configuration, -1, -1, addressSettings);
+ server = createServer(true, configuration, -1, -1, addressSettings, mbeanServer);
server.start();
createClients();
Modified: trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2011-01-13 00:23:58 UTC (rev 10118)
+++ trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2011-01-13 08:59:53 UTC (rev 10119)
@@ -169,6 +169,38 @@
final Configuration configuration,
final int pageSize,
final int maxAddressSize,
+ final Map<String, AddressSettings> settings,
+ final MBeanServer mbeanServer)
+ {
+ HornetQServer server;
+
+ if (realFiles)
+ {
+ server = HornetQServers.newHornetQServer(configuration, mbeanServer, true);
+ }
+ else
+ {
+ server = HornetQServers.newHornetQServer(configuration, mbeanServer, false);
+ }
+
+ for (Map.Entry<String, AddressSettings> setting : settings.entrySet())
+ {
+ server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
+ }
+
+ AddressSettings defaultSetting = new AddressSettings();
+ defaultSetting.setPageSizeBytes(pageSize);
+ defaultSetting.setMaxSizeBytes(maxAddressSize);
+
+ server.getAddressSettingsRepository().addMatch("#", defaultSetting);
+
+ return server;
+ }
+
+ protected HornetQServer createServer(final boolean realFiles,
+ final Configuration configuration,
+ final int pageSize,
+ final int maxAddressSize,
final Map<String, AddressSettings> settings)
{
HornetQServer server;
13 years, 11 months
JBoss hornetq SVN: r10118 - trunk.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-12 19:23:58 -0500 (Wed, 12 Jan 2011)
New Revision: 10118
Modified:
trunk/build-maven.xml
Log:
maven build
Modified: trunk/build-maven.xml
===================================================================
--- trunk/build-maven.xml 2011-01-12 23:59:09 UTC (rev 10117)
+++ trunk/build-maven.xml 2011-01-13 00:23:58 UTC (rev 10118)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.2.0.QA-10111"/>
+ <property name="hornetq.version" value="2.2.0.QA-10117"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
13 years, 11 months
JBoss hornetq SVN: r10117 - in trunk/src/main/org/hornetq/core: server/impl and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-12 18:59:09 -0500 (Wed, 12 Jan 2011)
New Revision: 10117
Modified:
trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
JBPAPP-5659 - fixing dependency on security roles on backup nodes
Modified: trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java 2011-01-12 04:03:22 UTC (rev 10116)
+++ trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java 2011-01-12 23:59:09 UTC (rev 10117)
@@ -185,10 +185,10 @@
}
throw new HornetQException(HornetQException.SECURITY_EXCEPTION,
- "Unable to validate user: " + session.getUsername() +
- " for check type " +
+ "User: " + session.getUsername() +
+ " doesn't have permission='" +
checkType +
- " for address " +
+ "' on address " +
saddress);
}
// if we get here we're granted, add to the cache
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-01-12 04:03:22 UTC (rev 10116)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-01-12 23:59:09 UTC (rev 10117)
@@ -1378,11 +1378,9 @@
securityDeployer.start();
}
}
- else
- {
- deploySecurityFromConfiguration();
- }
+ deploySecurityFromConfiguration();
+
deployGroupingHandlerConfiguration(configuration.getGroupingHandlerConfiguration());
// This can't be created until node id is set
13 years, 11 months
JBoss hornetq SVN: r10116 - trunk/docs/eap-manual/en.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-11 23:03:22 -0500 (Tue, 11 Jan 2011)
New Revision: 10116
Modified:
trunk/docs/eap-manual/en/clusters.xml
Log:
fixing a few typos
Modified: trunk/docs/eap-manual/en/clusters.xml
===================================================================
--- trunk/docs/eap-manual/en/clusters.xml 2011-01-11 22:29:38 UTC (rev 10115)
+++ trunk/docs/eap-manual/en/clusters.xml 2011-01-12 04:03:22 UTC (rev 10116)
@@ -34,8 +34,8 @@
<title>Colocated Live and Backup in Symmetrical cluster</title>
<para>
The colocated symmetrical topology will be the most widely used topology, this is where an EAP instance has
- a live node running plus 1 or more backup nodes. Each backup node will belong to a live node on another EAP
- instance. In a simple cluster o 2
+ a live node running plus 1 or more backup node. Each backup node will belong to a live node on another EAP
+ instance. In a simple cluster of 2
EAP instances this would mean that each EAP instance would have a live server and 1 backup server as in
diagram1.
</para>
@@ -64,7 +64,7 @@
<graphic fileref="images/simple-colocated2.jpg" align="center" format="jpg" scale="30"/>
</para>
<para>
- With more thn 2 servers it is up to the user as to how many backups per live server are configured, you can
+ With more than 2 servers it is up to the user as to how many backups per live server are configured, you can
have
as many backups as required but usually 1 would suffice. In 3 node topology you may have each EAP instance
configured
13 years, 11 months
JBoss hornetq SVN: r10115 - in trunk/tests/src/org/hornetq/tests/integration/cluster: util and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-11 17:29:38 -0500 (Tue, 11 Jan 2011)
New Revision: 10115
Added:
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java
trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
trunk/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java
Log:
Adding Security Failover test (on the process of investigating a QA issue)
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-01-11 18:17:01 UTC (rev 10114)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-01-11 22:29:38 UTC (rev 10115)
@@ -44,6 +44,7 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.tests.integration.cluster.util.TestableServer;
import org.hornetq.tests.util.RandomUtil;
/**
@@ -56,6 +57,7 @@
public class FailoverTest extends FailoverTestBase
{
private static final Logger log = Logger.getLogger(FailoverTest.class);
+
private ServerLocator locator;
// Constants -----------------------------------------------------
@@ -101,7 +103,33 @@
super.tearDown();
}
- //https://jira.jboss.org/browse/HORNETQ-522
+ protected ClientSession createSession(ClientSessionFactory sf,
+ boolean autoCommitSends,
+ boolean autoCommitAcks,
+ int ackBatchSize) throws Exception
+ {
+ return sf.createSession(autoCommitSends, autoCommitAcks, ackBatchSize);
+ }
+
+ protected ClientSession createSession(ClientSessionFactory sf, boolean autoCommitSends, boolean autoCommitAcks) throws Exception
+ {
+ return sf.createSession(autoCommitSends, autoCommitAcks);
+ }
+
+ protected ClientSession createSession(ClientSessionFactory sf) throws Exception
+ {
+ return sf.createSession();
+ }
+
+ protected ClientSession createSession(ClientSessionFactory sf,
+ boolean xa,
+ boolean autoCommitSends,
+ boolean autoCommitAcks) throws Exception
+ {
+ return sf.createSession(xa, autoCommitSends, autoCommitAcks);
+ }
+
+ // https://jira.jboss.org/browse/HORNETQ-522
public void testNonTransactedWithZeroConsumerWindowSize() throws Exception
{
locator.setBlockOnNonDurableSend(true);
@@ -111,11 +139,10 @@
ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)locator.createSessionFactory();
- ClientSession session = sf.createSession(true, true);
+ ClientSession session = createSession(sf, true, true);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
-
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
final int numMessages = 100;
@@ -133,11 +160,12 @@
int winSize = 0;
ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS, null, winSize, 100, false);
-
+
final List<ClientMessage> received = new ArrayList<ClientMessage>();
-
- consumer.setMessageHandler(new MessageHandler() {
+ consumer.setMessageHandler(new MessageHandler()
+ {
+
public void onMessage(ClientMessage message)
{
received.add(message);
@@ -151,13 +179,13 @@
e.printStackTrace();
}
}
-
+
});
session.start();
-
+
crash(session);
-
+
int retry = 0;
while (received.size() >= numMessages)
{
@@ -172,7 +200,7 @@
session.close();
sf.close();
-
+
Assert.assertTrue(retry <= 5);
Assert.assertEquals(0, sf.numSessions());
@@ -190,7 +218,7 @@
sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, true);
+ ClientSession session = createSession(sf, true, true);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -250,7 +278,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(false, false);
+ ClientSession session = createSession(sf, false, false);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -309,7 +337,7 @@
for (int i = 0; i < numMessages; i++)
{
ClientMessage message = consumer.receive(1000);
-
+
assertNotNull(message);
message.acknowledge();
@@ -326,8 +354,6 @@
Assert.assertEquals(0, sf.numConnections());
}
-
-
// https://jira.jboss.org/jira/browse/HORNETQ-285
public void testFailoverOnInitialConnection() throws Exception
{
@@ -336,13 +362,12 @@
locator.setFailoverOnInitialConnection(true);
locator.setReconnectAttempts(-1);
-
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
// Crash live server
crash();
- ClientSession session = sf.createSession();
+ ClientSession session = createSession(sf);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -395,7 +420,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(false, false);
+ ClientSession session = createSession(sf, false, false);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -458,7 +483,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(false, false);
+ ClientSession session = createSession(sf, false, false);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -529,7 +554,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(false, false);
+ ClientSession session = createSession(sf, false, false);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -601,7 +626,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(false, false);
+ ClientSession session = createSession(sf, false, false);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -636,7 +661,7 @@
session.close();
- session = sf.createSession(false, false);
+ session = createSession(sf, false, false);
consumer = session.createConsumer(FailoverTestBase.ADDRESS);
@@ -681,7 +706,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session1 = sf.createSession(false, false);
+ ClientSession session1 = createSession(sf, false, false);
session1.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -702,7 +727,7 @@
session1.commit();
- ClientSession session2 = sf.createSession(false, false);
+ ClientSession session2 = createSession(sf, false, false);
ClientConsumer consumer = session2.createConsumer(FailoverTestBase.ADDRESS);
@@ -755,7 +780,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session1 = sf.createSession(false, false);
+ ClientSession session1 = createSession(sf, false, false);
session1.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -776,7 +801,7 @@
session1.commit();
- ClientSession session2 = sf.createSession(false, false);
+ ClientSession session2 = createSession(sf, false, false);
ClientConsumer consumer = session2.createConsumer(FailoverTestBase.ADDRESS);
@@ -841,7 +866,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, false, false);
+ ClientSession session = createSession(sf, true, false, false);
Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes());
@@ -902,7 +927,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, false, false);
+ ClientSession session = createSession(sf, true, false, false);
Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes());
@@ -966,7 +991,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, false, false);
+ ClientSession session = createSession(sf, true, false, false);
Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes());
@@ -1031,7 +1056,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, false, false);
+ ClientSession session = createSession(sf, true, false, false);
Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes());
@@ -1111,7 +1136,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session1 = sf.createSession(false, false);
+ ClientSession session1 = createSession(sf, false, false);
session1.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -1132,7 +1157,7 @@
session1.commit();
- ClientSession session2 = sf.createSession(true, false, false);
+ ClientSession session2 = createSession(sf, true, false, false);
ClientConsumer consumer = session2.createConsumer(FailoverTestBase.ADDRESS);
@@ -1187,7 +1212,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session1 = sf.createSession(false, false);
+ ClientSession session1 = createSession(sf, false, false);
session1.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -1208,7 +1233,7 @@
session1.commit();
- ClientSession session2 = sf.createSession(true, false, false);
+ ClientSession session2 = createSession(sf, true, false, false);
ClientConsumer consumer = session2.createConsumer(FailoverTestBase.ADDRESS);
@@ -1265,7 +1290,7 @@
locator.setReconnectAttempts(-1);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session1 = sf.createSession(false, false);
+ ClientSession session1 = createSession(sf, false, false);
session1.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -1286,7 +1311,7 @@
session1.commit();
- ClientSession session2 = sf.createSession(true, false, false);
+ ClientSession session2 = createSession(sf, true, false, false);
ClientConsumer consumer = session2.createConsumer(FailoverTestBase.ADDRESS);
@@ -1352,7 +1377,7 @@
Thread.sleep(5000);
- sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
+ sf = (ClientSessionFactoryInternal)locator.createSessionFactory();
session = sendAndConsume(sf, true);
@@ -1381,7 +1406,7 @@
for (int i = 0; i < numSessions; i++)
{
- ClientSession session = sf.createSession(true, true);
+ ClientSession session = createSession(sf, true, true);
List<ClientConsumer> consumers = new ArrayList<ClientConsumer>();
@@ -1399,7 +1424,7 @@
sessionConsumerMap.put(session, consumers);
}
- ClientSession sendSession = sf.createSession(true, true);
+ ClientSession sendSession = createSession(sf, true, true);
ClientProducer producer = sendSession.createProducer(FailoverTestBase.ADDRESS);
@@ -1421,7 +1446,6 @@
sessionSet.toArray(sessions);
crash(sessions);
-
for (ClientSession session : sessionConsumerMap.keySet())
{
session.start();
@@ -1470,7 +1494,7 @@
locator.setReconnectAttempts(-1);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, true);
+ ClientSession session = createSession(sf, true, true);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -1541,7 +1565,7 @@
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, true);
+ ClientSession session = createSession(sf, true, true);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -1614,7 +1638,7 @@
locator.setReconnectAttempts(-1);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, true, 0);
+ ClientSession session = createSession(sf, true, true, 0);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -1717,7 +1741,7 @@
locator.setReconnectAttempts(-1);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- ClientSession session = sf.createSession(true, true, 0);
+ ClientSession session = createSession(sf, true, true, 0);
if (temporary)
{
@@ -1728,7 +1752,6 @@
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, durable);
}
-
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
final int numMessages = 100;
@@ -1778,16 +1801,14 @@
locator.setBlockOnDurableSend(true);
locator.setBlockOnAcknowledge(true);
locator.setReconnectAttempts(-1);
- ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)locator.createSessionFactory();
// Add an interceptor to delay the send method so we can get time to cause failover before it returns
- //liveServer.getRemotingService().addInterceptor(new DelayInterceptor());
+ // liveServer.getRemotingService().addInterceptor(new DelayInterceptor());
+ final ClientSession session = createSession(sf, true, true, 0);
-
- final ClientSession session = sf.createSession(true, true, 0);
-
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
@@ -1846,7 +1867,7 @@
locator.setBlockOnAcknowledge(true);
final ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- final ClientSession session = sf.createSession(false, false);
+ final ClientSession session = createSession(sf, false, false);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -1932,7 +1953,7 @@
session.close();
- ClientSession session2 = sf.createSession(false, false);
+ ClientSession session2 = createSession(sf, false, false);
producer = session2.createProducer(FailoverTestBase.ADDRESS);
@@ -1996,7 +2017,7 @@
locator.setReconnectAttempts(-1);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
- final ClientSession session = sf.createSession(false, false);
+ final ClientSession session = createSession(sf, false, false);
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
@@ -2066,7 +2087,7 @@
session.close();
- ClientSession session2 = sf.createSession(false, false);
+ ClientSession session2 = createSession(sf, false, false);
producer = session2.createProducer(FailoverTestBase.ADDRESS);
@@ -2144,7 +2165,10 @@
backupServer.stop();
liveServer.crash();
-
+
+ // To reload security or other settings that are read during startup
+ beforeRestart(backupServer);
+
backupServer.start();
assertTrue(latch.await(5, TimeUnit.SECONDS));
@@ -2160,7 +2184,7 @@
session.close();
sf.close();
-
+
Assert.assertEquals(0, sf.numSessions());
Assert.assertEquals(0, sf.numConnections());
@@ -2196,6 +2220,11 @@
liveServer.crash();
+ beforeRestart(liveServer);
+
+ // To reload security or other settings that are read during startup
+ beforeRestart(liveServer);
+
liveServer.start();
assertTrue(latch.await(5, TimeUnit.SECONDS));
@@ -2247,6 +2276,9 @@
liveServer.crash();
+ // To reload security or other settings that are read during startup
+ beforeRestart(liveServer);
+
liveServer.start();
assertTrue(latch.await(5, TimeUnit.SECONDS));
@@ -2263,14 +2295,14 @@
sf.close();
- sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
+ sf = (ClientSessionFactoryInternal)locator.createSessionFactory();
- session = sf.createSession();
+ session = createSession(sf);
ClientConsumer cc = session.createConsumer(FailoverTestBase.ADDRESS);
session.start();
-
+
ClientMessage cm = cc.receive(5000);
assertNotNull(cm);
@@ -2278,7 +2310,7 @@
Assert.assertEquals("message0", cm.getBodyBuffer().readString());
session.close();
-
+
sf.close();
Assert.assertEquals(0, sf.numSessions());
@@ -2316,6 +2348,9 @@
liveServer.crash();
+ // To reload security or other settings that are read during startup
+ beforeRestart(backupServer);
+
backupServer.start();
assertTrue(latch.await(5, TimeUnit.SECONDS));
@@ -2332,9 +2367,9 @@
sf.close();
- sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
+ sf = (ClientSessionFactoryInternal)locator.createSessionFactory();
- session = sf.createSession();
+ session = createSession(sf);
ClientConsumer cc = session.createConsumer(FailoverTestBase.ADDRESS);
@@ -2354,6 +2389,7 @@
Assert.assertEquals(0, sf.numConnections());
}
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -2389,11 +2425,15 @@
message.getBodyBuffer().writeString("message" + i);
}
+ protected void beforeRestart(TestableServer liveServer)
+ {
+ }
+
// Private -------------------------------------------------------
private ClientSession sendAndConsume(final ClientSessionFactory sf, final boolean createQueue) throws Exception
{
- ClientSession session = sf.createSession(false, true, true);
+ ClientSession session = createSession(sf, false, true, true);
if (createQueue)
{
@@ -2440,5 +2480,4 @@
// Inner classes -------------------------------------------------
-
}
Added: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java 2011-01-11 22:29:38 UTC (rev 10115)
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.failover;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.core.config.ClusterConnectionConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.security.Role;
+import org.hornetq.core.server.impl.InVMNodeManager;
+import org.hornetq.spi.core.security.HornetQSecurityManager;
+import org.hornetq.tests.integration.cluster.util.TestableServer;
+
+/**
+ * A SecurityFailoverTest
+ *
+ * @author clebertsuconic
+ *
+ *
+ */
+public class SecurityFailoverTest extends FailoverTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected ClientSession createSession(ClientSessionFactory sf,
+ boolean isXA,
+ boolean autoCommitSends,
+ boolean autoCommitAcks,
+ int ackBatchSize) throws Exception
+ {
+ return sf.createSession("a",
+ "b",
+ isXA,
+ autoCommitSends,
+ autoCommitAcks,
+ sf.getServerLocator().isPreAcknowledge(),
+ ackBatchSize);
+ }
+
+ protected ClientSession createSession(ClientSessionFactory sf,
+ boolean autoCommitSends,
+ boolean autoCommitAcks,
+ int ackBatchSize) throws Exception
+ {
+ return sf.createSession("a", "b", false, autoCommitSends, autoCommitAcks, sf.getServerLocator()
+ .isPreAcknowledge(), ackBatchSize);
+ }
+
+ protected ClientSession createSession(ClientSessionFactory sf, boolean autoCommitSends, boolean autoCommitAcks) throws Exception
+ {
+ return createSession(sf, autoCommitSends, autoCommitAcks, sf.getServerLocator().getAckBatchSize());
+ }
+
+ protected ClientSession createSession(ClientSessionFactory sf) throws Exception
+ {
+ return createSession(sf, true, true, sf.getServerLocator().getAckBatchSize());
+ }
+
+ protected ClientSession createSession(ClientSessionFactory sf,
+ boolean xa,
+ boolean autoCommitSends,
+ boolean autoCommitAcks) throws Exception
+ {
+ return createSession(sf, xa, autoCommitSends, autoCommitAcks, sf.getServerLocator().getAckBatchSize());
+ }
+
+ /**
+ * @throws Exception
+ */
+ protected void createConfigs() throws Exception
+ {
+ nodeManager = new InVMNodeManager();
+
+ backupConfig = super.createDefaultConfig();
+ backupConfig.getAcceptorConfigurations().clear();
+ backupConfig.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(false));
+ backupConfig.setSecurityEnabled(true);
+ backupConfig.setSharedStore(true);
+ backupConfig.setBackup(true);
+ backupConfig.setClustered(true);
+ TransportConfiguration liveConnector = getConnectorTransportConfiguration(true);
+ TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
+ backupConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
+ backupConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
+ ArrayList<String> staticConnectors = new ArrayList<String>();
+ staticConnectors.add(liveConnector.getName());
+ ClusterConnectionConfiguration cccLive = new ClusterConnectionConfiguration("cluster1",
+ "jms",
+ backupConnector.getName(),
+ -1,
+ false,
+ false,
+ 1,
+ 1,
+ staticConnectors,
+ false);
+ backupConfig.getClusterConfigurations().add(cccLive);
+ backupServer = createBackupServer();
+
+ HornetQSecurityManager securityManager = installSecurity(backupServer);
+
+ securityManager.setDefaultUser(null);
+
+ liveConfig = super.createDefaultConfig();
+ liveConfig.getAcceptorConfigurations().clear();
+ liveConfig.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
+ liveConfig.setSecurityEnabled(true);
+ liveConfig.setSharedStore(true);
+ liveConfig.setClustered(true);
+ List<String> pairs = null;
+ ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1",
+ "jms",
+ liveConnector.getName(),
+ -1,
+ false,
+ false,
+ 1,
+ 1,
+ pairs,
+ false);
+ liveConfig.getClusterConfigurations().add(ccc0);
+ liveConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
+ liveServer = createLiveServer();
+
+ installSecurity(liveServer);
+ }
+
+ protected void beforeRestart(TestableServer server)
+ {
+ installSecurity(server);
+ }
+
+
+ /**
+ * @return
+ */
+ protected HornetQSecurityManager installSecurity(TestableServer server)
+ {
+ HornetQSecurityManager securityManager = server.getServer().getSecurityManager();
+ securityManager.addUser("a", "b");
+ Role role = new Role("arole", true, true, true, true, true, true, true);
+ Set<Role> roles = new HashSet<Role>();
+ roles.add(role);
+ server.getServer().getSecurityRepository().addMatch("#", roles);
+ securityManager.addRole("a", "arole");
+ return securityManager;
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java 2011-01-11 18:17:01 UTC (rev 10114)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java 2011-01-11 22:29:38 UTC (rev 10115)
@@ -22,6 +22,7 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.SessionFailureListener;
+import org.hornetq.core.server.HornetQServer;
/**
* A RemoteProcessHornetQServer
@@ -169,4 +170,12 @@
{
started = true;
}
+
+ /* (non-Javadoc)
+ * @see org.hornetq.tests.integration.cluster.util.TestableServer#getServer()
+ */
+ public HornetQServer getServer()
+ {
+ return null;
+ }
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2011-01-11 18:17:01 UTC (rev 10114)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2011-01-11 22:29:38 UTC (rev 10115)
@@ -109,6 +109,14 @@
Assert.assertTrue(ok);
}
+ /* (non-Javadoc)
+ * @see org.hornetq.tests.integration.cluster.util.TestableServer#getServer()
+ */
+ public HornetQServer getServer()
+ {
+ return server;
+ }
+
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java 2011-01-11 18:17:01 UTC (rev 10114)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java 2011-01-11 22:29:38 UTC (rev 10115)
@@ -15,6 +15,7 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.core.server.HornetQServer;
/**
* A TestServer
@@ -25,10 +26,13 @@
*/
public interface TestableServer
{
+
+ HornetQServer getServer();
+
public void start() throws Exception;
-
+
public void stop() throws Exception;
-
+
public void crash(ClientSession... sessions) throws Exception;
public boolean isInitialised();
13 years, 12 months