[jboss-cvs] JBoss Messaging SVN: r6404 - in branches/Branch_Temp_Clebert_LargeMessage: src/main/org/jboss/messaging/core/client and 22 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Apr 10 14:58:34 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-04-10 14:58:34 -0400 (Fri, 10 Apr 2009)
New Revision: 6404
Added:
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/LargeMessageBuffer.java
branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/LargeMessageTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/client/
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/client/impl/
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LargeMessageBufferTest.java
Removed:
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientFileMessage.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageInternal.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/details1.xsl
branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/shortXmlSummary.xsl
branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1.xsl
branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1a.xsl
branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1b.xsl
branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary2.xsl
Modified:
branches/Branch_Temp_Clebert_LargeMessage/build-messaging.xml
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientMessage.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientSession.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageInternal.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/exception/MessagingException.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/Message.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendLargeMessage.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerMessageImpl.java
branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/soak/chunk/MessageChunkSoakTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java
branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/junit-frames.xsl
Log:
Upload another backup
Modified: branches/Branch_Temp_Clebert_LargeMessage/build-messaging.xml
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/build-messaging.xml 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/build-messaging.xml 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1141,6 +1141,13 @@
</antcall>
</target>
+ <target name="failover-tests" depends="jar, compile-unit-tests">
+ <antcall inheritall="true" inheritrefs="true" target="tests">
+ <param name="tests.param" value="**/org/jboss/messaging/tests/integration/cluster/failover/**/*${test-mask}.class"/>
+ </antcall>
+ </target>
+
+
<target name="integration-tests" depends="jar, compile-unit-tests">
<antcall inheritall="true" inheritrefs="true" target="tests">
<param name="tests.param" value="**/org/jboss/messaging/tests/integration/**/*${test-mask}.class"/>
Deleted: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientFileMessage.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientFileMessage.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientFileMessage.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.core.client;
-
-import java.io.File;
-
-/**
- * A ClientFileMessage
- *
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- *
- * Created Oct 14, 2008 3:21:15 PM
- *
- *
- */
-public interface ClientFileMessage extends ClientMessage
-{
- File getFile();
-
- void setFile(File file);
-}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientMessage.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientMessage.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientMessage.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -22,6 +22,8 @@
package org.jboss.messaging.core.client;
+import java.io.OutputStream;
+
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.message.Message;
@@ -30,6 +32,7 @@
* A ClientMessage
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
*
*/
public interface ClientMessage extends Message
@@ -37,6 +40,21 @@
int getDeliveryCount();
void setDeliveryCount(int deliveryCount);
+
+ /** Sets the outputStream of large messages. It doesn't block on waiting the large-message to complete
+ * @throws MessagingException */
+ void setOutputStream(OutputStream out) throws MessagingException;
+
+ /** Save the content of the message to the outputStream. It blocks until the entire data was received */
+ void saveToOutputStream(OutputStream out) throws MessagingException;
+ /**
+ * Wait the outputStream completion of the message.
+ * @param timeMilliseconds - 0 means wait forever
+ * @return true if it reached the end
+ * @throws MessagingException
+ */
+ boolean waitOutputStreamCompletion(long timeMilliseconds) throws MessagingException;
+
void acknowledge() throws MessagingException;
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientSession.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientSession.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/ClientSession.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -22,8 +22,6 @@
package org.jboss.messaging.core.client;
-import java.io.File;
-
import javax.transaction.xa.XAResource;
import org.jboss.messaging.core.exception.MessagingException;
@@ -90,35 +88,6 @@
ClientConsumer createConsumer(String queueName, String filterString, int windowSize, int maxRate, boolean browseOnly) throws MessagingException;
- ClientConsumer createFileConsumer(File directory, SimpleString queueName) throws MessagingException;
-
- ClientConsumer createFileConsumer(File directory, SimpleString queueName, SimpleString filterString) throws MessagingException;
-
- ClientConsumer createFileConsumer(File directory,
- SimpleString queueName,
- SimpleString filterString,
- boolean browseOnly) throws MessagingException;
-
- ClientConsumer createFileConsumer(File directory,
- SimpleString queueName,
- SimpleString filterString,
- int windowSize,
- int maxRate,
- boolean browseOnly) throws MessagingException;
-
- ClientConsumer createFileConsumer(File directory, String queueName) throws MessagingException;
-
- ClientConsumer createFileConsumer(File directory, String queueName, String filterString) throws MessagingException;
-
- ClientConsumer createFileConsumer(File directory, String queueName, String filterString, boolean browseOnly) throws MessagingException;
-
- ClientConsumer createFileConsumer(File directory,
- String queueName,
- String filterString,
- int windowSize,
- int maxRate,
- boolean browseOnly) throws MessagingException;
-
/**
* Create a producer with no default address.
* Address must be specified every time a message is sent
@@ -183,8 +152,6 @@
ClientMessage createClientMessage(final boolean durable);
- ClientFileMessage createFileMessage(final boolean durable);
-
void start() throws MessagingException;
void stop() throws MessagingException;
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -13,13 +13,9 @@
package org.jboss.messaging.core.client.impl;
import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
import java.util.concurrent.Executor;
import org.jboss.messaging.core.buffers.ChannelBuffers;
-import org.jboss.messaging.core.client.ClientFileMessage;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.MessageHandler;
import org.jboss.messaging.core.exception.MessagingException;
@@ -31,7 +27,6 @@
import org.jboss.messaging.core.remoting.impl.wireformat.SessionConsumerFlowCreditMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveContinuationMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveMessage;
-import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.utils.Future;
import org.jboss.messaging.utils.TokenBucketLimiter;
@@ -79,6 +74,11 @@
private ClientMessageInternal currentChunkMessage;
+ private LargeMessageBuffer currentLargeMessageBuffer;
+
+ // When receiving LargeMessages, the user may choose to not read the body, on this case we need to discard te body before moving to the next message.
+ private ClientMessageInternal largeMessageReceived;
+
private final TokenBucketLimiter rateLimiter;
private volatile Thread receiverThread;
@@ -118,7 +118,7 @@
this.channel = channel;
this.session = session;
-
+
this.rateLimiter = rateLimiter;
sessionExecutor = executor;
@@ -137,12 +137,18 @@
{
checkClosed();
+ if (largeMessageReceived != null)
+ {
+ // Check if there are pending packets to be received
+ largeMessageReceived.discardLargeBody();
+ largeMessageReceived = null;
+ }
+
if (rateLimiter != null)
{
rateLimiter.limit();
}
-
if (handler != null)
{
throw new MessagingException(MessagingException.ILLEGAL_STATE,
@@ -171,11 +177,10 @@
while (true)
{
ClientMessageInternal m = null;
-
+
synchronized (this)
{
- while ((stopped || (m = buffer.removeFirst()) == null) &&
- !closed && toWait > 0)
+ while ((stopped || (m = buffer.removeFirst()) == null) && !closed && toWait > 0)
{
if (start == -1)
@@ -190,7 +195,7 @@
catch (InterruptedException e)
{
}
-
+
if (m != null || closed)
{
break;
@@ -212,6 +217,8 @@
if (expired)
{
+ m.discardLargeBody();
+
session.expire(id, m.getMessageID());
if (toWait > 0)
@@ -224,6 +231,11 @@
}
}
+ if (m.isLargeMessage())
+ {
+ this.largeMessageReceived = m;
+ }
+
return m;
}
else
@@ -268,7 +280,7 @@
}
boolean noPreviousHandler = handler == null;
-
+
if (handler != theHandler && clientWindowSize == 0)
{
sendCredits(1);
@@ -323,14 +335,14 @@
public void stop() throws MessagingException
{
waitForOnMessageToComplete();
-
+
synchronized (this)
{
if (stopped)
{
return;
}
-
+
stopped = true;
}
}
@@ -365,18 +377,14 @@
ClientMessageInternal messageToHandle = message;
- if (isFileConsumer())
- {
- messageToHandle = cloneAsFileMessage(message);
- }
-
messageToHandle.onReceipt(this);
+ // Add it to the buffer
+ buffer.addLast(messageToHandle, messageToHandle.getPriority());
+
if (handler != null)
{
// Execute using executor
-
- buffer.addLast(messageToHandle, messageToHandle.getPriority());
if (!stopped)
{
queueExecutor();
@@ -384,9 +392,6 @@
}
else
{
- // Add it to the buffer
- buffer.addLast(messageToHandle, messageToHandle.getPriority());
-
notify();
}
}
@@ -398,11 +403,23 @@
// This is ok - we just ignore the message
return;
}
-
+
// Flow control for the first packet, we will have others
flowControl(packet.getPacketSize(), true);
- currentChunkMessage = createFileMessage(packet.getLargeMessageHeader());
+ currentChunkMessage = new ClientMessageImpl();
+
+ currentChunkMessage.decodeProperties(ChannelBuffers.wrappedBuffer(packet.getLargeMessageHeader()));
+
+ currentChunkMessage.setLargeMessage(true);
+
+ currentLargeMessageBuffer = new LargeMessageBuffer(this, packet.getLargeMessageSize(), 60);
+
+ currentChunkMessage.setBody(currentLargeMessageBuffer);
+
+ currentChunkMessage.setFlowControlSize(0);
+
+ handleMessage(currentChunkMessage);
}
public synchronized void handleLargeMessageContinuation(final SessionReceiveContinuationMessage chunk) throws Exception
@@ -411,45 +428,8 @@
{
return;
}
-
- if (chunk.isContinues())
- {
- flowControl(chunk.getPacketSize(), true);
- }
-
- if (isFileConsumer())
- {
- ClientFileMessageInternal fileMessage = (ClientFileMessageInternal)currentChunkMessage;
- addBytesBody(fileMessage, chunk.getBody());
- }
- else
- {
- if (currentChunkMessage.getBody() == null)
- {
- currentChunkMessage.setBody(ChannelBuffers.dynamicBuffer(chunk.getBody()));
- }
- else
- {
- currentChunkMessage.getBody().writeBytes(chunk.getBody());
- }
- }
-
- if (!chunk.isContinues())
- {
- // Close the file that was being generated
- if (isFileConsumer())
- {
- ((ClientFileMessageInternal)currentChunkMessage).closeChannel();
- }
-
- currentChunkMessage.setFlowControlSize(chunk.getPacketSize());
-
- ClientMessageInternal msgToSend = currentChunkMessage;
-
- currentChunkMessage = null;
-
- handleMessage(msgToSend);
- }
+
+ currentLargeMessageBuffer.addPacket(chunk);
}
public void clear()
@@ -499,40 +479,15 @@
}
}
- // Public7
- // ---------------------------------------------------------------------------------------
-
- // Package protected
- // ---------------------------------------------------------------------------------------
-
- // Protected
- // ---------------------------------------------------------------------------------------
-
- // Private
- // ---------------------------------------------------------------------------------------
-
- private void requeueExecutors()
+ public void flowControl(final int messageBytes, final boolean isLargeMessage) throws MessagingException
{
- for (int i = 0; i < buffer.size(); i++)
- {
- queueExecutor();
- }
- }
-
- private void queueExecutor()
- {
- sessionExecutor.execute(runner);
- }
-
- private void flowControl(final int messageBytes, final boolean isLargeMessage) throws MessagingException
- {
if (clientWindowSize >= 0)
{
creditsToSend += messageBytes;
-
+
if (creditsToSend >= clientWindowSize)
{
-
+
if (isLargeMessage)
{
// Flowcontrol on largeMessages continuations needs to be done in a separate thread or failover would
@@ -540,21 +495,23 @@
final int credits = creditsToSend;
creditsToSend = 0;
- sessionExecutor.execute(new Runnable()
- {
- public void run()
- {
- sendCredits(credits);
- }
+ sendCredits(credits);
- });
+ // sessionExecutor.execute(new Runnable()
+ // {
+ // public void run()
+ // {
+ // sendCredits(credits);
+ // }
+ // });
}
else
{
if (clientWindowSize == 0)
{
- // sending the credits - 1 initially send to fire the slow consumer, or the slow consumer would be always buffering one after received the first message
+ // sending the credits - 1 initially send to fire the slow consumer, or the slow consumer would be
+ // always buffering one after received the first message
sendCredits(creditsToSend - 1);
}
else
@@ -567,6 +524,31 @@
}
}
+ // Public
+ // ---------------------------------------------------------------------------------------
+
+ // Package protected
+ // ---------------------------------------------------------------------------------------
+
+ // Protected
+ // ---------------------------------------------------------------------------------------
+
+ // Private
+ // ---------------------------------------------------------------------------------------
+
+ private void requeueExecutors()
+ {
+ for (int i = 0; i < buffer.size(); i++)
+ {
+ queueExecutor();
+ }
+ }
+
+ private void queueExecutor()
+ {
+ sessionExecutor.execute(runner);
+ }
+
/**
* @param credits
*/
@@ -625,7 +607,7 @@
MessageHandler theHandler = handler;
if (theHandler != null)
- {
+ {
if (rateLimiter != null)
{
rateLimiter.limit();
@@ -647,12 +629,17 @@
onMessageThread = Thread.currentThread();
theHandler.onMessage(message);
+
+ if (message.isLargeMessage())
+ {
+ message.discardLargeBody();
+ }
}
else
{
session.expire(id, message.getMessageID());
}
-
+
// If slow consumer, we need to send 1 credit to make sure we get another message
if (clientWindowSize == 0)
{
@@ -669,7 +656,10 @@
private void flowControlBeforeConsumption(final ClientMessageInternal message) throws MessagingException
{
// Chunk messages will execute the flow control while receiving the chunks
- flowControl(message.getFlowControlSize(), false);
+ if (message.getFlowControlSize() != 0)
+ {
+ flowControl(message.getFlowControlSize(), false);
+ }
}
private void doCleanUp(final boolean sendCloseMessage) throws MessagingException
@@ -721,16 +711,6 @@
private void clearBuffer()
{
- if (isFileConsumer())
- {
- for (ClientMessage message : buffer)
- {
- if (message instanceof ClientFileMessage)
- {
- ((ClientFileMessage)message).getFile().delete();
- }
- }
- }
buffer.clear();
}
@@ -743,89 +723,6 @@
session.acknowledge(id, message.getMessageID());
}
- private ClientMessageInternal cloneAsFileMessage(final ClientMessageInternal message) throws Exception
- {
- if (message instanceof ClientFileMessageImpl)
- {
- // nothing to be done
- return message;
- }
- else
- {
- int propertiesSize = message.getPropertiesEncodeSize();
-
- MessagingBuffer bufferProperties = session.createBuffer(propertiesSize);
-
- // FIXME: Find a better way to clone this ClientMessageImpl as ClientFileMessageImpl without using the
- // MessagingBuffer.
- // There is no direct access into the Properties, and I couldn't add a direct cast to this method without loose
- // abstraction
- message.encodeProperties(bufferProperties);
-
- bufferProperties.resetReaderIndex();
-
- ClientFileMessageImpl cloneMessage = new ClientFileMessageImpl();
-
- cloneMessage.decodeProperties(bufferProperties);
-
- cloneMessage.setDeliveryCount(message.getDeliveryCount());
-
- cloneMessage.setLargeMessage(message.isLargeMessage());
-
- cloneMessage.setFile(new File(directory, cloneMessage.getMessageID() + "-" +
- session.getName() +
- "-" +
- getID() +
- ".jbm"));
-
- cloneMessage.setFlowControlSize(message.getFlowControlSize());
-
- addBytesBody(cloneMessage, message.getBody().array());
-
- cloneMessage.closeChannel();
-
- return cloneMessage;
- }
- }
-
- private ClientMessageInternal createFileMessage(final byte[] header) throws Exception
- {
-
- MessagingBuffer headerBuffer = ChannelBuffers.wrappedBuffer(header);
-
- if (isFileConsumer())
- {
- if (!directory.exists())
- {
- boolean ok = directory.mkdirs();
-
- if (!ok)
- {
- throw new IOException("Failed to create directory " + directory.getCanonicalPath());
- }
- }
-
- ClientFileMessageImpl message = new ClientFileMessageImpl();
- message.decodeProperties(headerBuffer);
- message.setFile(new File(directory, message.getMessageID() + "-" + session.getName() + "-" + getID() + ".jbm"));
- message.setLargeMessage(true);
- return message;
- }
- else
- {
- ClientMessageImpl message = new ClientMessageImpl();
- message.decodeProperties(headerBuffer);
- message.setLargeMessage(true);
- return message;
- }
- }
-
- private void addBytesBody(final ClientFileMessageInternal fileMessage, final byte[] body) throws Exception
- {
- FileChannel channel = fileMessage.getChannel();
- channel.write(ByteBuffer.wrap(body));
- }
-
// Inner classes
// --------------------------------------------------------------------------------
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientConsumerInternal.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -44,6 +44,8 @@
void handleLargeMessage(SessionReceiveMessage largeMessageHeader) throws Exception;
void handleLargeMessageContinuation(SessionReceiveContinuationMessage continuation) throws Exception;
+
+ void flowControl(final int messageBytes, final boolean isLargeMessage) throws MessagingException;
void clear();
Deleted: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,246 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.core.client.impl;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-
-import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-
-/**
- * A ClientFileMessageImpl
- *
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- *
- * Created Oct 13, 2008 4:33:56 PM
- *
- *
- */
-public class ClientFileMessageImpl extends ClientMessageImpl implements ClientFileMessageInternal
-{
- private File file;
-
- private FileChannel currentChannel;
-
- public ClientFileMessageImpl()
- {
- }
-
- public ClientFileMessageImpl(final boolean durable)
- {
- super(durable, null);
- }
-
- /**
- * @param type
- * @param durable
- * @param expiration
- * @param timestamp
- * @param priority
- * @param body
- */
- public ClientFileMessageImpl(final byte type,
- final boolean durable,
- final long expiration,
- final long timestamp,
- final byte priority,
- final MessagingBuffer body)
- {
- super(type, durable, expiration, timestamp, priority, body);
- }
-
- /**
- * @param type
- * @param durable
- * @param body
- */
- public ClientFileMessageImpl(final byte type, final boolean durable, final MessagingBuffer body)
- {
- super(type, durable, body);
- }
-
- /**
- * @param deliveryCount
- */
- public ClientFileMessageImpl(final int deliveryCount)
- {
- super(deliveryCount);
- }
-
- /**
- * @return the file
- */
- public File getFile()
- {
- return file;
- }
-
- /**
- * @param file the file to set
- */
- public void setFile(final File file)
- {
- this.file = file;
- }
-
- @Override
- public MessagingBuffer getBody()
- {
- throw new UnsupportedOperationException("getBody is not supported on FileMessages.");
- }
-
- /**
- * If a ClientFileMessage is Smaller then the MinLargeMessage configured on the SessionFactory (or JMSConnectionFactory), it will still be sent as any other message,
- * and for that the file body (which should be small) will be read from the file an populated on the output buffer
- *
- * */
- public void encodeBody(MessagingBuffer buffer)
- {
- FileChannel channel = null;
- try
- {
- // We open a new channel on getBody.
- // for a better performance, users should be using the channels when using file
- channel = newChannel();
-
- ByteBuffer fileBuffer = ByteBuffer.allocate((int)channel.size());
-
- channel.position(0);
- channel.read(fileBuffer);
-
- buffer.writeBytes(fileBuffer.array(), 0, fileBuffer.limit());
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- try
- {
- channel.close();
- }
- catch (Throwable ignored)
- {
-
- }
- }
- }
-
- /**
- * Read the file content from start to size.
- */
- @Override
- public synchronized void encodeBody(final MessagingBuffer buffer, final long start, final int size)
- {
- try
- {
- FileChannel channel = getChannel();
-
- ByteBuffer bufferRead = ByteBuffer.allocate(size);
-
- channel.position(start);
- channel.read(bufferRead);
-
- buffer.writeBytes(bufferRead.array());
- }
- catch (Exception e)
- {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- @Override
- public void setBody(final MessagingBuffer body)
- {
- throw new RuntimeException("Not supported");
- }
-
- public synchronized FileChannel getChannel() throws MessagingException
- {
- if (currentChannel == null)
- {
- currentChannel = newChannel();
- }
-
- return currentChannel;
- }
-
- public synchronized void closeChannel() throws MessagingException
- {
- if (currentChannel != null)
- {
- try
- {
- currentChannel.close();
- }
- catch (IOException e)
- {
- throw new MessagingException(MessagingException.INTERNAL_ERROR, e.getMessage(), e);
- }
- currentChannel = null;
- }
-
- }
-
- @Override
- public synchronized int getBodySize()
- {
- return (int)file.length();
- }
-
- public boolean isFileMessage()
- {
- return true;
- }
-
-
- /**
- * @return
- * @throws FileNotFoundException
- * @throws IOException
- */
- private FileChannel newChannel() throws MessagingException
- {
- try
- {
- RandomAccessFile randomFile = new RandomAccessFile(getFile(), "rw");
-
- randomFile.seek(0);
-
- FileChannel channel = randomFile.getChannel();
-
- return channel;
- }
- catch (IOException e)
- {
- throw new MessagingException(MessagingException.INTERNAL_ERROR, e.getMessage(), e);
- }
- }
-
-}
Deleted: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageInternal.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageInternal.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageInternal.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-
-package org.jboss.messaging.core.client.impl;
-
-import java.nio.channels.FileChannel;
-
-import org.jboss.messaging.core.client.ClientFileMessage;
-import org.jboss.messaging.core.exception.MessagingException;
-
-/**
- * A ClientFileMessageInternal
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * Created 10 Dec 2008 19:02:06
- *
- *
- */
-public interface ClientFileMessageInternal extends ClientFileMessage
-{
- void setLargeMessage(boolean largeMessage);
-
- FileChannel getChannel() throws MessagingException;
-
- void closeChannel() throws MessagingException;
-}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -22,6 +22,9 @@
package org.jboss.messaging.core.client.impl;
+import java.io.IOException;
+import java.io.OutputStream;
+
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.message.impl.MessageImpl;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
@@ -138,6 +141,7 @@
{
this.largeMessage = largeMessage;
}
+
/* (non-Javadoc)
* @see org.jboss.messaging.core.client.impl.ClientMessageInternal#isFileMessage()
@@ -147,4 +151,70 @@
return false;
}
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientMessageInternal#discardLargeBody()
+ */
+ public void discardLargeBody()
+ {
+ if (largeMessage)
+ {
+ ((LargeMessageBuffer)getBody()).discardUnusedPackets();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientMessage#saveToOutputStream(java.io.OutputStream)
+ */
+ public void saveToOutputStream(OutputStream out) throws MessagingException
+ {
+ if (largeMessage)
+ {
+ ((LargeMessageBuffer)this.getBody()).saveBuffer(out);
+ }
+ else
+ {
+ try
+ {
+ out.write(this.getBody().array());
+ }
+ catch (IOException e)
+ {
+ throw new MessagingException(MessagingException.LARGE_MESSAGE_ERROR_BODY, "Error saving the message body", e);
+ }
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientMessage#setOutputStream(java.io.OutputStream)
+ */
+ public void setOutputStream(OutputStream out) throws MessagingException
+ {
+ if (largeMessage)
+ {
+ ((LargeMessageBuffer)this.getBody()).setOutputStream(out);
+ }
+ else
+ {
+ saveToOutputStream(out);
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientMessage#waitOutputStreamCompletion()
+ */
+ public boolean waitOutputStreamCompletion(long timeMilliseconds) throws MessagingException
+ {
+ if (largeMessage)
+ {
+ return ((LargeMessageBuffer)this.getBody()).waitCompletion(timeMilliseconds);
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageInternal.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageInternal.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientMessageInternal.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -45,5 +45,12 @@
boolean isLargeMessage();
- boolean isFileMessage();
+ void setLargeMessage(boolean largeMessage);
+
+ boolean isFileMessage();
+
+ /**
+ * Discard unused packets (used on large-message)
+ */
+ void discardLargeBody();
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -24,7 +24,11 @@
import static org.jboss.messaging.utils.SimpleString.toSimpleString;
+import java.io.IOException;
+import java.io.InputStream;
+
import org.jboss.messaging.core.buffers.ChannelBuffers;
+import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.Message;
@@ -221,7 +225,7 @@
SessionSendMessage message = new SessionSendMessage(msg, sendBlocking);
- if (msg.getEncodeSize() >= minLargeMessageSize)
+ if (msg.getBodyInputStream() != null || msg.getEncodeSize() >= minLargeMessageSize)
{
sendMessageInChunks(sendBlocking, (ClientMessageInternal)msg);
}
@@ -252,51 +256,88 @@
MessagingBuffer headerBuffer = ChannelBuffers.buffer(headerSize);
msg.encodeProperties(headerBuffer);
- final int bodySize = msg.getBodySize();
+ SessionSendLargeMessage initialChunk = new SessionSendLargeMessage(headerBuffer.array());
- SessionSendLargeMessage initialChunk = new SessionSendLargeMessage(headerBuffer.array(), false);
-
channel.send(initialChunk);
- for (int pos = 0; pos < bodySize;)
+
+ if (msg.getBodyInputStream() != null)
{
- final boolean lastChunk;
-
- final int chunkLength = Math.min(bodySize - pos, minLargeMessageSize);
- final MessagingBuffer bodyBuffer = ChannelBuffers.buffer(chunkLength);
+ boolean lastChunk = false;
+ InputStream input = msg.getBodyInputStream();
+ while (!lastChunk)
+ {
+ byte[] bytesRead = new byte[minLargeMessageSize];
+ int numberOfBytesRead;
+
+ try
+ {
+ numberOfBytesRead = input.read(bytesRead);
+ }
+ catch (IOException e)
+ {
+ throw new MessagingException(MessagingException.LARGE_MESSAGE_ERROR_BODY, "Error reading the LargeMessageBody", e);
+ }
+
+ if (numberOfBytesRead < 0)
+ {
+ numberOfBytesRead = 0;
+ lastChunk = true;
+ }
+
+ final SessionSendContinuationMessage chunk = new SessionSendContinuationMessage(bytesRead, numberOfBytesRead, !lastChunk, lastChunk && sendBlocking);
- msg.encodeBody(bodyBuffer, pos, chunkLength);
-
- pos += chunkLength;
+ if (sendBlocking && lastChunk)
+ {
+ // When sending it blocking, only the last chunk will be blocking.
+ channel.sendBlocking(chunk);
+ }
+ else
+ {
+ channel.send(chunk);
+ }
+ }
- lastChunk = pos >= bodySize;
-
- final SessionSendContinuationMessage chunk = new SessionSendContinuationMessage(bodyBuffer.array(), !lastChunk, lastChunk && sendBlocking);
-
- if (sendBlocking && lastChunk)
+ try
{
- // When sending it blocking, only the last chunk will be blocking.
- channel.sendBlocking(chunk);
+ input.close();
}
- else
+ catch (IOException e)
{
- channel.send(chunk);
- }
+ throw new MessagingException(MessagingException.LARGE_MESSAGE_ERROR_BODY, "Error closing stream from LargeMessageBody", e);
+ }
}
-
- // Note: This could be either a regular message, with a huge body,
- // or a ClientFileMessage.
- if (msg.isFileMessage())
+ else
{
- try
+ final int bodySize = msg.getBodySize();
+
+ for (int pos = 0; pos < bodySize;)
{
- ((ClientFileMessageInternal)msg).closeChannel();
+ final boolean lastChunk;
+
+ final int chunkLength = Math.min(bodySize - pos, minLargeMessageSize);
+
+ final MessagingBuffer bodyBuffer = ChannelBuffers.buffer(chunkLength);
+
+ msg.encodeBody(bodyBuffer, pos, chunkLength);
+
+ pos += chunkLength;
+
+ lastChunk = pos >= bodySize;
+
+ final SessionSendContinuationMessage chunk = new SessionSendContinuationMessage(bodyBuffer.array(), chunkLength, !lastChunk, lastChunk && sendBlocking);
+
+ if (sendBlocking && lastChunk)
+ {
+ // When sending it blocking, only the last chunk will be blocking.
+ channel.sendBlocking(chunk);
+ }
+ else
+ {
+ channel.send(chunk);
+ }
}
- catch (Exception e)
- {
- log.warn(e.getMessage(), e);
- }
}
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -38,7 +38,6 @@
import org.jboss.messaging.core.buffers.ChannelBuffers;
import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientFileMessage;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.SendAcknowledgementHandler;
@@ -369,77 +368,6 @@
return createConsumer(toSimpleString(queueName), toSimpleString(filterString), windowSize, maxRate, browseOnly);
}
- public ClientConsumer createFileConsumer(final File directory, final SimpleString queueName) throws MessagingException
- {
- return createFileConsumer(directory, queueName, null, false);
- }
-
- public ClientConsumer createFileConsumer(final File directory, final String queueName) throws MessagingException
- {
- return createFileConsumer(directory, toSimpleString(queueName));
- }
-
- public ClientConsumer createFileConsumer(final File directory,
- final SimpleString queueName,
- final SimpleString filterString) throws MessagingException
- {
- return createFileConsumer(directory, queueName, filterString, consumerWindowSize, consumerMaxRate, false);
- }
-
- public ClientConsumer createFileConsumer(final File directory, final String queueName, final String filterString) throws MessagingException
- {
- return createFileConsumer(directory, toSimpleString(queueName), toSimpleString(filterString));
- }
-
- public ClientConsumer createFileConsumer(final File directory,
- final SimpleString queueName,
- final SimpleString filterString,
- final boolean browseOnly) throws MessagingException
- {
- return createFileConsumer(directory, queueName, filterString, consumerWindowSize, consumerMaxRate, browseOnly);
- }
-
- public ClientConsumer createFileConsumer(final File directory,
- final String queueName,
- final String filterString,
- final boolean browseOnly) throws MessagingException
- {
- return createFileConsumer(directory, toSimpleString(queueName), toSimpleString(filterString), browseOnly);
- }
-
- /*
- * Note, we DO NOT currently support direct consumers (i.e. consumers we're delivery occurs on the remoting thread.
- * Direct consumers have issues with blocking and failover.
- * E.g. if direct then inside MessageHandler call a blocking method like rollback or acknowledge (blocking)
- * This can block until failove completes, which disallows the thread to be used to deliver any responses to the client
- * during that period, so failover won't occur.
- * If we want direct consumers we need to rethink how they work
- */
- public ClientConsumer createFileConsumer(final File directory,
- final SimpleString queueName,
- final SimpleString filterString,
- final int windowSize,
- final int maxRate,
- final boolean browseOnly) throws MessagingException
- {
- return internalCreateConsumer(queueName, filterString, windowSize, maxRate, browseOnly, directory);
- }
-
- public ClientConsumer createFileConsumer(final File directory,
- final String queueName,
- final String filterString,
- final int windowSize,
- final int maxRate,
- final boolean browseOnly) throws MessagingException
- {
- return createFileConsumer(directory,
- toSimpleString(queueName),
- toSimpleString(filterString),
- windowSize,
- maxRate,
- browseOnly);
- }
-
public ClientProducer createProducer() throws MessagingException
{
return createProducer((SimpleString)null);
@@ -566,11 +494,6 @@
return ChannelBuffers.dynamicBuffer(size);
}
- public ClientFileMessage createFileMessage(final boolean durable)
- {
- return new ClientFileMessageImpl(durable);
- }
-
public boolean isClosed()
{
return closed;
@@ -1295,7 +1218,7 @@
final boolean temp) throws MessagingException
{
checkClosed();
-
+
if (durable && temp)
{
throw new MessagingException(MessagingException.INTERNAL_ERROR, "Queue can not be both durable and temporay");
Added: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/LargeMessageBuffer.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/LargeMessageBuffer.java (rev 0)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/client/impl/LargeMessageBuffer.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -0,0 +1,1034 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.client.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.messaging.core.buffers.ChannelBuffer;
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveContinuationMessage;
+import org.jboss.messaging.utils.DataConstants;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.UTF8Util;
+
+/**
+ * This class aggregates several SessionReceiveContinuationMessages as it was being handled by a single buffer.
+ * This buffer can be consumed as messages are arriving, and it will hold the packets until they are read using the ChannelBuffer interface, or the setOutputStream or saveStream are called.
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class LargeMessageBuffer implements ChannelBuffer
+{
+ // Constants -----------------------------------------------------
+
+ private final String READ_ONLY_ERROR_MESSAGE = "This is a read-only buffer, setOperations are not supported";
+
+ // Attributes ----------------------------------------------------
+
+ private final ClientConsumerInternal consumerInternal;
+
+ private final LinkedBlockingQueue<SessionReceiveContinuationMessage> packets = new LinkedBlockingQueue<SessionReceiveContinuationMessage>();
+
+ private SessionReceiveContinuationMessage currentPacket = null;
+
+
+ private final int totalSize;
+
+ private boolean streamEnded = false;
+
+ private final int readTimeout;
+
+ private int readerIndex = 0;
+
+ private int packetPosition = -1;
+
+ private int packetLastPosition = -1;
+
+ private OutputStream outStream;
+
+ private Exception handledException;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public LargeMessageBuffer(final ClientConsumerInternal consumerInternal, final int totalSize, final int readTimeout)
+ {
+ this.consumerInternal = consumerInternal;
+ this.readTimeout = readTimeout;
+ this.totalSize = totalSize;
+ }
+
+ // Public --------------------------------------------------------
+
+ public synchronized Exception getHandledException()
+ {
+ return handledException;
+ }
+
+
+ /**
+ *
+ */
+ public void discardUnusedPackets()
+ {
+ if (outStream == null)
+ {
+ try
+ {
+ checkForPacket(this.totalSize - 1);
+ }
+ catch (Exception ignored)
+ {
+ }
+ }
+ }
+
+
+ /**
+ * Add a buff to the List, or save it to the OutputStream if set
+ * @param packet
+ */
+ public synchronized void addPacket(final SessionReceiveContinuationMessage packet)
+ {
+ if (outStream != null)
+ {
+ try
+ {
+ if (!packet.isContinues())
+ {
+ streamEnded = true;
+ }
+
+ outStream.write(packet.getBody());
+
+ consumerInternal.flowControl(packet.getPacketSize(), true);
+
+ if (streamEnded)
+ {
+ outStream.close();
+ }
+
+ notifyAll();
+ }
+ catch (Exception e)
+ {
+ handledException = e;
+
+ }
+ }
+ else
+ {
+ packets.offer(packet);
+ }
+ }
+
+ public synchronized void setOutputStream(final OutputStream output) throws MessagingException
+ {
+ while (true)
+ {
+ SessionReceiveContinuationMessage packet = this.packets.poll();
+ if (packet == null)
+ {
+ break;
+ }
+ try
+ {
+ output.write(packet.getBody());
+ }
+ catch (IOException e)
+ {
+ throw new MessagingException(MessagingException.LARGE_MESSAGE_ERROR_BODY, "Error writing body of message", e);
+ }
+ }
+
+ this.outStream = output;
+ }
+
+ public synchronized void saveBuffer(final OutputStream output) throws MessagingException
+ {
+ setOutputStream(output);
+ waitCompletion(0);
+ }
+
+
+ /**
+ *
+ * @param timeWait Milliseconds to Wait. 0 means forever
+ * @throws Exception
+ */
+ public synchronized boolean waitCompletion(long timeWait) throws MessagingException
+ {
+
+ if (outStream == null)
+ {
+ // There is no stream.. it will never achieve the end of streaming
+ return false;
+ }
+
+ long timeOut = System.currentTimeMillis() + timeWait;
+ while (!streamEnded && handledException == null)
+ {
+ try
+ {
+ this.wait(readTimeout * 1000);
+ }
+ catch (InterruptedException e)
+ {
+ throw new MessagingException(MessagingException.INTERNAL_ERROR, e.getMessage(), e);
+ }
+
+ if (timeWait > 0 && System.currentTimeMillis() > timeOut)
+ {
+ throw new MessagingException(MessagingException.LARGE_MESSAGE_ERROR_BODY, "Timeout waiting for LargeMessage Body");
+ }
+ }
+
+ if (this.handledException != null)
+ {
+ throw new MessagingException (MessagingException.LARGE_MESSAGE_ERROR_BODY, "Error on saving LargeMessageBuffer", this.handledException);
+ }
+
+ return this.streamEnded;
+
+ }
+
+ // Channel Buffer Implementation ---------------------------------
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#array()
+ */
+ public byte[] array()
+ {
+ throw new IllegalAccessError("array not supported on LargeMessageBuffer");
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#capacity()
+ */
+ public int capacity()
+ {
+ return -1;
+ }
+
+ public byte readByte()
+ {
+ return getByte(readerIndex++);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getByte(int)
+ */
+ public byte getByte(final int index)
+ {
+ checkForPacket(index);
+ return currentPacket.getBody()[index - packetPosition];
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getBytes(int, org.jboss.messaging.core.buffers.ChannelBuffer, int, int)
+ */
+ public void getBytes(final int index, final ChannelBuffer dst, final int dstIndex, final int length)
+ {
+ byte[] destBytes = new byte[length];
+ getBytes(index, destBytes);
+ dst.setBytes(dstIndex, destBytes);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getBytes(int, byte[], int, int)
+ */
+ public void getBytes(final int index, final byte[] dst, final int dstIndex, final int length)
+ {
+ byte bytesToGet[] = new byte[length];
+
+ getBytes(index, bytesToGet);
+
+ System.arraycopy(bytesToGet, 0, dst, dstIndex, length);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getBytes(int, java.nio.ByteBuffer)
+ */
+ public void getBytes(final int index, final ByteBuffer dst)
+ {
+ byte bytesToGet[] = new byte[dst.remaining()];
+ getBytes(index, bytesToGet);
+ dst.put(bytesToGet);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getBytes(int, java.io.OutputStream, int)
+ */
+ public void getBytes(final int index, final OutputStream out, final int length) throws IOException
+ {
+ byte bytesToGet[] = new byte[length];
+ getBytes(index, bytesToGet);
+ out.write(bytesToGet);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getBytes(int, java.nio.channels.GatheringByteChannel, int)
+ */
+ public int getBytes(final int index, final GatheringByteChannel out, final int length) throws IOException
+ {
+ byte bytesToGet[] = new byte[length];
+ getBytes(index, bytesToGet);
+ return out.write(ByteBuffer.wrap(bytesToGet));
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getInt(int)
+ */
+ public int getInt(final int index)
+ {
+ return (getByte(index) & 0xff) << 24 | (getByte(index + 1) & 0xff) << 16 |
+ (getByte(index + 2) & 0xff) << 8 |
+ (getByte(index + 3) & 0xff) << 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getLong(int)
+ */
+ public long getLong(final int index)
+ {
+ return ((long)getByte(index) & 0xff) << 56 | ((long)getByte(index + 1) & 0xff) << 48 |
+ ((long)getByte(index + 2) & 0xff) << 40 |
+ ((long)getByte(index + 3) & 0xff) << 32 |
+ ((long)getByte(index + 4) & 0xff) << 24 |
+ ((long)getByte(index + 5) & 0xff) << 16 |
+ ((long)getByte(index + 6) & 0xff) << 8 |
+ ((long)getByte(index + 7) & 0xff) << 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getShort(int)
+ */
+ public short getShort(final int index)
+ {
+ return (short)(getByte(index) << 8 | getByte(index + 1) & 0xFF);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#getUnsignedMedium(int)
+ */
+ public int getUnsignedMedium(final int index)
+ {
+ return (getByte(index) & 0xff) << 16 | (getByte(index + 1) & 0xff) << 8 | (getByte(index + 2) & 0xff) << 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setByte(int, byte)
+ */
+ public void setByte(final int index, final byte value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setBytes(int, org.jboss.messaging.core.buffers.ChannelBuffer, int, int)
+ */
+ public void setBytes(final int index, final ChannelBuffer src, final int srcIndex, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setBytes(int, byte[], int, int)
+ */
+ public void setBytes(final int index, final byte[] src, final int srcIndex, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setBytes(int, java.nio.ByteBuffer)
+ */
+ public void setBytes(final int index, final ByteBuffer src)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setBytes(int, java.io.InputStream, int)
+ */
+ public int setBytes(final int index, final InputStream in, final int length) throws IOException
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setBytes(int, java.nio.channels.ScatteringByteChannel, int)
+ */
+ public int setBytes(final int index, final ScatteringByteChannel in, final int length) throws IOException
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setInt(int, int)
+ */
+ public void setInt(final int index, final int value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setLong(int, long)
+ */
+ public void setLong(final int index, final long value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setMedium(int, int)
+ */
+ public void setMedium(final int index, final int value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#setShort(int, short)
+ */
+ public void setShort(final int index, final short value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#toByteBuffer(int, int)
+ */
+ public ByteBuffer toByteBuffer(final int index, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#toString(int, int, java.lang.String)
+ */
+ public String toString(final int index, final int length, final String charsetName)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public int readerIndex()
+ {
+ return readerIndex;
+ }
+
+ public void readerIndex(final int readerIndex)
+ {
+ checkForPacket(readerIndex);
+ this.readerIndex = readerIndex;
+ }
+
+ public int writerIndex()
+ {
+ return totalSize;
+ }
+
+ public void writerIndex(final int writerIndex)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void setIndex(final int readerIndex, final int writerIndex)
+ {
+ checkForPacket(readerIndex);
+ this.readerIndex = readerIndex;
+ }
+
+ public void clear()
+ {
+ }
+
+ public boolean readable()
+ {
+ return true;
+ }
+
+ public boolean writable()
+ {
+ return false;
+ }
+
+ public int readableBytes()
+ {
+ return this.totalSize - this.readerIndex;
+ }
+
+ public int writableBytes()
+ {
+ return 0;
+ }
+
+ public void markReaderIndex()
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void resetReaderIndex()
+ {
+ checkForPacket(0);
+ }
+
+ public void markWriterIndex()
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void resetWriterIndex()
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void discardReadBytes()
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public short getUnsignedByte(final int index)
+ {
+ return (short)(getByte(index) & 0xFF);
+ }
+
+ public int getUnsignedShort(final int index)
+ {
+ return getShort(index) & 0xFFFF;
+ }
+
+ public int getMedium(final int index)
+ {
+ int value = getUnsignedMedium(index);
+ if ((value & 0x800000) != 0)
+ {
+ value |= 0xff000000;
+ }
+ return value;
+ }
+
+ public long getUnsignedInt(final int index)
+ {
+ return getInt(index) & 0xFFFFFFFFL;
+ }
+
+ public void getBytes(int index, final byte[] dst)
+ {
+ // TODO: optimize this by using System.arraycopy
+ for (int i = 0; i < dst.length; i++)
+ {
+ dst[i] = getByte(index++);
+ }
+ }
+
+ public void getBytes(final int index, final ChannelBuffer dst)
+ {
+ getBytes(index, dst, dst.writableBytes());
+ }
+
+ public void getBytes(final int index, final ChannelBuffer dst, final int length)
+ {
+ if (length > dst.writableBytes())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ getBytes(index, dst, dst.writerIndex(), length);
+ dst.writerIndex(dst.writerIndex() + length);
+ }
+
+ public void setBytes(final int index, final byte[] src)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void setBytes(final int index, final ChannelBuffer src)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void setBytes(final int index, final ChannelBuffer src, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void setZero(final int index, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public short readUnsignedByte()
+ {
+ return (short)(readByte() & 0xFF);
+ }
+
+ public short readShort()
+ {
+ short v = getShort(readerIndex);
+ readerIndex += 2;
+ return v;
+ }
+
+ public int readUnsignedShort()
+ {
+ return readShort() & 0xFFFF;
+ }
+
+ public int readMedium()
+ {
+ int value = readUnsignedMedium();
+ if ((value & 0x800000) != 0)
+ {
+ value |= 0xff000000;
+ }
+ return value;
+ }
+
+ public int readUnsignedMedium()
+ {
+ int v = getUnsignedMedium(readerIndex);
+ readerIndex += 3;
+ return v;
+ }
+
+ public int readInt()
+ {
+ int v = getInt(readerIndex);
+ readerIndex += 4;
+ return v;
+ }
+
+ public long readUnsignedInt()
+ {
+ return readInt() & 0xFFFFFFFFL;
+ }
+
+ public long readLong()
+ {
+ long v = getLong(readerIndex);
+ readerIndex += 8;
+ return v;
+ }
+
+ public void readBytes(final byte[] dst, final int dstIndex, final int length)
+ {
+ getBytes(readerIndex, dst, dstIndex, length);
+ readerIndex += length;
+ }
+
+ public void readBytes(final byte[] dst)
+ {
+ readBytes(dst, 0, dst.length);
+ }
+
+ public void readBytes(final ChannelBuffer dst)
+ {
+ readBytes(dst, dst.writableBytes());
+ }
+
+ public void readBytes(final ChannelBuffer dst, final int length)
+ {
+ if (length > dst.writableBytes())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ readBytes(dst, dst.writerIndex(), length);
+ dst.writerIndex(dst.writerIndex() + length);
+ }
+
+ public void readBytes(final ChannelBuffer dst, final int dstIndex, final int length)
+ {
+ getBytes(readerIndex, dst, dstIndex, length);
+ readerIndex += length;
+ }
+
+ public void readBytes(final ByteBuffer dst)
+ {
+ int length = dst.remaining();
+ getBytes(readerIndex, dst);
+ readerIndex += length;
+ }
+
+ public int readBytes(final GatheringByteChannel out, final int length) throws IOException
+ {
+ int readBytes = getBytes(readerIndex, out, length);
+ readerIndex += readBytes;
+ return readBytes;
+ }
+
+ public void readBytes(final OutputStream out, final int length) throws IOException
+ {
+ getBytes(readerIndex, out, length);
+ readerIndex += length;
+ }
+
+ public void skipBytes(final int length)
+ {
+
+ int newReaderIndex = readerIndex + length;
+ checkForPacket(newReaderIndex);
+ readerIndex = newReaderIndex;
+ }
+
+ public void writeByte(final byte value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeShort(final short value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeMedium(final int value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeInt(final int value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeLong(final long value)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeBytes(final byte[] src, final int srcIndex, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeBytes(final byte[] src)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeBytes(final ChannelBuffer src)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeBytes(final ChannelBuffer src, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeBytes(final ChannelBuffer src, final int srcIndex, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeBytes(final ByteBuffer src)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeBytes(final InputStream in, final int length) throws IOException
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public int writeBytes(final ScatteringByteChannel in, final int length) throws IOException
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public void writeZero(final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public ByteBuffer toByteBuffer()
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public ByteBuffer[] toByteBuffers()
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public ByteBuffer[] toByteBuffers(final int index, final int length)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public String toString(final String charsetName)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ public Object getUnderlyingBuffer()
+ {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readBoolean()
+ */
+ public boolean readBoolean()
+ {
+ return readByte() != 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readChar()
+ */
+ public char readChar()
+ {
+ return (char)readShort();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readDouble()
+ */
+ public double readDouble()
+ {
+ return Double.longBitsToDouble(readLong());
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readFloat()
+ */
+ public float readFloat()
+ {
+ return Float.intBitsToFloat(readInt());
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readNullableSimpleString()
+ */
+ public SimpleString readNullableSimpleString()
+ {
+ int b = readByte();
+ if (b == DataConstants.NULL)
+ {
+ return null;
+ }
+ else
+ {
+ return readSimpleString();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readNullableString()
+ */
+ public String readNullableString()
+ {
+ int b = readByte();
+ if (b == DataConstants.NULL)
+ {
+ return null;
+ }
+ else
+ {
+ return readString();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readSimpleString()
+ */
+ public SimpleString readSimpleString()
+ {
+ int len = readInt();
+ byte[] data = new byte[len];
+ readBytes(data);
+ return new SimpleString(data);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readString()
+ */
+ public String readString()
+ {
+ int len = readInt();
+ char[] chars = new char[len];
+ for (int i = 0; i < len; i++)
+ {
+ chars[i] = readChar();
+ }
+ return new String(chars);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#readUTF()
+ */
+ public String readUTF() throws Exception
+ {
+ return UTF8Util.readUTF(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeBoolean(boolean)
+ */
+ public void writeBoolean(final boolean val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeChar(char)
+ */
+ public void writeChar(final char val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeDouble(double)
+ */
+ public void writeDouble(final double val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeFloat(float)
+ */
+ public void writeFloat(final float val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeNullableSimpleString(org.jboss.messaging.util.SimpleString)
+ */
+ public void writeNullableSimpleString(final SimpleString val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeNullableString(java.lang.String)
+ */
+ public void writeNullableString(final String val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeSimpleString(org.jboss.messaging.util.SimpleString)
+ */
+ public void writeSimpleString(final SimpleString val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeString(java.lang.String)
+ */
+ public void writeString(final String val)
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.spi.MessagingBuffer#writeUTF(java.lang.String)
+ */
+ public void writeUTF(final String utf) throws Exception
+ {
+ throw new IllegalAccessError(READ_ONLY_ERROR_MESSAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.buffers.ChannelBuffer#compareTo(org.jboss.messaging.core.buffers.ChannelBuffer)
+ */
+ public int compareTo(final ChannelBuffer buffer)
+ {
+ return -1;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private void popPacket()
+ {
+ try
+ {
+
+ if (streamEnded)
+ {
+ // no more packets, we are over the last one already
+ throw new IndexOutOfBoundsException();
+ }
+
+ int sizeToAdd = currentPacket != null ? currentPacket.getBody().length : 1;
+ currentPacket = packets.poll(readTimeout, TimeUnit.SECONDS);
+ if (currentPacket == null)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ consumerInternal.flowControl(currentPacket.getPacketSize(), true);
+
+ packetPosition += sizeToAdd;
+
+ packetLastPosition = packetPosition + currentPacket.getBody().length;
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void checkForPacket(final int index)
+ {
+ if (index >= totalSize)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ if (index < packetPosition)
+ {
+ throw new IllegalAccessError("LargeMessage have read-only and one-way buffers");
+ }
+ while (index >= packetLastPosition)
+ {
+ popPacket();
+ }
+ }
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/exception/MessagingException.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/exception/MessagingException.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/exception/MessagingException.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -66,6 +66,8 @@
public static final int INCOMPATIBLE_CLIENT_SERVER_VERSIONS = 108;
public static final int SESSION_EXISTS = 109;
+
+ public static final int LARGE_MESSAGE_ERROR_BODY = 110;
// Native Error codes ----------------------------------------------
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/Message.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/Message.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/Message.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -22,6 +22,7 @@
package org.jboss.messaging.core.message;
+import java.io.InputStream;
import java.util.Set;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
@@ -86,6 +87,13 @@
// Used on Message chunk
void encodeBody(MessagingBuffer buffer, long start, int size);
+ /** Used to set the MessageBody out of a File or any other Streaming you choose */
+ void setBodyInputStream(InputStream stream);
+
+ /** Used to set the MessageBody out of a File or any other Streaming you choose */
+ InputStream getBodyInputStream();
+
+
void encodeBody(MessagingBuffer buffer);
void decodeBody(MessagingBuffer buffer);
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -27,6 +27,7 @@
import static org.jboss.messaging.utils.DataConstants.SIZE_INT;
import static org.jboss.messaging.utils.DataConstants.SIZE_LONG;
+import java.io.InputStream;
import java.util.Set;
import org.jboss.messaging.core.buffers.ChannelBuffers;
@@ -96,6 +97,10 @@
private byte priority;
private MessagingBuffer body;
+
+ /** Used on LargeMessages */
+ private InputStream bodyInputStream;
+
// Constructors --------------------------------------------------
@@ -323,6 +328,24 @@
return System.currentTimeMillis() - expiration >= 0;
}
+ /**
+ * @return the bodyInputStream
+ */
+ public InputStream getBodyInputStream()
+ {
+ return bodyInputStream;
+ }
+
+ /**
+ * @param bodyInputStream the bodyInputStream to set
+ */
+ public void setBodyInputStream(InputStream bodyInputStream)
+ {
+ this.bodyInputStream = bodyInputStream;
+ }
+
+
+
// Properties
// ---------------------------------------------------------------------------------------
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -42,6 +42,7 @@
public static final int SESSION_RECEIVE_MESSAGE_LARGE_MESSAGE_SIZE = BASIC_PACKET_SIZE + DataConstants.SIZE_LONG +
DataConstants.SIZE_INT +
+ DataConstants.SIZE_INT +
DataConstants.SIZE_BOOLEAN +
DataConstants.SIZE_INT;
@@ -60,12 +61,15 @@
private ServerMessage serverMessage;
private int deliveryCount;
+
+ /** Since we receive the message before the entire message was received, */
+ private int largeMessageSize;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public SessionReceiveMessage(final long consumerID, final byte[] largeMessageHeader, final int deliveryCount)
+ public SessionReceiveMessage(final long consumerID, final byte[] largeMessageHeader, final int largeMessageSize, final int deliveryCount)
{
super(SESS_RECEIVE_MSG);
@@ -76,6 +80,8 @@
this.deliveryCount = deliveryCount;
this.largeMessage = true;
+
+ this.largeMessageSize = largeMessageSize;
}
public SessionReceiveMessage(final long consumerID, final ServerMessage message, final int deliveryCount)
@@ -133,6 +139,14 @@
return deliveryCount;
}
+ /**
+ * @return the largeMessageSize
+ */
+ public int getLargeMessageSize()
+ {
+ return largeMessageSize;
+ }
+
public int getRequiredBufferSize()
{
if (largeMessage)
@@ -154,6 +168,7 @@
buffer.writeBoolean(largeMessage);
if (largeMessage)
{
+ buffer.writeInt(largeMessageSize);
buffer.writeInt(largeMessageHeader.length);
buffer.writeBytes(largeMessageHeader);
}
@@ -175,6 +190,7 @@
if (largeMessage)
{
+ largeMessageSize = buffer.readInt();
int size = buffer.readInt();
largeMessageHeader = new byte[size];
buffer.readBytes(largeMessageHeader);
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -44,6 +44,9 @@
private boolean requiresResponse;
+ // Not sent through the wire. Just to define how many bytes to send of body
+ private transient int bodyLength;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -63,11 +66,13 @@
* @param requiresResponse
*/
public SessionSendContinuationMessage(final byte[] body,
+ final int bodyLength,
final boolean continues,
final boolean requiresResponse)
{
super(SESS_SEND_CONTINUATION, body, continues);
this.requiresResponse = requiresResponse;
+ this.bodyLength = bodyLength;
}
@@ -84,20 +89,25 @@
@Override
public int getRequiredBufferSize()
{
- return super.getRequiredBufferSize() + DataConstants.SIZE_BOOLEAN;
+ return SESSION_CONTINUATION_BASE_SIZE + bodyLength + DataConstants.SIZE_BOOLEAN;
}
@Override
public void encodeBody(final MessagingBuffer buffer)
{
- super.encodeBody(buffer);
+ buffer.writeInt(bodyLength);
+ buffer.writeBytes(body, 0, bodyLength);
+ buffer.writeBoolean(continues);
buffer.writeBoolean(requiresResponse);
}
@Override
public void decodeBody(final MessagingBuffer buffer)
{
- super.decodeBody(buffer);
+ bodyLength = buffer.readInt();
+ body = new byte[bodyLength];
+ buffer.readBytes(body);
+ continues = buffer.readBoolean();
requiresResponse = buffer.readBoolean();
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendLargeMessage.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendLargeMessage.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendLargeMessage.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -44,19 +44,15 @@
/** We need to set the MessageID when replicating this on the server */
private long largeMessageId = -1;
- private boolean requiresResponse;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public SessionSendLargeMessage(final byte[] largeMessageHeader, final boolean requiresResponse)
+ public SessionSendLargeMessage(final byte[] largeMessageHeader)
{
super(SESS_SEND_LARGE);
this.largeMessageHeader = largeMessageHeader;
-
- this.requiresResponse = requiresResponse;
}
public SessionSendLargeMessage()
@@ -71,11 +67,6 @@
return largeMessageHeader;
}
- public boolean isRequiresResponse()
- {
- return requiresResponse;
- }
-
/**
* @return the largeMessageId
*/
@@ -98,7 +89,6 @@
buffer.writeInt(largeMessageHeader.length);
buffer.writeBytes(largeMessageHeader);
buffer.writeLong(largeMessageId);
- buffer.writeBoolean(requiresResponse);
}
@Override
@@ -111,16 +101,13 @@
buffer.readBytes(largeMessageHeader);
largeMessageId = buffer.readLong();
-
- requiresResponse = buffer.readBoolean();
}
public int getRequiredBufferSize()
{
int size = BASIC_PACKET_SIZE + DataConstants.SIZE_INT +
largeMessageHeader.length +
- DataConstants.SIZE_LONG +
- DataConstants.SIZE_BOOLEAN;
+ DataConstants.SIZE_LONG;
return size;
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -137,13 +137,13 @@
private final ManagementService managementService;
private final Binding binding;
-
-
+
private MessagingServer server;
// Constructors ---------------------------------------------------------------------------------
- public ServerConsumerImpl(final MessagingServer server, final long id,
+ public ServerConsumerImpl(final MessagingServer server,
+ final long id,
final long replicatedSessionID,
final ServerSession session,
final QueueBinding binding,
@@ -160,7 +160,7 @@
final ManagementService managementService) throws Exception
{
this.server = server;
-
+
this.id = id;
this.replicatedSessionID = replicatedSessionID;
@@ -217,9 +217,14 @@
}
public void close() throws Exception
- {
+ {
setStarted(false);
+ if (largeMessageDeliverer != null)
+ {
+ largeMessageDeliverer.close();
+ }
+
messageQueue.removeConsumer(this);
session.removeConsumer(this);
@@ -414,23 +419,27 @@
}
public void deliverReplicated(final long messageID) throws Exception
- {
+ {
MessageReference ref = messageQueue.removeFirstReference(messageID);
if (ref == null)
{
// The order is correct, but it hasn't been depaged yet, so we need to force a depage
PagingStore store = pagingManager.getPageStore(binding.getAddress());
-
+
// force a depage
if (!store.readPage()) // This returns false if there are no pages
{
- throw new IllegalStateException("Cannot find ref " + messageID + " server " + System.identityHashCode(server) + " queue " + this.messageQueue.getName());
+ throw new IllegalStateException("Cannot find ref " + messageID +
+ " server " +
+ System.identityHashCode(server) +
+ " queue " +
+ this.messageQueue.getName());
}
else
{
ref = messageQueue.removeFirstReference(messageID);
-
+
if (ref == null)
{
throw new IllegalStateException("Cannot find ref after depaging");
@@ -451,7 +460,7 @@
handled);
}
}
-
+
public void failedOver()
{
if (messageQueue.consumerFailedOver())
@@ -732,6 +741,9 @@
{
pendingLargeMessage = message;
+ // we must hold one reference, or the file will be deleted before it could be delivered
+ pendingLargeMessage.incrementRefCount();
+
sizePendingLargeMessage = pendingLargeMessage.getBodySize();
this.ref = ref;
@@ -766,7 +778,10 @@
pendingLargeMessage.encodeProperties(headerBuffer);
- initialMessage = new SessionReceiveMessage(id, headerBuffer.array(), ref.getDeliveryCount());
+ initialMessage = new SessionReceiveMessage(id,
+ headerBuffer.array(),
+ pendingLargeMessage.getBodySize(),
+ ref.getDeliveryCount());
}
int precalculateAvailableCredits;
@@ -838,32 +853,8 @@
trace("Finished deliverLargeMessage isBackup = " + messageQueue.isBackup());
}
- pendingLargeMessage.releaseResources();
+ close();
- if (preAcknowledge && !browseOnly)
- {
- // We added a reference for pre-ack, to avoid deleting the file before it was delivered
- if (pendingLargeMessage.decrementRefCount() == 0)
- {
- // On pre-acks for Large messages, the decrement was deferred to large-message, hence we need to
- // subtract the size inside largeMessage
- try
- {
- PagingStore store = pagingManager.getPageStore(binding.getAddress());
- store.addSize(-pendingLargeMessage.getMemoryEstimate());
- }
- catch (Exception e)
- {
- // This shouldn't happen on getPageStore
- log.error("Error getting pageStore", e);
- }
- }
- }
-
- largeMessageDeliverer = null;
-
- pendingLargeMessagesCounter.decrementAndGet();
-
return true;
}
finally
@@ -873,6 +864,47 @@
}
/**
+ *
+ */
+ public void close()
+ {
+ pendingLargeMessage.releaseResources();
+
+ int counter = pendingLargeMessage.decrementRefCount();
+
+ if (preAcknowledge && !browseOnly)
+ {
+ // PreAck will have an extra reference
+ counter = pendingLargeMessage.decrementRefCount();
+ }
+
+ if (!browseOnly)
+ {
+ // We added a reference to avoid deleting the file before it was delivered
+ // if (pendingLargeMessage.decrementRefCount() == 0)
+ if (counter == 0)
+ {
+ // The decrement was deferred to large-message, hence we need to
+ // subtract the size inside largeMessage
+ try
+ {
+ PagingStore store = pagingManager.getPageStore(binding.getAddress());
+ store.addSize(-pendingLargeMessage.getMemoryEstimate());
+ }
+ catch (Exception e)
+ {
+ // This shouldn't happen as the pageStore should have been initialized already.
+ log.error("Error getting pageStore", e);
+ }
+ }
+ }
+
+ largeMessageDeliverer = null;
+
+ pendingLargeMessagesCounter.decrementAndGet();
+ }
+
+ /**
* Credits flow control are calculated in advance.
* @return
*/
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerMessageImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerMessageImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerMessageImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -121,7 +121,9 @@
public int incrementRefCount()
{
- return refCount.incrementAndGet();
+ int value = refCount.incrementAndGet();
+ //new Exception ("Incrementing refCount = " + value).printStackTrace();
+ return value;
}
public int incrementDurableRefCount()
@@ -136,7 +138,9 @@
public int decrementRefCount()
{
- return refCount.decrementAndGet();
+ int value = refCount.decrementAndGet();
+ //new Exception ("Decrementing refCount = " + value).printStackTrace();
+ return value;
}
public int getRefCount()
Modified: branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -2201,17 +2201,8 @@
{
log.error("Failed to create large message", e);
Packet response = null;
- if (packet.isRequiresResponse())
- {
- if (e instanceof MessagingException)
- {
- response = new MessagingExceptionMessage((MessagingException)e);
- }
- else
- {
- response = new MessagingExceptionMessage(new MessagingException(MessagingException.INTERNAL_ERROR));
- }
- }
+
+
channel.confirm(packet);
if (response != null)
{
@@ -2236,15 +2227,8 @@
private void doSendLargeMessage(final SessionSendLargeMessage packet)
{
- Packet response = null;
-
try
{
- if (packet.isRequiresResponse())
- {
- response = new NullResponseMessage();
- }
-
long id = storageManager.generateUniqueID();
currentLargeMessage.setMessageID(id);
@@ -2252,26 +2236,9 @@
catch (Exception e)
{
log.error("Failed to send message", e);
-
- if (packet.isRequiresResponse())
- {
- if (e instanceof MessagingException)
- {
- response = new MessagingExceptionMessage((MessagingException)e);
- }
- else
- {
- response = new MessagingExceptionMessage(new MessagingException(MessagingException.INTERNAL_ERROR));
- }
- }
}
channel.confirm(packet);
-
- if (response != null)
- {
- channel.send(response);
- }
}
private void doSend(final SessionSendMessage packet)
Added: branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/LargeMessageTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/LargeMessageTest.java (rev 0)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/LargeMessageTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging.jms.message;
+
+import java.io.BufferedOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.util.concurrent.CountDownLatch;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import org.jboss.messaging.jms.client.JBossMessage;
+import org.jboss.test.messaging.jms.JMSTestCase;
+
+/**
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 6220 $</tt>
+ *
+ * $Id: MessageHeaderTest.java 6220 2009-03-30 19:38:11Z timfox $
+ */
+public class LargeMessageTest extends JMSTestCase
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSimpleLargeMessage() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session.createProducer(queue1);
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ BytesMessage m = session.createBytesMessage();
+
+ ((JBossMessage)m).getCoreMessage().setBodyInputStream(createFakeLargeStream((byte)'j', 1024 * 1024));
+
+ prod.send(m);
+
+ conn.close();
+
+ conn = cf.createConnection();
+
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer cons = session.createConsumer(queue1);
+
+ conn.start();
+
+ BytesMessage rm = (BytesMessage)cons.receive(10000);
+
+ byte data[] = new byte[1024];
+
+ System.out.println("Message = " + rm);
+
+ for (int i = 0; i < 1024 * 1024; i += 1024)
+ {
+ System.out.println("Read message chunk " + i);
+ int numberOfBytes = rm.readBytes(data);
+ assertEquals(1024, numberOfBytes);
+ for (int j = 0 ; j < 1024; j++)
+ {
+ assertEquals((byte)'j', data[j]);
+ }
+ }
+
+ assertNotNull(rm);
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+
+ }
+
+
+ public void testReceiveAfterACK() throws Exception
+ {
+ // Make sure ACK will not delete the file while deliver is done
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+
+ private InputStream createFakeLargeStream(final byte byteToWrite, final long size) throws Exception
+ {
+
+ final PipedInputStream pipedInput = new PipedInputStream();
+ final PipedOutputStream pipedOut = new PipedOutputStream(pipedInput);
+ final OutputStream out = new BufferedOutputStream(pipedOut);
+
+
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ for (long i = 0; i < size; i++)
+ {
+ out.write(byteToWrite);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ out.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
+
+ }.start();
+
+
+ return pipedInput;
+
+ }
+
+
+
+
+ // Inner classes -------------------------------------------------
+
+
+ class ThreadReader extends Thread
+ {
+ CountDownLatch latch;
+
+ ThreadReader(CountDownLatch latch)
+ {
+ this.latch = latch;
+ }
+
+ public void run()
+ {
+ }
+ }
+
+
+}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -43,7 +43,6 @@
import org.jboss.messaging.core.buffers.ChannelBuffers;
import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientFileMessage;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
@@ -1071,11 +1070,6 @@
return message;
}
- public ClientFileMessage createFileMessage(boolean durable)
- {
- return null;
- }
-
public void start() throws MessagingException
{
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -46,7 +46,7 @@
public void stop() throws Exception
{
- // TODO Auto-generated method stub
+
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -121,25 +121,25 @@
assertNotNull(rm1);
+ assertEquals(s1, rm1.getBody().readString());
+
ClientMessage rm2 = consumer.receive(1000);
assertNotNull(rm2);
+ assertEquals(s2, rm2.getBody().readString());
+
ClientMessage rm3 = consumer.receive(1000);
+ assertEquals(s3, rm3.getBody().readString());
+
assertNotNull(rm3);
ClientMessage rm4 = consumer.receive(1000);
+ assertEquals(s4, rm4.getBody().readString());
+
assertNotNull(rm4);
-
- assertEquals(s1, rm1.getBody().readString());
-
- assertEquals(s2, rm2.getBody().readString());
-
- assertEquals(s3, rm3.getBody().readString());
-
- assertEquals(s4, rm4.getBody().readString());
}
public void test64KLimitWithWriteUTF() throws Exception
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -23,11 +23,10 @@
package org.jboss.messaging.tests.integration.chunkmessage;
import java.io.File;
+import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
-import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientFileMessage;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
@@ -44,7 +43,6 @@
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.integration.chunkmessage.mock.MockConnector;
import org.jboss.messaging.tests.integration.chunkmessage.mock.MockConnectorFactory;
-import org.jboss.messaging.utils.SimpleString;
/**
* A ChunkCleanupTest
@@ -67,12 +65,18 @@
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
+
+
public void testCleanup() throws Exception
{
clearData();
+
+ FileOutputStream fileOut = new FileOutputStream(new File(getLargeMessagesDir(), "1234.tmp"));
+
+ fileOut.write(new byte[1024]); // anything
+
+ fileOut.close();
- createLargeFile(getLargeMessagesDir(), "1234.tmp", 13333);
-
Configuration config = createDefaultConfig();
server = createServer(true, config, new HashMap<String, AddressSettings>());
@@ -84,7 +88,7 @@
File directoryLarge = new File(getLargeMessagesDir());
- assertEquals(0, directoryLarge.list().length);
+ assertEquals("The startup should have been deleted 1234.tmp", 0, directoryLarge.list().length);
}
finally
{
@@ -105,7 +109,7 @@
server.start();
- final int numberOfIntegersBigMessage = 150000;
+ final int numberOfBytes = 2 * 1024 * 1024;
ClientSession session = null;
@@ -154,7 +158,7 @@
ClientProducer producer = session.createProducer(ADDRESS);
- ClientFileMessage clientLarge = createLargeClientMessage(session, numberOfIntegersBigMessage);
+ ClientMessage clientLarge = createLargeClientMessage(session, numberOfBytes);
try
{
@@ -182,94 +186,6 @@
}
}
-
- // Validate the functions to create and verify files
- public void testFiles() throws Exception
- {
- clearData();
-
- File file = createLargeFile(getTemporaryDir(), "test.tst", 13333);
-
- checkFileRead(file, 13333);
- }
-
- public void testClearOnClientBuffer() throws Exception
- {
- clearData();
-
- server = createServer(true);
- server.start();
-
- final int numberOfIntegers = 10;
- final int numberOfMessages = 100;
-
- try
- {
- ClientSessionFactory sf = createInVMFactory();
-
- sf.setBlockOnNonPersistentSend(true);
- sf.setBlockOnPersistentSend(true);
- sf.setBlockOnAcknowledge(true);
-
- ClientSession session = sf.createSession(null, null, false, true, false, false, 0);
-
- session.createQueue(ADDRESS, ADDRESS, null, true);
-
- server.getPostOffice().getPagingManager().getGlobalSize();
-
- ClientProducer producer = session.createProducer(ADDRESS);
-
- File tmpData = createLargeFile(getTemporaryDir(), "someFile.dat", numberOfIntegers);
-
- for (int i = 0; i < numberOfMessages; i++)
- {
- ClientMessage message = session.createFileMessage(true);
- ((ClientFileMessage)message).setFile(tmpData);
- message.putIntProperty(new SimpleString("counter-message"), i);
- System.currentTimeMillis();
- producer.send(message);
- }
-
- ClientConsumer consumer = session.createFileConsumer(new File(getClientLargeMessagesDir()), ADDRESS);;
-
- File clientfiles = new File(getClientLargeMessagesDir());
-
- session.start();
-
- ClientMessage msg = consumer.receive(1000);
- msg.acknowledge();
-
- for (int i = 0; i < 100; i++)
- {
- if (clientfiles.listFiles().length > 0)
- {
- break;
- }
- Thread.sleep(100);
- }
-
- assertTrue(clientfiles.listFiles().length > 0);
-
- session.close();
-
- assertEquals(1, clientfiles.list().length); // 1 message was received, that should be kept
-
- validateNoFilesOnLargeDir();
-
- }
- finally
- {
- try
- {
- server.stop();
- }
- catch (Throwable ignored)
- {
- }
- }
-
- }
-
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -25,20 +25,22 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.buffers.ChannelBuffers;
import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientFileMessage;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.MessageHandler;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.impl.MessageImpl;
@@ -82,45 +84,41 @@
protected void testChunks(final boolean isXA,
final boolean realFiles,
- final boolean useFile,
final boolean preAck,
final boolean sendingBlocking,
final boolean testBrowser,
+ final boolean useMessageConsumer,
final int numberOfMessages,
- final int numberOfIntegers,
+ final int numberOfBytes,
final int waitOnConsumer,
final long delayDelivery) throws Exception
{
testChunks(isXA,
realFiles,
- useFile,
preAck,
sendingBlocking,
testBrowser,
+ useMessageConsumer,
numberOfMessages,
- numberOfIntegers,
+ numberOfBytes,
waitOnConsumer,
delayDelivery,
-1,
- 100 * 1024,
- 10 * 1024,
- false);
+ 10 * 1024);
}
protected void testChunks(final boolean isXA,
final boolean realFiles,
- final boolean useFile,
final boolean preAck,
final boolean sendingBlocking,
final boolean testBrowser,
+ final boolean useMessageConsumer,
final int numberOfMessages,
- final int numberOfIntegers,
+ final int numberOfBytes,
final int waitOnConsumer,
final long delayDelivery,
final int producerWindow,
- final int minSizeProducer,
- final int minSizeConsumer,
- final boolean testTime) throws Exception
+ final int minSize) throws Exception
{
clearData();
@@ -143,7 +141,7 @@
sf.setSendWindowSize(producerWindow);
}
- sf.setMinLargeMessageSize(minSizeProducer);
+ sf.setMinLargeMessageSize(minSize);
ClientSession session;
@@ -160,7 +158,7 @@
ClientProducer producer = session.createProducer(ADDRESS);
- sendMessages(useFile, numberOfMessages, numberOfIntegers, delayDelivery, testTime, session, producer);
+ sendMessages(numberOfMessages, numberOfBytes, delayDelivery, session, producer);
if (isXA)
{
@@ -176,7 +174,7 @@
validateNoFilesOnLargeDir();
- sendMessages(useFile, numberOfMessages, numberOfIntegers, delayDelivery, testTime, session, producer);
+ sendMessages(numberOfMessages, numberOfBytes, delayDelivery, session, producer);
if (isXA)
{
@@ -202,8 +200,6 @@
sf = createInVMFactory();
}
- sf.setMinLargeMessageSize(minSizeConsumer);
-
session = sf.createSession(null, null, isXA, false, false, preAck, 0);
if (isXA)
@@ -214,99 +210,139 @@
ClientConsumer consumer = null;
- // If delayed deliveries... it doesn't make sense with Browsing
- for (int iteration = (testBrowser ? 0 : 1); iteration < 2; iteration++)
+ for (int iteration = testBrowser ? 0 : 1; iteration < 2; iteration++)
{
+ System.out.println("Iteration: " + iteration);
+
+ session.stop();
+
// first time with a browser
- if (realFiles)
+ consumer = session.createConsumer(ADDRESS, null, iteration == 0);
+
+ if (useMessageConsumer)
{
- consumer = session.createFileConsumer(new File(getClientLargeMessagesDir()),
- ADDRESS,
- null,
- iteration == 0);
- }
- else
- {
- consumer = session.createConsumer(ADDRESS, null, iteration == 0);
- }
+ final CountDownLatch latchDone = new CountDownLatch(numberOfMessages);
+ final AtomicInteger errrors = new AtomicInteger(0);
- session.start();
+ MessageHandler handler = new MessageHandler()
+ {
+ int msgCounter;
- for (int i = 0; i < numberOfMessages; i++)
- {
- long start = System.currentTimeMillis();
+ public void onMessage(final ClientMessage message)
+ {
- ClientMessage message = consumer.receive(waitOnConsumer + delayDelivery);
+ try
+ {
+ latchDone.countDown();
- assertNotNull(message);
+ System.out.println("Message: " + msgCounter);
- if (realFiles)
- {
- assertTrue(message instanceof ClientFileMessage);
- }
+ if (delayDelivery > 0)
+ {
+ long originalTime = (Long)message.getProperty(new SimpleString("original-time"));
+ assertTrue(System.currentTimeMillis() - originalTime + "<" + delayDelivery,
+ System.currentTimeMillis() - originalTime >= delayDelivery);
+ }
- if (testTime)
- {
- System.out.println("Message received in " + (System.currentTimeMillis() - start));
- }
- start = System.currentTimeMillis();
+ if (!preAck)
+ {
+ message.acknowledge();
+ }
- if (delayDelivery > 0)
- {
- long originalTime = (Long)message.getProperty(new SimpleString("original-time"));
- assertTrue((System.currentTimeMillis() - originalTime) + "<" + delayDelivery,
- System.currentTimeMillis() - originalTime >= delayDelivery);
- }
+ assertNotNull(message);
- if (!preAck)
- {
- message.acknowledge();
- }
+ if (delayDelivery <= 0)
+ {
+ // right now there is no guarantee of ordered delivered on multiple scheduledMessages with
+ // the same
+ // scheduled delivery time
+ assertEquals(msgCounter,
+ ((Integer)message.getProperty(new SimpleString("counter-message"))).intValue());
+ }
- if (isXA)
- {
- session.end(xid, XAResource.TMSUCCESS);
- session.commit(xid, true);
- xid = newXID();
- session.start(xid, XAResource.TMNOFLAGS);
- }
- else
- {
- session.commit();
- }
+ MessagingBuffer buffer = message.getBody();
+ buffer.resetReaderIndex();
+ assertEquals(numberOfBytes, buffer.writerIndex());
+ for (int b = 0; b < numberOfBytes; b++)
+ {
+ assertEquals((byte)'a', buffer.readByte());
+ }
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ errrors.incrementAndGet();
+ }
+ finally
+ {
+ msgCounter++;
+ }
+ }
+ };
- assertNotNull(message);
+ session.start();
+
+ Thread.sleep(1000);
- if (delayDelivery <= 0)
+ consumer.setMessageHandler(handler);
+
+ assertTrue(latchDone.await(20, TimeUnit.SECONDS));
+ assertEquals(0, errrors.get());
+
+ }
+ else
+ {
+
+ session.start();
+
+ for (int i = 0; i < numberOfMessages; i++)
{
- // right now there is no guarantee of ordered delivered on multiple scheduledMessages with the same
- // scheduled delivery time
- assertEquals(i, ((Integer)message.getProperty(new SimpleString("counter-message"))).intValue());
- }
+ System.currentTimeMillis();
- if (!testTime)
- {
- if (message instanceof ClientFileMessage)
+ ClientMessage message = consumer.receive(waitOnConsumer + delayDelivery);
+
+ assertNotNull(message);
+
+ System.out.println("Message: " + i);
+
+ System.currentTimeMillis();
+
+ if (delayDelivery > 0)
{
- checkFileRead(((ClientFileMessage)message).getFile(), numberOfIntegers);
+ long originalTime = (Long)message.getProperty(new SimpleString("original-time"));
+ assertTrue(System.currentTimeMillis() - originalTime + "<" + delayDelivery,
+ System.currentTimeMillis() - originalTime >= delayDelivery);
}
- else
+
+ if (!preAck)
{
- MessagingBuffer buffer = message.getBody();
- buffer.resetReaderIndex();
- assertEquals(numberOfIntegers * DataConstants.SIZE_INT, buffer.writerIndex());
- for (int b = 0; b < numberOfIntegers; b++)
- {
- assertEquals(b, buffer.readInt());
- }
+ message.acknowledge();
}
+
+ assertNotNull(message);
+
+ if (delayDelivery <= 0)
+ {
+ // right now there is no guarantee of ordered delivered on multiple scheduledMessages with the same
+ // scheduled delivery time
+ assertEquals(i, ((Integer)message.getProperty(new SimpleString("counter-message"))).intValue());
+ }
+
+ MessagingBuffer buffer = message.getBody();
+ buffer.resetReaderIndex();
+ assertEquals(numberOfBytes, buffer.writerIndex());
+ for (int b = 0; b < numberOfBytes; b++)
+ {
+ assertEquals((byte)'a', buffer.readByte());
+ }
}
+
}
+ consumer.close();
if (iteration == 0)
{
- consumer.close();
if (isXA)
{
session.end(xid, XAResource.TMSUCCESS);
@@ -319,6 +355,20 @@
session.rollback();
}
}
+ else
+ {
+ if (isXA)
+ {
+ session.end(xid, XAResource.TMSUCCESS);
+ session.commit(xid, true);
+ xid = newXID();
+ session.start(xid, XAResource.TMNOFLAGS);
+ }
+ else
+ {
+ session.commit();
+ }
+ }
}
session.close();
@@ -355,69 +405,45 @@
* @throws IOException
* @throws MessagingException
*/
- private void sendMessages(final boolean useFile,
- final int numberOfMessages,
- final int numberOfIntegers,
+ private void sendMessages(final int numberOfMessages,
+ final int numberOfBytes,
final long delayDelivery,
- final boolean testTime,
- ClientSession session,
- ClientProducer producer) throws FileNotFoundException, IOException, MessagingException
+ final ClientSession session,
+ final ClientProducer producer) throws Exception
{
- if (useFile)
+ for (int i = 0; i < numberOfMessages; i++)
{
- File tmpData = createLargeFile(getTemporaryDir(), "someFile.dat", numberOfIntegers);
-
- for (int i = 0; i < numberOfMessages; i++)
+ ClientMessage message = session.createClientMessage(true);
+
+ // If the test is using more than 1M, we will only use the Streaming, as it require too much memory from the test
+ if (numberOfBytes > 1024 * 1024 || i % 2 == 0)
{
- ClientMessage message = session.createFileMessage(true);
- ((ClientFileMessage)message).setFile(tmpData);
- message.putIntProperty(new SimpleString("counter-message"), i);
- long timeStart = System.currentTimeMillis();
- if (delayDelivery > 0)
+ System.out.println("Sending message (stream)" + i);
+ message.setBodyInputStream(createFakeLargeStream(numberOfBytes, (byte)'a'));
+ }
+ else
+ {
+ System.out.println("Sending message (array)" + i);
+ byte[] bytes = new byte[numberOfBytes];
+ for (int j = 0; j < bytes.length; j++)
{
- long time = System.currentTimeMillis();
- message.putLongProperty(new SimpleString("original-time"), time);
- message.putLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME, time + delayDelivery);
-
- producer.send(message);
+ bytes[j] = 'a';
}
- else
- {
- producer.send(message);
- }
- if (testTime)
- {
- System.out.println("Message sent in " + (System.currentTimeMillis() - timeStart));
- }
+ message.getBody().writeBytes(bytes);
}
-
- }
- else
- {
- for (int i = 0; i < numberOfMessages; i++)
+ message.putIntProperty(new SimpleString("counter-message"), i);
+ if (delayDelivery > 0)
{
- ClientMessage message = session.createClientMessage(true);
- message.putIntProperty(new SimpleString("counter-message"), i);
- message.setBody(createLargeBuffer(numberOfIntegers));
- long timeStart = System.currentTimeMillis();
- if (delayDelivery > 0)
- {
- long time = System.currentTimeMillis();
- message.putLongProperty(new SimpleString("original-time"), time);
- message.putLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME, time + delayDelivery);
+ long time = System.currentTimeMillis();
+ message.putLongProperty(new SimpleString("original-time"), time);
+ message.putLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME, time + delayDelivery);
- producer.send(message);
- }
- else
- {
- producer.send(message);
- }
-
- if (testTime)
- {
- System.out.println("Message sent in " + (System.currentTimeMillis() - timeStart));
- }
+ producer.send(message);
}
+ else
+ {
+ producer.send(message);
+ }
}
}
@@ -434,66 +460,24 @@
}
- protected ClientFileMessage createLargeClientMessage(final ClientSession session, final int numberOfIntegers) throws Exception
+ protected ClientMessage createLargeClientMessage(final ClientSession session, final int numberOfBytes) throws Exception
{
- return createLargeClientMessage(session, numberOfIntegers, true);
+ return createLargeClientMessage(session, numberOfBytes, true);
}
- protected ClientFileMessage createLargeClientMessage(final ClientSession session,
- final int numberOfIntegers,
- boolean persistent) throws Exception
+ protected ClientMessage createLargeClientMessage(final ClientSession session,
+ final int numberOfBytes,
+ final boolean persistent) throws Exception
{
- ClientFileMessage clientMessage = session.createFileMessage(persistent);
+ ClientMessage clientMessage = session.createClientMessage(persistent);
- File tmpFile = createLargeFile(getTemporaryDir(), "tmpUpload.data", numberOfIntegers);
+ clientMessage.setBodyInputStream(createFakeLargeStream(numberOfBytes, (byte)'a'));
- clientMessage.setFile(tmpFile);
-
return clientMessage;
}
/**
- * @param name
- * @param numberOfIntegers
- * @return
- * @throws FileNotFoundException
- * @throws IOException
- */
- protected File createLargeFile(final String directory, final String name, final int numberOfIntegers) throws FileNotFoundException,
- IOException
- {
- File tmpFile = new File(directory + "/" + name);
-
- RandomAccessFile random = new RandomAccessFile(tmpFile, "rw");
- FileChannel channel = random.getChannel();
-
- ByteBuffer buffer = ByteBuffer.allocate(4 * 1000);
-
- for (int i = 0; i < numberOfIntegers; i++)
- {
- if (buffer.position() > 0 && i % 1000 == 0)
- {
- buffer.flip();
- channel.write(buffer);
- buffer.clear();
- }
- buffer.putInt(i);
- }
-
- if (buffer.position() > 0)
- {
- buffer.flip();
- channel.write(buffer);
- }
-
- channel.close();
- random.close();
-
- return tmpFile;
- }
-
- /**
* @param session
* @param queueToRead
* @param numberOfIntegers
@@ -501,36 +485,18 @@
* @throws FileNotFoundException
* @throws IOException
*/
- protected void readMessage(final ClientSession session, final SimpleString queueToRead, final int numberOfIntegers) throws MessagingException,
- FileNotFoundException,
- IOException
+ protected void readMessage(final ClientSession session, final SimpleString queueToRead, final int numberOfBytes) throws MessagingException,
+ FileNotFoundException,
+ IOException
{
session.start();
- ClientConsumer consumer = session.createFileConsumer(new File(getClientLargeMessagesDir()), queueToRead);
+ ClientConsumer consumer = session.createConsumer(queueToRead);
ClientMessage clientMessage = consumer.receive(5000);
assertNotNull(clientMessage);
- if (!(clientMessage instanceof ClientFileMessage))
- {
- System.out.println("Size = " + clientMessage.getBodySize());
- }
-
- if (clientMessage instanceof ClientFileMessage)
- {
- assertTrue(clientMessage instanceof ClientFileMessage);
-
- ClientFileMessage fileClientMessage = (ClientFileMessage)clientMessage;
-
- assertNotNull(fileClientMessage);
- File receivedFile = fileClientMessage.getFile();
-
- checkFileRead(receivedFile, numberOfIntegers);
-
- }
-
clientMessage.acknowledge();
session.commit();
@@ -539,61 +505,97 @@
}
/**
- * @param receivedFile
- * @throws FileNotFoundException
- * @throws IOException
+ * Deleting a file on LargeDire is an asynchronous process. Wee need to keep looking for a while if the file hasn't been deleted yet
*/
- protected void checkFileRead(final File receivedFile, final int numberOfIntegers) throws FileNotFoundException,
- IOException
+ protected void validateNoFilesOnLargeDir() throws Exception
{
- RandomAccessFile random2 = new RandomAccessFile(receivedFile, "r");
- FileChannel channel2 = random2.getChannel();
+ File largeMessagesFileDir = new File(getLargeMessagesDir());
- ByteBuffer buffer2 = ByteBuffer.allocate(1000 * 4);
+ // Deleting the file is async... we keep looking for a period of the time until the file is really gone
+ for (int i = 0; i < 100; i++)
+ {
+ if (largeMessagesFileDir.listFiles().length > 0)
+ {
+ Thread.sleep(10);
+ }
+ else
+ {
+ break;
+ }
+ }
- channel2.position(0l);
+ assertEquals(0, largeMessagesFileDir.listFiles().length);
+ }
- for (int i = 0; i < numberOfIntegers;)
+ protected InputStream createFakeLargeStream(final int size, final byte byteUsed) throws Exception
+ {
+ return new InputStream()
{
- channel2.read(buffer2);
+ private int count;
- buffer2.flip();
- for (int j = 0; j < buffer2.limit() / 4; j++, i++)
+ private boolean closed = false;
+
+ @Override
+ public void close() throws IOException
{
- assertEquals(i, buffer2.getInt());
+ super.close();
+ closed = true;
}
- buffer2.clear();
- }
+ @Override
+ public int read() throws IOException
+ {
+ if (closed)
+ {
+ throw new IOException("Stream was closed");
+ }
+ if (count++ < size)
+ {
+ return byteUsed;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ };
- channel2.close();
}
- /**
- * Deleting a file on LargeDire is an asynchronous process. Wee need to keep looking for a while if the file hasn't been deleted yet
- */
- protected void validateNoFilesOnLargeDir() throws Exception
+ protected OutputStream createFakeOutputStream() throws Exception
{
- File largeMessagesFileDir = new File(getLargeMessagesDir());
- // Deleting the file is async... we keep looking for a period of the time until the file is really gone
- for (int i = 0; i < 100; i++)
+ return new OutputStream()
{
- if (largeMessagesFileDir.listFiles().length > 0)
+ private boolean closed = false;
+
+ private int count;
+
+ @Override
+ public void close() throws IOException
{
- Thread.sleep(10);
+ super.close();
+ closed = true;
}
- else
+
+ @Override
+ public void write(final int b) throws IOException
{
- break;
+ if (count++ % 1024 * 1024 == 0)
+ {
+ System.out.println("OutputStream received " + count + " bytes");
+ }
+ if (closed)
+ {
+ throw new IOException("Stream was closed");
+ }
}
- }
- assertEquals(0, largeMessagesFileDir.listFiles().length);
+ };
+
}
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
-
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,133 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.tests.integration.client;
-
-import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientFileMessage;
-import org.jboss.messaging.core.client.ClientMessage;
-import org.jboss.messaging.core.client.ClientProducer;
-import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.client.impl.ClientFileMessageImpl;
-import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.utils.SimpleString;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class ClientFileMessageTest extends ServiceTestBase
-{
- public final SimpleString addressA = new SimpleString("addressA");
-
- public final SimpleString queueA = new SimpleString("queueA");
-
- public void testConsumeFileMessage() throws Exception
- {
- String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/jbm-unit-test";
-
- MessagingServer server = createServer(false);
- try
- {
- server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setMinLargeMessageSize(1000);
- ClientSession sendSession = cf.createSession(false, true, true);
- ClientSession recSession = cf.createSession(false, true, true);
- sendSession.createQueue(addressA, queueA, false);
- ClientProducer cp = sendSession.createProducer(addressA);
- File directory = new File(testDir);
- directory.mkdirs();
- ClientConsumer cc = recSession.createFileConsumer(directory, queueA);
- recSession.start();
- ClientMessage message = recSession.createClientMessage(false);
- byte[] bytes = new byte[3000];
- message.getBody().writeBytes(bytes);
- cp.send(message);
- ClientFileMessageImpl m = (ClientFileMessageImpl) cc.receive(5000);
- assertNotNull(m);
- FileChannel channel = m.getChannel();
- ByteBuffer dst = ByteBuffer.allocate(3000);
- channel.read(dst);
- assertEqualsByteArrays(bytes, dst.array());
- sendSession.close();
- recSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
- }
-
- public void testProduceFileMessage() throws Exception
- {
- String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/jbm-unit-test";
-
- MessagingServer server = createServer(false);
- try
- {
- server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setMinLargeMessageSize(1000);
- ClientSession sendSession = cf.createSession(false, true, true);
- ClientSession recSession = cf.createSession(false, true, true);
- sendSession.createQueue(addressA, queueA, false);
- ClientProducer cp = sendSession.createProducer(addressA);
- File directory = new File(testDir);
- directory.delete();
- directory.mkdirs();
- ClientConsumer cc = recSession.createConsumer(queueA);
- recSession.start();
- ClientFileMessage message = sendSession.createFileMessage(false);
- byte[] bytes = new byte[3000];
- File src = new File(directory, "test.jbm");
- src.createNewFile();
- FileOutputStream fos = new FileOutputStream(src);
- fos.write(bytes);
- fos.close();
- message.setFile(src);
- cp.send(message);
- ClientMessage m = cc.receive(5000);
- assertNotNull(m);
- byte[] recBytes = new byte[3000];
- m.getBody().readBytes(recBytes);
- assertEqualsByteArrays(bytes, recBytes);
- sendSession.close();
- recSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
- }
-}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -26,8 +26,6 @@
import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
import static org.jboss.messaging.tests.util.RandomUtil.randomXid;
-import java.io.File;
-
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
@@ -98,14 +96,6 @@
{
public void run() throws MessagingException
{
- session.createFileConsumer(new File("."), randomSimpleString());
- }
- });
-
- expectMessagingException(MessagingException.OBJECT_CLOSED, new MessagingAction()
- {
- public void run() throws MessagingException
- {
session.createQueue(randomSimpleString(), randomSimpleString(), randomBoolean());
}
});
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -47,7 +47,7 @@
cf.setProducerMaxRate(99);
cf.setBlockOnNonPersistentSend(true);
cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
+ ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName);
assertNotNull(consumer);
@@ -69,7 +69,7 @@
cf.setProducerMaxRate(99);
cf.setBlockOnNonPersistentSend(true);
cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
+ ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
try
{
clientSession.createConsumer(queueName);
@@ -97,7 +97,7 @@
cf.setProducerMaxRate(99);
cf.setBlockOnNonPersistentSend(true);
cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
+ ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName, "foo=bar");
assertNotNull(consumer);
@@ -119,7 +119,7 @@
cf.setProducerMaxRate(99);
cf.setBlockOnNonPersistentSend(true);
cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
+ ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
try
{
@@ -148,7 +148,7 @@
cf.setProducerMaxRate(99);
cf.setBlockOnNonPersistentSend(true);
cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
+ ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName, null, true);
assertNotNull(consumer);
@@ -170,7 +170,7 @@
cf.setProducerMaxRate(99);
cf.setBlockOnNonPersistentSend(true);
cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
+ ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName, null, 100, 100, false);
assertNotNull(consumer);
@@ -182,148 +182,4 @@
}
}
- public void testCreateFileConsumerTest() throws Exception
- {
- MessagingServer service = createServer(false);
- try
- {
- service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setProducerMaxRate(99);
- cf.setBlockOnNonPersistentSend(true);
- cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
- clientSession.createQueue(queueName, queueName, false);
- ClientConsumer consumer = clientSession.createFileConsumer(new File(""), queueName);
- assertNotNull(consumer);
- clientSession.close();
- }
- finally
- {
- service.stop();
- }
- }
-
- public void testCreateFileConsumerNoQ() throws Exception
- {
- MessagingServer service = createServer(false);
- try
- {
- service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setProducerMaxRate(99);
- cf.setBlockOnNonPersistentSend(true);
- cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
- try
- {
- clientSession.createFileConsumer(new File(""), queueName);
- fail("should throw exception");
- }
- catch (MessagingException e)
- {
- assertEquals(e.getCode(), MessagingException.QUEUE_DOES_NOT_EXIST);
- }
- clientSession.close();
- }
- finally
- {
- service.stop();
- }
- }
-
- public void testCreateFileConsumerWithFilter() throws Exception
- {
- MessagingServer service = createServer(false);
- try
- {
- service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setProducerMaxRate(99);
- cf.setBlockOnNonPersistentSend(true);
- cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
- clientSession.createQueue(queueName, queueName, false);
- ClientConsumer consumer = clientSession.createFileConsumer(new File(""), queueName, "foo=bar");
- assertNotNull(consumer);
- clientSession.close();
- }
- finally
- {
- service.stop();
- }
- }
-
- public void testCreateFileConsumerWithInvalidFilter() throws Exception
- {
- MessagingServer service = createServer(false);
- try
- {
- service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setProducerMaxRate(99);
- cf.setBlockOnNonPersistentSend(true);
- cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
- clientSession.createQueue(queueName, queueName, false);
- try
- {
- clientSession.createFileConsumer(new File(""), queueName, "foobar");
- fail("should throw exception");
- }
- catch (MessagingException e)
- {
- assertEquals(e.getCode(), MessagingException.INVALID_FILTER_EXPRESSION);
- }
- clientSession.close();
- }
- finally
- {
- service.stop();
- }
- }
-
- public void testCreateFileConsumerWithBrowseOnly() throws Exception
- {
- MessagingServer service = createServer(false);
- try
- {
- service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setProducerMaxRate(99);
- cf.setBlockOnNonPersistentSend(true);
- cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
- clientSession.createQueue(queueName, queueName, false);
- ClientConsumer consumer = clientSession.createFileConsumer(new File(""), queueName, null, true);
- assertNotNull(consumer);
- clientSession.close();
- }
- finally
- {
- service.stop();
- }
- }
-
- public void testCreateFileConsumerWithOverrides() throws Exception
- {
- MessagingServer service = createServer(false);
- try
- {
- service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.setProducerMaxRate(99);
- cf.setBlockOnNonPersistentSend(true);
- cf.setBlockOnNonPersistentSend(true);
- ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true);
- clientSession.createQueue(queueName, queueName, false);
- ClientConsumer consumer = clientSession.createFileConsumer(new File(""), queueName, null, 100, 100, false);
- assertNotNull(consumer);
- clientSession.close();
- }
- finally
- {
- service.stop();
- }
- }
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -26,7 +26,6 @@
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.client.impl.ClientFileMessageInternal;
import org.jboss.messaging.core.client.impl.ClientSessionImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.remoting.FailureListener;
@@ -348,48 +347,6 @@
}
}
- public void testCreateClientFileMessageNonDurable() throws Exception
- {
- MessagingServer server = createServer(false);
- try
- {
- server.start();
- ClientSessionFactory cf = createInVMFactory();
- ClientSession clientSession = cf.createSession(false, true, true);
- ClientFileMessageInternal clientMessage = (ClientFileMessageInternal) clientSession.createFileMessage(false);
- assertEquals(false, clientMessage.isDurable());
- clientSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
- }
-
- public void testCreateClientFileMessageDurable() throws Exception
- {
- MessagingServer server = createServer(false);
- try
- {
- server.start();
- ClientSessionFactory cf = createInVMFactory();
- ClientSession clientSession = cf.createSession(false, true, true);
- ClientFileMessageInternal clientMessage = (ClientFileMessageInternal) clientSession.createFileMessage(true);
- assertEquals(true, clientMessage.isDurable());
- clientSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
- }
-
public void testGetVersion() throws Exception
{
MessagingServer server = createServer(false);
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -28,14 +28,12 @@
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
-import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.tests.util.UnitTestCase;
+import org.jboss.messaging.tests.util.ServiceTestBase;
import org.jboss.messaging.utils.SimpleString;
/**
@@ -43,7 +41,7 @@
*
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
*/
-public class DurableQueueTest extends UnitTestCase
+public class DurableQueueTest extends ServiceTestBase
{
// Constants -----------------------------------------------------
@@ -54,7 +52,7 @@
private ClientSession session;
- private ClientSessionFactoryImpl sf;
+ private ClientSessionFactory sf;
// Static --------------------------------------------------------
@@ -153,12 +151,12 @@
{
super.setUp();
- Configuration config = new ConfigurationImpl();
- config.setSecurityEnabled(false);
- server = Messaging.newMessagingServer(config);
- server.start();
+ server = createServer(true);
- sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ server.start();
+
+ sf = createInVMFactory();
+
session = sf.createSession(false, true, true);
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -22,7 +22,6 @@
package org.jboss.messaging.tests.integration.client;
-import java.io.File;
import java.util.HashMap;
import javax.transaction.xa.XAResource;
@@ -32,15 +31,17 @@
import org.jboss.messaging.core.buffers.ChannelBuffers;
import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientFileMessage;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientConsumerInternal;
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.tests.integration.chunkmessage.ChunkTestBase;
import org.jboss.messaging.utils.DataConstants;
@@ -62,6 +63,8 @@
final static int RECEIVE_WAIT_TIME = 10000;
+ private final int LARGE_MESSAGE_SIZE = 20 * 1024;
+
// Attributes ----------------------------------------------------
static final SimpleString ADDRESS = new SimpleString("SimpleAddress");
@@ -73,67 +76,141 @@
// Public --------------------------------------------------------
+ public void testReuseMessage() throws Exception
+ {
+ // Reusing a largemessage should throw an exception
+ }
+ public void testMessageChunkFilePersistenceOneMessage() throws Exception
+ {
+ testChunks(false, true, false, false, true, false, 10, 1024 * 1024, RECEIVE_WAIT_TIME, 0);
+ }
+
+ public void testMessageChunkFilePersistenceOneMessageConsumer() throws Exception
+ {
+ testChunks(false, true, false, false, true, true, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkFilePersistence() throws Exception
{
- testChunks(false, true, false, false, false, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, true, false, false, true, false, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkFilePersistenceConsumer() throws Exception
+ {
+ testChunks(false, true, false, false, true, true, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkFilePersistenceXA() throws Exception
{
- testChunks(true, true, false, false, false, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, true, false, false, true, false, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkFilePersistenceXAConsumer() throws Exception
+ {
+ testChunks(true, true, false, false, true, true, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkFilePersistenceBlocked() throws Exception
{
- testChunks(false, true, false, false, true, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, true, false, true, true, false, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkFilePersistenceBlockedConsumer() throws Exception
+ {
+ testChunks(false, true, false, true, true, true, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkFilePersistenceBlockedXA() throws Exception
{
- testChunks(true, true, false, false, true, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, true, false, true, true, false, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkFilePersistenceBlockedXAConsumer() throws Exception
+ {
+ testChunks(true, true, false, true, true, true, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkFilePersistenceBlockedPreACK() throws Exception
{
- testChunks(false, true, false, true, true, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, true, true, true, true, false, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkFilePersistenceBlockedPreACKConsumer() throws Exception
+ {
+ testChunks(false, true, true, true, true, true, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkFilePersistenceBlockedPreACKXA() throws Exception
{
- testChunks(true, true, false, true, true, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, true, true, true, true, false, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkFilePersistenceBlockedPreACKXAConsumer() throws Exception
+ {
+ testChunks(true, true, true, true, true, true, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkFilePersistenceDelayed() throws Exception
{
- testChunks(false, true, false, false, false, false, 1, 50000, RECEIVE_WAIT_TIME, 2000);
+ testChunks(false, true, false, false, false, false, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 2000);
}
+ public void testMessageChunkFilePersistenceDelayedConsumer() throws Exception
+ {
+ testChunks(false, true, false, false, false, true, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 2000);
+ }
+
public void testMessageChunkFilePersistenceDelayedXA() throws Exception
{
- testChunks(true, true, false, false, false, false, 1, 50000, RECEIVE_WAIT_TIME, 2000);
+ testChunks(true, true, false, false, false, false, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 2000);
}
+ public void testMessageChunkFilePersistenceDelayedXAConsumer() throws Exception
+ {
+ testChunks(true, true, false, false, false, true, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 2000);
+ }
+
public void testMessageChunkNullPersistence() throws Exception
{
- testChunks(false, false, false, false, false, true, 1, 50000, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, false, false, false, true, true, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkNullPersistenceConsumer() throws Exception
+ {
+ testChunks(false, false, false, false, true, true, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkNullPersistenceXA() throws Exception
{
- testChunks(true, false, false, false, false, true, 1, 50000, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, false, false, false, true, false, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
}
+ public void testMessageChunkNullPersistenceXAConsumer() throws Exception
+ {
+ testChunks(true, false, false, false, true, true, 1, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 0);
+ }
+
public void testMessageChunkNullPersistenceDelayed() throws Exception
{
- testChunks(false, false, false, false, false, false, 100, 50000, RECEIVE_WAIT_TIME, 100);
+ testChunks(false, false, false, false, false, false, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 100);
}
+ public void testMessageChunkNullPersistenceDelayedConsumer() throws Exception
+ {
+ testChunks(false, false, false, false, false, true, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 100);
+ }
+
public void testMessageChunkNullPersistenceDelayedXA() throws Exception
{
- testChunks(true, false, false, false, false, false, 100, 50000, RECEIVE_WAIT_TIME, 100);
+ testChunks(true, false, false, false, false, false, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 100);
}
+ public void testMessageChunkNullPersistenceDelayedXAConsumer() throws Exception
+ {
+ testChunks(true, false, false, false, false, true, 100, LARGE_MESSAGE_SIZE, RECEIVE_WAIT_TIME, 100);
+ }
+
public void testPageOnLargeMessage() throws Exception
{
testPageOnLargeMessage(true, false);
@@ -145,84 +222,84 @@
}
- public void testSendfileMessage() throws Exception
+ public void testSendSmallMessageXA() throws Exception
{
- testChunks(false, true, true, false, false, true, 100, 50000, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, true, false, false, true, false, 100, 4, RECEIVE_WAIT_TIME, 0);
}
- public void testSendfileMessageXA() throws Exception
+ public void testSendSmallMessageXAConsumer() throws Exception
{
- testChunks(true, true, true, false, false, true, 100, 50000, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, true, false, false, true, true, 100, 4, RECEIVE_WAIT_TIME, 0);
}
- public void testSendfileMessageOnNullPersistence() throws Exception
+ public void testSendSmallMessageNullPersistenceXA() throws Exception
{
- testChunks(false, false, true, false, false, true, 100, 50000, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, false, false, false, true, false, 100, 100, RECEIVE_WAIT_TIME, 0);
}
- public void testSendfileMessageOnNullPersistenceXA() throws Exception
+ public void testSendSmallMessageNullPersistenceXAConsumer() throws Exception
{
- testChunks(true, false, true, false, false, true, 100, 50000, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, false, false, false, true, true, 100, 100, RECEIVE_WAIT_TIME, 0);
}
- public void testSendfileMessageOnNullPersistenceSmallMessage() throws Exception
+ public void testSendRegularMessageNullPersistenceDelayed() throws Exception
{
- testChunks(false, false, true, false, true, true, 100, 100, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, false, false, false, false, false, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
- public void testSendfileMessageOnNullPersistenceSmallMessageXA() throws Exception
+ public void testSendRegularMessageNullPersistenceDelayedConsumer() throws Exception
{
- testChunks(true, false, true, false, true, true, 100, 100, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, false, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
- public void testSendfileMessageSmallMessage() throws Exception
+ public void testSendRegularMessageNullPersistenceDelayedXA() throws Exception
{
- testChunks(false, true, true, false, false, true, 100, 4, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, false, false, false, false, false, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
- public void testSendfileMessageSmallMessageXA() throws Exception
+ public void testSendRegularMessageNullPersistenceDelayedXAConsumer() throws Exception
{
- testChunks(true, true, true, false, false, true, 100, 4, RECEIVE_WAIT_TIME, 0);
+ testChunks(true, false, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
- public void testSendRegularMessageNullPersistence() throws Exception
+ public void testSendRegularMessagePersistence() throws Exception
{
- testChunks(false, false, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, true, false, false, true, false, 100, 100, RECEIVE_WAIT_TIME, 0);
}
- public void testSendRegularMessageNullPersistenceXA() throws Exception
+ public void testSendRegularMessagePersistenceConsumer() throws Exception
{
- testChunks(true, false, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, true, false, false, true, true, 100, 100, RECEIVE_WAIT_TIME, 0);
}
- public void testSendRegularMessageNullPersistenceDelayed() throws Exception
+ public void testSendRegularMessagePersistenceXA() throws Exception
{
- testChunks(false, false, false, false, false, false, 100, 100, RECEIVE_WAIT_TIME, 1000);
+ testChunks(true, true, false, false, true, false, 100, 100, RECEIVE_WAIT_TIME, 0);
}
- public void testSendRegularMessageNullPersistenceDelayedXA() throws Exception
+ public void testSendRegularMessagePersistenceXAConsumer() throws Exception
{
- testChunks(true, false, false, false, false, false, 100, 100, RECEIVE_WAIT_TIME, 1000);
+ testChunks(true, true, false, false, true, true, 100, 100, RECEIVE_WAIT_TIME, 0);
}
- public void testSendRegularMessagePersistence() throws Exception
+ public void testSendRegularMessagePersistenceDelayed() throws Exception
{
- testChunks(false, true, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, true, false, false, false, false, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
- public void testSendRegularMessagePersistenceXA() throws Exception
+ public void testSendRegularMessagePersistenceDelayedConsumer() throws Exception
{
- testChunks(true, true, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 0);
+ testChunks(false, true, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
- public void testSendRegularMessagePersistenceDelayed() throws Exception
+ public void testSendRegularMessagePersistenceDelayedXA() throws Exception
{
testChunks(false, true, false, false, false, false, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
- public void testSendRegularMessagePersistenceDelayedXA() throws Exception
+ public void testSendRegularMessagePersistenceDelayedXAConsumer() throws Exception
{
- testChunks(false, true, false, false, false, false, 100, 100, RECEIVE_WAIT_TIME, 1000);
+ testChunks(false, true, false, false, false, true, 100, 100, RECEIVE_WAIT_TIME, 1000);
}
public void testTwoBindingsTwoStartedConsumers() throws Exception
@@ -230,8 +307,6 @@
// there are two bindings.. one is ACKed, the other is not, the server is restarted
// The other binding is acked... The file must be deleted
- clearData();
-
try
{
@@ -261,7 +336,7 @@
producer.close();
- ClientConsumer consumer = session.createFileConsumer(new File(getClientLargeMessagesDir()), queue[1]);
+ ClientConsumer consumer = session.createConsumer(queue[1]);
ClientMessage msg = consumer.receive(RECEIVE_WAIT_TIME);
assertNull(consumer.receive(1000));
assertNotNull(msg);
@@ -273,7 +348,7 @@
session.stop();
- ClientConsumer consumer1 = session.createFileConsumer(new File(getClientLargeMessagesDir()), queue[0]);
+ ClientConsumer consumer1 = session.createConsumer(queue[0]);
session.start();
@@ -316,8 +391,6 @@
// there are two bindings.. one is ACKed, the other is not, the server is restarted
// The other binding is acked... The file must be deleted
- clearData();
-
try
{
@@ -394,8 +467,6 @@
private void internalTestSendRollback(final boolean isXA) throws Exception
{
- clearData();
-
server = createServer(true);
server.start();
@@ -452,13 +523,11 @@
simpleRollbackInternalTest(true);
}
- public void simpleRollbackInternalTest(boolean isXA) throws Exception
+ public void simpleRollbackInternalTest(final boolean isXA) throws Exception
{
// there are two bindings.. one is ACKed, the other is not, the server is restarted
// The other binding is acked... The file must be deleted
- clearData();
-
try
{
@@ -480,7 +549,7 @@
session.createQueue(ADDRESS, ADDRESS, null, true);
- int numberOfIntegers = 50000;
+ int numberOfBytes = 200000;
session.start();
@@ -492,7 +561,7 @@
for (int n = 0; n < 10; n++)
{
- Message clientFile = createLargeClientMessage(session, numberOfIntegers, n % 2 == 0);
+ Message clientFile = createLargeClientMessage(session, numberOfBytes, n % 2 == 0);
producer.send(clientFile);
@@ -510,6 +579,8 @@
session.rollback();
}
+ clientFile = createLargeClientMessage(session, numberOfBytes, n % 2 == 0);
+
producer.send(clientFile);
assertNull(consumer.receiveImmediate());
@@ -533,7 +604,7 @@
assertNotNull(clientMessage);
- assertEquals(numberOfIntegers * 4, clientMessage.getBody().writerIndex());
+ assertEquals(numberOfBytes, clientMessage.getBody().writerIndex());
clientMessage.acknowledge();
@@ -586,6 +657,270 @@
}
+ public void testBufferMultipleLargeMessages() throws Exception
+ {
+ ClientSession session = null;
+ MessagingServer server = null;
+
+ final int SIZE = 10 * 1024;
+ final int NUMBER_OF_MESSAGES = 30;
+ try
+ {
+
+ server = createServer(true);
+
+ server.start();
+
+ ClientSessionFactory sf = createInVMFactory();
+
+ sf.setMinLargeMessageSize(1024);
+ sf.setConsumerWindowSize(1024 * 1024);
+
+ session = sf.createSession(null, null, false, false, false, false, 0);
+
+ session.createQueue(ADDRESS, ADDRESS, null, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
+ {
+ Message clientFile = session.createClientMessage(true);
+ clientFile.setBodyInputStream(createFakeLargeStream(SIZE, (byte)i));
+ producer.send(clientFile);
+
+ }
+ session.commit();
+ producer.close();
+
+ session.start();
+
+ ClientConsumerInternal consumer = (ClientConsumerInternal)session.createConsumer(ADDRESS);
+
+ // Wait the consumer to be complete with 10 messages before getting others
+ long timeout = System.currentTimeMillis() + 10000;
+ while (consumer.getBufferSize() < NUMBER_OF_MESSAGES && timeout > System.currentTimeMillis())
+ {
+ Thread.sleep(10);
+ }
+ assertEquals(NUMBER_OF_MESSAGES, consumer.getBufferSize());
+
+ // Reads the messages, rollback.. read them again
+ for (int trans = 0; trans < 2; trans++)
+ {
+
+ for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
+ {
+ ClientMessage msg = consumer.receive(10000);
+ assertNotNull(msg);
+
+ // it will ignore the buffer (not read it) on the first try
+ if (trans == 0)
+ {
+ for (int byteRead = 0; byteRead < SIZE; byteRead++)
+ {
+ assertEquals((byte)i, msg.getBody().readByte());
+ }
+ }
+
+ msg.acknowledge();
+ }
+ if (trans == 0)
+ {
+ session.rollback();
+ }
+ else
+ {
+ session.commit();
+ }
+ }
+
+ assertEquals(0l, server.getPostOffice().getPagingManager().getGlobalSize());
+ assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getDeliveringCount());
+ assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+
+ }
+ finally
+ {
+ try
+ {
+ session.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+
+ try
+ {
+ server.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
+
+ public void testSendStreamingSingleMessage() throws Exception
+ {
+ ClientSession session = null;
+ MessagingServer server = null;
+
+ final int SIZE = 10 * 1024 * 1024;
+ try
+ {
+
+ server = createServer(true);
+
+ server.start();
+
+ ClientSessionFactory sf = createInVMFactory();
+
+ sf.setMinLargeMessageSize(100 * 1024);
+
+ session = sf.createSession(null, null, false, true, true, false, 0);
+
+ session.createQueue(ADDRESS, ADDRESS, null, true);
+
+ Message clientFile = session.createClientMessage(true);
+ clientFile.setBodyInputStream(createFakeLargeStream(SIZE, (byte)'a'));
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ session.start();
+
+ System.out.println("Sending");
+ producer.send(clientFile);
+
+ producer.close();
+
+ System.out.println("Waiting");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ ClientMessage msg2 = consumer.receive(10000);
+
+ msg2.acknowledge();
+
+ msg2.setOutputStream(createFakeOutputStream());
+ assertTrue(msg2.waitOutputStreamCompletion(60000));
+
+ // for (int i = 0; i < SIZE; i++)
+ // {
+ // byte value = msg2.getBody().readByte();
+ // assertEquals("Error position " + i, (byte)'a', value);
+ // }
+
+ session.commit();
+
+ assertEquals(0l, server.getPostOffice().getPagingManager().getGlobalSize());
+ assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getDeliveringCount());
+ assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+
+ }
+ finally
+ {
+ try
+ {
+ session.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+
+ try
+ {
+ server.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
+
+ /** Receive messages but never reads them, leaving the buffer pending */
+ public void testIgnoreStreaming() throws Exception
+ {
+ ClientSession session = null;
+ MessagingServer server = null;
+
+ final int SIZE = 10 * 1024;
+ final int NUMBER_OF_MESSAGES = 1;
+ try
+ {
+
+ server = createServer(true);
+
+ server.start();
+
+ ClientSessionFactory sf = createInVMFactory();
+
+ sf.setMinLargeMessageSize(1024);
+
+ session = sf.createSession(null, null, false, true, true, false, 0);
+
+ session.createQueue(ADDRESS, ADDRESS, null, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
+ {
+ Message msg = session.createClientMessage(true);
+ msg.setBodyInputStream(createFakeLargeStream(SIZE, (byte)'a'));
+ msg.putIntProperty(new SimpleString("key"), i);
+ producer.send(msg);
+
+ System.out.println("Sent msg " + i);
+ }
+
+ session.start();
+
+ System.out.println("Sending");
+
+ producer.close();
+
+ System.out.println("Waiting");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
+ {
+ ClientMessage msg = consumer.receive(50000);
+ assertNotNull(msg);
+
+ assertEquals(i, msg.getProperty(new SimpleString("key")));
+
+ msg.acknowledge();
+ }
+
+ consumer.close();
+
+ session.commit();
+
+ assertEquals(0l, server.getPostOffice().getPagingManager().getGlobalSize());
+ assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getDeliveringCount());
+ assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+
+ System.out.println("Thread done");
+ }
+ finally
+ {
+ try
+ {
+ session.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+
+ try
+ {
+ server.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -594,22 +929,21 @@
protected void setUp() throws Exception
{
super.setUp();
- log.info("\n*********************************************************************************\n Starting " + this.getName() +
+ clearData();
+ log.info("\n*********************************************************************************\n Starting " + getName() +
"\n*********************************************************************************");
}
@Override
protected void tearDown() throws Exception
{
- log.info("\n*********************************************************************************\nDone with " + this.getName() +
+ log.info("\n*********************************************************************************\nDone with " + getName() +
"\n*********************************************************************************");
super.tearDown();
}
protected void testPageOnLargeMessage(final boolean realFiles, final boolean sendBlocking) throws Exception
{
- clearData();
-
Configuration config = createDefaultConfig();
config.setPagingMaxGlobalSizeBytes(20 * 1024);
@@ -666,7 +1000,7 @@
producer.send(message);
}
- ClientFileMessage clientFile = createLargeClientMessage(session, numberOfIntegersBigMessage);
+ ClientMessage clientFile = createLargeClientMessage(session, numberOfIntegersBigMessage);
producer.send(clientFile);
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -38,6 +38,7 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.settings.impl.AddressSettings;
+import org.jboss.messaging.tests.util.ServiceTestBase;
import org.jboss.messaging.tests.util.UnitTestCase;
import org.jboss.messaging.utils.SimpleString;
@@ -48,7 +49,7 @@
*
*
*/
-public class MessageExpirationTest extends UnitTestCase
+public class MessageExpirationTest extends ServiceTestBase
{
// Constants -----------------------------------------------------
@@ -142,12 +143,10 @@
{
super.setUp();
- Configuration config = new ConfigurationImpl();
- config.setSecurityEnabled(false);
- server = Messaging.newMessagingServer(config);
+ server = createServer(false);
server.start();
- ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ ClientSessionFactory sf = createInVMFactory();
session = sf.createSession(false, true, true);
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -28,17 +28,15 @@
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
-import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.remoting.RemotingConnection;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.impl.ServerSessionImpl;
-import org.jboss.messaging.tests.util.UnitTestCase;
+import org.jboss.messaging.tests.util.ServiceTestBase;
import org.jboss.messaging.utils.SimpleString;
/**
@@ -53,7 +51,7 @@
*
*
*/
-public class TemporaryQueueTest extends UnitTestCase
+public class TemporaryQueueTest extends ServiceTestBase
{
// Constants -----------------------------------------------------
@@ -64,7 +62,7 @@
private ClientSession session;
- private ClientSessionFactoryImpl sf;
+ private ClientSessionFactory sf;
// Static --------------------------------------------------------
@@ -215,12 +213,10 @@
{
super.setUp();
- Configuration config = new ConfigurationImpl();
- config.setSecurityEnabled(false);
- server = Messaging.newMessagingServer(config);
+ server = createServer(false);
server.start();
- sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ sf = createInVMFactory();
session = sf.createSession(false, true, true);
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -959,6 +959,7 @@
configuration.setJournalMinFiles(2);
configuration.setJournalDirectory(getJournalDir(node, false));
configuration.setJournalFileSize(100 * 1024);
+ configuration.setJournalType(JournalType.NIO);
configuration.setPagingDirectory(getPageDir(node, false));
configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, false));
configuration.setClustered(true);
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -80,9 +80,15 @@
}
- @Override
+
protected void start() throws Exception
{
+ startNullPersistence();
+ //startJournal();
+ }
+
+ protected void startJournal() throws Exception
+ {
deleteDirectory(new File(getTestDir()));
@@ -135,11 +141,40 @@
liveServer.start();
}
+
+
+ protected void startNullPersistence() throws Exception
+ {
+ Configuration backupConf = new ConfigurationImpl();
+ backupConf.setSecurityEnabled(false);
+ backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
+ backupConf.getAcceptorConfigurations()
+ .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
+ backupParams));
+ backupConf.setBackup(true);
+ backupServer = Messaging.newMessagingServer(backupConf, false);
+ backupServer.start();
+ Configuration liveConf = new ConfigurationImpl();
+ liveConf.setSecurityEnabled(false);
+ liveConf.getAcceptorConfigurations()
+ .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
+ Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
+ TransportConfiguration backupTC = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
+ backupParams,
+ "backup-connector");
+ connectors.put(backupTC.getName(), backupTC);
+ liveConf.setConnectorConfigurations(connectors);
+ liveConf.setBackupConnectorName(backupTC.getName());
+ liveServer = Messaging.newMessagingServer(liveConf, false);
+ liveServer.start();
+ }
+
+
+
@Override
protected void setBody(final ClientMessage message) throws Exception
{
-
message.getBody().writeBytes(FIVE_HUNDRED_BYTES);
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1287,7 +1287,7 @@
protected int getNumIterations()
{
- return 2;
+ return 500;
}
@Override
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -88,7 +88,7 @@
protected int getNumIterations()
{
- return 2;
+ return 20;
}
protected boolean shouldFail()
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakeBinding.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -39,79 +39,79 @@
public SimpleString getClusterName()
{
- // TODO Auto-generated method stub
+
return null;
}
public BindingType getType()
{
- // TODO Auto-generated method stub
+
return null;
}
public int getDistance()
{
- // TODO Auto-generated method stub
+
return 0;
}
public SimpleString getOriginatingNodeID()
{
- // TODO Auto-generated method stub
+
return null;
}
public Filter getFilter()
{
- // TODO Auto-generated method stub
+
return null;
}
public int getID()
{
- // TODO Auto-generated method stub
+
return 0;
}
public void setID(int id)
{
- // TODO Auto-generated method stub
+
}
public void willRoute(ServerMessage message)
{
- // TODO Auto-generated method stub
+
}
public boolean filterMatches(ServerMessage message) throws Exception
{
- // TODO Auto-generated method stub
+
return false;
}
public boolean isHighAcceptPriority(ServerMessage message)
{
- // TODO Auto-generated method stub
+
return false;
}
public SimpleString getRoutingName()
{
- // TODO Auto-generated method stub
+
return null;
}
public SimpleString getUniqueName()
{
- // TODO Auto-generated method stub
+
return null;
}
public boolean isExclusive()
{
- // TODO Auto-generated method stub
+
return false;
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -49,13 +49,13 @@
{
public boolean redistribute(ServerMessage message, SimpleString routingName, Transaction tx) throws Exception
{
- // TODO Auto-generated method stub
+
return false;
}
public void sendQueueInfoToQueue(SimpleString queueName, SimpleString address) throws Exception
{
- // TODO Auto-generated method stub
+
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/soak/chunk/MessageChunkSoakTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/soak/chunk/MessageChunkSoakTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/soak/chunk/MessageChunkSoakTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -49,20 +49,18 @@
public void testMessageChunkFilePersistence1G() throws Exception
{
- testChunks(false,
+ testChunks(false,
true,
- true,
false,
- true,
false,
- 2,
- 268435456,
+ false,
+ false,
+ 1,
+ 1024 * 1024 * 1024,
300000,
0,
-1,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- true);
+ ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
}
// Package protected ---------------------------------------------
Added: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LargeMessageBufferTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LargeMessageBufferTest.java (rev 0)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LargeMessageBufferTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -0,0 +1,595 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.unit.core.client.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.messaging.core.buffers.ChannelBuffer;
+import org.jboss.messaging.core.buffers.ChannelBuffers;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.MessageHandler;
+import org.jboss.messaging.core.client.impl.ClientConsumerInternal;
+import org.jboss.messaging.core.client.impl.ClientMessageInternal;
+import org.jboss.messaging.core.client.impl.LargeMessageBuffer;
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveContinuationMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveMessage;
+import org.jboss.messaging.tests.util.RandomUtil;
+import org.jboss.messaging.tests.util.UnitTestCase;
+
+/**
+ * A LargeMessageBufferUnitTest
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class LargeMessageBufferTest extends UnitTestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Test Simple getBytes
+ public void testGetBytes() throws Exception
+ {
+ LargeMessageBuffer buffer = create15BytesSample();
+
+ for (int i = 1; i <= 15; i++)
+ {
+ try
+ {
+ assertEquals(i, buffer.readByte());
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Exception at position " + i, e);
+ }
+ }
+
+ try
+ {
+ buffer.readByte();
+ fail("supposed to throw an exception");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ }
+ }
+
+ // Test for void getBytes(final int index, final byte[] dst)
+ public void testGetBytesIByteArray() throws Exception
+ {
+ LargeMessageBuffer buffer = create15BytesSample();
+
+ byte[] bytes = new byte[15];
+ buffer.getBytes(0, bytes);
+
+ validateAgainstSample(bytes);
+
+ try
+ {
+ buffer = create15BytesSample();
+
+ bytes = new byte[16];
+ buffer.getBytes(0, bytes);
+ fail("supposed to throw an exception");
+ }
+ catch (java.lang.IndexOutOfBoundsException e)
+ {
+ }
+ }
+
+ // testing void getBytes(int index, ChannelBuffer dst, int dstIndex, int length)
+ public void testGetBytesILChannelBufferII() throws Exception
+ {
+ LargeMessageBuffer buffer = create15BytesSample();
+
+ ChannelBuffer dstBuffer = ChannelBuffers.buffer(20);
+
+ dstBuffer.setIndex(0, 5);
+
+ buffer.getBytes(0, dstBuffer);
+
+ byte[] compareBytes = new byte[15];
+ dstBuffer.getBytes(5, compareBytes);
+
+ validateAgainstSample(compareBytes);
+ }
+
+ // testing void getBytes(int index, ChannelBuffer dst, int dstIndex, int length)
+ public void testReadIntegers() throws Exception
+ {
+ LargeMessageBuffer buffer = createBufferWithIntegers(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+
+ for (int i = 1; i <= 15; i++)
+ {
+ assertEquals(i, buffer.readInt());
+ }
+
+ try
+ {
+ buffer.readByte();
+ fail("supposed to throw an exception");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ }
+ }
+
+ // testing void getBytes(int index, ChannelBuffer dst, int dstIndex, int length)
+ public void testReadLongs() throws Exception
+ {
+ LargeMessageBuffer buffer = createBufferWithLongs(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+
+ for (int i = 1; i <= 15; i++)
+ {
+ assertEquals(i, buffer.readLong());
+ }
+
+ try
+ {
+ buffer.readByte();
+ fail("supposed to throw an exception");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ }
+ }
+
+ public void testReadData() throws Exception
+ {
+ ChannelBuffer dynamic = ChannelBuffers.dynamicBuffer(1);
+
+ String str1 = RandomUtil.randomString();
+ String str2 = RandomUtil.randomString();
+ Double d1 = RandomUtil.randomDouble();
+ float f1 = RandomUtil.randomFloat();
+
+ dynamic.writeUTF(str1);
+ dynamic.writeString(str2);
+ dynamic.writeDouble(d1);
+ dynamic.writeFloat(f1);
+
+ LargeMessageBuffer readBuffer = splitBuffer(3, dynamic.array());
+
+ assertEquals(str1, readBuffer.readUTF());
+ assertEquals(str2, readBuffer.readString());
+ assertEquals(d1, readBuffer.readDouble());
+ assertEquals(f1, readBuffer.readFloat());
+ }
+
+ public void testStreamData() throws Exception
+ {
+ final LargeMessageBuffer outBuffer = new LargeMessageBuffer(new FakeConsumerInternal(), 1024 * 11 + 123, 1);
+
+ final PipedOutputStream output = new PipedOutputStream();
+ final PipedInputStream input = new PipedInputStream(output);
+
+ final AtomicInteger errors = new AtomicInteger(0);
+
+ // Done reading 3 elements
+ final CountDownLatch done1 = new CountDownLatch(1);
+ // Done with the thread
+ final CountDownLatch done2 = new CountDownLatch(1);
+
+ final AtomicInteger count = new AtomicInteger(0);
+ final AtomicInteger totalBytes = new AtomicInteger(0);
+
+ Thread treader = new Thread("treader")
+ {
+ public void run()
+ {
+ try
+ {
+
+ byte line[] = new byte[1024];
+ int dataRead = 0;
+ while (dataRead >= 0)
+ {
+ dataRead = input.read(line);
+ if (dataRead > 0)
+ {
+ System.out.println("Read one line with " + dataRead + " bytes");
+ totalBytes.addAndGet(dataRead);
+ if (count.incrementAndGet() == 3)
+ {
+ done1.countDown();
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ errors.incrementAndGet();
+ }
+ finally
+ {
+ done1.countDown();
+ done2.countDown();
+ }
+ }
+ };
+
+ treader.setDaemon(true);
+ treader.start();
+
+ for (int i = 0; i < 3; i++)
+ {
+ outBuffer.addPacket(new SessionReceiveContinuationMessage(-1, new byte[1024], true, false));
+ }
+
+ outBuffer.setOutputStream(output);
+
+ final CountDownLatch waiting = new CountDownLatch(1);
+
+ Thread twaiter = new Thread("twaiter")
+ {
+ public void run()
+ {
+ try
+ {
+ outBuffer.waitCompletion(0);
+ waiting.countDown();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ errors.incrementAndGet();
+ }
+ }
+ };
+
+ twaiter.setDaemon(true);
+ twaiter.start();
+
+ assertTrue(done1.await(10, TimeUnit.SECONDS));
+
+ assertEquals(3, count.get());
+ assertEquals(1024 * 3, totalBytes.get());
+
+ for (int i = 0; i < 8; i++)
+ {
+ outBuffer.addPacket(new SessionReceiveContinuationMessage(-1, new byte[1024], true, false));
+ }
+
+ assertEquals(1, waiting.getCount());
+
+ outBuffer.addPacket(new SessionReceiveContinuationMessage(-1, new byte[123], false, false));
+
+ assertTrue(done2.await(10, TimeUnit.SECONDS));
+
+ assertTrue(waiting.await(10, TimeUnit.SECONDS));
+
+ assertEquals(12, count.get());
+ assertEquals(1024 * 11 + 123, totalBytes.get());
+
+ treader.join();
+
+ twaiter.join();
+
+ assertEquals(0, errors.get());
+
+ }
+
+ /**
+ * @return
+ */
+ private LargeMessageBuffer create15BytesSample() throws Exception
+ {
+ return splitBuffer(5, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 });
+ }
+
+ private LargeMessageBuffer createBufferWithIntegers(int splitFactor, int... values) throws Exception
+ {
+ ByteArrayOutputStream byteOut = new ByteArrayOutputStream(values.length * 4);
+ DataOutputStream dataOut = new DataOutputStream(byteOut);
+
+ for (int value : values)
+ {
+ dataOut.writeInt(value);
+ }
+
+ return splitBuffer(splitFactor, byteOut.toByteArray());
+ }
+
+ private LargeMessageBuffer createBufferWithLongs(int splitFactor, long... values) throws Exception
+ {
+ ByteArrayOutputStream byteOut = new ByteArrayOutputStream(values.length * 8);
+ DataOutputStream dataOut = new DataOutputStream(byteOut);
+
+ for (long value : values)
+ {
+ dataOut.writeLong(value);
+ }
+
+ return splitBuffer(splitFactor, byteOut.toByteArray());
+ }
+
+ private LargeMessageBuffer splitBuffer(int splitFactor, byte[] bytes) throws Exception
+ {
+ LargeMessageBuffer outBuffer = new LargeMessageBuffer(new FakeConsumerInternal(), bytes.length, 5);
+
+ ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+
+ while (true)
+ {
+ byte[] splitElement = new byte[splitFactor];
+ int size = input.read(splitElement);
+ if (size <= 0)
+ {
+ break;
+ }
+
+ if (size < splitFactor)
+ {
+ byte[] newSplit = new byte[size];
+ System.arraycopy(splitElement, 0, newSplit, 0, size);
+
+ outBuffer.addPacket(new SessionReceiveContinuationMessage(-1, newSplit, input.available() > 0, false));
+ }
+ else
+ {
+ outBuffer.addPacket(new SessionReceiveContinuationMessage(-1, splitElement, input.available() > 0, false));
+ }
+ }
+
+ return outBuffer;
+
+ }
+
+ /**
+ * @param bytes
+ */
+ private void validateAgainstSample(byte[] bytes)
+ {
+ for (int i = 1; i <= 15; i++)
+ {
+ assertEquals(i, bytes[i - 1]);
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+ static class FakeConsumerInternal implements ClientConsumerInternal
+ {
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#acknowledge(org.jboss.messaging.core.client.ClientMessage)
+ */
+ public void acknowledge(ClientMessage message) throws MessagingException
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#cleanUp()
+ */
+ public void cleanUp() throws MessagingException
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#clear()
+ */
+ public void clear()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#flowControl(int, boolean)
+ */
+ public void flowControl(int messageBytes, boolean isLargeMessage) throws MessagingException
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#flushAcks()
+ */
+ public void flushAcks() throws MessagingException
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#getBufferSize()
+ */
+ public int getBufferSize()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#getClientWindowSize()
+ */
+ public int getClientWindowSize()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#getCreditsToSend()
+ */
+ public int getCreditsToSend()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#getID()
+ */
+ public long getID()
+ {
+
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#handleLargeMessage(org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveMessage)
+ */
+ public void handleLargeMessage(SessionReceiveMessage largeMessageHeader) throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#handleLargeMessageContinuation(org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveContinuationMessage)
+ */
+ public void handleLargeMessageContinuation(SessionReceiveContinuationMessage continuation) throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#handleMessage(org.jboss.messaging.core.client.impl.ClientMessageInternal)
+ */
+ public void handleMessage(ClientMessageInternal message) throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#isFileConsumer()
+ */
+ public boolean isFileConsumer()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#start()
+ */
+ public void start()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.impl.ClientConsumerInternal#stop()
+ */
+ public void stop() throws MessagingException
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#close()
+ */
+ public void close() throws MessagingException
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#getLastException()
+ */
+ public Exception getLastException()
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#getMessageHandler()
+ */
+ public MessageHandler getMessageHandler() throws MessagingException
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#isClosed()
+ */
+ public boolean isClosed()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#receive()
+ */
+ public ClientMessage receive() throws MessagingException
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#receive(long)
+ */
+ public ClientMessage receive(long timeout) throws MessagingException
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#receiveImmediate()
+ */
+ public ClientMessage receiveImmediate() throws MessagingException
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.client.ClientConsumer#setMessageHandler(org.jboss.messaging.core.client.MessageHandler)
+ */
+ public void setMessageHandler(MessageHandler handler) throws MessagingException
+ {
+
+ }
+
+ }
+
+}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/BindingImplTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -22,6 +22,7 @@
package org.jboss.messaging.tests.unit.core.postoffice.impl;
+import java.io.InputStream;
import java.util.Set;
import javax.transaction.xa.Xid;
@@ -724,6 +725,21 @@
}
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.message.Message#getBodyInputStream()
+ */
+ public InputStream getBodyInputStream()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.message.Message#setBodyInputStream(java.io.InputStream)
+ */
+ public void setBodyInputStream(InputStream stream)
+ {
+ }
+
}
class FakeFilter implements Filter
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -46,19 +46,19 @@
public void connectionCreated(Connection connection)
{
- // TODO Auto-generated method stub
+
}
public void connectionDestroyed(Object connectionID)
{
- // TODO Auto-generated method stub
+
}
public void connectionException(Object connectionID, MessagingException me)
{
- // TODO Auto-generated method stub
+
}
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/org/jboss/messaging/tests/unit/core/server/impl/fakes/FakeConsumer.java 2009-04-10 18:58:34 UTC (rev 6404)
@@ -60,7 +60,7 @@
public Filter getFilter()
{
- // TODO Auto-generated method stub
+
return null;
}
Deleted: branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/details1.xsl
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/details1.xsl 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/details1.xsl 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,166 +0,0 @@
-<?xml version='1.0'?>
-
-<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
-<xsl:param name="thedate">undefined</xsl:param>
-
-<xsl:output method='html' indent='yes' doctype-public='-//W3C//DTD HTML 3.2 FINAL//EN'/>
-
-<xsl:template match='/'>
-
-<xsl:variable name="numberOfTests" select="sum(//@tests)"/>
-<xsl:variable name="numberOfErrors" select="sum(//@errors)"/>
-<xsl:variable name="numberOfFailures" select="sum(//@failures)"/>
-<xsl:variable name="numberOfSuccesses" select="$numberOfTests - $numberOfErrors - $numberOfFailures"/>
-
-<html>
-<head>
-
-<META NAME="ROBOTS" CONTENT="ALL"/>
-<meta name="rating" content="Safe For Kids"/>
-
-<title>JBossTest - Detailed Results</title>
-</head>
-
-<body bgcolor='white'>
-
-
-<h3>JBossTest daily test results</h3>
-
-<b>SUMMARY</b><p/>
-
-Number of tests run: <xsl:value-of select="$numberOfTests"/>
-
-<hr/>
-
-<table bgcolor="yellow">
-<tr>
-<td>
-Successful tests:
-</td><td bgcolor="cyan">
-<xsl:value-of select="$numberOfSuccesses"/>
-</td></tr><tr><td>
-Errors:
-</td><td bgcolor="cyan">
-<xsl:value-of select="$numberOfErrors"/>
-</td></tr><tr><td>
-Failures:
-</td><td bgcolor="cyan">
-<xsl:value-of select="$numberOfFailures"/>
-</td></tr>
-</table>
-
-<hr/>
-
-<pre>
-[time of test: <xsl:value-of select="$thedate"/> GMT]
-[java.version: <xsl:value-of select="$java_version"/>]
-[java.vendor: <xsl:value-of select="$java_vendor"/>]
-[java.vm.version: <xsl:value-of select="$java_vm_version"/>]
-[java.vm.name: <xsl:value-of select="$java_vm_name"/>]
-[java.vm.info: <xsl:value-of select="$java_vm_info"/>]
-[os.name: <xsl:value-of select="$os_name"/>]
-[os.arch: <xsl:value-of select="$os_arch"/>]
-[os.version: <xsl:value-of select="$os_version"/>]
-</pre>
-
-
-<hr/>
-
-<pre>
-
-<xsl:if test='$numberOfFailures!=0 or $numberOfErrors!=0'>
-
-TESTSUITE SUMMARY
-
-
-<table >
-<tr bgcolor="gray">
-<th>Testsuites</th>
-<th>Tests</th>
-<th>Successes</th>
-<th>Failures</th>
-<th>Errors</th>
-</tr>
-<xsl:for-each select="//testsuite">
-<tr><td align="left">
-<a><xsl:attribute name='href'>#<xsl:value-of select='@name'/></xsl:attribute><xsl:value-of select="@name"/></a>
-</td>
-<td align="center">
- <xsl:if test='@errors!=0 or @failures!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute></xsl:if>
- <xsl:value-of select='@tests'/></td>
-<td align="center">
- <xsl:if test='@errors!=0 or @failures!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute></xsl:if>
- <xsl:value-of select='@tests - @errors - @failures'/></td>
-<td align="center">
- <xsl:if test='@failures!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute></xsl:if>
- <xsl:value-of select='@failures'/></td>
-<td align="center">
- <xsl:if test='@errors!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute></xsl:if>
- <xsl:value-of select='@errors'/></td>
-
-</tr>
-</xsl:for-each>
-</table>
-
-<hr/>
-
-DETAILS OF ERRORS
-
-<p/>
-
-<xsl:for-each select="//testsuite">
-
-<a><xsl:attribute name='name'><xsl:value-of select='@name'/></xsl:attribute><b><xsl:value-of select='@name'/></b></a>
-
-<p/>
-
-<table border="1">
-<tr bgcolor="gray">
-<th>Test</th>
-<th>Time</th>
-<th>Problem Type</th>
-<th>Exception</th>
-<th>Message</th>
-<th>Stack Trace</th>
-</tr>
-
-<xsl:for-each select="testcase">
-
-<tr>
-<td><xsl:value-of select="@name"/>
-</td><td><xsl:value-of select="@time"/>
-</td>
-
-<xsl:for-each select="error | failure">
-
-<td><xsl:value-of select="name()"/>
-</td><td><xsl:value-of select="@type"/>
-</td><td><xsl:value-of select="@message"/>
-</td><td><pre><xsl:value-of select="."/></pre>
-</td>
-
-</xsl:for-each>
-
-</tr>
-
-</xsl:for-each>
-
-</table>
-
-<p/>
-<hr/>
-<p/>
-
-</xsl:for-each>
-
-
-</xsl:if>
-
-</pre>
-
-</body>
-</html>
-
-</xsl:template>
-</xsl:stylesheet>
Modified: branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/junit-frames.xsl
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/junit-frames.xsl 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/junit-frames.xsl 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,196 +1,283 @@
-<?xml version='1.0' encoding='UTF-8'?>
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+ xmlns:lxslt="http://xml.apache.org/xslt"
+ xmlns:redirect="http://xml.apache.org/xalan/redirect"
+ xmlns:stringutils="xalan://org.apache.tools.ant.util.StringUtils"
+ extension-element-prefixes="redirect">
+<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
+<xsl:decimal-format decimal-separator="." grouping-separator=","/>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xsltc="http://xml.apache.org/xalan/xsltc"
- xmlns:redirect="http://xml.apache.org/xalan/redirect"
- extension-element-prefixes="redirect"
- version="1.0">
+ http://www.apache.org/licenses/LICENSE-2.0
-<xsl:variable name='java.version' select="//property[@name='java.version']/@value"/>
-<xsl:variable name='java.vendor' select="//property[@name='java.vendor']/@value"/>
-<xsl:variable name='java.vm.name' select="//property[@name='java.vm.name']/@value"/>
-<xsl:variable name='java.vm.version' select="//property[@name='java.vm.version']/@value"/>
-<xsl:variable name='java.vm.info' select="//property[@name='java.vm.info']/@value"/>
-<xsl:variable name='os.name' select="//property[@name='os.name']/@value"/>
-<xsl:variable name='os.version' select="//property[@name='os.version']/@value"/>
-<xsl:variable name='os.arch' select="//property[@name='os.arch']/@value"/>
-<xsl:variable name='TODAY' select="//property[@name='TODAY']/@value"/>
+ 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.
+ -->
+<!--
-<!-- ======================================================================
+ Sample stylesheet to be used with Ant JUnitReport output.
- Stylesheet to transform an XML file generated by the Ant JUnit task into
- a set of JavaDoc-like HTML page to make pages more convenient to be browsed.
-
- It use the Xalan redirect extension to write to multiple output files.
-
- Note: HTML output can be made much more clean by removing non css attributes
+ It creates a set of HTML files a la javadoc where you can browse easily
+ through all packages and classes.
- ====================================================================== -->
-<xsl:output method="html" encoding="UTF-8" indent="yes"/>
-<xsl:decimal-format decimal-separator="." grouping-separator=","/>
-
-<!--
- Xalan redirect extension writes relative file based on the parent directory
- from the main output file, unfortunately, this is never set and you have
- to do it yourself on the API. The code that does it in command line was
- commented out in Xalan 1.2.2 :-(
-
- Therefore I will use a stylesheet param for the output directory.
-
- This has to be invoked as follows from the command line:
-
- java -classpath bsf.jar;xalan.jar;xerces.jar org.apache.xalan.xslt.Process -IN testsuites.xml -XSL junit-frames.xsl -PARAM output.dir './report'
-->
<xsl:param name="output.dir" select="'.'"/>
+<xsl:param name="TITLE">Unit Test Results.</xsl:param>
<xsl:template match="testsuites">
- <!-- create the index.html -->
- <redirect:write file="{$output.dir}/index.html">
- <xsl:call-template name="index.html"/>
- </redirect:write>
+ <!-- create the index.html -->
+ <redirect:write file="{$output.dir}/index.html">
+ <xsl:call-template name="index.html"/>
+ </redirect:write>
- <!-- create the stylesheet.css -->
- <redirect:write file="{$output.dir}/stylesheet.css">
- <xsl:call-template name="stylesheet.css"/>
- </redirect:write>
+ <!-- create the stylesheet.css -->
+ <redirect:write file="{$output.dir}/stylesheet.css">
+ <xsl:call-template name="stylesheet.css"/>
+ </redirect:write>
- <!-- create the overview-packages.html at the root -->
- <redirect:write file="{$output.dir}/overview-summary.html">
- <xsl:apply-templates select="." mode="overview.packages"/>
- </redirect:write>
+ <!-- create the overview-packages.html at the root -->
+ <redirect:write file="{$output.dir}/overview-summary.html">
+ <xsl:apply-templates select="." mode="overview.packages"/>
+ </redirect:write>
- <!-- create the all-packages.html at the root -->
- <redirect:write file="{$output.dir}/overview-frame.html">
- <xsl:apply-templates select="." mode="all.packages"/>
- </redirect:write>
-
- <!-- create the all-classes.html at the root -->
- <redirect:write file="{$output.dir}/allclasses-frame.html">
- <xsl:apply-templates select="." mode="all.classes"/>
- </redirect:write>
-
- <!-- process all packages -->
- <xsl:for-each select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
- <xsl:call-template name="package">
- <xsl:with-param name="name" select="@package"/>
- </xsl:call-template>
- </xsl:for-each>
+ <!-- create the all-packages.html at the root -->
+ <redirect:write file="{$output.dir}/overview-frame.html">
+ <xsl:apply-templates select="." mode="all.packages"/>
+ </redirect:write>
+
+ <!-- create the all-classes.html at the root -->
+ <redirect:write file="{$output.dir}/allclasses-frame.html">
+ <xsl:apply-templates select="." mode="all.classes"/>
+ </redirect:write>
+
+ <!-- create the all-tests.html at the root -->
+ <redirect:write file="{$output.dir}/all-tests.html">
+ <xsl:apply-templates select="." mode="all.tests"/>
+ </redirect:write>
+
+ <!-- create the alltests-fails.html at the root -->
+ <redirect:write file="{$output.dir}/alltests-fails.html">
+ <xsl:apply-templates select="." mode="all.tests">
+ <xsl:with-param name="type" select="'fails'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+
+ <!-- create the alltests-errors.html at the root -->
+ <redirect:write file="{$output.dir}/alltests-errors.html">
+ <xsl:apply-templates select="." mode="all.tests">
+ <xsl:with-param name="type" select="'errors'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+
+ <!-- process all packages -->
+ <xsl:for-each select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
+ <xsl:call-template name="package">
+ <xsl:with-param name="name" select="@package"/>
+ </xsl:call-template>
+ </xsl:for-each>
</xsl:template>
<xsl:template name="package">
- <xsl:param name="name"/>
- <xsl:variable name="package.dir">
- <xsl:if test="not($name = '')"><xsl:value-of select="translate($name,'.','/')"/></xsl:if>
- <xsl:if test="$name = ''">.</xsl:if>
- </xsl:variable>
- <!--Processing package <xsl:value-of select="@name"/> in <xsl:value-of select="$output.dir"/> -->
- <!-- create a classes-list.html in the package directory -->
- <redirect:write file="{$output.dir}/{$package.dir}/package-frame.html">
- <xsl:call-template name="classes.list">
- <xsl:with-param name="name" select="$name"/>
- </xsl:call-template>
- </redirect:write>
-
- <!-- create a package-summary.html in the package directory -->
- <redirect:write file="{$output.dir}/{$package.dir}/package-summary.html">
- <xsl:call-template name="package.summary">
- <xsl:with-param name="name" select="$name"/>
- </xsl:call-template>
- </redirect:write>
-
- <!-- for each class, creates a @name.html -->
- <!-- @bug there will be a problem with inner classes having the same name, it will be overwritten -->
- <xsl:for-each select="/testsuites/testsuite[@package = $name]">
- <redirect:write file="{$output.dir}/{$package.dir}/{@name}.html">
- <xsl:apply-templates select="." mode="class.details"/>
+ <xsl:param name="name"/>
+ <xsl:variable name="package.dir">
+ <xsl:if test="not($name = '')"><xsl:value-of select="translate($name,'.','/')"/></xsl:if>
+ <xsl:if test="$name = ''">.</xsl:if>
+ </xsl:variable>
+ <!--Processing package <xsl:value-of select="@name"/> in <xsl:value-of select="$output.dir"/> -->
+ <!-- create a classes-list.html in the package directory -->
+ <redirect:write file="{$output.dir}/{$package.dir}/package-frame.html">
+ <xsl:call-template name="classes.list">
+ <xsl:with-param name="name" select="$name"/>
+ </xsl:call-template>
+ </redirect:write>
+
+ <!-- create a package-summary.html in the package directory -->
+ <redirect:write file="{$output.dir}/{$package.dir}/package-summary.html">
+ <xsl:call-template name="package.summary">
+ <xsl:with-param name="name" select="$name"/>
+ </xsl:call-template>
+ </redirect:write>
+
+ <!-- for each class, creates a @name.html -->
+ <!-- @bug there will be a problem with inner classes having the same name, it will be overwritten -->
+ <xsl:for-each select="/testsuites/testsuite[@package = $name]">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}.html">
+ <xsl:apply-templates select="." mode="class.details"/>
+ </redirect:write>
+ <xsl:if test="string-length(./system-out)!=0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-out.txt">
+ <xsl:value-of disable-output-escaping="yes" select="./system-out"/>
</redirect:write>
- </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="string-length(./system-err)!=0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-err.txt">
+ <xsl:value-of disable-output-escaping="yes" select="./system-err"/>
+ </redirect:write>
+ </xsl:if>
+ <xsl:if test="@failures != 0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-fails.html">
+ <xsl:apply-templates select="." mode="class.details">
+ <xsl:with-param name="type" select="'fails'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+ </xsl:if>
+ <xsl:if test="@errors != 0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-errors.html">
+ <xsl:apply-templates select="." mode="class.details">
+ <xsl:with-param name="type" select="'errors'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+ </xsl:if>
+ </xsl:for-each>
</xsl:template>
<xsl:template name="index.html">
<html>
- <head>
- <title>JBoss Test Suite Results</title>
- </head>
- <frameset cols="20%,80%">
- <frameset rows="30%,70%">
- <frame src="overview-frame.html" name="packageListFrame"/>
- <frame src="allclasses-frame.html" name="classListFrame"/>
- </frameset>
- <frame src="overview-summary.html" name="classFrame"/>
- </frameset>
- <noframes>
- <h2>Frame Alert</h2>
- <p>
- This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
- </p>
- </noframes>
+ <head>
+ <title><xsl:value-of select="$TITLE"/></title>
+ </head>
+ <frameset cols="20%,80%">
+ <frameset rows="30%,70%">
+ <frame src="overview-frame.html" name="packageListFrame"/>
+ <frame src="allclasses-frame.html" name="classListFrame"/>
+ </frameset>
+ <frame src="overview-summary.html" name="classFrame"/>
+ <noframes>
+ <h2>Frame Alert</h2>
+ <p>
+ This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
+ </p>
+ </noframes>
+ </frameset>
</html>
</xsl:template>
-
<!-- this is the stylesheet css to use for nearly everything -->
<xsl:template name="stylesheet.css">
body {
- font:normal 68% verdana,arial,helvetica;
- color:#000000;
+ font:normal 68% verdana,arial,helvetica;
+ color:#000000;
}
-td {
- font-size: 68%
+table tr td, table tr th {
+ font-size: 68%;
}
+table.details tr th{
+ font-weight: bold;
+ text-align:left;
+ background:#a6caf0;
+}
+table.details tr td{
+ background:#eeeee0;
+}
+
p {
- line-height:1.5em;
- margin-top:0.5em; margin-bottom:1.0em;
+ line-height:1.5em;
+ margin-top:0.5em; margin-bottom:1.0em;
}
h1 {
- margin: 0px 0px 5px;
- font: 165% verdana,arial,helvetica
+ margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
}
h2 {
- margin-top: 1em;
- margin-bottom: 0.5em;
- font: bold 125% verdana,arial,helvetica
+ margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
}
h3 {
- margin-bottom: 0.5em;
- font: bold 115% verdana,arial,helvetica
+ margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
}
h4 {
- margin-bottom: 0.5em;
- font: bold 100% verdana,arial,helvetica
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
h5 {
- margin-bottom: 0.5em;
- font: bold 100% verdana,arial,helvetica
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
h6 {
- margin-bottom: 0.5em;
- font: bold 100% verdana,arial,helvetica
+ margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
}
.Error {
- font-weight:bold;
- color:#FFFFFF;
+ font-weight:bold; color:red;
}
.Failure {
- font-weight:bold;
- color:#FFFFFF;
+ font-weight:bold; color:purple;
}
-.ErrorDetail {
- font-weight:bold;
- color:#FF0000;
+.Properties {
+ text-align:right;
}
-.FailureDetail {
- font-weight:bold;
- color:#800080;
-}
-.Info {
- font-size: x-small
-}
+</xsl:template>
+<!-- Create list of all/failed/errored tests -->
+<xsl:template match="testsuites" mode="all.tests">
+ <xsl:param name="type" select="'all'"/>
+ <html>
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <xsl:text>All Failures</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <xsl:text>All Errors</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>All Tests</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <head>
+ <title>Unit Test Results: <xsl:value-of select="$title"/></title>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <xsl:attribute name="onload">open('allclasses-frame.html','classListFrame')</xsl:attribute>
+ <xsl:call-template name="pageHeader"/>
+ <h2><xsl:value-of select="$title"/></h2>
+
+ <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
+ <xsl:call-template name="testcase.test.header">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:call-template>
+ <!--
+ test can even not be started at all (failure to load the class)
+ so report the error directly
+ -->
+ <xsl:if test="./error">
+ <tr class="Error">
+ <td colspan="4">
+ <xsl:apply-templates select="./error"/>
+ </td>
+ </tr>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <xsl:apply-templates select=".//testcase[failure]" mode="print.test">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <xsl:apply-templates select=".//testcase[error]" mode="print.test">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select=".//testcase" mode="print.test">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </table>
+ </body>
+ </html>
</xsl:template>
@@ -200,37 +287,133 @@
testcase methods.
====================================================================== -->
<xsl:template match="testsuite" mode="class.details">
- <xsl:variable name="package.name" select="@package"/>
- <html>
- <head>
- <xsl:call-template name="create.stylesheet.link">
- <xsl:with-param name="package.name" select="$package.name"/>
- </xsl:call-template>
- </head>
- <body>
- <xsl:call-template name="pageHeader"/>
- <h3>Class <xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></h3>
+ <xsl:param name="type" select="'all'"/>
+ <xsl:variable name="package.name" select="@package"/>
+ <xsl:variable name="class.name"><xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></xsl:variable>
+ <html>
+ <head>
+ <title>Unit Test Results: <xsl:value-of select="$class.name"/></title>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name" select="$package.name"/>
+ </xsl:call-template>
+ <script type="text/javascript" language="JavaScript">
+ var TestCases = new Array();
+ var cur;
+ <xsl:apply-templates select="properties"/>
+ </script>
+ <script type="text/javascript" language="JavaScript"><![CDATA[
+ function displayProperties (name) {
+ var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
+ var doc = win.document;
+ doc.open();
+ doc.write("<html><head><title>Properties of " + name + "</title>");
+ doc.write("<style type=\"text/css\">");
+ doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }");
+ doc.write("table tr td, table tr th { font-size: 68%; }");
+ doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
+ doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
+ doc.write("table.properties td { font:normal; text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }");
+ doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }");
+ doc.write("</style>");
+ doc.write("</head><body>");
+ doc.write("<h3>Properties of " + name + "</h3>");
+ doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>");
+ doc.write("<table class='properties'>");
+ doc.write("<tr><th>Name</th><th>Value</th></tr>");
+ for (prop in TestCases[name]) {
+ doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>");
+ }
+ doc.write("</table>");
+ doc.write("</body></html>");
+ doc.close();
+ win.focus();
+ }
+ ]]>
+ </script>
+ </head>
+ <body>
+ <xsl:call-template name="pageHeader"/>
+ <h3>Class <xsl:value-of select="$class.name"/></h3>
-
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testsuite.test.header"/>
- <xsl:apply-templates select="." mode="print.test"/>
- </table>
-
- <h2>Tests</h2>
- <p>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testcase.test.header"/>
- <xsl:apply-templates select="./testcase" mode="print.test"/>
- </table>
-
- </p>
- <xsl:call-template name="pageFooter"/>
- </body>
- </html>
+
+ <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
+ <xsl:call-template name="testsuite.test.header"/>
+ <xsl:apply-templates select="." mode="print.test"/>
+ </table>
+
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <h2>Failures</h2>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <h2>Errors</h2>
+ </xsl:when>
+ <xsl:otherwise>
+ <h2>Tests</h2>
+ </xsl:otherwise>
+ </xsl:choose>
+ <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
+ <xsl:call-template name="testcase.test.header"/>
+ <!--
+ test can even not be started at all (failure to load the class)
+ so report the error directly
+ -->
+ <xsl:if test="./error">
+ <tr class="Error">
+ <td colspan="4"><xsl:apply-templates select="./error"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <xsl:apply-templates select="./testcase[failure]" mode="print.test"/>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <xsl:apply-templates select="./testcase[error]" mode="print.test"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="./testcase" mode="print.test"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </table>
+ <div class="Properties">
+ <a>
+ <xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
+ Properties »
+ </a>
+ </div>
+ <xsl:if test="string-length(./system-out)!=0">
+ <div class="Properties">
+ <a>
+ <xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-out.txt</xsl:attribute>
+ System.out »
+ </a>
+ </div>
+ </xsl:if>
+ <xsl:if test="string-length(./system-err)!=0">
+ <div class="Properties">
+ <a>
+ <xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-err.txt</xsl:attribute>
+ System.err »
+ </a>
+ </div>
+ </xsl:if>
+ </body>
+ </html>
</xsl:template>
+ <!--
+ Write properties into a JavaScript data structure.
+ This is based on the original idea by Erik Hatcher (ehatcher at apache.org)
+ -->
+ <xsl:template match="properties">
+ cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of select="../@name"/>'] = new Array();
+ <xsl:for-each select="property">
+ <xsl:sort select="@name"/>
+ cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>';
+ </xsl:for-each>
+ </xsl:template>
+
<!-- ======================================================================
This page is created for every package.
It prints the name of all classes that belongs to this package.
@@ -238,250 +421,245 @@
====================================================================== -->
<!-- list of classes in a package -->
<xsl:template name="classes.list">
- <xsl:param name="name"/>
- <html>
- <head>
- <xsl:call-template name="create.stylesheet.link">
- <xsl:with-param name="package.name" select="$name"/>
- </xsl:call-template>
- </head>
- <body>
- <table width="100%">
- <tr>
- <td nowrap="nowrap">
- <h2><a href="package-summary.html" target="classFrame"><xsl:value-of select="$name"/></a></h2>
- </td>
- </tr>
- </table>
-
- <h2>Classes</h2>
- <p>
- <table width="100%">
- <xsl:for-each select="/testsuites/testsuite[./@package = $name]">
- <xsl:sort select="@name"/>
- <tr>
- <td nowrap="nowrap">
- <a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </p>
- </body>
- </html>
+ <xsl:param name="name"/>
+ <html>
+ <head>
+ <title>Unit Test Classes: <xsl:value-of select="$name"/></title>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name" select="$name"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <table width="100%">
+ <tr>
+ <td nowrap="nowrap">
+ <h2><a href="package-summary.html" target="classFrame">
+ <xsl:value-of select="$name"/>
+ <xsl:if test="$name = ''"><none></xsl:if>
+ </a></h2>
+ </td>
+ </tr>
+ </table>
+
+ <h2>Classes</h2>
+ <table width="100%">
+ <xsl:for-each select="/testsuites/testsuite[./@package = $name]">
+ <xsl:sort select="@name"/>
+ <tr>
+ <td nowrap="nowrap">
+ <a href="{@id}_{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </body>
+ </html>
</xsl:template>
<!--
- Creates an all-classes.html file that contains a link to all package-summary.html
- on each class.
+ Creates an all-classes.html file that contains a link to all package-summary.html
+ on each class.
-->
<xsl:template match="testsuites" mode="all.classes">
- <html>
- <head>
- <xsl:call-template name="create.stylesheet.link">
- <xsl:with-param name="package.name"/>
- </xsl:call-template>
- </head>
- <body>
- <h2>Classes</h2>
- <p>
- <table width="100%">
- <xsl:apply-templates select="testsuite" mode="all.classes">
- <xsl:sort select="@name"/>
- </xsl:apply-templates>
- </table>
- </p>
- </body>
- </html>
+ <html>
+ <head>
+ <title>All Unit Test Classes</title>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <h2>Classes</h2>
+ <table width="100%">
+ <xsl:apply-templates select="testsuite" mode="all.classes">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </table>
+ </body>
+ </html>
</xsl:template>
<xsl:template match="testsuite" mode="all.classes">
- <!-- (ancestor::package)[last()] is buggy in MSXML3, fixed in SP1? -->
- <xsl:variable name="package.name" select="@package"/>
- <tr>
- <td nowrap="nowrap">
- <a target="classFrame">
- <xsl:attribute name="href">
- <xsl:if test="not($package.name='')">
- <xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text>
- </xsl:if><xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
- </xsl:attribute>
- <xsl:value-of select="@name"/>
- </a>
- </td>
- </tr>
+ <xsl:variable name="package.name" select="@package"/>
+ <tr>
+ <td nowrap="nowrap">
+ <a target="classFrame">
+ <xsl:attribute name="href">
+ <xsl:if test="not($package.name='')">
+ <xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text>
+ </xsl:if><xsl:value-of select="@id"/>_<xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </a>
+ </td>
+ </tr>
</xsl:template>
<!--
- Creates an html file that contains a link to all package-summary.html files on
- each package existing on testsuites.
- @bug there will be a problem here, I don't know yet how to handle unnamed package :(
+ Creates an html file that contains a link to all package-summary.html files on
+ each package existing on testsuites.
+ @bug there will be a problem here, I don't know yet how to handle unnamed package :(
-->
<xsl:template match="testsuites" mode="all.packages">
- <html>
- <head>
- <xsl:call-template name="create.stylesheet.link">
- <xsl:with-param name="package.name"/>
- </xsl:call-template>
- </head>
- <body>
- <h2><a href="overview-summary.html" target="classFrame">Home</a></h2>
- <h2>Packages</h2>
- <p>
+ <html>
+ <head>
+ <title>All Unit Test Packages</title>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <h2><a href="overview-summary.html" target="classFrame">Home</a></h2>
+ <h2>Packages</h2>
<table width="100%">
- <xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
- <xsl:sort select="@package"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
+ <xsl:sort select="@package"/>
+ </xsl:apply-templates>
</table>
- </p>
- </body>
- </html>
+ </body>
+ </html>
</xsl:template>
<xsl:template match="testsuite" mode="all.packages">
- <tr>
- <td nowrap="nowrap">
- <a href="{translate(@package,'.','/')}/package-summary.html" target="classFrame">
- <xsl:value-of select="@package"/>
- </a>
- </td>
- </tr>
+ <tr>
+ <td nowrap="nowrap">
+ <a href="./{translate(@package,'.','/')}/package-summary.html" target="classFrame">
+ <xsl:value-of select="@package"/>
+ <xsl:if test="@package = ''"><none></xsl:if>
+ </a>
+ </td>
+ </tr>
</xsl:template>
<xsl:template match="testsuites" mode="overview.packages">
- <html>
- <head>
- <xsl:call-template name="create.stylesheet.link">
- <xsl:with-param name="package.name"/>
- </xsl:call-template>
- </head>
- <body>
- <xsl:call-template name="pageHeader"/>
- <h2>Summary</h2>
- <xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
- <xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
- <xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
- <xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
- <xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
- <tr bgcolor="#A6CAF0" valign="top">
- <td><strong>Tests</strong></td>
- <td><strong>Failures</strong></td>
- <td><strong>Errors</strong></td>
- <td><strong>Success rate</strong></td>
- <td><strong>Time</strong></td>
- </tr>
- <tr bgcolor="#FFEBCD" valign="top">
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="$errorCount > 0">ErrorDetail</xsl:when>
- <xsl:when test="$failureCount > 0">FailureDetail</xsl:when>
- <xsl:otherwise>Pass</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td><xsl:value-of select="$testCount"/></td>
- <td><xsl:value-of select="$failureCount"/></td>
- <td><xsl:value-of select="$errorCount"/></td>
- <td>
- <xsl:call-template name="display-percent">
- <xsl:with-param name="value" select="$successRate"/>
+ <html>
+ <head>
+ <title>Unit Test Results: Summary</title>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name"/>
</xsl:call-template>
- </td>
- <td>
- <xsl:call-template name="display-time">
- <xsl:with-param name="value" select="$timeCount"/>
- </xsl:call-template>
- </td>
+ </head>
+ <body>
+ <xsl:attribute name="onload">open('allclasses-frame.html','classListFrame')</xsl:attribute>
+ <xsl:call-template name="pageHeader"/>
+ <h2>Summary</h2>
+ <xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
+ <xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
+ <xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
+ <xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
+ <xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
+ <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
+ <tr valign="top">
+ <th>Tests</th>
+ <th>Failures</th>
+ <th>Errors</th>
+ <th>Success rate</th>
+ <th>Time</th>
+ </tr>
+ <tr valign="top">
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="$errorCount > 0">Error</xsl:when>
+ <xsl:when test="$failureCount > 0">Failure</xsl:when>
+ <xsl:otherwise>Pass</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td><a title="Display all tests" href="all-tests.html"><xsl:value-of select="$testCount"/></a></td>
+ <td><a title="Display all failures" href="alltests-fails.html"><xsl:value-of select="$failureCount"/></a></td>
+ <td><a title="Display all errors" href="alltests-errors.html"><xsl:value-of select="$errorCount"/></a></td>
+ <td>
+ <xsl:call-template name="display-percent">
+ <xsl:with-param name="value" select="$successRate"/>
+ </xsl:call-template>
+ </td>
+ <td>
+ <xsl:call-template name="display-time">
+ <xsl:with-param name="value" select="$timeCount"/>
+ </xsl:call-template>
+ </td>
+ </tr>
+ </table>
+ <table border="0" width="95%">
+ <tr>
+ <td style="text-align: justify;">
+ Note: <em>failures</em> are anticipated and checked for with assertions while <em>errors</em> are unanticipated.
+ </td>
+ </tr>
+ </table>
- </tr>
- </table>
- <table border="0" width="95%">
- <tr>
- <td style="text-align: justify;">
- Note: <em>failures</em> are anticipated and checked for with assertions while <em>errors</em> are unanticipated.
- </td>
- </tr>
- </table>
-
- <h2>Packages</h2>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testsuite.test.header"/>
- <xsl:for-each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
- <xsl:sort select="@package" order="ascending"/>
- <!-- get the node set containing all testsuites that have the same package -->
- <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/>
- <tr bgcolor="#FFEBCD" valign="top">
- <xsl:if test='sum($insamepackage/@errors)!=0 or sum($insamepackage/@failures)!=0'><xsl:attribute name='bgcolor'>#FF0000</xsl:attribute>
- </xsl:if>
-
- <!-- display a failure if there is any failure/error in the package -->
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="sum($insamepackage/@errors) > 0">Error</xsl:when>
- <xsl:when test="sum($insamepackage/@failures) > 0">Failure</xsl:when>
- <xsl:otherwise>Pass</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td><a href="{translate(@package,'.','/')}/package-summary.html">
- <font color='#000000'>
- <xsl:if test='sum($insamepackage/@errors)!=0 or
- sum($insamepackage/@failures)!=0'>
- <xsl:attribute name='color'>#FFFFFF</xsl:attribute>
- </xsl:if>
- <xsl:value-of select="@package"/></font></a></td>
- <td><xsl:value-of select="sum($insamepackage/@tests)"/></td>
- <td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
- <td><xsl:value-of select="sum($insamepackage/@failures)"/></td>
- <td>
- <xsl:call-template name="display-time">
- <xsl:with-param name="value" select="sum($insamepackage/@time)"/>
- </xsl:call-template>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- <xsl:call-template name="pageFooter"/>
- </body>
- </html>
+ <h2>Packages</h2>
+ <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
+ <xsl:call-template name="testsuite.test.header"/>
+ <xsl:for-each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
+ <xsl:sort select="@package" order="ascending"/>
+ <!-- get the node set containing all testsuites that have the same package -->
+ <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/>
+ <tr valign="top">
+ <!-- display a failure if there is any failure/error in the package -->
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="sum($insamepackage/@errors) > 0">Error</xsl:when>
+ <xsl:when test="sum($insamepackage/@failures) > 0">Failure</xsl:when>
+ <xsl:otherwise>Pass</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td><a href="./{translate(@package,'.','/')}/package-summary.html">
+ <xsl:value-of select="@package"/>
+ <xsl:if test="@package = ''"><none></xsl:if>
+ </a></td>
+ <td><xsl:value-of select="sum($insamepackage/@tests)"/></td>
+ <td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
+ <td><xsl:value-of select="sum($insamepackage/@failures)"/></td>
+ <td>
+ <xsl:call-template name="display-time">
+ <xsl:with-param name="value" select="sum($insamepackage/@time)"/>
+ </xsl:call-template>
+ </td>
+ <td><xsl:value-of select="$insamepackage/@timestamp"/></td>
+ <td><xsl:value-of select="$insamepackage/@hostname"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </body>
+ </html>
</xsl:template>
<xsl:template name="package.summary">
- <xsl:param name="name"/>
- <html>
- <head>
- <xsl:call-template name="create.stylesheet.link">
- <xsl:with-param name="package.name" select="$name"/>
- </xsl:call-template>
- </head>
- <body>
- <xsl:attribute name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
- <xsl:call-template name="pageHeader"/>
- <h3>Package <xsl:value-of select="$name"/></h3>
-
- <!--table border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="class.metrics.header"/>
- <xsl:apply-templates select="." mode="print.metrics"/>
- </table-->
-
- <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = $name]"/>
- <xsl:if test="count($insamepackage) > 0">
- <h2>Classes</h2>
- <p>
- <table border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testsuite.test.header"/>
- <xsl:apply-templates select="$insamepackage" mode="print.test">
- <xsl:sort select="@name"/>
- </xsl:apply-templates>
- </table>
- </p>
- </xsl:if>
- <xsl:call-template name="pageFooter"/>
- </body>
- </html>
+ <xsl:param name="name"/>
+ <html>
+ <head>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name" select="$name"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <xsl:attribute name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
+ <xsl:call-template name="pageHeader"/>
+ <h3>Package <xsl:value-of select="$name"/></h3>
+
+ <!--table border="0" cellpadding="5" cellspacing="2" width="95%">
+ <xsl:call-template name="class.metrics.header"/>
+ <xsl:apply-templates select="." mode="print.metrics"/>
+ </table-->
+
+ <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = $name]"/>
+ <xsl:if test="count($insamepackage) > 0">
+ <h2>Classes</h2>
+ <p>
+ <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
+ <xsl:call-template name="testsuite.test.header"/>
+ <xsl:apply-templates select="$insamepackage" mode="print.test">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </table>
+ </p>
+ </xsl:if>
+ </body>
+ </html>
</xsl:template>
@@ -490,140 +668,153 @@
@param path the path to transform into a descending directory path
-->
<xsl:template name="path">
- <xsl:param name="path"/>
- <xsl:if test="contains($path,'.')">
- <xsl:text>../</xsl:text>
- <xsl:call-template name="path">
- <xsl:with-param name="path"><xsl:value-of select="substring-after($path,'.')"/></xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="not(contains($path,'.')) and not($path = '')">
- <xsl:text>../</xsl:text>
- </xsl:if>
+ <xsl:param name="path"/>
+ <xsl:if test="contains($path,'.')">
+ <xsl:text>../</xsl:text>
+ <xsl:call-template name="path">
+ <xsl:with-param name="path"><xsl:value-of select="substring-after($path,'.')"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not(contains($path,'.')) and not($path = '')">
+ <xsl:text>../</xsl:text>
+ </xsl:if>
</xsl:template>
<!-- create the link to the stylesheet based on the package name -->
<xsl:template name="create.stylesheet.link">
- <xsl:param name="package.name"/>
- <link rel="stylesheet" type="text/css" title="Style"><xsl:attribute name="href"><xsl:if test="not($package.name = 'unnamed package')"><xsl:call-template name="path"><xsl:with-param name="path" select="$package.name"/></xsl:call-template></xsl:if>stylesheet.css</xsl:attribute></link>
+ <xsl:param name="package.name"/>
+ <link rel="stylesheet" type="text/css" title="Style"><xsl:attribute name="href"><xsl:if test="not($package.name = 'unnamed package')"><xsl:call-template name="path"><xsl:with-param name="path" select="$package.name"/></xsl:call-template></xsl:if>stylesheet.css</xsl:attribute></link>
</xsl:template>
<!-- Page HEADER -->
<xsl:template name="pageHeader">
- <h1>Unit Test Results</h1>
- <table width="100%">
- <tr>
- <td align="left"></td>
- <td align="right">Designed for use with <a href='http://www.junit.org'>JUnit</a> and <a href='http://jakarta.apache.org'>Ant</a>.
- Generated on <xsl:value-of select="$TODAY"/>.
- </td>
- </tr>
- </table>
- <hr size="1"/>
+ <h1><xsl:value-of select="$TITLE"/></h1>
+ <table width="100%">
+ <tr>
+ <td align="left"></td>
+ <td align="right">Designed for use with <a href="http://www.junit.org/">JUnit</a> and <a href="http://ant.apache.org/">Ant</a>.</td>
+ </tr>
+ </table>
+ <hr size="1"/>
</xsl:template>
-<!-- Page FOOTER -->
-<xsl:template name="pageFooter">
- <p/>
- <hr size="1"/>
- <p/>
- <table class="Info">
- <tr>
- <td>Java Version</td><td><xsl:value-of select="$java.version"/></td>
- </tr><tr>
- <td>Java Vendor</td><td><xsl:value-of select="$java.vendor"/></td>
- </tr><tr>
- <td>Java VM Name</td><td><xsl:value-of select="$java.vm.name"/></td>
- </tr><tr>
- <td>Java VM Version</td><td><xsl:value-of select="$java.vm.version"/></td>
- </tr><tr>
- <td>Java VM Info</td><td><xsl:value-of select="$java.vm.info"/></td>
- </tr><tr>
- <td>OS Name</td><td><xsl:value-of select="$os.name"/></td>
- </tr><tr>
- <td>OS Version</td><td><xsl:value-of select="$os.version"/></td>
- </tr><tr>
- <td>OS Arch</td><td><xsl:value-of select="$os.arch"/></td>
- </tr>
- </table>
-</xsl:template>
-
<!-- class header -->
<xsl:template name="testsuite.test.header">
- <tr bgcolor="#A6CAF0" valign="top">
- <td width="80%"><strong>Name</strong></td>
- <td><strong>Tests</strong></td>
- <td><strong>Errors</strong></td>
- <td><strong>Failures</strong></td>
- <td nowrap="nowrap"><strong>Time(s)</strong></td>
- </tr>
+ <tr valign="top">
+ <th width="80%">Name</th>
+ <th>Tests</th>
+ <th>Errors</th>
+ <th>Failures</th>
+ <th nowrap="nowrap">Time(s)</th>
+ <th nowrap="nowrap">Time Stamp</th>
+ <th>Host</th>
+ </tr>
</xsl:template>
<!-- method header -->
<xsl:template name="testcase.test.header">
- <tr bgcolor="#A6CAF0" valign="top">
- <td><strong>Name</strong></td>
- <td><strong>Status</strong></td>
- <td width="80%"><strong>Type</strong></td>
- <td nowrap="nowrap"><strong>Time(s)</strong></td>
- </tr>
+ <xsl:param name="show.class" select="''"/>
+ <tr valign="top">
+ <xsl:if test="boolean($show.class)">
+ <th>Class</th>
+ </xsl:if>
+ <th>Name</th>
+ <th>Status</th>
+ <th width="80%">Type</th>
+ <th nowrap="nowrap">Time(s)</th>
+ </tr>
</xsl:template>
<!-- class information -->
<xsl:template match="testsuite" mode="print.test">
- <tr bgcolor="#FFEBCD" valign="top">
- <xsl:if test='@errors!=0 or @failures!=0'><xsl:attribute name='bgcolor'>#FF0000</xsl:attribute>
- </xsl:if>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@errors[.> 0]">Error</xsl:when>
- <xsl:when test="@failures[.> 0]">Failure</xsl:when>
- <xsl:otherwise>Pass</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td><a href="{@name}.html"><xsl:value-of select="@name"/></a></td>
- <td><xsl:apply-templates select="@tests"/></td>
- <td><xsl:apply-templates select="@errors"/></td>
- <td><xsl:apply-templates select="@failures"/></td>
- <td><xsl:call-template name="display-time">
- <xsl:with-param name="value" select="@time"/>
- </xsl:call-template>
+ <tr valign="top">
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@errors[.> 0]">Error</xsl:when>
+ <xsl:when test="@failures[.> 0]">Failure</xsl:when>
+ <xsl:otherwise>Pass</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td><a title="Display all tests" href="{@id}_{@name}.html"><xsl:value-of select="@name"/></a></td>
+ <td><a title="Display all tests" href="{@id}_{@name}.html"><xsl:apply-templates select="@tests"/></a></td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@errors != 0">
+ <a title="Display only errors" href="{@id}_{@name}-errors.html"><xsl:apply-templates select="@errors"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="@errors"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@failures != 0">
+ <a title="Display only failures" href="{@id}_{@name}-fails.html"><xsl:apply-templates select="@failures"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="@failures"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td><xsl:call-template name="display-time">
+ <xsl:with-param name="value" select="@time"/>
+ </xsl:call-template>
</td>
- </tr>
+ <td><xsl:apply-templates select="@timestamp"/></td>
+ <td><xsl:apply-templates select="@hostname"/></td>
+ </tr>
</xsl:template>
<xsl:template match="testcase" mode="print.test">
- <tr bgcolor="#FFEBCD" valign="top">
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="error">ErrorDetail</xsl:when>
- <xsl:when test="failure">FailureDetail</xsl:when>
- <xsl:otherwise>TableRowColor</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td><xsl:value-of select="@name"/></td>
- <xsl:choose>
- <xsl:when test="failure">
- <td>Failure</td>
- <td><xsl:apply-templates select="failure"/></td>
- </xsl:when>
- <xsl:when test="error">
- <td>Error</td>
- <td><xsl:apply-templates select="error"/></td>
- </xsl:when>
- <xsl:otherwise>
- <td>Success</td>
- <td></td>
- </xsl:otherwise>
- </xsl:choose>
- <td>
- <xsl:call-template name="display-time">
+ <xsl:param name="show.class" select="''"/>
+ <tr valign="top">
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="error">Error</xsl:when>
+ <xsl:when test="failure">Failure</xsl:when>
+ <xsl:otherwise>TableRowColor</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:variable name="class.href">
+ <xsl:value-of select="concat(translate(../@package,'.','/'), '/', ../@id, '_', ../@name, '.html')"/>
+ </xsl:variable>
+ <xsl:if test="boolean($show.class)">
+ <td><a href="{$class.href}"><xsl:value-of select="../@name"/></a></td>
+ </xsl:if>
+ <td>
+ <a name="{@name}"/>
+ <xsl:choose>
+ <xsl:when test="boolean($show.class)">
+ <a href="{concat($class.href, '#', @name)}"><xsl:value-of select="@name"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <xsl:choose>
+ <xsl:when test="failure">
+ <td>Failure</td>
+ <td><xsl:apply-templates select="failure"/></td>
+ </xsl:when>
+ <xsl:when test="error">
+ <td>Error</td>
+ <td><xsl:apply-templates select="error"/></td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>Success</td>
+ <td></td>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td>
+ <xsl:call-template name="display-time">
<xsl:with-param name="value" select="@time"/>
- </xsl:call-template>
- </td>
+ </xsl:call-template>
+ </td>
</tr>
</xsl:template>
@@ -631,62 +822,56 @@
<!-- Note : the below template error and failure are the same style
so just call the same style store in the toolkit template -->
<xsl:template match="failure">
- <xsl:call-template name="display-failures"/>
+ <xsl:call-template name="display-failures"/>
</xsl:template>
<xsl:template match="error">
- <xsl:call-template name="display-failures"/>
+ <xsl:call-template name="display-failures"/>
</xsl:template>
<!-- Style for the error and failure in the testcase template -->
<xsl:template name="display-failures">
- <xsl:choose>
- <xsl:when test="not(@message)">N/A</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@message"/>
- </xsl:otherwise>
- </xsl:choose>
- <!-- display the stacktrace. Disabled since it can cause stack overflow
- and is slow
- <code>
- <p/>
- <xsl:call-template name="br-replace">
- <xsl:with-param name="word" select="."/>
- </xsl:call-template>
- </code>
- -->
- <pre><xsl:value-of select="."/>
- </pre>
+ <xsl:choose>
+ <xsl:when test="not(@message)">N/A</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@message"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- display the stacktrace -->
+ <br/><br/>
+ <code>
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word" select="."/>
+ </xsl:call-template>
+ </code>
+ <!-- the latter is better but might be problematic for non-21" monitors... -->
+ <!--pre><xsl:value-of select="."/></pre-->
</xsl:template>
+<xsl:template name="JS-escape">
+ <xsl:param name="string"/>
+ <xsl:param name="tmp1" select="stringutils:replace(string($string),'\','\\')"/>
+ <xsl:param name="tmp2" select="stringutils:replace(string($tmp1),"'","\'")"/>
+ <xsl:value-of select="$tmp2"/>
+</xsl:template>
+
+
<!--
- template that will convert a carriage return into a br tag
- @param word the text from which to convert CR to BR tag
+ template that will convert a carriage return into a br tag
+ @param word the text from which to convert CR to BR tag
-->
<xsl:template name="br-replace">
- <xsl:param name="word"/>
- <xsl:choose>
- <xsl:when test="contains($word,'
')">
- <xsl:value-of select="substring-before($word,'
')"/>
- <br/>
- <xsl:call-template name="br-replace">
- <xsl:with-param name="word" select="substring-after($word,'
')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$word"/>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:param name="word"/>
+ <xsl:value-of disable-output-escaping="yes" select='stringutils:replace(string($word),"
","<br/>")'/>
</xsl:template>
<xsl:template name="display-time">
- <xsl:param name="value"/>
- <xsl:value-of select="format-number($value,'0.000')"/>
+ <xsl:param name="value"/>
+ <xsl:value-of select="format-number($value,'0.000')"/>
</xsl:template>
<xsl:template name="display-percent">
- <xsl:param name="value"/>
- <xsl:value-of select="format-number($value,'0.00%')"/>
+ <xsl:param name="value"/>
+ <xsl:value-of select="format-number($value,'0.00%')"/>
</xsl:template>
</xsl:stylesheet>
-
Deleted: branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/shortXmlSummary.xsl
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/shortXmlSummary.xsl 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/shortXmlSummary.xsl 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,69 +0,0 @@
-<?xml version='1.0'?>
-
-<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
-<xsl:param name="thedate"/>
-<xsl:param name="java_version"/>
-<xsl:param name="java_vendor"/>
-<xsl:param name="java_vm_specification_version"/>
-<xsl:param name="java_vm_version"/>
-<xsl:param name="java_vm_name"/>
-<xsl:param name="java_vm_info"/>
-<xsl:param name="java_specification_version"/>
-<xsl:param name="java_class_version"/>
-<xsl:param name="os_name"/>
-<xsl:param name="os_arch"/>
-<xsl:param name="os_version"/>
-
-<xsl:output method='xml'/>
-
-<xsl:template match='/'>
-
-<xsl:variable name="numberOfTests" select="sum(//@tests)"/>
-<xsl:variable name="numberOfErrors" select="sum(//@errors)"/>
-<xsl:variable name="numberOfFailures" select="sum(//@failures)"/>
-<xsl:variable name="numberOfSuccesses" select="$numberOfTests - $numberOfErrors - $numberOfFailures"/>
-
-<testsuitesummary>
-
-<testsuite>
-
- <time-of-test> <xsl:value-of select="$thedate"/> </time-of-test>
-
- <jdk-vendor> <xsl:value-of select="$java_vendor"/> </jdk-vendor>
-
- <jdk-version> <xsl:value-of select="$java_version"/> </jdk-version>
-
- <jvm-vm-spec-version> <xsl:value-of select="$java_vm_specification_version"/> </jvm-vm-spec-version>
-
- <jvm-name> <xsl:value-of select="$java_vm_name"/> </jvm-name>
-
- <jvm-version> <xsl:value-of select="$java_vm_version"/> </jvm-version>
-
- <jvm-info> <xsl:value-of select="$java_vm_info"/> </jvm-info>
-
- <java-spec-version> <xsl:value-of select="$java_specification_version"/> </java-spec-version>
-
- <java-class-version> <xsl:value-of select="$java_class_version"/> </java-class-version>
-
- <os-name> <xsl:value-of select="$os_name"/> </os-name>
-
- <os-arch> <xsl:value-of select="$os_arch"/> </os-arch>
-
- <os-version> <xsl:value-of select="$os_version"/> </os-version>
-
- <tests> <xsl:value-of select="$numberOfTests"/> </tests>
-
- <successes> <xsl:value-of select="$numberOfSuccesses"/> </successes>
-
- <errors> <xsl:value-of select="$numberOfErrors"/> </errors>
-
- <failures> <xsl:value-of select="$numberOfFailures"/> </failures>
-
-</testsuite>
-
-</testsuitesummary>
-
-</xsl:template>
-
-</xsl:stylesheet>
Deleted: branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1.xsl
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1.xsl 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1.xsl 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,85 +0,0 @@
-<?xml version='1.0'?>
-
-<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
-<xsl:param name="thedate"/>
-<xsl:param name="java_version"/>
-<xsl:param name="java_vendor"/>
-<xsl:param name="java_vm_version"/>
-<xsl:param name="java_vm_name"/>
-<xsl:param name="java_vm_info"/>
-<xsl:param name="os_name"/>
-<xsl:param name="os_arch"/>
-<xsl:param name="os_version"/>
-
-
-<xsl:output method='text'/>
-
-<xsl:template match='/'>
-
-<xsl:variable name="numberOfTests" select="sum(//@tests)"/>
-<xsl:variable name="numberOfErrors" select="sum(//@errors)"/>
-<xsl:variable name="numberOfFailures" select="sum(//@failures)"/>
-<xsl:variable name="numberOfSuccesses" select="$numberOfTests - $numberOfErrors - $numberOfFailures"/>
-
-JBoss daily test results
-
-SUMMARY
-
-Number of tests run: <xsl:value-of select="$numberOfTests"/>
-
---------------------------------------------
-
-Successful tests: <xsl:value-of select="$numberOfSuccesses"/>
-
-Errors: <xsl:value-of select="$numberOfErrors"/>
-
-Failures: <xsl:value-of select="$numberOfFailures"/>
-
---------------------------------------------
-
-
-
-[time of test: <xsl:value-of select="$thedate"/> GMT]
-[java.version: <xsl:value-of select="$java_version"/>]
-[java.vendor: <xsl:value-of select="$java_vendor"/>]
-[java.vm.version: <xsl:value-of select="$java_vm_version"/>]
-[java.vm.name: <xsl:value-of select="$java_vm_name"/>]
-[java.vm.info: <xsl:value-of select="$java_vm_info"/>]
-[os.name: <xsl:value-of select="$os_name"/>]
-[os.arch: <xsl:value-of select="$os_arch"/>]
-[os.version: <xsl:value-of select="$os_version"/>]
-
-See http://lubega.com for full details
-
-NOTE: If there are any errors shown above - this mail is only highlighting
-them - it is NOT indicating that they are being looked at by anyone.
-
-It is assumed that whoever makes change(s) to jboss that
-break the test will be fixing the test or jboss, as appropriate!
-
---------------------------------------------
-
-<xsl:if test='$numberOfFailures!=0 or $numberOfErrors!=0'>
-
-DETAILS OF ERRORS
-
-<xsl:for-each select="//error | //failure">
-
-Suite: <xsl:value-of select="../../@name"/>
-Test: <xsl:value-of select="../@name"/>
-Type: <xsl:value-of select="name()"/>
-Exception: <xsl:value-of select="@type"/>
-Message: <xsl:value-of select="@message"/>
-Stack Trace:
-<xsl:value-of select="."/>
----------------------------------
-
-</xsl:for-each>
-
-</xsl:if>
-
-
-</xsl:template>
-
-</xsl:stylesheet>
Deleted: branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1a.xsl
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1a.xsl 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1a.xsl 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,72 +0,0 @@
-<?xml version='1.0'?>
-
-<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
-<xsl:param name="thedate"/>
-<xsl:param name="java_version"/>
-<xsl:param name="java_vendor"/>
-<xsl:param name="java_vm_version"/>
-<xsl:param name="java_vm_name"/>
-<xsl:param name="java_vm_info"/>
-<xsl:param name="os_name"/>
-<xsl:param name="os_arch"/>
-<xsl:param name="os_version"/>
-<xsl:param name="builduid"/>
-<xsl:param name="results_web"/>
-
-
-<xsl:output method='text'/>
-
-<xsl:template match='/'>
-<xsl:variable name="numberOfTests" select="sum(//@tests)"/>
-<xsl:variable name="numberOfErrors" select="sum(//@errors)"/>
-<xsl:variable name="numberOfFailures" select="sum(//@failures)"/>
-<xsl:variable name="numberOfSuccesses" select="$numberOfTests - $numberOfErrors - $numberOfFailures"/>
-Number of tests run: <xsl:value-of select="$numberOfTests"/>
-
---------------------------------------------
-
-Successful tests: <xsl:value-of select="$numberOfSuccesses"/>
-Errors: <xsl:value-of select="$numberOfErrors"/>
-Failures: <xsl:value-of select="$numberOfFailures"/>
-
---------------------------------------------
-
-[time of test: <xsl:value-of select="$thedate"/> GMT]
-[java.version: <xsl:value-of select="$java_version"/>]
-[java.vendor: <xsl:value-of select="$java_vendor"/>]
-[java.vm.version: <xsl:value-of select="$java_vm_version"/>]
-[java.vm.name: <xsl:value-of select="$java_vm_name"/>]
-[java.vm.info: <xsl:value-of select="$java_vm_info"/>]
-[os.name: <xsl:value-of select="$os_name"/>]
-[os.arch: <xsl:value-of select="$os_arch"/>]
-[os.version: <xsl:value-of select="$os_version"/>]
-
-Useful resources:
-
-- <xsl:value-of select="$results_web"/>/<xsl:value-of select="$builduid"/> for the junit report of this test.
-- <xsl:value-of select="$results_web"/>/<xsl:value-of select="$builduid"/>/logs/ for the logs for this test.
-
-NOTE: If there are any errors shown above - this mail is only highlighting
-them - it is NOT indicating that they are being looked at by anyone.
-Remember - if a test becomes broken after your changes - fix it or fix the test!
-
---------------------------------------------
-
-<xsl:if test='$numberOfFailures!=0 or $numberOfErrors!=0'>
-
-Oh dear - still got some errors!
-
-</xsl:if>
-
-<xsl:if test='$numberOfFailures=0 and $numberOfErrors=0'>
-
-HURRAY - everything worked!
-
-</xsl:if>
-
-Thanks for all your effort - we really do love you!
-
-</xsl:template>
-
-</xsl:stylesheet>
Deleted: branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1b.xsl
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1b.xsl 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary1b.xsl 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,89 +0,0 @@
-<?xml version='1.0'?>
-
-<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
-<xsl:param name="thedate"/>
-<xsl:param name="java_version"/>
-<xsl:param name="java_vendor"/>
-<xsl:param name="java_vm_version"/>
-<xsl:param name="java_vm_name"/>
-<xsl:param name="java_vm_info"/>
-<xsl:param name="os_name"/>
-<xsl:param name="os_arch"/>
-<xsl:param name="os_version"/>
-<xsl:param name="results_web"/>
-<xsl:param name="builduid"/>
-
-
-<xsl:output method='text'/>
-
-<xsl:template match='/'>
-
-<xsl:variable name="numberOfTests" select="sum(//@tests)"/>
-<xsl:variable name="numberOfErrors" select="sum(//@errors)"/>
-<xsl:variable name="numberOfFailures" select="sum(//@failures)"/>
-<xsl:variable name="numberOfSuccesses" select="$numberOfTests - $numberOfErrors - $numberOfFailures"/>
-
-JBoss daily test results
-
-SUMMARY
-
-Number of tests run: <xsl:value-of select="$numberOfTests"/>
-
---------------------------------------------
-
-Successful tests: <xsl:value-of select="$numberOfSuccesses"/>
-
-Errors: <xsl:value-of select="$numberOfErrors"/>
-
-Failures: <xsl:value-of select="$numberOfFailures"/>
-
---------------------------------------------
-
-
-
-[time of test: <xsl:value-of select="$thedate"/> GMT]
-[java.version: <xsl:value-of select="$java_version"/>]
-[java.vendor: <xsl:value-of select="$java_vendor"/>]
-[java.vm.version: <xsl:value-of select="$java_vm_version"/>]
-[java.vm.name: <xsl:value-of select="$java_vm_name"/>]
-[java.vm.info: <xsl:value-of select="$java_vm_info"/>]
-[os.name: <xsl:value-of select="$os_name"/>]
-[os.arch: <xsl:value-of select="$os_arch"/>]
-[os.version: <xsl:value-of select="$os_version"/>]
-
-Useful resources:
-
-- <xsl:value-of select="$results_web"/>/<xsl:value-of select="$builduid"/> for
-the junit report of this test.
-
-
-NOTE: If there are any errors shown above - this mail is only highlighting
-them - it is NOT indicating that they are being looked at by anyone.
-
-It is assumed that whoever makes change(s) to jboss that
-break the test will be fixing the test or jboss, as appropriate!
-
---------------------------------------------
-
-<xsl:if test='$numberOfFailures!=0 or $numberOfErrors!=0'>
-
-DETAILS OF ERRORS
-
-<xsl:for-each select="//error | //failure">
-
-Suite: <xsl:value-of select="../../@package"/>.<xsl:value-of select="../../@name"/>
-Test: <xsl:value-of select="../@name"/>
-Type: <xsl:value-of select="name()"/>
-Exception: <xsl:value-of select="@type"/>
-Message: <xsl:value-of select="@message"/>
----------------------------------
-
-</xsl:for-each>
-
-</xsl:if>
-
-
-</xsl:template>
-
-</xsl:stylesheet>
Deleted: branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary2.xsl
===================================================================
--- branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary2.xsl 2009-04-10 18:56:30 UTC (rev 6403)
+++ branches/Branch_Temp_Clebert_LargeMessage/tests/src/stylesheets/summary2.xsl 2009-04-10 18:58:34 UTC (rev 6404)
@@ -1,225 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
-<xsl:param name="thedate">undefined</xsl:param>
-
-<xsl:output method='html' indent='yes' doctype-public='-//W3C//DTD HTML 3.2 FINAL//EN'/>
-
-
-<xsl:template match="/">
-
-<xsl:variable name="numberOfTests" select="sum(//@tests)"/>
-<xsl:variable name="numberOfErrors" select="sum(//@errors)"/>
-<xsl:variable name="numberOfFailures" select="sum(//@failures)"/>
-<xsl:variable name="numberOfSuccesses" select="$numberOfTests - $numberOfErrors - $numberOfFailures"/>
-
-<html>
-<head>
-
-<META NAME="ROBOTS" CONTENT="ALL"/>
-<meta name="rating" content="Safe For Kids"/>
-
-<title>JBoss Test Results</title>
-</head>
-<body bgcolor='white'>
-
-<p/>
-
-<hr/>
-
-The results of the latest <a href='http://jboss.org'>JBoss</a> daily build
-and test results - make sure the JBoss Group do not let anything slip!
-<br/>
-
-<i>The tests are run around 2:30am GMT each day on <a href="http://lubega.com">lubega.com</a> - so expect the files to be
-empty/half complete around that time. Also, the tests are run using 3 JDKs - Sun, IBM and Blackdown. Only the last
-run is shown on this web page - follow the archives link for the earlier runs.</i>
-
-<p/>
-<b>Date of last successful run: <xsl:value-of select="$thedate"/> GMT</b>
-<ul>
- <li><a href='#tests'>Test Results</a></li>
- <li><a href='#javadocs'>Javadocs of the JBoss modules</a></li>
- <li><a href='#testlogs'>Test Logs</a></li>
- <li><a href='#links'>Useful Links</a></li>
- <li><a href='#source'>How tests were run</a></li>
-</ul>
-
-<hr/>
-
-<table width='100%' border='1'>
-<tr valign='top'><td>
-
-<a name='tests'/>
-
-<h3>Test Results</h3>
-
-
-<p/>
-
-What were the results?
-<ul>
- <li><a href='TEST-all-test-results.log'>summary of test results</a> - that is, whats in the email</li>
- <li><a href='TEST-all-test-results.xml'>all test results combined into one file</a></li>
- <li><a href='testarchive/?M=D'>archive</a> - the last months worth of results</li>
-</ul>
-
-
-</td><td>
-
-<table border='1'>
-
- <tr bgcolor='lightblue'>
- <th>Test Name</th>
- <th>Tests (<xsl:value-of select='$numberOfTests'/>)</th>
- <th>Successes (<xsl:value-of select='$numberOfSuccesses'/>)</th>
- <th>Failures (<xsl:value-of select='$numberOfFailures'/>)</th>
- <th>Errors (<xsl:value-of select='$numberOfErrors'/>)</th>
- <th>-</th>
- </tr>
-
- <xsl:for-each select="//testsuite">
- <xsl:sort select="@name"/>
- <tr>
- <td>
- <a><xsl:attribute name='href'>detailed-results.html#<xsl:value-of select='@name'/></xsl:attribute>
- <xsl:value-of select='@name'/>
- </a>
- (<a><xsl:attribute name='href'>TEST-<xsl:value-of select='@name'/>.xml</xsl:attribute>
- xml
- </a>)
- </td>
- <td bgcolor='yellow'>
- <xsl:if test='@failures!=0 or @errors!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute>
- </xsl:if>
- <a><xsl:attribute name='href'>detailed-results.html#<xsl:value-of select='@name'/></xsl:attribute>
- <xsl:value-of select='@tests'/>
- </a>
- </td>
- <td bgcolor='gold'>
- <a><xsl:attribute name='href'>detailed-results.html#<xsl:value-of select='@name'/></xsl:attribute>
- <xsl:value-of select='@tests - @errors - @failures'/>
- </a>
- </td>
- <td>
- <xsl:if test='@failures=0'><xsl:attribute name='bgcolor'>lightgreen</xsl:attribute></xsl:if>
- <xsl:if test='@failures!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute></xsl:if>
- <a><xsl:attribute name='href'>detailed-results.html#<xsl:value-of select='@name'/></xsl:attribute>
- <xsl:value-of select='@failures'/>
- </a>
- </td>
- <td>
- <xsl:if test='@errors=0'><xsl:attribute name='bgcolor'>lightgreen</xsl:attribute></xsl:if>
- <xsl:if test='@errors!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute></xsl:if>
- <a><xsl:attribute name='href'>detailed-results.html#<xsl:value-of select='@name'/></xsl:attribute>
- <xsl:value-of select='@errors'/>
- </a>
- </td>
- <td>
- <xsl:if test='@failures=0 and @errors=0'><xsl:attribute name='bgcolor'>lightgreen</xsl:attribute>passed!
- </xsl:if>
- <xsl:if test='@failures!=0 or @errors!=0'><xsl:attribute name='bgcolor'>red</xsl:attribute>failures!
- </xsl:if>
- </td>
- </tr>
- </xsl:for-each>
-
-</table>
-
-Environment Information:<br/>
-[java.version: <xsl:value-of select="$java_version"/>]
-[java.vendor: <xsl:value-of select="$java_vendor"/>]
-[java.vm.version: <xsl:value-of select="$java_vm_version"/>]
-[java.vm.name: <xsl:value-of select="$java_vm_name"/>]
-[java.vm.info: <xsl:value-of select="$java_vm_info"/>]
-[os.name: <xsl:value-of select="$os_name"/>]
-[os.arch: <xsl:value-of select="$os_arch"/>]
-[os.version: <xsl:value-of select="$os_version"/>]
-
-</td></tr><tr valign='top'><td>
-
-<a name='javadocs'/>
-
-<h3>Javadocs</h3>
-
-The following <b>javadocs</b> are available:
-<ul>
- <li><a href='jboss/build/docs/api/'>jboss</a></li>
- <li><a href='jbosssx/build/docs/api/'>jbosssx</a></li>
- <li><a href='jbosscx/build/docs/api/'>jbosscx</a></li>
- <li><a href='jbossmx/build/docs/api/'>jbossmx</a></li>
- <li><a href='jbosspool/build/docs/api/'>jbosspool (aka minerva)</a></li>
- <li><a href='jboss-j2ee/build/docs/api/'>jboss-j2ee</a></li>
- <li><a href='jbossmq/build/docs/api/'>jbossmq</a></li>
- <li><a href='zoap/build/docs/api/'>zoap</a></li>
- <li><a href='zola/ZOL/ZOL-2.0/docs/javadoc/'>zola</a></li>
- <li><a href='jbosstest/build/docs/api/'>jbosstest</a></li>
-</ul>
-
-</td><td>
-
-
-<a name='testlogs'/>
-
-<h3>Test Logs</h3>
-
-<a href='cronjob.log'>Overall log file for tests</a><p/>
-
-The jboss server logs:
-<ul>
- <li><a href='jboss/dist/log/server.log'>server.log</a></li>
- <li><a href='jboss/dist/log/trace.log'>trace.log</a></li>
-</ul>
-<p/>
-
-The test run log is <a href='jbosstest/src/build/cronjob_test.log'>here</a>
-
-</td></tr><tr valign='top'><td>
-
-
-<a name='links'/>
-
-<h3>Useful Links</h3>
-
-<ul>
- <li><a href='http://www.jboss.org'>JBoss</a></li>
- <li><a href='http://java.sun.com'>Sun and Java</a></li>
- <li><a href='http://java.sun.com/j2ee'>Sun and J2EE</a></li>
- <li><a href='http://www.theserverside.com'>News and Tips on Java on the Server</a></li>
-</ul>
-
-</td><td>
-
-
-<a name='source'/>
-
-<h3>Source to the scripts that run the tests</h3>
-
-How are these tests performed - using these scripts
-<ul>
- <li><a href='cronjob.sh'>cronjob.sh</a>
- <ul>
- <li><a href='cronjob_clean.sh'>cronjob_clean.sh</a></li>
- <li><a href='cronjob_build.sh'>cronjob_build.sh</a></li>
- <li><a href='cronjob_build.sh'>cronjob_javadocs.sh</a></li>
- <li><a href='cronjob_test.sh'>cronjob_test.sh</a></li>
- <li><a href='cronjob_setup.sh'>cronjob_setup.sh</a></li>
- <li><a href='cronjob_mail.sh'>cronjob_mail.sh</a></li>
- </ul>
- </li>
-</ul>
-
-</td></tr></table>
-
-<hr/>
-
-<font color='navy'>
-<i><a href='mailto:chris at kimptoc.net'>chris at kimptoc.net</a></i>
-</font>
-
-
-</body>
-</html>
-
-</xsl:template>
-</xsl:stylesheet>
-
More information about the jboss-cvs-commits
mailing list