[hornetq-commits] JBoss hornetq SVN: r9245 - trunk/tests/src/org/hornetq/tests/integration/clientcrash.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue May 18 13:09:09 EDT 2010
Author: timfox
Date: 2010-05-18 13:09:09 -0400 (Tue, 18 May 2010)
New Revision: 9245
Added:
trunk/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient2.java
Log:
missing file
Added: trunk/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient2.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient2.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient2.java 2010-05-18 17:09:09 UTC (rev 9245)
@@ -0,0 +1,104 @@
+/*
+ * 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.clientcrash;
+
+import java.util.Arrays;
+
+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.core.logging.Logger;
+
+/**
+ * Code to be run in an external VM, via main().
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class CrashClient2
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(CrashClient2.class);
+
+ // Static ---------------------------------------------------------------------------------------
+
+ public static void main(final String[] args) throws Exception
+ {
+ try
+ {
+ log.debug("args = " + Arrays.asList(args));
+
+ ClientSessionFactory sf = HornetQClient.createClientSessionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"));
+
+ sf.setClientFailureCheckPeriod(ClientCrashTest.PING_PERIOD);
+ sf.setConnectionTTL(ClientCrashTest.CONNECTION_TTL);
+
+ ClientSession session = sf.createSession(true, true, 1000000);
+ ClientProducer producer = session.createProducer(ClientCrashTest.QUEUE);
+
+ ClientMessage message = session.createMessage(false);
+ message.getBodyBuffer().writeString(ClientCrashTest.MESSAGE_TEXT_FROM_CLIENT);
+
+ producer.send(message);
+
+ //Now consume the message, but don't let ack get to server
+
+ //Consume the message
+ ClientConsumer cons = session.createConsumer(ClientCrashTest.QUEUE);
+
+ session.start();
+
+ ClientMessage msg = cons.receive(10000);
+
+ if (msg == null)
+ {
+ log.error("Didn't receive msg");
+
+ System.exit(1);
+ }
+
+ // exit without closing the session properly
+ System.exit(9);
+ }
+ catch (Throwable t)
+ {
+ log.error(t.getMessage(), t);
+ System.exit(1);
+ }
+ }
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ // Command implementation -----------------------------------------------------------------------
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
More information about the hornetq-commits
mailing list