JBoss hornetq SVN: r9628 - in branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster: failover/remote and 1 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-01 11:53:47 -0400 (Wed, 01 Sep 2010)
New Revision: 9628
Added:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteServerConfiguration.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java
Removed:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
Log:
moved classes to run hornetq server in separate process in cluster.util package
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2010-09-01 15:52:22 UTC (rev 9627)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -16,6 +16,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
@@ -30,6 +31,9 @@
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.server.JournalType;
import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
+import org.hornetq.tests.integration.cluster.util.RemoteProcessHornetQServer;
+import org.hornetq.tests.integration.cluster.util.RemoteServerConfiguration;
+import org.hornetq.tests.integration.cluster.util.TestableServer;
/**
* A ServerTest
@@ -51,7 +55,7 @@
// Public --------------------------------------------------------
- static class SharedLiveServerConfiguration extends RemoteServerConfiguration
+ public static class SharedLiveServerConfiguration extends RemoteServerConfiguration
{
@Override
@@ -79,7 +83,7 @@
}
- static class SharedBackupServerConfiguration extends RemoteServerConfiguration
+ public static class SharedBackupServerConfiguration extends RemoteServerConfiguration
{
@Override
@@ -113,15 +117,26 @@
}
+ protected TestableServer createLiveServer() {
+ return new RemoteProcessHornetQServer(SharedLiveServerConfiguration.class.getName());
+ }
+
+ protected TestableServer createBackupServer() {
+ return new RemoteProcessHornetQServer(SharedBackupServerConfiguration.class.getName());
+ }
+
public void testCrashLiveServer() throws Exception
{
- Process liveServer = null;
- Process backupServer = null;
+ TestableServer liveServer = null;
+ TestableServer backupServer = null;
try
{
- liveServer = RemoteHornetQServer.start(SharedLiveServerConfiguration.class.getName());
- backupServer = RemoteHornetQServer.start(SharedBackupServerConfiguration.class.getName());
-
+ liveServer = createLiveServer();
+ backupServer = createBackupServer();
+
+ liveServer.start();
+ backupServer.start();
+
ServerLocator locator = HornetQClient.createServerLocatorWithHA(createTransportConfiguration(true,
false,
generateParams(0,
@@ -138,11 +153,10 @@
prodSession.commit();
prodSession.close();
- RemoteHornetQServer.crash(liveServer);
- assertTrue(liveServer.exitValue() == 1);
+ liveServer.crash();
liveServer = null;
Thread.sleep(5000);
-
+
sf = locator.createSessionFactory();
ClientSession consSession = sf.createSession();
consSession.start();
@@ -161,23 +175,30 @@
{
if (liveServer != null)
{
- RemoteHornetQServer.stop(liveServer);
-
+ liveServer.stop();
}
if (backupServer != null)
{
- RemoteHornetQServer.stop(backupServer);
-
+ backupServer.stop();
}
}
}
- public void _testNoConnection() throws Exception
+ public void testNoConnection() throws Exception
{
ServerLocator locator = HornetQClient.createServerLocatorWithHA(new TransportConfiguration(NettyConnectorFactory.class.getName()));
- locator.createSessionFactory();
+ try
+ {
+ locator.createSessionFactory();
+ fail();
+ }
+ catch (HornetQException e)
+ {
+ assertEquals(HornetQException.NOT_CONNECTED, e.getCode());
+ }
}
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Deleted: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java 2010-09-01 15:52:22 UTC (rev 9627)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -1,173 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.tests.integration.cluster.failover.remote;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.HornetQServers;
-import org.hornetq.tests.util.SpawnedVMSupport;
-
-/**
- * A RemoteHornetQServer
- *
- * @author jmesnil
- *
- *
- */
-public class RemoteHornetQServer
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- public static void main(final String[] args) throws Exception
- {
- try
- {
- String serverClass = args[0];
- System.out.println("Instantiate " + serverClass);
- RemoteServerConfiguration spawnedServer = (RemoteServerConfiguration)Class.forName(serverClass).newInstance();
-
- HornetQServer server = HornetQServers.newHornetQServer(spawnedServer.getConfiguration());
- server.start();
-
- System.out.println("Server started, ready to start client test");
-
- // create the reader before printing OK so that if the test is quick
- // we will still capture the STOP message sent by the client
- InputStreamReader isr = new InputStreamReader(System.in);
- BufferedReader br = new BufferedReader(isr);
-
- System.out.println("OK");
-
- String line = null;
- while ((line = br.readLine()) != null)
- {
- if ("STOP".equals(line.trim()))
- {
- server.stop();
- System.out.println("Server stopped");
- System.exit(0);
- }
- else
- {
- // stop anyway but with a error status
- System.out.println("Server crashed");
- System.exit(1);
- }
- }
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- String allStack = t.getCause().getMessage() + "|";
- StackTraceElement[] stackTrace = t.getCause().getStackTrace();
- for (StackTraceElement stackTraceElement : stackTrace)
- {
- allStack += stackTraceElement.toString() + "|";
- }
- System.out.println(allStack);
- System.out.println("KO");
- System.exit(1);
- }
- }
-
-
- public static Process start(String serverClassName) throws Exception
- {
- String[] vmArgs = new String[] { "-Dorg.hornetq.logger-delegate-factory-class-name=org.hornetq.jms.SysoutLoggerDelegateFactory" };
- Process serverProcess = SpawnedVMSupport.spawnVM(RemoteHornetQServer.class.getName(), vmArgs, false, serverClassName);
- InputStreamReader isr = new InputStreamReader(serverProcess.getInputStream());
-
- final BufferedReader br = new BufferedReader(isr);
- String line = null;
- while ((line = br.readLine()) != null)
- {
- System.out.println("SERVER: " + line);
- line.replace('|', '\n');
- if ("OK".equals(line.trim()))
- {
- new Thread()
- {
- @Override
- public void run()
- {
- try
- {
- String line = null;
- while ((line = br.readLine()) != null)
- {
- System.out.println("SERVER: " + line);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }.start();
- return serverProcess;
- }
- else if ("KO".equals(line.trim()))
- {
- // something went wrong with the server, destroy it:
- serverProcess.destroy();
- throw new IllegalStateException("Unable to start the spawned server :" + line);
- }
- }
- return serverProcess;
- }
-
- public static void stop(Process serverProcess) throws Exception
- {
- OutputStreamWriter osw = new OutputStreamWriter(serverProcess.getOutputStream());
- osw.write("STOP\n");
- osw.flush();
- int exitValue = serverProcess.waitFor();
- if (exitValue != 0)
- {
- serverProcess.destroy();
- }
- }
-
- public static void crash(Process serverProcess) throws Exception
- {
- OutputStreamWriter osw = new OutputStreamWriter(serverProcess.getOutputStream());
- osw.write("KILL\n");
- osw.flush();
- int exitValue = serverProcess.waitFor();
- if (exitValue != 0)
- {
- serverProcess.destroy();
- }
- }
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java 2010-09-01 15:52:22 UTC (rev 9627)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -1,31 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.tests.integration.cluster.failover.remote;
-
-import org.hornetq.core.config.Configuration;
-
-/**
- * A RemoteServerConfiguration
- *
- * @author jmesnil
- *
- */
-public abstract class RemoteServerConfiguration
-{
-
- public RemoteServerConfiguration() {
- }
-
- public abstract Configuration getConfiguration();
-}
Added: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -0,0 +1,68 @@
+/*
+ * 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.util;
+
+
+/**
+ * A RemoteProcessHornetQServer
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class RemoteProcessHornetQServer implements TestableServer
+{
+
+ private String configurationClassName;
+ private Process serverProcess;
+
+ public RemoteProcessHornetQServer(String configurationClassName)
+ {
+ this.configurationClassName = configurationClassName;
+ }
+
+ public void start() throws Exception
+ {
+ serverProcess = RemoteProcessHornetQServerSupport.start(configurationClassName);
+ }
+
+ public void stop() throws Exception
+ {
+ RemoteProcessHornetQServerSupport.stop(serverProcess);
+ }
+
+ public void crash() throws Exception
+ {
+ RemoteProcessHornetQServerSupport.crash(serverProcess);
+ }
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Copied: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java (from rev 9626, branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java)
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -0,0 +1,173 @@
+/*
+ * 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.util;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.tests.util.SpawnedVMSupport;
+
+/**
+ * A RemoteProcessHornetQServerSupport
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class RemoteProcessHornetQServerSupport
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ public static void main(final String[] args) throws Exception
+ {
+ try
+ {
+ String serverClass = args[0];
+ System.out.println("Instantiate " + serverClass);
+ RemoteServerConfiguration spawnedServer = (RemoteServerConfiguration)Class.forName(serverClass).newInstance();
+ System.out.println(spawnedServer);
+ HornetQServer server = HornetQServers.newHornetQServer(spawnedServer.getConfiguration());
+ server.start();
+
+ System.out.println("Server started, ready to start client test");
+
+ // create the reader before printing OK so that if the test is quick
+ // we will still capture the STOP message sent by the client
+ InputStreamReader isr = new InputStreamReader(System.in);
+ BufferedReader br = new BufferedReader(isr);
+
+ System.out.println("OK");
+
+ String line = null;
+ while ((line = br.readLine()) != null)
+ {
+ if ("STOP".equals(line.trim()))
+ {
+ server.stop();
+ System.out.println("Server stopped");
+ System.exit(0);
+ }
+ else
+ {
+ // stop anyway but with a error status
+ System.out.println("Server crashed");
+ System.exit(1);
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ String allStack = t.getCause().getMessage() + "|";
+ StackTraceElement[] stackTrace = t.getCause().getStackTrace();
+ for (StackTraceElement stackTraceElement : stackTrace)
+ {
+ allStack += stackTraceElement.toString() + "|";
+ }
+ System.out.println(allStack);
+ System.out.println("KO");
+ System.exit(1);
+ }
+ }
+
+
+ public static Process start(String serverClassName) throws Exception
+ {
+ String[] vmArgs = new String[] { "-Dorg.hornetq.logger-delegate-factory-class-name=org.hornetq.jms.SysoutLoggerDelegateFactory" };
+ Process serverProcess = SpawnedVMSupport.spawnVM(RemoteProcessHornetQServerSupport.class.getName(), vmArgs, false, serverClassName);
+ InputStreamReader isr = new InputStreamReader(serverProcess.getInputStream());
+
+ final BufferedReader br = new BufferedReader(isr);
+ String line = null;
+ while ((line = br.readLine()) != null)
+ {
+ System.out.println("SERVER: " + line);
+ line.replace('|', '\n');
+ if ("OK".equals(line.trim()))
+ {
+ new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ String line = null;
+ while ((line = br.readLine()) != null)
+ {
+ System.out.println("SERVER: " + line);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }.start();
+ return serverProcess;
+ }
+ else if ("KO".equals(line.trim()))
+ {
+ // something went wrong with the server, destroy it:
+ serverProcess.destroy();
+ throw new IllegalStateException("Unable to start the spawned server :" + line);
+ }
+ }
+ return serverProcess;
+ }
+
+ public static void stop(Process serverProcess) throws Exception
+ {
+ OutputStreamWriter osw = new OutputStreamWriter(serverProcess.getOutputStream());
+ osw.write("STOP\n");
+ osw.flush();
+ int exitValue = serverProcess.waitFor();
+ if (exitValue != 0)
+ {
+ serverProcess.destroy();
+ }
+ }
+
+ public static void crash(Process serverProcess) throws Exception
+ {
+ OutputStreamWriter osw = new OutputStreamWriter(serverProcess.getOutputStream());
+ osw.write("KILL\n");
+ osw.flush();
+ int exitValue = serverProcess.waitFor();
+ if (exitValue != 0)
+ {
+ serverProcess.destroy();
+ }
+ }
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Copied: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteServerConfiguration.java (from rev 9624, branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java)
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteServerConfiguration.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteServerConfiguration.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.util;
+
+import org.hornetq.core.config.Configuration;
+
+/**
+ * A RemoteServerConfiguration
+ *
+ * @author jmesnil
+ *
+ */
+public abstract class RemoteServerConfiguration
+{
+
+ public RemoteServerConfiguration() {
+ }
+
+ public abstract Configuration getConfiguration();
+}
Added: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -0,0 +1,69 @@
+/*
+ * 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.util;
+
+import org.hornetq.core.server.HornetQServer;
+
+/**
+ * A SameProcessHornetQServer
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class SameProcessHornetQServer implements TestableServer
+{
+
+ private HornetQServer server;
+
+ public SameProcessHornetQServer(HornetQServer server)
+ {
+ this.server = server;
+ }
+
+ public void start() throws Exception
+ {
+ server.start();
+ }
+
+ public void stop() throws Exception
+ {
+ server.stop();
+ }
+
+ public void crash()
+ {
+ // FIXME...
+ }
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java 2010-09-01 15:53:47 UTC (rev 9628)
@@ -0,0 +1,30 @@
+/*
+ * 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.util;
+
+/**
+ * A TestServer
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public interface TestableServer
+{
+ public void start() throws Exception;
+
+ public void stop() throws Exception;
+
+ public void crash() throws Exception;
+}
14 years, 3 months
JBoss hornetq SVN: r9627 - in branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests: util and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-01 11:52:22 -0400 (Wed, 01 Sep 2010)
New Revision: 9627
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java
Log:
move helper methods to ServiceTestBase
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-09-01 15:01:34 UTC (rev 9626)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-09-01 15:52:22 UTC (rev 9627)
@@ -41,10 +41,6 @@
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.postoffice.QueueBinding;
import org.hornetq.core.postoffice.impl.LocalQueueBinding;
-import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
-import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
-import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.remoting.impl.netty.TransportConstants;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
@@ -1388,51 +1384,6 @@
servers[node] = server;
}
- protected static Map<String, Object> generateParams(final int node, final boolean netty)
- {
- Map<String, Object> params = new HashMap<String, Object>();
-
- if (netty)
- {
- params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME,
- org.hornetq.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + node);
- }
- else
- {
- params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, node);
- }
-
- return params;
- }
-
- protected static TransportConfiguration createTransportConfiguration(boolean netty, boolean acceptor, Map<String, Object> params)
- {
- String className;
- if (netty)
- {
- if (acceptor)
- {
- className = NettyAcceptorFactory.class.getName();
- }
- else
- {
- className = NettyConnectorFactory.class.getName();
- }
- } else
- {
- if (acceptor)
- {
- className = InVMAcceptorFactory.class.getName();
- }
- else
- {
- className = InVMConnectorFactory.class.getName();
- }
- }
- return new TransportConfiguration(className, params);
- }
-
-
protected void clearServer(final int... nodes)
{
for (int i = 0; i < nodes.length; i++)
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-09-01 15:01:34 UTC (rev 9626)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-09-01 15:52:22 UTC (rev 9627)
@@ -68,6 +68,50 @@
protected static final String NETTY_CONNECTOR_FACTORY = NettyConnectorFactory.class.getCanonicalName();
+ protected static Map<String, Object> generateParams(final int node, final boolean netty)
+ {
+ Map<String, Object> params = new HashMap<String, Object>();
+
+ if (netty)
+ {
+ params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME,
+ org.hornetq.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + node);
+ }
+ else
+ {
+ params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, node);
+ }
+
+ return params;
+ }
+
+ protected static TransportConfiguration createTransportConfiguration(boolean netty, boolean acceptor, Map<String, Object> params)
+ {
+ String className;
+ if (netty)
+ {
+ if (acceptor)
+ {
+ className = NettyAcceptorFactory.class.getName();
+ }
+ else
+ {
+ className = NettyConnectorFactory.class.getName();
+ }
+ } else
+ {
+ if (acceptor)
+ {
+ className = InVMAcceptorFactory.class.getName();
+ }
+ else
+ {
+ className = InVMConnectorFactory.class.getName();
+ }
+ }
+ return new TransportConfiguration(className, params);
+ }
+
// Static --------------------------------------------------------
private final Logger log = Logger.getLogger(this.getClass());
14 years, 3 months
JBoss hornetq SVN: r9626 - branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-01 11:01:34 -0400 (Wed, 01 Sep 2010)
New Revision: 9626
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java
Log:
forgot to stop the server...
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java 2010-09-01 14:32:51 UTC (rev 9625)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java 2010-09-01 15:01:34 UTC (rev 9626)
@@ -62,7 +62,7 @@
{
if ("STOP".equals(line.trim()))
{
- //server.stop();
+ server.stop();
System.out.println("Server stopped");
System.exit(0);
}
14 years, 3 months
JBoss hornetq SVN: r9625 - branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-01 10:32:51 -0400 (Wed, 01 Sep 2010)
New Revision: 9625
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
flag generateParams as protected
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-09-01 14:32:17 UTC (rev 9624)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-09-01 14:32:51 UTC (rev 9625)
@@ -1388,7 +1388,7 @@
servers[node] = server;
}
- protected Map<String, Object> generateParams(final int node, final boolean netty)
+ protected static Map<String, Object> generateParams(final int node, final boolean netty)
{
Map<String, Object> params = new HashMap<String, Object>();
14 years, 3 months
JBoss hornetq SVN: r9624 - in branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover: remote and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-01 10:32:17 -0400 (Wed, 01 Sep 2010)
New Revision: 9624
Added:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java
Log:
add helper methods to start/stop/crash remote hornetq servers
Added: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2010-09-01 14:32:17 UTC (rev 9624)
@@ -0,0 +1,189 @@
+/*
+ * 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.remote;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.ClusterConnectionConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.hornetq.core.server.JournalType;
+import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
+
+/**
+ * A ServerTest
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class FailoverWithSharedStoreTest extends ClusterTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ static class SharedLiveServerConfiguration extends RemoteServerConfiguration
+ {
+
+ @Override
+ public Configuration getConfiguration()
+ {
+ Configuration config = new ConfigurationImpl();
+ config.setSecurityEnabled(false);
+ config.setJournalType(JournalType.NIO);
+ config.setSharedStore(true);
+ config.setClustered(true);
+ config.getAcceptorConfigurations().add(createTransportConfiguration(true, true, generateParams(0, true)));
+ config.getConnectorConfigurations().put("self",
+ createTransportConfiguration(true, false, generateParams(0, true)));
+ config.getClusterConfigurations().add(new ClusterConnectionConfiguration("cluster",
+ "foo",
+ "self",
+ -1,
+ false,
+ false,
+ 1,
+ 1,
+ new ArrayList<String>()));
+ return config;
+ }
+
+ }
+
+ static class SharedBackupServerConfiguration extends RemoteServerConfiguration
+ {
+
+ @Override
+ public Configuration getConfiguration()
+ {
+ Configuration config = new ConfigurationImpl();
+ config.setSecurityEnabled(false);
+ config.setJournalType(JournalType.NIO);
+ config.setSharedStore(true);
+ config.setBackup(true);
+ config.setClustered(true);
+ config.getAcceptorConfigurations().add(createTransportConfiguration(true, true, generateParams(1, true)));
+ config.setLiveConnectorName("live");
+ config.getConnectorConfigurations().put("live",
+ createTransportConfiguration(true, false, generateParams(0, true)));
+ config.getConnectorConfigurations().put("self",
+ createTransportConfiguration(true, false, generateParams(1, true)));
+ List<String> connectors = new ArrayList<String>();
+ connectors.add("live");
+ config.getClusterConfigurations().add(new ClusterConnectionConfiguration("cluster",
+ "foo",
+ "self",
+ -1,
+ false,
+ false,
+ 1,
+ 1,
+ connectors));
+ return config;
+ }
+
+ }
+
+ public void testCrashLiveServer() throws Exception
+ {
+ Process liveServer = null;
+ Process backupServer = null;
+ try
+ {
+ liveServer = RemoteHornetQServer.start(SharedLiveServerConfiguration.class.getName());
+ backupServer = RemoteHornetQServer.start(SharedBackupServerConfiguration.class.getName());
+
+ ServerLocator locator = HornetQClient.createServerLocatorWithHA(createTransportConfiguration(true,
+ false,
+ generateParams(0,
+ true)));
+ locator.setFailoverOnInitialConnection(true);
+
+ ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSession prodSession = sf.createSession();
+ prodSession.createQueue("foo", "bar", true);
+ ClientProducer producer = prodSession.createProducer("foo");
+ ClientMessage message = prodSession.createMessage(true);
+ message.putStringProperty("key", "value");
+ producer.send(message);
+ prodSession.commit();
+ prodSession.close();
+
+ RemoteHornetQServer.crash(liveServer);
+ assertTrue(liveServer.exitValue() == 1);
+ liveServer = null;
+ Thread.sleep(5000);
+
+ sf = locator.createSessionFactory();
+ ClientSession consSession = sf.createSession();
+ consSession.start();
+ ClientConsumer consumer = consSession.createConsumer("bar");
+ ClientMessage receivedMessage = consumer.receive(5000);
+ assertNotNull(receivedMessage);
+ assertEquals(message.getStringProperty("key"), receivedMessage.getStringProperty("key"));
+ receivedMessage.acknowledge();
+
+ consumer.close();
+ consSession.deleteQueue("bar");
+ locator.close();
+
+ }
+ finally
+ {
+ if (liveServer != null)
+ {
+ RemoteHornetQServer.stop(liveServer);
+
+ }
+ if (backupServer != null)
+ {
+ RemoteHornetQServer.stop(backupServer);
+
+ }
+ }
+
+ }
+
+ public void _testNoConnection() throws Exception
+ {
+ ServerLocator locator = HornetQClient.createServerLocatorWithHA(new TransportConfiguration(NettyConnectorFactory.class.getName()));
+ locator.createSessionFactory();
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteHornetQServer.java 2010-09-01 14:32:17 UTC (rev 9624)
@@ -0,0 +1,173 @@
+/*
+ * 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.remote;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.tests.util.SpawnedVMSupport;
+
+/**
+ * A RemoteHornetQServer
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class RemoteHornetQServer
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ public static void main(final String[] args) throws Exception
+ {
+ try
+ {
+ String serverClass = args[0];
+ System.out.println("Instantiate " + serverClass);
+ RemoteServerConfiguration spawnedServer = (RemoteServerConfiguration)Class.forName(serverClass).newInstance();
+
+ HornetQServer server = HornetQServers.newHornetQServer(spawnedServer.getConfiguration());
+ server.start();
+
+ System.out.println("Server started, ready to start client test");
+
+ // create the reader before printing OK so that if the test is quick
+ // we will still capture the STOP message sent by the client
+ InputStreamReader isr = new InputStreamReader(System.in);
+ BufferedReader br = new BufferedReader(isr);
+
+ System.out.println("OK");
+
+ String line = null;
+ while ((line = br.readLine()) != null)
+ {
+ if ("STOP".equals(line.trim()))
+ {
+ //server.stop();
+ System.out.println("Server stopped");
+ System.exit(0);
+ }
+ else
+ {
+ // stop anyway but with a error status
+ System.out.println("Server crashed");
+ System.exit(1);
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ String allStack = t.getCause().getMessage() + "|";
+ StackTraceElement[] stackTrace = t.getCause().getStackTrace();
+ for (StackTraceElement stackTraceElement : stackTrace)
+ {
+ allStack += stackTraceElement.toString() + "|";
+ }
+ System.out.println(allStack);
+ System.out.println("KO");
+ System.exit(1);
+ }
+ }
+
+
+ public static Process start(String serverClassName) throws Exception
+ {
+ String[] vmArgs = new String[] { "-Dorg.hornetq.logger-delegate-factory-class-name=org.hornetq.jms.SysoutLoggerDelegateFactory" };
+ Process serverProcess = SpawnedVMSupport.spawnVM(RemoteHornetQServer.class.getName(), vmArgs, false, serverClassName);
+ InputStreamReader isr = new InputStreamReader(serverProcess.getInputStream());
+
+ final BufferedReader br = new BufferedReader(isr);
+ String line = null;
+ while ((line = br.readLine()) != null)
+ {
+ System.out.println("SERVER: " + line);
+ line.replace('|', '\n');
+ if ("OK".equals(line.trim()))
+ {
+ new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ String line = null;
+ while ((line = br.readLine()) != null)
+ {
+ System.out.println("SERVER: " + line);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }.start();
+ return serverProcess;
+ }
+ else if ("KO".equals(line.trim()))
+ {
+ // something went wrong with the server, destroy it:
+ serverProcess.destroy();
+ throw new IllegalStateException("Unable to start the spawned server :" + line);
+ }
+ }
+ return serverProcess;
+ }
+
+ public static void stop(Process serverProcess) throws Exception
+ {
+ OutputStreamWriter osw = new OutputStreamWriter(serverProcess.getOutputStream());
+ osw.write("STOP\n");
+ osw.flush();
+ int exitValue = serverProcess.waitFor();
+ if (exitValue != 0)
+ {
+ serverProcess.destroy();
+ }
+ }
+
+ public static void crash(Process serverProcess) throws Exception
+ {
+ OutputStreamWriter osw = new OutputStreamWriter(serverProcess.getOutputStream());
+ osw.write("KILL\n");
+ osw.flush();
+ int exitValue = serverProcess.waitFor();
+ if (exitValue != 0)
+ {
+ serverProcess.destroy();
+ }
+ }
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java (rev 0)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/remote/RemoteServerConfiguration.java 2010-09-01 14:32:17 UTC (rev 9624)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.failover.remote;
+
+import org.hornetq.core.config.Configuration;
+
+/**
+ * A RemoteServerConfiguration
+ *
+ * @author jmesnil
+ *
+ */
+public abstract class RemoteServerConfiguration
+{
+
+ public RemoteServerConfiguration() {
+ }
+
+ public abstract Configuration getConfiguration();
+}
14 years, 3 months
JBoss hornetq SVN: r9623 - branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-09-01 10:27:02 -0400 (Wed, 01 Sep 2010)
New Revision: 9623
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
Log:
fixed connection to backup on failoverOnInitialConnection
* the connection to the backup was using the params of the *live* connector config
instead of the *backup* connector config
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2010-09-01 13:54:23 UTC (rev 9622)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2010-09-01 14:27:02 UTC (rev 9623)
@@ -220,7 +220,7 @@
connectorFactory = instantiateConnectorFactory(connectorConfig.getFactoryClassName());
- transportParams = connectorConfig.getParams();
+ transportParams = this.connectorConfig.getParams();
getConnectionWithRetry(initialConnectAttempts);
}
14 years, 3 months
JBoss hornetq SVN: r9622 - in trunk/src/main/org/hornetq: jms/server/embedded and 1 other directory.
by do-not-reply@jboss.org
Author: bill.burke(a)jboss.com
Date: 2010-09-01 09:54:23 -0400 (Wed, 01 Sep 2010)
New Revision: 9622
Modified:
trunk/src/main/org/hornetq/integration/spring/SpringJmsBootstrap.java
trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java
Log:
remove println
Modified: trunk/src/main/org/hornetq/integration/spring/SpringJmsBootstrap.java
===================================================================
--- trunk/src/main/org/hornetq/integration/spring/SpringJmsBootstrap.java 2010-09-01 07:22:34 UTC (rev 9621)
+++ trunk/src/main/org/hornetq/integration/spring/SpringJmsBootstrap.java 2010-09-01 13:54:23 UTC (rev 9622)
@@ -14,7 +14,6 @@
{
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
{
- System.out.println("SpringJmsBootstrap setBeanFactory...");
- registry = new SpringBindingRegistry((ConfigurableBeanFactory)beanFactory);
+ registry = new SpringBindingRegistry((ConfigurableBeanFactory) beanFactory);
}
}
Modified: trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java 2010-09-01 07:22:34 UTC (rev 9621)
+++ trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java 2010-09-01 13:54:23 UTC (rev 9622)
@@ -5,13 +5,10 @@
import org.hornetq.jms.server.impl.JMSServerManagerImpl;
import org.hornetq.spi.BindingRegistry;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Simple bootstrap class that parses hornetq config files (server and jms and security) and starts
* a HornetQServer instance and populates it with configured JMS endpoints.
- *
+ * <p/>
* JMS Endpoints are registered with a simple MapBindingRegistry. If you want to use a different registry
* you must set the registry property of this clas
*
@@ -57,7 +54,6 @@
public void start() throws Exception
{
- System.out.println("EmbeddedJMS starting...");
super.initStart();
if (jmsConfigResourcePath == null) serverManager = new JMSServerManagerImpl(hornetQServer);
else serverManager = new JMSServerManagerImpl(hornetQServer, jmsConfigResourcePath);
14 years, 3 months
JBoss hornetq SVN: r9621 - in branches/2_2_0_HA_Improvements: tests/src/org/hornetq/tests/integration/cluster/failover and 1 other directory.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-09-01 03:22:34 -0400 (Wed, 01 Sep 2010)
New Revision: 9621
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
fakelockfile fix
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-08-31 22:06:01 UTC (rev 9620)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-09-01 07:22:34 UTC (rev 9621)
@@ -386,7 +386,7 @@
liveLock.lock();
- log.info("Obtained live lock");
+ log.info("Live Server Obtained live lock");
// We now load the node id file, creating it, if it doesn't exist yet
File nodeIDFile = new File(configuration.getJournalDirectory(), "node.id");
@@ -448,12 +448,13 @@
{
// We need to delete the file too, otherwise the backup will failover when we shutdown or if the backup is
// started before the live
-
+ log.info("Live Server about to delete Live Lock file");
File liveFile = new File(configuration.getJournalDirectory(), "live.lock");
-
+ log.info("Live Server deleting Live Lock file");
liveFile.delete();
liveLock.unlock();
+ log.info("Live server unlocking live lock");
}
}
@@ -535,16 +536,16 @@
LockFile nodeIDLockFile = createLockFile("nodeid.lock", configuration.getJournalDirectory());
nodeIDLockFile.lock();
-
+ log.info("Backup server waiting for node id file creation");
if (!nodeIDFile.exists())
{
nodeIDLockFile.unlock();
Thread.sleep(2000);
-
+ log.info("Backup server still waiting for node id file creation");
continue;
}
-
+ log.info("Backup server waited for node id file creation");
nodeIDLockFile.unlock();
break;
@@ -563,13 +564,14 @@
while (true)
{
File liveLockFile = new File(configuration.getJournalDirectory(), "live.lock");
-
+ log.info("Backup server waiting for live lock file creation");
while (!liveLockFile.exists())
{
log.info("Waiting for server live lock file. Live server is not started");
Thread.sleep(2000);
}
+ log.info("Backup server waited for live lock file creation");
liveLock = createLockFile("live.lock", configuration.getJournalDirectory());
@@ -588,7 +590,7 @@
// continue;
// }
- log.info("Obtained live lock");
+ log.info("Backup server obtained live lock");
// Announce presence of live node to cluster
@@ -599,8 +601,7 @@
configuration.setBackup(false);
clusterManager.activate();
- //todo fix this problem with the journal
- Thread.sleep(200);
+
initialisePart2();
log.info("Back Up Server is now live");
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-08-31 22:06:01 UTC (rev 9620)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-09-01 07:22:34 UTC (rev 9621)
@@ -233,7 +233,7 @@
/** It doesn't fail, but it restart both servers, live and backup, and the data should be received after the restart,
* and the servers should be able to connect without any problems. */
- public void _testRestartServers() throws Exception
+ public void testRestartServers() throws Exception
{
ServerLocator locator = getServerLocator();
14 years, 3 months