these two modules moved outside of the activemq module into a top level sandbox module.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@452105 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-10-02 16:12:19 +00:00
parent 097a4183ed
commit 8f0490178b
154 changed files with 0 additions and 15663 deletions

View File

@ -1 +0,0 @@
This directory tree contains experimental source code which one day could be integrated into the main branch

View File

@ -1,21 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Build Properties
# -------------------------------------------------------------------
maven.multiproject.type=jar

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project>
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../etc/project.xml</extend>
<name>ActiveMQ :: Transport :: Jabber</name>
<id>activemq-transport-jabber</id>
<shortDescription>ActiveMQ Jabber Message Transport</shortDescription>
<description>ActiveMQ Jabber Message Transport</description>
<package>org.activemq.transport.jabber</package>
<packageGroups>
<packageGroup>
<title>Jabber Message Transport</title>
<packages>org.activemq.transport.jabber</packages>
</packageGroup>
</packageGroups>
<!-- ============ -->
<!-- Dependencies -->
<!-- ============ -->
<dependencies>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${pom.currentVersion}</version>
<properties>
<eclipse.dependency>true</eclipse.dependency>
</properties>
</dependency>
<dependency> <!-- Used for unit tests -->
<groupId>activemq</groupId>
<artifactId>activemq-core-test</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,193 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jabber;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.jms.JMSException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.activemq.io.AbstractWireFormat;
import org.activemq.io.WireFormat;
import org.activemq.message.ActiveMQBytesMessage;
import org.activemq.message.ActiveMQMessage;
import org.activemq.message.ActiveMQObjectMessage;
import org.activemq.message.ActiveMQTextMessage;
import org.activemq.message.Packet;
import org.activemq.io.util.ByteArray;
/**
* A wire format which uses XMPP format of messages
*
* @version $Revision: 1.1 $
*/
public class JabberWireFormat extends AbstractWireFormat {
private static final Log log = LogFactory.getLog(JabberWireFormat.class);
public WireFormat copy() {
return new JabberWireFormat();
}
public Packet readPacket(DataInput in) throws IOException {
return null; /** TODO */
}
public Packet readPacket(int firstByte, DataInput in) throws IOException {
return null; /** TODO */
}
public Packet writePacket(Packet packet, DataOutput out) throws IOException, JMSException {
switch (packet.getPacketType()) {
case Packet.ACTIVEMQ_MESSAGE:
writeMessage((ActiveMQMessage) packet, "", out);
break;
case Packet.ACTIVEMQ_TEXT_MESSAGE:
writeTextMessage((ActiveMQTextMessage) packet, out);
break;
case Packet.ACTIVEMQ_BYTES_MESSAGE:
writeBytesMessage((ActiveMQBytesMessage) packet, out);
break;
case Packet.ACTIVEMQ_OBJECT_MESSAGE:
writeObjectMessage((ActiveMQObjectMessage) packet, out);
break;
case Packet.ACTIVEMQ_MAP_MESSAGE:
case Packet.ACTIVEMQ_STREAM_MESSAGE:
case Packet.ACTIVEMQ_BROKER_INFO:
case Packet.ACTIVEMQ_CONNECTION_INFO:
case Packet.ACTIVEMQ_MSG_ACK:
case Packet.CONSUMER_INFO:
case Packet.DURABLE_UNSUBSCRIBE:
case Packet.INT_RESPONSE_RECEIPT_INFO:
case Packet.PRODUCER_INFO:
case Packet.RECEIPT_INFO:
case Packet.RESPONSE_RECEIPT_INFO:
case Packet.SESSION_INFO:
case Packet.TRANSACTION_INFO:
case Packet.XA_TRANSACTION_INFO:
default:
log.warn("Ignoring message type: " + packet.getPacketType() + " packet: " + packet);
}
return null;
}
/**
* Can this wireformat process packets of this version
* @param version the version number to test
* @return true if can accept the version
*/
public boolean canProcessWireFormatVersion(int version){
return true;
}
/**
* @return the current version of this wire format
*/
public int getCurrentWireFormatVersion(){
return 1;
}
// Implementation methods
//-------------------------------------------------------------------------
protected void writeObjectMessage(ActiveMQObjectMessage message, DataOutput out) throws JMSException, IOException {
Serializable object = message.getObject();
String text = (object != null) ? object.toString() : "";
writeMessage(message, text, out);
}
protected void writeTextMessage(ActiveMQTextMessage message, DataOutput out) throws JMSException, IOException {
writeMessage(message, message.getText(), out);
}
protected void writeBytesMessage(ActiveMQBytesMessage message, DataOutput out) throws IOException {
ByteArray data = message.getBodyAsBytes();
String text = encodeBinary(data.getBuf(),data.getOffset(),data.getLength());
writeMessage(message, text, out);
}
protected void writeMessage(ActiveMQMessage message, String body, DataOutput out) throws IOException {
String type = getXmppType(message);
StringBuffer buffer = new StringBuffer("<");
buffer.append(type);
buffer.append(" to='");
buffer.append(message.getJMSDestination().toString());
buffer.append("' from='");
buffer.append(message.getJMSReplyTo().toString());
String messageID = message.getJMSMessageID();
if (messageID != null) {
buffer.append("' id='");
buffer.append(messageID);
}
HashMap properties = message.getProperties();
if (properties != null) {
for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object value = entry.getValue();
if (value != null) {
buffer.append("' ");
buffer.append(key.toString());
buffer.append("='");
buffer.append(value.toString());
}
}
}
buffer.append("'>");
String id = message.getJMSCorrelationID();
if (id != null) {
buffer.append("<thread>");
buffer.append(id);
buffer.append("</thread>");
}
buffer.append(body);
buffer.append("</");
buffer.append(type);
buffer.append(">");
out.write(buffer.toString().getBytes());
}
protected String encodeBinary(byte[] data,int offset,int length) {
// TODO
throw new RuntimeException("Not implemented yet!");
}
protected String getXmppType(ActiveMQMessage message) {
String type = message.getJMSType();
if (type == null) {
type = "message";
}
return type;
}
}

View File

@ -1,50 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jabber;
import junit.framework.TestCase;
import org.activemq.io.WireFormat;
import org.activemq.message.ActiveMQTextMessage;
import org.activemq.message.ActiveMQTopic;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
/**
* @version $Revision: 1.1 $
*/
public class JabberWireFormatTest extends TestCase {
protected WireFormat format = new JabberWireFormat();
public void testWrite() throws Exception {
ActiveMQTextMessage message = new ActiveMQTextMessage();
message.setJMSType("id");
message.setJMSReplyTo(new ActiveMQTopic("my.source"));
message.setJMSDestination(new ActiveMQTopic("my.target"));
message.setJMSCorrelationID("abc123");
message.setText("<body>hello there </body>");
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(buffer);
format.writePacket(message, out);
out.close();
byte[] data = buffer.toByteArray();
System.out.println(new String(data));
}
}

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="" kind="src" path="src/java">
</classpathentry>
<classpathentry kind="src" path="src/conf">
</classpathentry>
<classpathentry output="bin" kind="src" path="src/test">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar">
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
</classpathentry>
<classpathentry kind="src" path="/activemq-core">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/activemq/jars/activemq-core-test-4.0-SNAPSHOT.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/jrms/jars/jrms-1.1.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.3.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-jms-1.1-rc4.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-jta-1.0.1B-rc4.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-j2ee-management-1.0-rc4.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-j2ee-jacc-1.0-rc4.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/backport-util-concurrent/jars/backport-util-concurrent-2.0_01_pd.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar">
</classpathentry>
<classpathentry kind="output" path="bin">
</classpathentry>
</classpath>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>activemq-transport-jrms</name>
<comment>ActiveMQ JRMS Message Transport</comment>
<projects>
<project>activemq-core</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,22 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Build Properties
# -------------------------------------------------------------------
maven.multiproject.type=jar
maven.eclipse.classpath.include=${basedir}/src/conf

View File

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project>
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../etc/project.xml</extend>
<name>ActiveMQ :: Transport :: JRMS</name>
<id>activemq-transport-jrms</id>
<shortDescription>ActiveMQ JRMS Message Transport</shortDescription>
<description>ActiveMQ JRMS Message Transport</description>
<package>org.activemq.transport.jrms</package>
<packageGroups>
<packageGroup>
<title>JRMS Message Transport</title>
<packages>org.activemq.transport.jrms</packages>
</packageGroup>
</packageGroups>
<!-- ============ -->
<!-- Dependencies -->
<!-- ============ -->
<dependencies>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${pom.currentVersion}</version>
<properties>
<eclipse.dependency>true</eclipse.dependency>
</properties>
</dependency>
<dependency> <!-- Used for unit tests -->
<groupId>activemq</groupId>
<artifactId>activemq-core-test</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>jrms</groupId>
<artifactId>jrms</artifactId>
<version>${jrms_version}</version>
</dependency>
</dependencies>
<build>
<nagEmailAddress>dev@activemq.codehaus.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<integrationUnitTestSourceDirectory/>
<aspectSourceDirectory/>
<unitTest>
<resources>
<resource>
<directory>src/test</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<includes>
<include>**/*Test.*</include>
</includes>
<excludes>
<!-- not sure why these tests fail -->
<exclude>**/jgroups/*Test.*</exclude>
</excludes>
</unitTest>
<resources>
<resource>
<directory>src/conf</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@ -1,241 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
import com.sun.multicast.reliable.RMException;
import com.sun.multicast.reliable.transport.RMPacketSocket;
import com.sun.multicast.reliable.transport.SessionDoneException;
import com.sun.multicast.reliable.transport.TransportProfile;
import com.sun.multicast.reliable.transport.lrmp.LRMPTransportProfile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.activemq.io.WireFormat;
import org.activemq.message.Packet;
import org.activemq.transport.TransportChannelSupport;
import org.activemq.util.IdGenerator;
import javax.jms.JMSException;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.URI;
/**
* A JRMS implementation of a TransportChannel
*
* @version $Revision$
*/
public class JRMSTransportChannel extends TransportChannelSupport implements Runnable {
private static final int SOCKET_BUFFER_SIZE = 32 * 1024;
private static final Log log = LogFactory.getLog(JRMSTransportChannel.class);
private WireFormat wireFormat;
private SynchronizedBoolean closed;
private SynchronizedBoolean started;
private Thread thread; //need to change this - and use a thread pool
// need to see our own messages
private RMPacketSocket socket;
private IdGenerator idGenerator;
private String channelId;
private int port;
private InetAddress inetAddress;
private Object lock;
/**
* Construct basic helpers
*/
protected JRMSTransportChannel(WireFormat wireFormat) {
this.wireFormat = wireFormat;
idGenerator = new IdGenerator();
channelId = idGenerator.generateId();
closed = new SynchronizedBoolean(false);
started = new SynchronizedBoolean(false);
lock = new Object();
}
/**
* Connect to a remote Node - e.g. a Broker
*
* @param remoteLocation
* @throws JMSException
*/
public JRMSTransportChannel(WireFormat wireFormat, URI remoteLocation) throws JMSException {
this(wireFormat);
try {
this.port = remoteLocation.getPort();
this.inetAddress = InetAddress.getByName(remoteLocation.getHost());
LRMPTransportProfile profile = new LRMPTransportProfile(inetAddress, port);
profile.setTTL((byte) 1);
profile.setOrdered(true);
this.socket = profile.createRMPacketSocket(TransportProfile.SEND_RECEIVE);
}
catch (Exception ioe) {
ioe.printStackTrace();
JMSException jmsEx = new JMSException("Initialization of JRMSTransportChannel failed: " + ioe);
jmsEx.setLinkedException(ioe);
throw jmsEx;
}
}
/**
* close the channel
*/
public void stop() {
if (closed.commit(false, true)) {
super.stop();
try {
socket.close();
}
catch (Exception e) {
log.trace(toString() + " now closed");
}
}
}
/**
* start listeneing for events
*
* @throws JMSException if an error occurs
*/
public void start() throws JMSException {
if (started.commit(false, true)) {
thread = new Thread(this, toString());
if (isServerSide()) {
thread.setDaemon(true);
}
thread.start();
}
}
/**
* Asynchronously send a Packet
*
* @param packet
* @throws JMSException
*/
public void asyncSend(Packet packet) throws JMSException {
try {
DatagramPacket dpacket = createDatagramPacket(packet);
// lets sync to avoid concurrent writes
//synchronized (lock) {
socket.send(dpacket);
//}
}
catch (RMException rme) {
JMSException jmsEx = new JMSException("syncSend failed " + rme.getMessage());
jmsEx.setLinkedException(rme);
throw jmsEx;
}
catch (IOException e) {
JMSException jmsEx = new JMSException("asyncSend failed " + e.getMessage());
jmsEx.setLinkedException(e);
throw jmsEx;
}
}
public boolean isMulticast() {
return true;
}
/**
* reads packets from a Socket
*/
public void run() {
try {
while (!closed.get()) {
DatagramPacket dpacket = socket.receive();
Packet packet = wireFormat.readPacket(channelId, dpacket);
if (packet != null) {
doConsumePacket(packet);
}
}
log.trace("The socket peer is now closed");
//doClose(new IOException("Socket peer is now closed"));
stop();
}
catch (SessionDoneException e) {
// this isn't really an exception, it just indicates
// that the socket has closed normally
log.trace("Session completed", e);
stop();
}
catch (RMException ste) {
doClose(ste);
}
catch (IOException e) {
doClose(e);
}
}
/**
* Can this wireformat process packets of this version
* @param version the version number to test
* @return true if can accept the version
*/
public boolean canProcessWireFormatVersion(int version){
return wireFormat.canProcessWireFormatVersion(version);
}
/**
* @return the current version of this wire format
*/
public int getCurrentWireFormatVersion(){
return wireFormat.getCurrentWireFormatVersion();
}
protected DatagramPacket createDatagramPacket() {
DatagramPacket answer = new DatagramPacket(new byte[SOCKET_BUFFER_SIZE], SOCKET_BUFFER_SIZE);
answer.setPort(port);
answer.setAddress(inetAddress);
return answer;
}
protected DatagramPacket createDatagramPacket(Packet packet) throws IOException, JMSException {
DatagramPacket answer = wireFormat.writePacket(channelId, packet);
answer.setPort(port);
answer.setAddress(inetAddress);
return answer;
}
private void doClose(Exception ex) {
if (!closed.get()) {
JMSException jmsEx = new JMSException("Error reading socket: " + ex);
jmsEx.setLinkedException(ex);
onAsyncException(jmsEx);
stop();
}
}
/**
* pretty print for object
*
* @return String representation of this object
*/
public String toString() {
return "JRMSTransportChannel: " + socket;
}
public void forceDisconnect() {
// TODO: implement me.
throw new RuntimeException("Not yet Implemented.");
}
}

View File

@ -1,64 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import org.activemq.io.WireFormat;
import org.activemq.transport.TransportChannel;
import org.activemq.transport.TransportChannelFactorySupport;
import javax.jms.JMSException;
import java.net.URI;
/**
* A JRMS implementation of a TransportChannelFactory
*
* @version $Revision$
*/
public class JRMSTransportChannelFactory extends TransportChannelFactorySupport {
/**
* Create a Channel to a remote Node - e.g. a Broker
*
* @param wireFormat
* @param remoteLocation
* @return the TransportChannel bound to the remote node
* @throws JMSException
*/
public TransportChannel create(WireFormat wireFormat, URI remoteLocation) throws JMSException {
return populateProperties(new JRMSTransportChannel(wireFormat, remoteLocation), remoteLocation);
}
/**
* Create a Channel to a remote Node - e.g. a Broker
*
* @param wireFormat
* @param remoteLocation
* @param localLocation -
* e.g. local InetAddress and local port
* @return the TransportChannel bound to the remote node
* @throws JMSException
*/
public TransportChannel create(WireFormat wireFormat, URI remoteLocation, URI localLocation) throws JMSException {
return create(wireFormat, remoteLocation);
}
public boolean requiresEmbeddedBroker() {
return true;
}
}

View File

@ -1,65 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.activemq.io.WireFormat;
import org.activemq.transport.TransportServerChannelSupport;
import javax.jms.JMSException;
import java.net.URI;
/**
* A JRMS implementation of TransportServerChannel
*
* @version $Revision$
*/
public class JRMSTransportServerChannel extends TransportServerChannelSupport {
private static final Log log = LogFactory.getLog(JRMSTransportServerChannel.class);
private SynchronizedBoolean started;
public JRMSTransportServerChannel(WireFormat wireFormat, URI bindAddr) {
super(bindAddr);
started = new SynchronizedBoolean(false);
}
/**
* start listeneing for events
*
* @throws JMSException if an error occurs
*/
public void start() throws JMSException {
if (started.commit(false, true)) {
log.info("JRMS ServerChannel at: " + getUrl());
}
}
/**
* @return pretty print of this
*/
public String toString() {
return "JRMSTransportServerChannel@" + getUrl();
}
}

View File

@ -1,46 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import org.activemq.io.WireFormat;
import org.activemq.transport.TransportServerChannel;
import org.activemq.transport.TransportServerChannelFactory;
import javax.jms.JMSException;
import java.net.URI;
/**
* A multicast implementation of a TransportServerChannelFactory
*
* @version $Revision$
*/
public class JRMSTransportServerChannelFactory implements TransportServerChannelFactory {
/**
* Bind a ServerChannel to an address
*
* @param wireFormat
* @param bindAddress
* @return the TransportChannel bound to the remote node
* @throws JMSException
*/
public TransportServerChannel create(WireFormat wireFormat, URI bindAddress) throws JMSException {
return new JRMSTransportServerChannel(wireFormat, bindAddress);
}
}

View File

@ -1,27 +0,0 @@
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
</head>
<body>
<p>
An implementation of the transport layer using Sun's reliable multicast library
</p>
</body>
</html>

View File

@ -1,31 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
/**
* @version $Revision$
*/
public class JRMSQueueSendReceiveTest extends JRMSTopicSendReceiveTest {
protected void setUp() throws Exception {
topic = false;
super.setUp();
}
}

View File

@ -1,31 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
/**
* @version $Revision$
*/
public class JRMSQueueSendReceiveTwoConnectionsTest extends JRMSTopicSendReceiveTwoConnectionsTest {
protected void setUp() throws Exception {
topic = false;
super.setUp();
}
}

View File

@ -1,34 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import org.activemq.ActiveMQConnectionFactory;
import org.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest;
/**
* @version $Revision$
*/
public class JRMSTopicSendReceiveTest extends JmsTopicSendReceiveWithTwoConnectionsTest {
protected ActiveMQConnectionFactory createConnectionFactory() {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL("jrms://224.1.2.3:5123");
return factory;
}
}

View File

@ -1,34 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import org.activemq.ActiveMQConnectionFactory;
import org.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest;
/**
* @version $Revision$
*/
public class JRMSTopicSendReceiveTwoConnectionsTest extends JmsTopicSendReceiveWithTwoConnectionsTest {
protected ActiveMQConnectionFactory createConnectionFactory() {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL("jrms://224.1.2.3:5123");
return factory;
}
}

View File

@ -1,42 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import junit.textui.TestRunner;
import org.activemq.transport.TransportChannelTestSupport;
/**
* @version $Revision$
*/
public class JRMSTransportChannelTest extends TransportChannelTestSupport {
public static void main(String[] args) {
TestRunner.run(JRMSTransportChannelTest.class);
}
public JRMSTransportChannelTest(String name) {
super(name);
}
protected void setUp() throws Exception {
createSenderAndReceiver("jrms://228.5.6.7:6677");
super.setUp();
}
}

View File

@ -1,29 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jrms;
import org.activemq.transport.multicast.MulticastTwoBrokerTest;
/**
* @version $Revision$
*/
public class JRMSTwoBrokerTest extends MulticastTwoBrokerTest {
protected String getBrokerURL() {
return "jrms://228.5.6.7:6677";
}
}

View File

@ -1,22 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Build Properties
# -------------------------------------------------------------------
maven.multiproject.type=jar
maven.eclipse.classpath.include=${basedir}/src/conf

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project>
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../etc/project.xml</extend>
<name>ActiveMQ :: Transport :: JXTA</name>
<id>activemq-transport-jxta</id>
<shortDescription>ActiveMQ JXTA Message Transport</shortDescription>
<description>ActiveMQ JXTA Message Transport</description>
<package>org.activemq.transport.jxta</package>
<packageGroups>
<packageGroup>
<title>JXTA Message Transport</title>
<packages>org.activemq.transport.jxta</packages>
</packageGroup>
</packageGroups>
<!-- ============ -->
<!-- Dependencies -->
<!-- ============ -->
<dependencies>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${pom.currentVersion}</version>
<properties>
<eclipse.dependency>true</eclipse.dependency>
</properties>
</dependency>
<dependency> <!-- Used for unit tests -->
<groupId>activemq</groupId>
<artifactId>activemq-core-test</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>p2psockets</groupId>
<artifactId>p2psockets-core</artifactId>
<version>${p2psockets_core_version}</version>
</dependency>
<dependency>
<groupId>jxta</groupId>
<artifactId>jxta</artifactId>
<version>${jxta_version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1 +0,0 @@
org.activemq.axis.ActiveMQVendorAdapter

View File

@ -1 +0,0 @@
org.activemq.transport.jxta.JxtaTransportChannelFactory

View File

@ -1 +0,0 @@
org.activemq.transport.jxta.JxtaTransportServerChannelFactory

View File

@ -1,82 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jxta;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.activemq.io.WireFormat;
import org.activemq.transport.tcp.TcpTransportChannel;
import org.p2psockets.P2PInetAddress;
import org.p2psockets.P2PSocket;
import javax.jms.JMSException;
import java.io.IOException;
import java.net.Socket;
import java.net.URI;
import java.net.UnknownHostException;
/**
* A JXTA implementation of a TransportChannel
*
* @version $Revision: 1.1 $
*/
public class JxtaTransportChannel extends TcpTransportChannel {
private static final Log log = LogFactory.getLog(JxtaTransportChannel.class);
/**
* Connect to a remote Node - e.g. a Broker
*
* @param remoteLocation
* @throws JMSException
*/
public JxtaTransportChannel(WireFormat wireFormat, URI remoteLocation) throws JMSException {
super(wireFormat, remoteLocation);
}
/**
* Connect to a remote Node - e.g. a Broker
*
* @param remoteLocation
* @param localLocation -
* e.g. local InetAddress and local port
* @throws JMSException
*/
public JxtaTransportChannel(WireFormat wireFormat, URI remoteLocation, URI localLocation) throws JMSException {
super(wireFormat, localLocation, remoteLocation);
}
/**
* pretty print for object
*
* @return String representation of this object
*/
public String toString() {
return "P2pTransportChannel: " + socket;
}
protected Socket createSocket(URI remoteLocation) throws UnknownHostException, IOException {
return new P2PSocket(remoteLocation.getHost(), remoteLocation.getPort());
}
protected Socket createSocket(URI remoteLocation, URI localLocation) throws IOException, UnknownHostException {
return new P2PSocket(remoteLocation.getHost(), remoteLocation.getPort(), P2PInetAddress
.getByName(localLocation.getHost()), localLocation.getPort());
}
}

View File

@ -1,63 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jxta;
import org.activemq.io.WireFormat;
import org.activemq.transport.TransportChannel;
import org.activemq.transport.TransportChannelFactorySupport;
import javax.jms.JMSException;
import java.net.URI;
/**
* A JXTA implementation of a TransportChannelFactory
*
* @version $Revision: 1.1 $
*/
public class JxtaTransportChannelFactory extends TransportChannelFactorySupport {
/**
* Create a Channel to a remote Node - e.g. a Broker
*
* @param wireFormat
* @param remoteLocation
* @return the TransportChannel bound to the remote node
* @throws JMSException
*/
public TransportChannel create(WireFormat wireFormat, URI remoteLocation) throws JMSException {
return populateProperties(new JxtaTransportChannel(wireFormat, remoteLocation), remoteLocation);
}
/**
* Create a Channel to a remote Node - e.g. a Broker
*
* @param wireFormat
* @param remoteLocation
* @param localLocation -
* e.g. local InetAddress and local port
* @return the TransportChannel bound to the remote node
* @throws JMSException
*/
public TransportChannel create(WireFormat wireFormat, URI remoteLocation, URI localLocation) throws JMSException {
return populateProperties(new JxtaTransportChannel(wireFormat, remoteLocation, localLocation), remoteLocation);
}
public boolean requiresEmbeddedBroker() {
return false;
}
}

View File

@ -1,88 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jxta;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.activemq.io.WireFormat;
import org.activemq.transport.tcp.TcpTransportServerChannel;
import org.p2psockets.P2PInetAddress;
import org.p2psockets.P2PServerSocket;
import javax.jms.JMSException;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.URI;
import java.net.UnknownHostException;
/**
* Binds to a well known port and listens for Sockets ...
*
* @version $Revision: 1.1 $
*/
public class JxtaTransportServerChannel extends TcpTransportServerChannel {
private static final Log log = LogFactory.getLog(JxtaTransportServerChannel.class);
/**
* Default Constructor
*
* @param bindAddr
* @throws JMSException
*/
public JxtaTransportServerChannel(WireFormat wireFormat, URI bindAddr) throws JMSException {
super(wireFormat, bindAddr);
}
/**
* @return pretty print of this
*/
public String toString() {
return "P2pTransportServerChannel@" + getUrl();
}
protected ServerSocket createServerSocket(URI bind) throws UnknownHostException, IOException {
ServerSocket answer = null;
String host = bind.getHost();
// host = (host == null || host.length() == 0) ? "localhost" : host;
//
// System.out.println("About to lookup host: " + host);
if (host == null || host.length() == 0 || host.equals("localhost")) {
InetAddress addr = P2PInetAddress.getLocalHost();
answer = new P2PServerSocket(bind.getPort(), getBacklog(), addr);
}
else {
InetAddress addr = P2PInetAddress.getByName(host);
answer = new P2PServerSocket(bind.getPort(), getBacklog(), addr);
}
/*
if (addr.equals(P2PInetAddress.getLocalHost())) {
answer = new P2PServerSocket(bind.getPort(), BACKLOG);
}
else {
answer = new P2PServerSocket(bind.getPort(), BACKLOG, addr);
}
*/
//answer = new P2PServerSocket(bind.toString(), BACKLOG);
return answer;
}
}

View File

@ -1,46 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.transport.jxta;
import org.activemq.io.WireFormat;
import org.activemq.transport.TransportServerChannel;
import org.activemq.transport.TransportServerChannelFactory;
import javax.jms.JMSException;
import java.net.URI;
/**
* A JXTA implementation of a TransportServerChannelFactory
*
* @version $Revision: 1.1 $
*/
public class JxtaTransportServerChannelFactory implements TransportServerChannelFactory {
/**
* Bind a ServerChannel to an address
*
* @param wireFormat
* @param bindAddress
* @return the TransportChannel bound to the remote node
* @throws JMSException
*/
public TransportServerChannel create(WireFormat wireFormat, URI bindAddress) throws JMSException {
return new JxtaTransportServerChannel(wireFormat, bindAddress);
}
}

View File

@ -1,27 +0,0 @@
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
</head>
<body>
<p>
An implementation of the transport layer using JXTA P2PSockets for navigating firewalls and NATs
</p>
</body>
</html>

View File

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>incubator-activemq</groupId>
<artifactId>activemq-parent</artifactId>
<version>4.0.2-SNAPSHOT</version>
</parent>
<groupId>org.apache.activemq.sandbox</groupId>
<artifactId>activemq-sandbox</artifactId>
<packaging>pom</packaging>
<name>ActiveMQ Sandbox</name>
<modules>
<module>activemq-gbean</module>
<module>activemq-gbean-management</module>
<!--
<module>activemq-jabber</module>
<module>activemq-jrms</module>
<module>activemq-jxta</module>
-->
</modules>
</project>

View File

@ -1,32 +0,0 @@
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="default" xmlns:j="jelly:core">
<goal name="default" prereqs="clean, test"/>
<goal name="java:compile"/>
<!--
<preGoal name="test:compile">
<echo>copying from ${basedir}/../../../src/test to ${basedir}/target/src/test</echo>
<copy todir="${basedir}/target/src/test">
<fileset dir="${basedir}/../../../src/test"/>
</copy>
</preGoal>
-->
</project>

View File

@ -1,26 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
#
# Testing system properties
#
maven.junit.sysproperties = activemq.persistenceAdapter activemq.store.dir
activemq.persistenceAdapter = org.activemq.store.bdb.BDbPersistenceAdapter
activemq.store.dir = ${basedir}/target/MessageStore
maven.test.search.classdir = true

View File

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../base-project.xml</extend>
<name>ActiveMQ :: Berkeley DB System Test</name>
<id>activemq-systest-bdb</id>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<dependencies>
<dependency>
<id>activemq</id>
<version>${pom.currentVersion}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<unitTestSourceDirectory>../../../src/test</unitTestSourceDirectory>
<unitTest>
<resources>
<resource>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<includes>
<include>**/*Test.*</include>
</includes>
<excludes>
<exclude>**/Ssl*Test.*</exclude>
<!-- disable native BDB unless you've installed it -->
<exclude>**/bdbn/*Test.*</exclude>
<!-- not sure why these tests fail -->
<exclude>**/ember/*Test.*</exclude>
<exclude>**/gnet/*Test.*</exclude>
<!-- maybe multicast is not supported on beaver? -->
<exclude>**/jrms/*</exclude>
<exclude>**/multicast/*</exclude>
<exclude>**/jgroups/*</exclude>
</excludes>
</unitTest>
</build>
<reports>
</reports>
</project>

View File

@ -1 +0,0 @@
This module runs the system tests for Berkeley DB

View File

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision: 1.1 $ $Date: 2005/03/14 02:57:53 $ -->
<project default="default"
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:maven="jelly:maven"
xmlns:u="jelly:util"
xmlns:deploy="geronimo:deploy"
xmlns:velocity="jelly:velocity"
>
<goal name="default" prereqs="jar:install"/>
<postGoal name="jar:install">
<attainGoal name="itest"/>
</postGoal>
<preGoal name="itest:setup">
<j:if test="${context.getVariable('enable.debug') == 'true'}">
<j:set var="geronimo.server.debug.options" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"/>
</j:if>
<ant:mkdir dir="${basedir}/target/plan"/>
<velocity:merge
basedir="${basedir}/src/plan"
template="activemq-itests-ear.ear.xml"
name="${basedir}/target/plan/activemq-itests-ear.ear.xml"/>
<delete dir="${maven.build.dir}/geronimo"/>
<deploy:unpackServer
geronimoVersion="1.0-SNAPSHOT"
/>
<deploy:startRemoteServer
geronimoTarget="${maven.build.dir}/geronimo"
vmArgs="-ea ${geronimo.server.debug.options} -Xms512m -Xmx768m -Djava.rmi.server.RMIClassLoaderSpi=org.apache.geronimo.system.rmi.RMIClassLoaderSpiImpl ${geronimo.server.options}"
configs="org/apache/geronimo/ActiveMQServer org/apache/geronimo/RuntimeDeployer"/>
<ant:echo message="Waiting for server"/>
<deploy:waitForStarted
uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
username="system"
password="manager"
id="org/apache/geronimo/RuntimeDeployer"/>
<echo message="server has started"/>
<deploy:distribute
uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
username="system"
password="manager"
module="${maven.repo.local}/${pom.groupId}/ears/activemq-itest-ear-${pom.currentVersion}.ear"
plan="${basedir}/target/plan/activemq-itests-ear.ear.xml"
/>
<deploy:start
uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
username="system"
password="manager"
id="org/activemq/itest/ServerEar"/>
<j:if test="${context.getVariable('enable.debug') == 'true'}">
<input message="Connect your debugger and then press any key to start the tests."/>
</j:if>
</preGoal>
<postGoal name="itest:teardown">
<deploy:stopRemoteServer
uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
username="system"
password="manager"/>
<sleep seconds="2"/>
<echo message="server has stopped"/>
</postGoal>
</project>

View File

@ -1,27 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Build Properties
# -------------------------------------------------------------------
maven.multiproject.type=jar
maven.itest.includes=**/*Test.*
#maven.itest.excludes=**/Abstract*.java
enable.debug=false
maven.eclipse.classpath.include=${basedir}/src/itest

View File

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project>
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../etc/project.xml</extend>
<name>ActiveMQ :: Integration Tests :: Client</name>
<id>activemq-itest-client</id>
<shortDescription>ActiveMQ is a JMS 1.1 implementation designed for easy deployment in Geronimo</shortDescription>
<description>
ActiveMQ is an open source JMS 1.1 implementation designed for easy deployment in Geronimo
</description>
<package>org.activemq.itests</package>
<packageGroups>
<packageGroup>
<title>Integration Tests</title>
<packages>org.activemq.itest.*</packages>
</packageGroup>
</packageGroups>
<dependencies>
<!-- Used for preprocessing the deployment descriptors -->
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-velocity</artifactId>
<version>${commons_jelly_tags_velocity_version}</version>
</dependency>
<dependency>
<groupId> velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity_version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ejb_2.1_spec</artifactId>
<version>${geronimo_spec_ejb_version}</version>
</dependency>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq</artifactId>
<version>${pom.currentVersion}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-itest-ear</artifactId>
<version>${pom.currentVersion}</version>
<type>ear</type>
</dependency>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-itest-ejb</artifactId>
<version>${pom.currentVersion}</version>
<type>ejb</type>
</dependency>
<!-- plugins used -->
<dependency>
<groupId>geronimo</groupId>
<artifactId>geronimo-deployment-plugin</artifactId>
<version>${geronimo_deployment_plugin_version}</version>
<type>plugin</type>
</dependency>
<dependency>
<groupId>maven-itest-plugin</groupId>
<artifactId>maven-itest-plugin</artifactId>
<version>${maven_itest_plugin_version}</version>
<type>plugin</type>
</dependency>
<!-- for openejb jndi class to look up the ejbs-->
<dependency>
<groupId>openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>${openejb_core_version}</version>
<properties>
<module>true</module>
</properties>
</dependency>
<dependency>
<groupId>geronimo</groupId>
<artifactId>geronimo-security</artifactId>
<version>${geronimo_security_version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-full</artifactId>
<version>${cglib_full_version}</version>
<url>http://cglib.sf.net</url>
</dependency>
</dependencies>
</project>

View File

@ -1,108 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.itests;
import java.rmi.RemoteException;
import java.util.HashSet;
import java.util.Hashtable;
import javax.ejb.CreateException;
import javax.jms.JMSException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import junit.framework.TestCase;
import org.activemq.itest.ejb.JMSToolHome;
import org.activemq.itest.ejb.JMSTool;
/**
* @version $Revision: 1.1 $
*/
public class ResourceAdapterTest extends TestCase {
private static final String JMSBEAN_JNDI = "org/activemq/itest/JMSToolBean";
private static final String TEST_QUEUE = "TestQueue";
private static final String TRANSFER_MDB_INPUT_QUEUE = "MDBInQueue";
private static final String TRANSFER_MDB_OUTPUT_QUEUE = "MDBOutQueue";
private JMSTool jmsTool;
protected void setUp() throws Exception {
InitialContext ctx = createInitialContext();
JMSToolHome home = (JMSToolHome) ctx.lookup(JMSBEAN_JNDI);
jmsTool = home.create();
}
protected void tearDown() throws Exception {
if( jmsTool != null ) {
try {
jmsTool.drain(TEST_QUEUE);
} catch (Throwable e) {
}
}
}
public void testSendReceiveMultiple() throws CreateException, RemoteException, NamingException, JMSException {
for( int i=0; i < 5; i++) {
String msg1 = "Test Send Receive:"+i;
jmsTool.sendTextMessage(TEST_QUEUE, msg1);
String msg2 = jmsTool.receiveTextMessage(TEST_QUEUE, 1000);
assertEquals("Message are not the same a iteration: "+i, msg1, msg2);
}
}
/**
* The MDBTransferBean should be moving message from the input queue to the output queue.
* Check to see if message sent to it's input get to the output queue.
*/
public void testSendReceiveFromMDB() throws CreateException, RemoteException, NamingException, JMSException {
HashSet a = new HashSet();
HashSet b = new HashSet();
for( int i=0; i < 5; i++) {
String msg1 = "Test Send Receive From MDB:"+i;
a.add(msg1);
jmsTool.sendTextMessage(TRANSFER_MDB_INPUT_QUEUE, msg1);
}
for( int i=0; i < 5; i++) {
String msg2 = jmsTool.receiveTextMessage(TRANSFER_MDB_OUTPUT_QUEUE, 1000);
b.add(msg2);
}
// Compare the messages using sets since they may be received out of order since,
// the MDB runns concurrent threads.
assertEquals(a,b);
}
private InitialContext createInitialContext() throws NamingException {
Hashtable props = new Hashtable();
props.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
props.put("java.naming.provider.url", "127.0.0.1:4201");
props.put("java.naming.security.principal", "testuser");
props.put("java.naming.security.credentials", "testpassword");
return new InitialContext(props);
}
}

View File

@ -1,41 +0,0 @@
## ---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
log4j.rootLogger=info, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%m [%t] (%F:%L) - %n
#log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
# detailed output
#log4j.appender.stdout.layout.ConversionPattern=%5p %t [%c] [%t] (%F:%L
# log4j.logger.pyrasun=DEBUG,STDOUT
# log4j.logger.pyrasun.eio.EIOOutputBuffer=DEBUG
# log4j.additivity.pyrasun.eio.EIOOutputBuffer=false
# log4j.logger.pyrasun.eio.EIOWorkerThread=DEBUG
# log4j.logger.pyrasun.eio.WorkerController=DEBUG
log4j.logger.pyrasun.eio.Endpoint_ready=INFO

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
configId="org/activemq/itest/ServerEar"
parentId="org/apache/geronimo/Server">
<module>
<ejb>activemq-itest-ejb-${pom.currentVersion}.jar</ejb>
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar" configId="mdb_msg_ejb.jar">
<enterprise-beans>
<session>
<ejb-name>JMSToolBean</ejb-name>
<jndi-name>org/activemq/itest/JMSToolBean</jndi-name>
</session>
<message-driven>
<ejb-name>MDBTransferBean</ejb-name>
<resource-adapter>
<resource-link>ITest ActiveMQ RA</resource-link>
</resource-adapter>
</message-driven>
</enterprise-beans>
</openejb-jar>
</module>
<module>
<connector>activemq-ra-${pom.currentVersion}.rar</connector>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector" version="1.5" configId="null">
<resourceadapter>
<resourceadapter-instance>
<resourceadapter-name>ITest ActiveMQ RA</resourceadapter-name>
<config-property-setting name="ServerUrl">tcp://localhost:61616</config-property-setting>
<workmanager>
<gbean-link>DefaultWorkManager</gbean-link>
</workmanager>
</resourceadapter-instance>
<outbound-resourceadapter>
<connection-definition>
<connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
<connectiondefinition-instance>
<name>jms/Default</name>
<implemented-interface>javax.jms.QueueConnectionFactory</implemented-interface>
<implemented-interface>javax.jms.TopicConnectionFactory</implemented-interface>
<connectionmanager>
<xa-transaction>
<transaction-caching/>
</xa-transaction>
<single-pool>
<max-size>10</max-size>
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
<match-one/>
</single-pool>
</connectionmanager>
<credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
</connectiondefinition-instance>
</connection-definition>
</outbound-resourceadapter>
</resourceadapter>
<adminobject>
<adminobject-interface>javax.jms.Queue</adminobject-interface>
<adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
<adminobject-instance>
<message-destination-name>MDBOutQueue</message-destination-name>
<config-property-setting name="PhysicalName">MDBOutQueue</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
<adminobject-interface>javax.jms.Queue</adminobject-interface>
<adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
<adminobject-instance>
<message-destination-name>MDBInQueue</message-destination-name>
<config-property-setting name="PhysicalName">MDBInQueue</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
<adminobject-interface>javax.jms.Queue</adminobject-interface>
<adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
<adminobject-instance>
<message-destination-name>TestQueue</message-destination-name>
<config-property-setting name="PhysicalName">TestQueue</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
<adminobject-interface>javax.jms.Topic</adminobject-interface>
<adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
<adminobject-instance>
<message-destination-name>TestTopic</message-destination-name>
<config-property-setting name="PhysicalName">TestTopic</config-property-setting>
</adminobject-instance>
</adminobject>
</connector>
</module>
</application>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision: 1.1 $ $Date: 2005/03/14 02:57:53 $ -->
<project default="ear:install"
xmlns:ant="jelly:ant"
xmlns:velocity="jelly:velocity"
>
<goal name="default" prereqs="ear:install"/>
<preGoal name="ear:ear">
<ant:mkdir dir="${basedir}/target/app"/>
<velocity:merge
basedir="${basedir}/src/application/META-INF"
template="application.xml"
name="${basedir}/target/app/application.xml"/>
</preGoal>
</project>

View File

@ -1,27 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Build Properties
# -------------------------------------------------------------------
maven.multiproject.type=ear
maven.ear.appxml=target/app/application.xml
maven.repo.remote=\
http://www.ibiblio.org/maven,\
http://dist.codehaus.org,\
http://people.apache.org/repository

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project>
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../../../etc/project.xml</extend>
<name>ActiveMQ :: Integration Tests :: Ear</name>
<id>activemq-itest-ear</id>
<shortDescription>ActiveMQ is a JMS 1.1 implementation designed for easy deployment in Geronimo</shortDescription>
<description>
ActiveMQ is an open source JMS 1.1 implementation designed for easy deployment in Geronimo
</description>
<package>org.activemq.itest</package>
<dependencies>
<!-- Used for preprocessing the deployment descriptors -->
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-velocity</artifactId>
<version>${commons_jelly_tags_velocity_version}</version>
</dependency>
<dependency>
<groupId> velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity_version}</version>
</dependency>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-itest-ejb</artifactId>
<version>${pom.currentVersion}</version>
<type>ejb</type>
<properties>
<ear.bundle>true</ear.bundle>
</properties>
</dependency>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-ra</artifactId>
<version>${pom.currentVersion}</version>
<type>rar</type>
<properties>
<ear.bundle>true</ear.bundle>
</properties>
</dependency>
</dependencies>
</project>

View File

@ -1,27 +0,0 @@
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<application xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4">
<module>
<connector>activemq-ra-${pom.currentVersion}.rar</connector>
</module>
<module>
<ejb>activemq-itest-ejb-${pom.currentVersion}.jar</ejb>
</module>
</application>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision: 1.1 $ $Date: 2005/03/14 02:57:53 $ -->
<project default="default"
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:maven="jelly:maven">
<goal name="default" prereqs="clean, ejb:install"/>
</project>

View File

@ -1,21 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Build Properties
# -------------------------------------------------------------------
maven.multiproject.type=ejb

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project>
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../../../etc/project.xml</extend>
<name>ActiveMQ :: Integration Tests :: Ejb</name>
<id>activemq-itest-ejb</id>
<shortDescription>ActiveMQ is a JMS 1.1 implementation designed for easy deployment in Geronimo</shortDescription>
<description>
ActiveMQ is an open source JMS 1.1 implementation designed for easy deployment in Geronimo
</description>
<package>org.activemq.itest</package>
<packageGroups>
<packageGroup>
<title>EJBs used by the Test Suite</title>
<packages>org.activemq.itest.ejb.*</packages>
</packageGroup>
</packageGroups>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ejb_2.1_spec</artifactId>
<version>${geronimo_spec_ejb_version}</version>
<properties>
<rar.bundle>false</rar.bundle>
<lib>true</lib>
</properties>
</dependency>
</dependencies>
</project>

View File

@ -1,137 +0,0 @@
<?xml version="1.0" encoding="US-ASCII"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">
<description>
Stateless Session Bean used to test the ActiveMQ outbound RA.
</description>
<enterprise-beans>
<session>
<description>
A SSB that uses the JMS RA
</description>
<ejb-name>JMSToolBean</ejb-name>
<home>org.activemq.itest.ejb.JMSToolHome</home>
<remote>org.activemq.itest.ejb.JMSTool</remote>
<ejb-class>org.activemq.itest.ejb.JMSToolBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>
This is a reference to the ActiveMQ JMS provider.
</description>
<res-ref-name>jms/Default</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>TestQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
<message-destination-link>TestQueue</message-destination-link>
</message-destination-ref>
<message-destination-ref>
<message-destination-ref-name>MDBInQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Consumes</message-destination-usage>
<message-destination-link>MDBInQueue</message-destination-link>
</message-destination-ref>
<message-destination-ref>
<message-destination-ref-name>MDBOutQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Consumes</message-destination-usage>
<message-destination-link>MDBOutQueue</message-destination-link>
</message-destination-ref>
</session>
<message-driven>
<description>
A MDB that uses the JMS RA. Transfers messages from one queue to another.
</description>
<ejb-name>MDBTransferBean</ejb-name>
<ejb-class>org.activemq.itest.ejb.MDBTransferBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>MDBInQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
</activation-config>
<resource-ref>
<description>
This is a reference to the ActiveMQ JMS provider.
</description>
<res-ref-name>jms/Default</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>MDBOut</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
<message-destination-link>MDBOutQueue</message-destination-link>
</message-destination-ref>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>JMSToolBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>MDBTransferBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<message-destination>
<message-destination-name>MDBInQueue</message-destination-name>
</message-destination>
<message-destination>
<message-destination-name>MDBOutQueue</message-destination-name>
</message-destination>
<message-destination>
<message-destination-name>TestQueue</message-destination-name>
</message-destination>
</assembly-descriptor>
</ejb-jar>

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
<jmx-name>activemq.rar:name=iTests</jmx-name>
<enterprise-beans>
<session>
<ejb-name>JMSToolBean</ejb-name>
<resource-ref>
<res-ref-name>jms/Default</res-ref-name>
<resource-name>default</resource-name>
</resource-ref>
</session>
<message-driven>
<ejb-name>MDBTransferBean</ejb-name>
<resource-adapter-name>activemq-ra-3.1-SNAPSHOT.rar</resource-adapter-name>
<configuration-name>ActiveMQ Message Driven Bean</configuration-name>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<message-destination>
<message-destination-name>MDBInQueue</message-destination-name>
<jndi-name>activemq/queue/MDBInQueue</jndi-name>
</message-destination>
<message-destination>
<message-destination-name>MDBOutQueue</message-destination-name>
<jndi-name>activemq/queue/MDBOutQueue</jndi-name>
</message-destination>
<message-destination>
<message-destination-name>TestQueue</message-destination-name>
<jndi-name>activemq/queue/TestQueue</jndi-name>
</message-destination>
</assembly-descriptor>
<resource-managers>
<resource-manager>
<res-name>default</res-name>
<res-jndi-name>java:/activemq/ConnectionFactory</res-jndi-name>
</resource-manager>
</resource-managers>
<invoker-proxy-bindings>
<invoker-proxy-binding>
<name>activemq-message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory</proxy-factory>
<proxy-factory-config>
<endpoint-interceptors>
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</endpoint-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
</invoker-proxy-bindings>
<container-configurations>
<container-configuration>
<container-name>ActiveMQ Message Driven Bean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>activemq-message-driven-bean</invoker-proxy-binding-name>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
<!-- CMT -->
<interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Container" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<!-- BMT -->
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Bean" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<container-pool-conf>
<MaximumSize>100</MaximumSize>
</container-pool-conf>
</container-configuration>
</container-configurations>
</jboss>

View File

@ -1,43 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.itest.ejb;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.naming.NamingException;
/**
* Provides the Remote interface of the MessengerBean.
*
* @version $Revision: 1.1 $
*/
public interface JMSTool extends EJBObject {
public void sendTextMessage(String dest, String text) throws RemoteException, JMSException, NamingException;
public void sendTextMessage(Destination dest, String text) throws RemoteException, JMSException, NamingException;
public String receiveTextMessage(String dest, long timeout) throws RemoteException, JMSException, NamingException;
public String receiveTextMessage(Destination dest, long timeout) throws RemoteException, JMSException, NamingException;
public int drain(String dest) throws RemoteException, JMSException, NamingException;
public int drain(Destination dest) throws RemoteException, JMSException, NamingException;
}

View File

@ -1,142 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.itest.ejb;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This is a SSB that uses an outbound JMS Resource Adapter.
*
* @version $Revision: 1.1 $
*/
public class JMSToolBean implements SessionBean {
private static final long serialVersionUID = 3834596495499474741L;
private static final Log log = LogFactory.getLog(JMSToolBean.class);
private SessionContext sessionContext;
private Context envContext;
public void ejbCreate() {
}
public void ejbRemove() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void setSessionContext(SessionContext sessionContext) {
try {
this.sessionContext = sessionContext;
envContext = (Context) new InitialContext().lookup("java:comp/env");
}
catch (NamingException e) {
throw new EJBException(e);
}
}
public void sendTextMessage(String dest, String text) throws RemoteException, JMSException, NamingException {
sendTextMessage(createDestination(dest), text);
}
public void sendTextMessage(Destination dest, String text) throws RemoteException, JMSException, NamingException {
log.info("sendTextMessage start");
Connection connection = createConnection();
try {
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
MessageProducer producer = session.createProducer(dest);
producer.send(session.createTextMessage(text));
} finally {
log.info("sendTextMessage end");
connection.close();
}
}
public String receiveTextMessage(String dest, long timeout) throws RemoteException, JMSException, NamingException {
return receiveTextMessage(createDestination(dest), timeout);
}
public String receiveTextMessage(Destination dest, long timeout) throws RemoteException, JMSException, NamingException {
log.info("receiveTextMessage start");
Connection connection = createConnection();
try {
connection.start();
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
MessageConsumer consumer = session.createConsumer(dest);
TextMessage message = null;
message = (TextMessage) consumer.receive(timeout);
return message==null ? null : message.getText();
} finally {
log.info("receiveTextMessage end");
connection.close();
}
}
public int drain(String dest) throws RemoteException, JMSException, NamingException {
return drain(createDestination(dest));
}
public int drain(Destination dest) throws RemoteException, JMSException, NamingException {
log.info("drain start");
Connection connection = createConnection();
try {
connection.start();
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
MessageConsumer consumer = session.createConsumer(dest);
int counter=0;
while( consumer.receive(1000) != null) {
counter++;
}
return counter;
} finally {
log.info("drain end");
connection.close();
}
}
private Destination createDestination(String dest) throws NamingException {
return (Destination) envContext.lookup(dest);
}
private Connection createConnection() throws NamingException, JMSException {
ConnectionFactory cf = (ConnectionFactory) envContext.lookup("jms/Default");
Connection con = cf.createConnection();
return con;
}
}

View File

@ -1,33 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.itest.ejb;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
/**
* Provides the Home interface of the MessengerBean.
*
* @version $Revision: 1.1 $
*/
public interface JMSToolHome extends EJBHome {
public JMSTool create() throws RemoteException, CreateException;
}

View File

@ -1,110 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.itest.ejb;
import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2005/03/14 02:57:53 $
*
* */
public class MDBTransferBean implements MessageDrivenBean, MessageListener {
private static final Log log = LogFactory.getLog(MDBTransferBean.class);
private MessageDrivenContext messageDrivenContext;
private Context envContext;
public void ejbCreate() {
}
public void ejbRemove() throws EJBException {
}
public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) throws EJBException {
try {
this.messageDrivenContext = messageDrivenContext;
envContext = (Context) new InitialContext().lookup("java:comp/env");
}
catch (NamingException e) {
throw new EJBException(e);
}
}
public void onMessage(Message message) {
System.out.println("entering onMessage");
try {
ConnectionFactory cf = (ConnectionFactory) envContext.lookup("jms/Default");
Connection con = cf.createConnection();
try {
Session session = con.createSession(true, 0);
Destination dest = (Destination) envContext.lookup("MDBOut");
MessageProducer producer = session.createProducer(dest);
producer.setDeliveryMode(message.getJMSDeliveryMode());
producer.send(message);
} finally {
con.close();
}
} catch (Throwable e) {
log.info(e);
}
System.out.println("leaving onMessage");
}
/**
*
*/
private void printCompEnv() throws NamingException {
log.warn("Printing java:comp/env/jms context: ");
Context c = (Context) new InitialContext().lookup("java:comp/env/jms");
NamingEnumeration iter = c.list("");
while (iter.hasMoreElements()) {
NameClassPair pair = (NameClassPair) iter.next();
log.warn("'" + pair.getName() + "'");
/*
* Object obj = ctx.lookup(node.getName()); if ( obj instanceof
* Context ){ node.type = Node.CONTEXT;
* buildNode(node,(Context)obj); } else if (obj instanceof
* java.rmi.Remote) { node.type = Node.BEAN; } else { node.type =
* Node.OTHER; }
*/
}
}
}

View File

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:artifact="artifact"
xmlns:license="license"
xmlns:maven="jelly:maven"
xmlns:util="jelly:util"
default="default">
<goal name="default" prereqs="ejb:ejb">
<attainGoal name="ejb:stage"/>
<attainGoal name="ds:stage"/>
</goal>
<goal name="deploy">
<attainGoal name="ejb:deploy"/>
<attainGoal name="ds:deploy"/>
</goal>
<goal name="undeploy">
<attainGoal name="ejb:undeploy"/>
<attainGoal name="ds:undeploy"/>
</goal>
<goal name="sendq" prereqs="setclasspath">
<java classname="com.panacya.platform.service.bus.client.JmsSimpleClient" fork="yes">
<classpath refid="test.classpath"/>
<arg value="send"/>
<arg value="queue.testQueue"/>
<arg value="-1"/>
<arg value="100"/>
</java>
</goal>
<goal name="sendt" prereqs="setclasspath">
<java classname="com.panacya.platform.service.bus.client.JmsSimpleClient" fork="yes">
<classpath refid="test.classpath"/>
<arg value="send"/>
<arg value="topic.testTopic"/>
</java>
</goal>
<goal name="listen" prereqs="setclasspath">
<java classname="com.panacya.platform.service.bus.client.JmsSimpleClient" fork="yes">
<classpath refid="test.classpath"/>
<arg value="receive"/>
<arg value="topic.testTopic"/>
</java>
</goal>
<goal name="receive" prereqs="setclasspath">
<java classname="com.panacya.platform.service.bus.client.JmsSimpleClient" fork="yes">
<classpath refid="test.classpath"/>
<arg value="receive"/>
<arg value="queue.outbound"/>
</java>
</goal>
<goal name="receive-non-stop" prereqs="setclasspath">
<java classname="com.panacya.platform.service.bus.client.JmsSimpleClient" fork="yes">
<classpath refid="test.classpath"/>
<arg value="receive-non-stop"/>
<arg value="queue.outbound"/>
</java>
</goal>
<goal name="sendq-receive" prereqs="setclasspath">
<java classname="com.panacya.platform.service.bus.client.JmsSimpleClient" fork="yes">
<classpath refid="test.classpath"/>
<arg value="send-receive"/>
<arg value="queue.testQueue"/>
</java>
</goal>
<goal name="sendt-receive" prereqs="setclasspath">
<java classname="com.panacya.platform.service.bus.client.JmsSimpleClient" fork="yes">
<classpath refid="test.classpath"/>
<arg value="send-receive"/>
<arg value="topic.testTopic"/>
</java>
</goal>
<goal name="setclasspath">
<maven:get var="maven.test.dest" plugin='maven-test-plugin' property='maven.test.dest'/>
<path id="test.classpath">
<pathelement location="${maven.test.dest}"/>
<pathelement location="${maven.build.dest}"/>
<path refid="maven.dependency.classpath"/>
</path>
</goal>
<j:set var="activemq.jboss.deploy" value="${activemq.jboss.home}/deploy"/>
<j:set var="activemq.jboss.deploy.bak" value="${activemq.jboss.home}/deploy.bak"/>
<goal name="ejb:stage">
<ant:copy todir="${activemq.jboss.deploy.bak}">
<ant:fileset file="${maven.build.dir}/${maven.final.name}.jar"/>
</ant:copy>
</goal>
<goal name="ejb:deploy">
<ant:move file="${activemq.jboss.deploy.bak}/${maven.final.name}.jar" todir="${activemq.jboss.deploy}" overwrite="false" preservelastmodified="true"/>
</goal>
<goal name="ejb:undeploy">
<ant:move file="${activemq.jboss.deploy}/${maven.final.name}.jar" todir="${activemq.jboss.deploy.bak}" overwrite="false" preservelastmodified="true"/>
</goal>
<goal name="ds:stage">
<ant:copy todir="${activemq.jboss.deploy.bak}">
<ant:fileset file="${basedir}/src/main/jboss-datasource/panacya-jms-ds.xml"/>
<ant:fileset file="${maven.repo.local}/activemq/rars/activemq-ra-3.1-SNAPSHOT.rar"/>
</ant:copy>
</goal>
<goal name="ds:deploy">
<ant:move todir="${activemq.jboss.deploy}" overwrite="false" preservelastmodified="true">
<ant:fileset file="${activemq.jboss.deploy.bak}/panacya-jms-ds.xml"/>
<ant:fileset file="${activemq.jboss.deploy.bak}/activemq-ra-3.1-SNAPSHOT.rar"/>
</ant:move>
</goal>
<goal name="ds:undeploy">
<ant:move todir="${activemq.jboss.deploy.bak}" overwrite="false" preservelastmodified="true">
<ant:fileset file="${activemq.jboss.deploy}/panacya-jms-ds.xml"/>
<ant:fileset file="${activemq.jboss.deploy}/activemq-ra-3.1-SNAPSHOT.rar"/>
</ant:move>
</goal>
</project>

View File

@ -1,22 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
maven.multiproject.type=ejb
maven.ejb.src=src/main/ejb
#activemq.jboss.home=C:/sandbox/cvs_master/trunk/jboss/server/default
activemq.jboss.home=/Users/chirino/Desktop/jboss-4.0.1sp1/server/default

View File

@ -1,104 +0,0 @@
<?xml version="1.0"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://maven.apache.org/xsd/maven-project-3.0.0.xsd">
<pomVersion>3</pomVersion>
<id>panacya-mdb-test</id>
<name>Message Driven Bean Test</name>
<groupId>panacya-cicada</groupId>
<currentVersion>1.0</currentVersion>
<package>com.panacya.platform.service.bus</package>
<description/>
<shortDescription/>
<developers>
<developer>
<name>Michael Gaffney</name>
<id>mgaffney</id>
<email>mike@gaffney.cc</email>
<organization>Panacya Inc.</organization>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq</artifactId>
<version>3.1-SNAPSHOT</version>
<url>http://activemq.codehaus.org/</url>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee_1.4_spec</artifactId>
<version>1.0</version>
<url>http://geronimo.apache.org/</url>
</dependency>
<dependency>
<groupId>concurrent</groupId>
<artifactId>concurrent</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<url>http://jakarta.apache.org/commons/logging/</url>
<properties>
<ejb.bundle>true</ejb.bundle>
<ejb.manifest.classpath>true</ejb.manifest.classpath>
</properties>
</dependency>
<dependency>
<groupId>springframework</groupId>
<artifactId>spring</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/Abstract*.java</exclude>
</excludes>
<resources>
<resource>
<directory>src/test/conf</directory>
<includes>
<include>log4j.properties</include>
</includes>
</resource>
</resources>
</unitTest>
</build>
</project>

View File

@ -1,234 +0,0 @@
<?xml version="1.0" encoding="US-ASCII"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">
<description>
A collection of simple EJBs for testing ActiveMQ integration with JBoss.
</description>
<enterprise-beans>
<session>
<description>A stateless session bean that sends a small text message to jms</description>
<display-name>Sender EJB</display-name>
<ejb-name>SenderEJB</ejb-name>
<home>com.panacya.platform.service.bus.sender.SenderHome</home>
<remote>com.panacya.platform.service.bus.sender.Sender</remote>
<ejb-class>com.panacya.platform.service.bus.sender.SenderBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jms/MyQueueConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>jms/LogQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
<message-destination-link>LoggingQueue</message-destination-link>
</message-destination-ref>
</session>
<message-driven>
<description>An MDB listening on a queue.</description>
<ejb-name>QueueListenerMDB</ejb-name>
<ejb-class>com.panacya.platform.service.bus.mdb.SimpleMessageReceiverBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>queue.testQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>messageSelector</activation-config-property-name>
<activation-config-property-value/>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maxSessions</activation-config-property-name>
<activation-config-property-value>1</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>useRAManagedTransaction</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
</activation-config>
<ejb-ref>
<ejb-ref-name>ejb/Sender</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.panacya.platform.service.bus.sender.SenderHome</home>
<remote>com.panacya.platform.service.bus.sender.Sender</remote>
<ejb-link>SenderEJB</ejb-link>
</ejb-ref>
</message-driven>
<message-driven>
<description>An MDB listening on a topic with a non-durable subscription.</description>
<ejb-name>TopicNonDurableMDB</ejb-name>
<ejb-class>com.panacya.platform.service.bus.mdb.SimpleMessageReceiverBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>topic.testTopic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>subscriptionDurability</activation-config-property-name>
<activation-config-property-value>NonDurable</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>messageSelector</activation-config-property-name>
<activation-config-property-value/>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maxSessions</activation-config-property-name>
<activation-config-property-value>1</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>useRAManagedTransaction</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
</activation-config>
<ejb-ref>
<ejb-ref-name>ejb/Sender</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.panacya.platform.service.bus.sender.SenderHome</home>
<remote>com.panacya.platform.service.bus.sender.Sender</remote>
<ejb-link>SenderEJB</ejb-link>
</ejb-ref>
</message-driven>
<message-driven>
<description>An MDB listening on a topic with a durable subscription.</description>
<ejb-name>TopicDurableMDB</ejb-name>
<ejb-class>com.panacya.platform.service.bus.mdb.SimpleMessageReceiverBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>topic.testTopic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>subscriptionDurability</activation-config-property-name>
<activation-config-property-value>Durable</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>clientId</activation-config-property-name>
<activation-config-property-value>foo</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>subscriptionName</activation-config-property-name>
<activation-config-property-value>bar</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>messageSelector</activation-config-property-name>
<activation-config-property-value/>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maxSessions</activation-config-property-name>
<activation-config-property-value>1</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>useRAManagedTransaction</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
</activation-config>
<ejb-ref>
<ejb-ref-name>ejb/Sender</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.panacya.platform.service.bus.sender.SenderHome</home>
<remote>com.panacya.platform.service.bus.sender.Sender</remote>
<ejb-link>SenderEJB</ejb-link>
</ejb-ref>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>QueueListenerMDB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>TopicDurableMDB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>TopicNonDurableMDB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>SenderEJB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<message-destination>
<message-destination-name>LoggingQueue</message-destination-name>
</message-destination>
</assembly-descriptor>
</ejb-jar>

View File

@ -1,119 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
<jmx-name>activemq.rar:name=iTests</jmx-name>
<enterprise-beans>
<session>
<ejb-name>SenderEJB</ejb-name>
<resource-ref>
<res-ref-name>jms/MyQueueConnectionFactory</res-ref-name>
<resource-name>queuefactoryref</resource-name>
</resource-ref>
</session>
<message-driven>
<ejb-name>QueueListenerMDB</ejb-name>
<resource-adapter-name>activemq-ra-4.0-SNAPSHOT.rar</resource-adapter-name>
<configuration-name>ActiveMQ Message Driven Bean</configuration-name>
</message-driven>
<message-driven>
<ejb-name>TopicNonDurableMDB</ejb-name>
<resource-adapter-name>activemq-ra-4.0-SNAPSHOT.rar</resource-adapter-name>
<configuration-name>ActiveMQ Message Driven Bean</configuration-name>
</message-driven>
<message-driven>
<ejb-name>TopicDurableMDB</ejb-name>
<resource-adapter-name>activemq-ra-4.0-SNAPSHOT.rar</resource-adapter-name>
<configuration-name>ActiveMQ Message Driven Bean</configuration-name>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<message-destination>
<message-destination-name>LoggingQueue</message-destination-name>
<jndi-name>activemq/queue/outbound</jndi-name>
</message-destination>
</assembly-descriptor>
<resource-managers>
<resource-manager>
<res-name>queuefactoryref</res-name>
<res-jndi-name>java:/activemq/QueueConnectionFactory</res-jndi-name>
</resource-manager>
<resource-manager>
<res-name>topicfactoryref</res-name>
<res-jndi-name>java:/activemq/TopicConnectionFactory</res-jndi-name>
</resource-manager>
</resource-managers>
<invoker-proxy-bindings>
<invoker-proxy-binding>
<name>activemq-message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory</proxy-factory>
<proxy-factory-config>
<endpoint-interceptors>
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</endpoint-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
</invoker-proxy-bindings>
<container-configurations>
<container-configuration>
<container-name>ActiveMQ Message Driven Bean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>activemq-message-driven-bean</invoker-proxy-binding-name>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
<!-- CMT -->
<interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Container" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<!-- BMT -->
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Bean" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<container-pool-conf>
<MaximumSize>100</MaximumSize>
</container-pool-conf>
</container-configuration>
</container-configurations>
</jboss>

View File

@ -1,92 +0,0 @@
/**
*
* Copyright 2004 Michael Gaffney
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
package com.panacya.platform.service.bus.client;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public class ClientArgs {
private long timeout = -1;
private String command;
private String destination;
private int noOfMessages = 1;
public ClientArgs(String[] args) {
/*
int argCount = args.length;
System.out.println(argCount);
for(int i = 0 ; i < argCount; i++){
System.out.println(args[i] + " ..........");
}
*/
switch (args.length) {
case 4:
setNoOfMessages(args[3]);
case 3:
setTimeout(args[2]);
case 2:
destination = args[1];
command = args[0];
break;
default :
printHelp();
}
}
public String getCommand() {
return command;
}
public String getDestination() {
return destination;
}
public long getTimeout() {
return timeout;
}
private void setTimeout(String timout) {
if (!isEmpty(timout)) {
try {
timeout = Long.valueOf(timout).longValue();
} catch (NumberFormatException e) {
System.err.println(e.toString());
}
}
}
public int getNoOfMessages() {
return noOfMessages;
}
public void setNoOfMessages(String count) {
System.out.println("noOfMessage " + count);
this.noOfMessages = Integer.parseInt(count);
}
private static boolean isEmpty(String value) {
return value == null || "".equals(value.trim());
}
private static void printHelp() {
System.out.println("JmsSimpleClient command(send | receive | send-receive) noOfMessages destination timeout");
}
}

View File

@ -1,140 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panacya.platform.service.bus.client;
import org.activemq.ActiveMQConnectionFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.JMSException;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.jms.ConnectionFactory;
import org.activemq.util.IdGenerator;
import java.util.Properties;
import java.lang.reflect.InvocationTargetException;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public class JmsSimpleClient {
private static final String BROKER_URL = "tcp://localhost:61616";
//private static final String BROKER_URL = "jnp://localhost:1099";
private static final String SEND_CMD = "send";
private static final String RECEIVE_CMD = "receive";
private static final String ENDLESS_RECEIVE_CMD = "receive-non-stop";
private static final String SEND_RECEIVE_CMD = "send-receive";
public static final String NAMING_CONTEXT = "org.jnp.interfaces.NamingContextFactory";
public static final String JNP_INTERFACES = "org.jnp.interfaces";
public static void main(String[] args) {
execute(new ClientArgs(args));
}
private static void execute(ClientArgs args) {
try {
if (SEND_CMD.equals(args.getCommand())) {
JmsSimpleClient.sendToActiveMQ(args.getDestination(), args.getNoOfMessages());
} else if (RECEIVE_CMD.equals(args.getCommand())) {
JmsSimpleClient.receiveFromActiveMQ(args.getDestination(), args.getTimeout());
} else if (ENDLESS_RECEIVE_CMD.equals(args.getCommand())) {
JmsSimpleClient.receiveFromActiveMQ(args.getDestination());
} else if (SEND_RECEIVE_CMD.equals(args.getCommand())) {
JmsSimpleClient.sendToActiveMQ(args.getDestination(), args.getNoOfMessages());
JmsSimpleClient.receiveFromActiveMQ(args.getDestination(), args.getTimeout());
} else {
System.err.println("Unknown command: " + args.getCommand());
System.exit(-1);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void sendToActiveMQ(String destinationName, int count) throws Exception {
System.out.println("Sending to '" + destinationName + "' ...");
JmsTemplate jt = createTemplate(destinationName);
int i = 0;
for (; i < count; i++) {
jt.send(destinationName, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("hello ActiveMQ world ");
}
});
}
System.out.println("Done sending " + count + " message/s ........");
}
public static void receiveFromActiveMQ(String destinationName, long timeout) throws Exception {
System.out.println("Listening to '" + destinationName + "' ...");
JmsTemplate jt = createTemplate(destinationName);
jt.setReceiveTimeout(timeout);
while (true) {
Message aMessage = jt.receive(destinationName);
System.out.println("...done");
if (aMessage == null) {
System.out.println("No message received");
} else {
System.out.println("Message Received: " + aMessage.toString());
}
}
}
public static void receiveFromActiveMQ(String destinationName) throws Exception {
System.out.println("Listening to '" + destinationName + "' ...");
JmsTemplate jt = createTemplate(destinationName);
while (true) {
Message aMessage = jt.receive(destinationName);
if (aMessage == null) {
System.out.println("No message received");
} else {
int messageNumber = aMessage.getIntProperty("MessageNumber");
System.out.println("Received MessageNumber: " + messageNumber);
}
}
}
private static JmsTemplate createTemplate(String destinationName) {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
connectionFactory.setBrokerURL(BROKER_URL);
IdGenerator idGenerator = new IdGenerator();
connectionFactory.setClientID(idGenerator.generateId());
JmsTemplate jt = new JmsTemplate(connectionFactory);
if (destinationName.startsWith("topic")) {
jt.setPubSubDomain(true);
}
return jt;
}
}

View File

@ -1,111 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panacya.platform.service.bus.mdb;
import com.panacya.platform.service.bus.sender.SenderClient;
import com.panacya.platform.service.bus.sender.SenderException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.ejb.CreateException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.naming.NamingException;
import java.rmi.RemoteException;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public class SimpleMessageReceiverBean implements MessageDrivenBean, MessageListener {
private static final String SENDER_NAME = "java:comp/env/ejb/Sender";
private Log _log = LogFactory.getLog(SimpleMessageReceiverBean.class);
private MessageDrivenContext context;
public SimpleMessageReceiverBean() {
if (_log.isInfoEnabled()) {
_log.info("SimpleMessageReceiverBean.SimpleMessageReceiverBean");
}
}
public void onMessage(Message message) {
if (_log.isInfoEnabled()) {
_log.info("SimpleMessageReceiverBean.onMessage");
}
try {
handleMessage(message);
} catch (JMSException e) {
_log.error(e.toString(), e);
} catch (NamingException e) {
_log.error(e.toString(), e);
} catch (RemoteException e) {
_log.error(e.toString(), e);
} catch (CreateException e) {
_log.error(e.toString(), e);
} catch (SenderException e) {
_log.error(e.toString(), e);
}
}
private void handleMessage(Message message) throws JMSException, NamingException, RemoteException, SenderException, CreateException {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
if (_log.isInfoEnabled()) {
_log.info("Message received: " + textMessage.getText());
}
send(textMessage.getText());
} else {
if (_log.isInfoEnabled()) {
_log.info("Unknown message type received: " + message.toString());
}
send("Unknown message type: " + message.toString());
}
}
public void ejbRemove() {
if (_log.isInfoEnabled()) {
_log.info("SimpleMessageReceiverBean.ejbRemove");
}
}
public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) {
if (_log.isInfoEnabled()) {
_log.info("SimpleMessageReceiverBean.setMessageDrivenContext");
}
context = messageDrivenContext;
}
public void ejbCreate() {
if (_log.isInfoEnabled()) {
_log.info("SimpleMessageReceiverBean.ejbCreate");
}
}
private void send(String recMessage) throws NamingException, RemoteException, CreateException, SenderException {
sendToEJB(recMessage);
}
private void sendToEJB(String recMessage) throws NamingException, RemoteException, CreateException, SenderException {
SenderClient senderClient = new SenderClient(SENDER_NAME);
senderClient.sendMessage(recMessage);
}
}

View File

@ -1,29 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panacya.platform.service.bus.sender;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public interface Sender extends EJBObject {
public void sendMessage(String message) throws RemoteException, SenderException;
}

View File

@ -1,88 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panacya.platform.service.bus.sender;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public class SenderBean implements SessionBean {
private Log _log = LogFactory.getLog(SenderBean.class);
public SenderBean() {
}
public void ejbCreate() throws CreateException {
}
public void setSessionContext(SessionContext sessionContext) throws EJBException {
}
public void ejbRemove() throws EJBException {
}
public void ejbActivate() throws EJBException {
}
public void ejbPassivate() throws EJBException {
}
public void sendMessage(String message) throws SenderException {
try {
send(message);
} catch (NamingException e) {
_log.error(e.toString(), e);
throw new SenderException(e);
} catch (JMSException e) {
_log.error(e.toString(), e);
throw new SenderException(e);
}
}
private void send(String recMessage) throws NamingException, JMSException {
InitialContext initCtx = new InitialContext();
QueueConnectionFactory qcf = (QueueConnectionFactory) initCtx.lookup("java:comp/env/jms/MyQueueConnectionFactory");
QueueConnection qcon = qcf.createQueueConnection();
QueueSession qsession = qcon.createQueueSession(true, 0);
Queue q = (Queue) initCtx.lookup("java:comp/env/jms/LogQueue");
QueueSender qsender = qsession.createSender(q);
TextMessage message = qsession.createTextMessage();
message.setText("Message Received: " + recMessage);
qsender.send(message);
qsender.close();
qsession.close();
qcon.close();
}
}

View File

@ -1,81 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panacya.platform.service.bus.sender;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.ejb.CreateException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import java.rmi.RemoteException;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public class SenderClient {
private static final Log _log = LogFactory.getLog(SenderClient.class);
private Sender sender;
private String ejbName;
public SenderClient(String ejbName) throws NamingException, RemoteException, CreateException {
setEjbName(ejbName);
}
public void sendMessage(final String message) throws RemoteException, SenderException {
if (_log.isInfoEnabled()) {
_log.info("Sending message: " + message);
}
sender.sendMessage(message);
if (_log.isInfoEnabled()) {
_log.info("Message sent");
}
}
public String getEjbName() {
return ejbName;
}
private void setEjbName(final String ejbName) throws NamingException, RemoteException, CreateException {
this.ejbName = ejbName;
lookupSender(ejbName);
}
private void lookupSender(final String ejbName) throws NamingException, RemoteException, CreateException {
if (_log.isInfoEnabled()) {
_log.info("Looking up Sender: " + ejbName);
}
Context context = new InitialContext();
Object objectRef = context.lookup(ejbName);
SenderHome senderHome = (SenderHome) PortableRemoteObject.narrow(objectRef, SenderHome.class);
sender = senderHome.create();
}
public static void main(String[] args) {
try {
SenderClient client = new SenderClient("SenderEJB");
client.sendMessage("Hello ActiveMQ");
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -1,78 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panacya.platform.service.bus.sender;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public class SenderException extends Exception {
/**
* Constructs a new exception with <code>null</code> as its detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*/
public SenderException() {
super();
}
/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public SenderException(final String message) {
super(message);
}
/**
* Constructs a new exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* <code>cause</code> is <i>not</i> automatically incorporated in
* this exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public SenderException(final String message, final Throwable cause) {
super(message, cause);
}
/**
* Constructs a new exception with the specified cause and a detail
* message of <tt>(cause==null ? null : cause.toString())</tt> (which
* typically contains the class and detail message of <tt>cause</tt>).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public SenderException(final Throwable cause) {
super(cause);
}
}

View File

@ -1,31 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panacya.platform.service.bus.sender;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import java.rmi.RemoteException;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public interface SenderHome extends EJBHome {
com.panacya.platform.service.bus.sender.Sender create() throws RemoteException, CreateException;
}

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE connection-factories
PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
"http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
<connection-factories>
<tx-connection-factory>
<jndi-name>activemq/QueueConnectionFactory</jndi-name>
<xa-transaction/>
<track-connection-by-tx/> <!-- Thanks to Adrian Brock for pointing this one out! -->
<rar-name>activemq-ra-4.0-SNAPSHOT.rar</rar-name>
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<config-property name="UseInboundSession" type="java.lang.Boolean">true</config-property>
</tx-connection-factory>
<tx-connection-factory>
<jndi-name>activemq/TopicConnectionFactory</jndi-name>
<xa-transaction/>
<track-connection-by-tx/> <!-- Thanks to Adrian Brock for pointing this one out too! -->
<rar-name>activemq-ra-4.0-SNAPSHOT.rar</rar-name>
<connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<config-property name="UseInboundSession" type="java.lang.Boolean">true</config-property>
</tx-connection-factory>
<mbean code="org.jboss.resource.deployment.AdminObject" name="activemq.queue:name=outboundQueue">
<attribute name="JNDIName">activemq/queue/outbound</attribute>
<depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-4.0-SNAPSHOT.rar'</depends>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
PhysicalName=queue.outbound
</attribute>
</mbean>
</connection-factories>

View File

@ -1,24 +0,0 @@
## ---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
log4j.rootLogger=debug, stdout
log4j.appender.stdout.threshold=ERROR
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=[%20.20t] %m%n

View File

@ -1,49 +0,0 @@
/**
*
* Copyright 2004 Michael Gaffney
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
package com.panacya.platform.service.bus.client;
import junit.framework.TestCase;
/**
* @author <a href="mailto:michael.gaffney@panacya.com">Michael Gaffney </a>
*/
public class ClientArgsTest extends TestCase {
public ClientArgsTest(String name) {
super(name);
}
public void testThreeArgs() {
Long timeout = new Long(14999);
String[] args = { "send", "topic.testTopic", timeout.toString()};
ClientArgs c = new ClientArgs(args);
assertEquals(args[0], c.getCommand());
assertEquals(args[1], c.getDestination());
assertEquals(timeout.longValue(), c.getTimeout());
}
public void testTwoArgs() {
String[] args = { "send", "topic.testTopic"};
ClientArgs c = new ClientArgs(args);
assertEquals(args[0], c.getCommand());
assertEquals(args[1], c.getDestination());
assertEquals(-1, c.getTimeout());
}
}

View File

@ -1,23 +0,0 @@
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="default" xmlns:j="jelly:core">
<goal name="default" prereqs="clean, test"/>
<goal name="java:compile"/>
</project>

View File

@ -1,23 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
#
# Testing system properties
#
maven.junit.sysproperties = activemq.persistenceAdapter activemq.store.dir
activemq.persistenceAdapter = org.activemq.store.jdbc.JDBCPersistenceAdapter
activemq.store.dir = target/MessageStore

View File

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../base-project.xml</extend>
<name>ActiveMQ :: JDBC System Test</name>
<id>activemq-systest-jdbc</id>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<dependencies>
<dependency>
<id>activemq</id>
<version>${pom.currentVersion}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<unitTestSourceDirectory>../../../src/test</unitTestSourceDirectory>
<unitTest>
<resources>
<resource>
<directory>../../../src/test</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<includes>
<include>**/*Test.*</include>
</includes>
<excludes>
<exclude>**/Ssl*Test.*</exclude>
<!-- disable native BDB unless you've installed it -->
<exclude>**/bdbn/*Test.*</exclude>
<!-- not sure why these tests fail -->
<exclude>**/ember/*Test.*</exclude>
<exclude>**/gnet/*Test.*</exclude>
<!-- maybe multicast is not supported on beaver.org? -->
<exclude>**/jrms/*</exclude>
<exclude>**/multicast/*</exclude>
<exclude>**/jgroups/*</exclude>
</excludes>
</unitTest>
</build>
<reports>
</reports>
</project>

View File

@ -1 +0,0 @@
This module runs the system tests for Axion based JDBC

View File

@ -1,22 +0,0 @@
<?xml version="1.0"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<proxy provider="org.exolab.jmscts.activemq.ActiveMQProvider" start="true" stop="true">
<property name="BrokerURL" type="java.lang.String" value="tcp://localhost:61616"/>
</proxy>
</configuration>

View File

@ -1,5 +0,0 @@
// grant all users all permissions. This is only for test cases
// and should be modified for deployment
grant {
permission java.security.AllPermission;
};

View File

@ -1,69 +0,0 @@
## ---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
# =============================================================================
# General properties
# -----------------------------------------------------------------------------
#
# Username & password
# A user name and password for creating Connection instances via
# TopicConnectionFactory.createTopicConnection(...) etc
#
valid.username=CHANGE_ME
valid.password=CHANGE_ME
#
# Invalid user name and password
# As above, but guaranteed to fail.
#
invalid.username=CHANGE_ME
invalid.password=CHANGE_ME
#
# Message receipt timeout
# The default time to wait for messages, in milliseconds
#
org.exolab.jmscts.core.MessagingBehaviour.timeout=2000
# =============================================================================
# Compliance test properties
# -----------------------------------------------------------------------------
#
# Expiration interval
# Time in milliseconds to wait for the JMS provider to collect expired
# messages.
# This can be set for providers which collect expired messages periodically,
# rather than at the moment they expire.
# NOTE: for OpenJMS 0.7.6, this should be set to 5000
org.exolab.jmscts.test.producer.ttl.ExpirationTest.expirationInterval=0
# =============================================================================
# Stress test properties
# -----------------------------------------------------------------------------
#
# Each of the following properties determines the no. of messages that
# will be sent by stress tests
#
org.exolab.jmscts.stress.Send0KTest.count=1000
org.exolab.jmscts.stress.ReceiveSize0KTest.count=1000
org.exolab.jmscts.stress.SendReceive0KTest.count=1000
org.exolab.jmscts.stress.SendReceive2Size0KTest.count=1000

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<!-- log containing a test summary and any errors or failures, produced -->
<!-- at the completion of the test -->
<appender name="jmscts-report.log" class="org.apache.log4j.FileAppender">
<param name="File" value="jmscts-report.log" />
<param name="Append" value="false" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} %m%n"/>
</layout>
</appender>
<!-- console log -->
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} [%c] %p - %m%n"/>
</layout>
</appender>
<!-- console log - provides less detail than STDOUT -->
<appender name="STDOUT-SHORT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} %m%n"/>
</layout>
</appender>
<!-- log for debugging purposes -->
<appender name="jmscts.log" class="org.apache.log4j.FileAppender">
<param name="File" value="jmscts.log" />
<param name="Append" value="false" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} [%c] %p - %m%n"/>
</layout>
</appender>
<!-- logs a trace of test runs -->
<category name="org.exolab.jmscts.core.JUnitTestRunner.Trace"
additivity="false">
<priority value="info" />
<appender-ref ref="STDOUT-SHORT" />
</category>
<!-- logs a summary of the test run at completion -->
<category name="org.exolab.jmscts.core.JUnitTestRunner.Summary"
additivity="false">
<priority value="info" />
<appender-ref ref="jmscts-report.log" />
<appender-ref ref="STDOUT-SHORT" />
</category>
<!-- logs detailed errors/failures of the test run at completion -->
<category name="org.exolab.jmscts.core.JUnitTestRunner.Detail"
additivity="false">
<priority value="info" />
<appender-ref ref="jmscts-report.log" />
</category>
<root>
<priority value="info"/>
<appender-ref ref="jmscts.log" />
<appender-ref ref="STDOUT" />
</root>
</log4j:configuration>
<!--
Log4J Configuration Quick Reference:
====================================
Priority order is DEBUG < INFO < WARN < ERROR < FATAL
PatternLayout conversion characters:
%c Category of the logging event
%C Fully qualified class name of the caller
%d Date of the logging event (example: %d{HH:mm:ss,SSS} )
%F File name where the logging request was issued (caution: extremely slow)
%l Location information of the caller (caution: extremely slow)
%L Line number from where the logging request was issued (caution: extremely slow)
%m Application-supplied message
%M Method name from where the logging request was issued (caution: extremely slow)
%n Line separator
%p Priority of the logging event
%r Number of milliseconds since the start of the application
%t Name of the thread that generated the logging event
%x Nested diagnotic context associated with the thread
%% A single percent sign
Format modifiers examples:
%20c Left pad with spaces if category is less than 20 characters long
%-20c Right pad with spaces if category is less than 20 characters long
%.30c Truncate from the beginning if category is more than 30 chars long
%20.30c Left pad 20 chars + truncate from beginning if more than 30 chars
%-20.30c Right pad 20 chars + truncate from beginning if more than 30 chars
Examples: "%r [%t] %-5p %c %x - %m\n"
"%-6r [%15.15t] %-5p %30.30c %x - %m\n"
-->

View File

@ -1,37 +0,0 @@
<?xml version="1.0"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- ====================================================================== -->
<!-- Sample provider configuration file -->
<!-- -->
<!-- This configures JMS CTS to test ActiveMQ -->
<!-- ====================================================================== -->
<configuration>
<provider>
<name>ActiveMQ</name>
<class>org.exolab.jmscts.activemq.ActiveMQProvider</class>
<paths>
</paths>
<config>
<path>activemq.xml</path>
</config>
</provider>
</configuration>

View File

@ -1,72 +0,0 @@
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="testall" xmlns:j="jelly:core">
<goal name="testall" prereqs="setclasspath"
description="Runs all the compliance scripts">
<mkdir dir="report"/>
<java classname="org.exolab.jmscts.test.ComplianceTestSuite" fork="yes" maxmemory="512M">
<classpath refid="test.classpath"/>
<jvmarg value="-server"/>
<sysproperty key="jmscts.home" value="."/>
<j:if test="${!empty(url)}">
<sysproperty key="url" value="${url}"/>
</j:if>
</java>
</goal>
<goal name="stress" prereqs="setclasspath"
description="Runs the stress test">
<mkdir dir="report"/>
<java classname="org.exolab.jmscts.stress.StressTestSuite" fork="yes" maxmemory="512M">
<classpath refid="test.classpath"/>
<jvmarg value="-server"/>
<sysproperty key="jmscts.home" value="."/>
<j:if test="${!empty(url)}">
<sysproperty key="url" value="${url}"/>
</j:if>
</java>
</goal>
<goal name="snapshot" prereqs="setclasspath"
description="Gets a snapshot of the running tests">
<mkdir dir="report"/>
<java classname="org.exolab.jmscts.core.Admin" fork="yes" maxmemory="512M">
<classpath refid="test.classpath"/>
<jvmarg value="-server"/>
<sysproperty key="jmscts.home" value="."/>
<arg value="-snapshot"/>
<arg value="report"/>
</java>
</goal>
<goal name="setclasspath" prereqs="jar">
<path id="test.classpath">
<pathelement path="${maven.build.dest}"/>
<pathelement path="config"/>
<pathelement path="target/classes"/>
<path refid="maven.dependency.classpath"/>
</path>
</goal>
</project>

View File

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../../etc/project.xml</extend>
<name>JMSCTS :: ActiveMQ Provider</name>
<id>jmscts-activemq</id>
<package>org.exolab.jmscts.activemq</package>
<description>
ActiveMQ provider for the JMSCTS tests
</description>
<dependencies>
<!-- JMSCTS dependencies -->
<dependency>
<groupId>jmscts</groupId>
<artifactId>jmscts</artifactId>
<version>0.5-b2</version>
</dependency>
<dependency>
<groupId>exolabcore</groupId>
<artifactId>exolabcore</artifactId>
<version>0.3.7</version>
<url>http://openjms.sourceforge.net/</url>
<properties>
<runtime>true</runtime>
</properties>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.0</version>
<url>http://jakarta.apache.org/commons/cli/</url>
<properties>
<runtime>true</runtime>
</properties>
</dependency>
<dependency>
<groupId>castor</groupId>
<artifactId>castor</artifactId>
<version>0.9.5</version>
<url>http://castor.exolab.org/</url>
<properties>
<runtime>true</runtime>
</properties>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.5.1</version>
<url>http://xml.apache.org/xalan-j/</url>
<properties>
<classloader>root</classloader>
<runtime>true</runtime>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.3.0</version>
<properties>
<runtime>true</runtime>
</properties>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.0.b2</version>
<properties>
<runtime>true</runtime>
</properties>
</dependency>
<!-- ActiveMQ stuff -->
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq</artifactId>
<version>${pom.currentVersion}</version>
<properties>
<runtime>true</runtime>
</properties>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>activeio-core</artifactId>
<version>${activeio_version}</version>
<properties>
<rar.bundle>true</rar.bundle>
</properties>
</dependency>
<dependency>
<id>springframework</id>
<artifactId>spring</artifactId>
<version>${spring_version}</version>
<url>http://www.springframework.org</url>
<properties>
<rar.bundle>true</rar.bundle>
</properties>
</dependency>
<dependency>
<groupId>jdbm</groupId>
<artifactId>jdbm</artifactId>
<version>${jdbm_version}</version>
<properties>
<rar.bundle>true</rar.bundle>
</properties>
</dependency>
</dependencies>
<build>
<nagEmailAddress>dev@activemq.codehaus.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
</build>
<reports>
<report>maven-javadoc-plugin</report>
</reports>
</project>

View File

@ -1,115 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:t="http://jmscts.sourceforge.net/test"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="meta" select="document('metadata.xml')"/>
<xsl:variable name="req" select="document('requirements.xml')"/>
<xsl:template name="output-requirement">
<xsl:variable name="root" select="parent::*"/>
<xsl:variable name="reqId" select="requirementId"/>
<redirect:write select="concat('xdocs/', $reqId, '.xml')">
<document>
<properties>
<title>
<xsl:value-of select="concat('Requirement: ',$reqId)"/>
</title>
</properties>
<body>
<section name="Requirement: {$reqId}">
<xsl:for-each
select="$req/document/requirement[@requirementId=$reqId]">
<xsl:call-template name="output-requirement-detail">
<xsl:with-param name="root" select="$root"/>
</xsl:call-template>
</xsl:for-each>
</section>
</body>
</document>
</redirect:write>
</xsl:template>
<xsl:template name="output-requirement-detail">
<xsl:param name="root"/>
<xsl:variable name="reqId" select="@requirementId"/>
<p>
<small><xsl:copy-of select="description/node()"/></small>
</p>
<p>
<small>See:</small>
<ul>
<xsl:apply-templates select="referenceId"/>
<xsl:apply-templates select="reference"/>
</ul>
</p>
<subsection name="Test cases">
<p>
<table>
<tr><th>Test Case</th><th>Tests</th><th>Failures</th></tr>
<xsl:for-each
select="$meta//method-meta/attribute[@name='jmscts.requirement'
and @value=$reqId]">
<xsl:sort select="concat(../../name, '.', ../name)"/>
<xsl:variable name="class" select="../../name"/>
<xsl:variable name="method" select="../name"/>
<xsl:variable name="test" select="concat($class,'.',$method)"/>
<xsl:variable name="testRuns"
select="$root/t:testRuns[test = $test]"/>
<tr>
<td>
<a href="{$test}.html">
<small><xsl:value-of select="$test"/></small>
</a>
</td>
<td>
<small>
<xsl:value-of select="count($testRuns/t:testRun)"/>
</small>
</td>
<td>
<small>
<xsl:value-of select="count($testRuns/t:testRun/t:failure)"/>
</small>
</td>
</tr>
</xsl:for-each>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template match="referenceId">
<xsl:variable name="id" select="." />
<xsl:apply-templates
select="ancestor::document/reference[@referenceId=$id]"/>
</xsl:template>
<xsl:template match="reference">
<li>
<small>
<xsl:choose>
<xsl:when test="section">
Section&#160;<xsl:value-of select="section/@name"/>,
<xsl:value-of select="section/@title"/>
</xsl:when>
<xsl:when test="table">
Table <xsl:value-of select="table"/>
</xsl:when>
<xsl:when test="url">
<a href="{url}"><xsl:value-of select="url"/></a>
</xsl:when>
</xsl:choose>
</small>
</li>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,193 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:c="http://jmscts.sourceforge.net/coverage"
xmlns:t="http://jmscts.sourceforge.net/test"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="meta" select="document('metadata.xml')"/>
<xsl:template name="output-test">
<redirect:write select="concat('xdocs/', test, '.xml')">
<document>
<body>
<section name="{test}">
<xsl:call-template name="output-description"/>
<xsl:call-template name="output-test-runs"/>
<xsl:if test="t:testRun/t:failure">
<xsl:call-template name="output-failures"/>
</xsl:if>
</section>
</body>
</document>
</redirect:write>
</xsl:template>
<xsl:template name="output-description">
<xsl:apply-templates select="$meta/meta-data">
<xsl:with-param name="name" select="test"/>
</xsl:apply-templates>
</xsl:template>
<xsl:key name="method-desc" match="/meta-data/class-meta/method-meta"
use="concat(../name, '.', name)"/>
<xsl:template match="meta-data">
<xsl:param name="name"/>
<xsl:apply-templates select="key('method-desc', $name)"/>
</xsl:template>
<xsl:template match="method-meta">
<p>
<xsl:copy-of select="description/node()"/>
</p>
<p>
<small>Requirements:</small>
<ul>
<xsl:for-each select="attribute[@name='jmscts.requirement']">
<li>
<a href="{@value}.html">
<small><xsl:value-of select="@value"/></small>
</a>
</li>
</xsl:for-each>
</ul>
</p>
</xsl:template>
<xsl:template name="output-test-runs">
<subsection name="Runs">
<p>
<table>
<tr>
<th>Run</th>
<th>ConnectionFactory</th>
<th>Destination</th>
<th>Delivery</th>
<th>Session</th>
<th>Consumer</th>
<th>Message</th>
<th>Pass</th>
</tr>
<xsl:apply-templates select="t:testRun"/>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template name="output-failures">
<subsection name="Failures">
<p>
<table>
<tr>
<th>Run</th>
<th>Description</th>
</tr>
<xsl:for-each select="t:testRun">
<xsl:if test="t:failure">
<tr>
<td>
<a name="failure{position()}">
<a href="#run{position()}">
<small><xsl:value-of select="position()"/></small>
</a>
</a>
</td>
<td>
<small><xsl:value-of select="t:failure/description"/></small>
</td>
</tr>
<tr>
<td/>
<td>
<pre><small><xsl:value-of select="t:failure/cause"/></small></pre>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template match="t:testRun">
<xsl:variable name="run" select="position()"/>
<tr>
<td>
<a name="run{$run}"><small><xsl:value-of select="$run"/></small></a>
</td>
<td>
<small><xsl:value-of select="t:context/t:factory/@type"/></small>
</td>
<td>
<small>
<xsl:value-of select="t:context/t:behaviour/@destination"/>
</small>
</td>
<td>
<small>
<xsl:value-of select="t:context/t:behaviour/@deliveryMode"/>
</small>
</td>
<td>
<small>
<xsl:call-template name="get-session">
<xsl:with-param name="session" select="t:context/session"/>
</xsl:call-template>
</small>
</td>
<td>
<small>
<xsl:call-template name="get-consumer">
<xsl:with-param name="consumer"
select="t:context/t:behaviour/@receiver"/>
</xsl:call-template>
</small>
</td>
<td><small><xsl:value-of select="t:context/message"/></small></td>
<td>
<small>
<xsl:choose>
<xsl:when test="t:failure">
<a href="#failure{$run}">No</a>
</xsl:when>
<xsl:otherwise>Yes</xsl:otherwise>
</xsl:choose>
</small>
</td>
</tr>
</xsl:template>
<xsl:template name="get-session">
<xsl:param name="session"/>
<xsl:choose>
<xsl:when test="$session='AUTO_ACKNOWLEDGE'">AUTO</xsl:when>
<xsl:when test="$session='CLIENT_ACKNOWLEDGE'">CLIENT</xsl:when>
<xsl:when test="$session='DUPS_OK_ACKNOWLEDGE'">DUPS_OK</xsl:when>
<xsl:otherwise><xsl:value-of select="$session"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="get-consumer">
<xsl:param name="consumer"/>
<xsl:choose>
<xsl:when test="$consumer='durable_synchronous'">
durable synchronous
</xsl:when>
<xsl:when test="$consumer='durable_asynchronous'">
durable asynchronous
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$consumer"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,266 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:c="http://jmscts.sourceforge.net/coverage"
xmlns:t="http://jmscts.sourceforge.net/test">
<xsl:include href="coverage-requirements.xsl"/>
<xsl:include href="coverage-tests.xsl"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<document>
<body>
<xsl:apply-templates select="c:requirementCoverage"/>
</body>
</document>
</xsl:template>
<xsl:template match="c:requirementCoverage">
<section name="Overview">
<xsl:call-template name="requirements-summary"/>
<xsl:call-template name="tests-summary"/>
</section>
<section name="Requirements">
<xsl:call-template name="requirements-passed"/>
<xsl:call-template name="requirements-failed"/>
<xsl:call-template name="requirements-untested"/>
</section>
<section name="Tests">
<xsl:call-template name="tests-passed"/>
<xsl:call-template name="tests-failed"/>
</section>
</xsl:template>
<xsl:template name="requirements-summary">
<subsection name="Requirements summary">
<p>
<table>
<tr>
<td><a href="#Passed">Passed</a></td>
<td><xsl:call-template name="get-requirements-passed"/></td>
</tr>
<tr>
<td><a href="#Failed">Failed</a></td>
<td><xsl:call-template name="get-requirements-failed"/></td>
</tr>
<tr>
<td><a href="#Untested">Untested</a></td>
<td><xsl:call-template name="get-requirements-untested"/></td>
</tr>
<tr>
<td>Total</td>
<td><xsl:call-template name="get-requirements"/></td>
</tr>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template name="tests-summary">
<subsection name="Tests summary">
<p>
<table>
<tr>
<td><a href="#Test Cases: Passed">Passed</a></td>
<td><xsl:call-template name="get-tests-passed"/></td>
</tr>
<tr>
<td><a href="#Test Cases: Failed">Failed</a></td>
<td><xsl:call-template name="get-tests-failed"/></td>
</tr>
<tr>
<td>Total</td>
<td><xsl:call-template name="get-tests"/></td>
</tr>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template name="requirements-passed">
<subsection name="Passed">
<p>
<table>
<tr>
<th>Requirement</th>
<th>Tests</th>
</tr>
<xsl:apply-templates select="c:coverage[test and @failures = 0]"
mode="passed">
<xsl:sort select="requirementId"/>
</xsl:apply-templates>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template name="requirements-failed">
<subsection name="Failed">
<p>
<table>
<tr>
<th>Requirement</th>
<th>Tests</th>
<th>Failures</th>
</tr>
<xsl:apply-templates select="c:coverage[@failures != 0]"
mode="failed">
<xsl:sort select="requirementId"/>
</xsl:apply-templates>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template name="requirements-untested">
<subsection name="Untested">
<p>
<table>
<tr><th>Requirement</th></tr>
<xsl:apply-templates select="c:coverage[count(test) = 0]"
mode="untested">
<xsl:sort select="requirementId"/>
</xsl:apply-templates>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template name="tests-passed">
<subsection name="Test Cases: Passed">
<p>
<table>
<tr>
<th>Test Case</th>
<th>Tests</th>
</tr>
<xsl:apply-templates
select="t:testRuns[count(t:testRun/t:failure) = 0]"
mode="passed">
<xsl:sort select="test"/>
</xsl:apply-templates>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template name="tests-failed">
<subsection name="Test Cases: Failed">
<p>
<table>
<tr>
<th>Test Case</th>
<th>Tests</th>
<th>Failures</th>
</tr>
<xsl:apply-templates
select="t:testRuns[count(t:testRun/t:failure) != 0]"
mode="failed">
<xsl:sort select="test"/>
</xsl:apply-templates>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template match="t:testRuns" mode="passed">
<tr>
<td>
<a href="{test}.html"><small><xsl:value-of select="test"/></small></a>
</td>
<td><small><xsl:value-of select="count(t:testRun)"/></small></td>
</tr>
<xsl:call-template name="output-test"/>
</xsl:template>
<xsl:template match="t:testRuns" mode="failed">
<tr>
<td>
<a href="{test}.html"><small><xsl:value-of select="test"/></small></a>
</td>
<td><small><xsl:value-of select="count(t:testRun)"/></small></td>
<td>
<small>
<xsl:value-of select="count(t:testRun/t:failure)"/>
</small>
</td>
</tr>
<xsl:call-template name="output-test"/>
</xsl:template>
<xsl:template match="c:coverage" mode="passed">
<tr>
<xsl:call-template name="print-requirement"/>
<td><small><xsl:value-of select="@runs"/></small></td>
</tr>
<xsl:call-template name="output-requirement"/>
</xsl:template>
<xsl:template match="c:coverage" mode="failed">
<tr>
<xsl:call-template name="print-requirement"/>
<td><small><xsl:value-of select="@runs"/></small></td>
<td>
<a href="{requirementId}.html">
<small><xsl:value-of select="@failures"/></small>
</a>
</td>
</tr>
<xsl:call-template name="output-requirement"/>
</xsl:template>
<xsl:template match="c:coverage" mode="untested">
<tr>
<xsl:call-template name="print-requirement"/>
</tr>
<xsl:call-template name="output-requirement"/>
</xsl:template>
<xsl:template name="print-requirement">
<xsl:variable name="reqId" select="requirementId"/>
<td>
<small>
<a href="{$reqId}.html"><xsl:value-of select="$reqId"/></a>
</small>
</td>
</xsl:template>
<xsl:template name="get-requirements">
<xsl:value-of select="count(c:coverage)"/>
</xsl:template>
<xsl:template name="get-requirements-passed">
<xsl:value-of select="count(c:coverage[@runs != 0 and @failures = 0])"/>
</xsl:template>
<xsl:template name="get-requirements-failed">
<xsl:value-of select="count(c:coverage[@failures != 0])"/>
</xsl:template>
<xsl:template name="get-requirements-untested">
<xsl:value-of select="count(c:coverage[@runs = 0])"/>
</xsl:template>
<xsl:template name="get-tests">
<xsl:value-of select="count(t:testRuns/t:testRun)"/>
</xsl:template>
<xsl:template name="get-tests-passed">
<xsl:variable name="total">
<xsl:call-template name="get-tests"/>
</xsl:variable>
<xsl:variable name="failed">
<xsl:call-template name="get-tests-failed"/>
</xsl:variable>
<xsl:value-of select="$total - $failed"/>
</xsl:template>
<xsl:template name="get-tests-failed">
<xsl:value-of select="count(t:testRuns/t:testRun/t:failure)"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,96 +0,0 @@
body {
background: #fff;
color: #000;
}
.app h3 {
color: #fff;
background-color: #036;
}
.app h4 {
color: #fff;
background-color: #888;
}
.a td {
background: #ddd;
color: #000;
}
.b td {
background: #efefef;
color: #000;
}
.app th {
background-color: #bbb;
color: #fff;
}
div#banner {
border-top: 1px solid #369;
border-bottom: 1px solid #003;
}
#banner, #banner td {
background: #fff;
color: #fff;
}
#leftcol {
background: #eee;
color: #000;
border-right: 1px solid #aaa;
border-bottom: 1px solid #aaa;
border-top: 1px solid #fff;
}
#navcolumn {
background: #eee;
color: #000;
border-right: none;
border-bottom: none;
border-top: none;
}
#breadcrumbs {
background-color: #ddd;
color: #000;
border-top: 1px solid #fff;
border-bottom: 1px solid #aaa;
}
#source {
background-color: #fff;
color: #000;
border-right: 1px solid #888;
border-left: 1px solid #888;
border-top: 1px solid #888;
border-bottom: 1px solid #888;
margin-right: 7px;
margin-left: 7px;
margin-top: 1em;
}
#source pre {
margin-right: 7px;
margin-left: 7px;
}
a:link, #breadcrumbs a:visited, #navcolumn a:visited, .app a:visited, .tasknav a:visited {
color: blue;
}
a:active, a:hover, #leftcol a:active, #leftcol a:hover {
color: #f30 !important;
}
a:link.selfref, a:visited.selfref {
color: #555 !important;
}
h3, h4 {
margin-top: 1em;
margin-bottom: 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,228 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:s="http://jmscts.sourceforge.net/statistics"
xmlns:t="http://jmscts.sourceforge.net/test">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="meta" select="document('metadata.xml')"/>
<xsl:template match="/">
<document>
<properties>
<title>Statistics</title>
</properties>
<xsl:apply-templates select="s:statistics"/>
</document>
</xsl:template>
<xsl:template match="s:statistics">
<body>
<xsl:apply-templates select="t:testRuns"/>
</body>
</xsl:template>
<xsl:template match="t:testRuns">
<section name="Statistics for test: {test}">
<xsl:call-template name="print-description"/>
<xsl:call-template name="print-runs">
<xsl:with-param name="title" select="'Queue'"/>
<xsl:with-param name="factory" select="'QueueConnectionFactory'"/>
<xsl:with-param name="destType" select="'administered'"/>
</xsl:call-template>
<xsl:call-template name="print-runs">
<xsl:with-param name="title" select="'TemporaryQueue'"/>
<xsl:with-param name="factory" select="'QueueConnectionFactory'"/>
<xsl:with-param name="destType" select="'temporary'"/>
</xsl:call-template>
<xsl:call-template name="print-runs">
<xsl:with-param name="title" select="'Topic'"/>
<xsl:with-param name="factory" select="'TopicConnectionFactory'"/>
<xsl:with-param name="destType" select="'administered'"/>
</xsl:call-template>
<xsl:call-template name="print-runs">
<xsl:with-param name="title" select="'TemporaryTopic'"/>
<xsl:with-param name="factory" select="'TopicConnectionFactory'"/>
<xsl:with-param name="destType" select="'temporary'"/>
</xsl:call-template>
</section>
</xsl:template>
<xsl:template name="print-description">
<p>
<xsl:apply-templates select="$meta/meta-data">
<xsl:with-param name="name" select="test"/>
</xsl:apply-templates>
</p>
</xsl:template>
<xsl:key name="method-desc" match="/meta-data/class-meta/method-meta"
use="concat(../name, '.', name)"/>
<xsl:template match="meta-data">
<xsl:param name="name"/>
<xsl:apply-templates select="key('method-desc', $name)"/>
</xsl:template>
<xsl:template match="method-meta">
<xsl:copy-of select="description/node()"/>
</xsl:template>
<xsl:template name="print-runs">
<xsl:param name="title"/>
<xsl:param name="factory"/>
<xsl:param name="destType"/>
<xsl:variable name="has-consumer">
<xsl:choose>
<xsl:when test="count(t:testRun/t:statistic[type='receive']) > 0">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<subsection name="{$title}">
<p>
<table>
<tr>
<th>Run</th>
<th>Delivery</th>
<th>Session</th>
<xsl:if test="$has-consumer='true'">
<th>Consumer</th>
</xsl:if>
<th>Message</th>
<th>Type</th>
<th>Count</th>
<th>Time</th>
<th>Msgs/sec</th>
</tr>
<xsl:apply-templates
select="t:testRun[t:context/t:factory/@type=$factory and
t:context/t:behaviour/@destination=$destType]">
<xsl:sort select="t:context/t:behaviour/@deliveryMode"/>
<xsl:with-param name="has-consumer" select="$has-consumer"/>
</xsl:apply-templates>
</table>
</p>
</subsection>
</xsl:template>
<xsl:template match="t:testRun">
<xsl:param name="has-consumer"/>
<xsl:apply-templates select="t:statistic">
<xsl:with-param name="run" select="position()"/>
<xsl:with-param name="has-consumer" select="$has-consumer"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="t:statistic">
<xsl:param name="run"/>
<xsl:param name="has-consumer"/>
<tr>
<xsl:choose>
<xsl:when test="position() = 1">
<xsl:call-template name="statistic-header">
<xsl:with-param name="run" select="$run"/>
<xsl:with-param name="has-consumer" select="$has-consumer"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="statistic">
<xsl:with-param name="has-consumer" select="$has-consumer"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:template>
<xsl:template name="statistic-header">
<xsl:param name="run"/>
<xsl:param name="has-consumer"/>
<td>
<small><xsl:value-of select="$run"/></small>
</td>
<td>
<small><xsl:value-of select="..//t:behaviour/@deliveryMode"/></small>
</td>
<td>
<small>
<xsl:call-template name="get-session">
<xsl:with-param name="session" select="..//session"/>
</xsl:call-template>
</small>
</td>
<xsl:if test="$has-consumer='true'">
<td>
<small>
<xsl:call-template name="get-consumer">
<xsl:with-param name="consumer"
select="..//t:behaviour/@receiver"/>
</xsl:call-template>
</small>
</td>
</xsl:if>
<td>
<small><xsl:value-of select="..//message"/></small>
</td>
<td><small><xsl:value-of select="type"/></small></td>
<td><small><xsl:value-of select="count"/></small></td>
<td><small><xsl:value-of select="time"/></small></td>
<td>
<small>
<xsl:value-of select="format-number(rate, '0.00')"/>
</small>
</td>
</xsl:template>
<xsl:template name="statistic">
<xsl:param name="has-consumer"/>
<td/> <!-- empty run column -->
<td/> <!-- empty delivery column -->
<td/> <!-- empty session column -->
<xsl:if test="$has-consumer='true'">
<td/> <!-- empty consumer column -->
</xsl:if>
<td/> <!-- empty message column -->
<td><small><xsl:value-of select="type"/></small></td>
<td><small><xsl:value-of select="count"/></small></td>
<td><small><xsl:value-of select="time"/></small></td>
<td>
<small>
<xsl:value-of select="format-number(rate, '0.00')"/>
</small>
</td>
</xsl:template>
<xsl:template name="get-session">
<xsl:param name="session"/>
<xsl:choose>
<xsl:when test="$session='AUTO_ACKNOWLEDGE'">AUTO</xsl:when>
<xsl:when test="$session='CLIENT_ACKNOWLEDGE'">CLIENT</xsl:when>
<xsl:when test="$session='DUPS_OK_ACKNOWLEDGE'">DUPS_OK</xsl:when>
<xsl:otherwise><xsl:value-of select="$session"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="get-consumer">
<xsl:param name="consumer"/>
<xsl:choose>
<xsl:when test="$consumer='durable_synchronous'">
durable synchronous
</xsl:when>
<xsl:when test="$consumer='durable_asynchronous'">
durable asynchronous
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$consumer"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,434 +0,0 @@
/* contains rules unsuitable for Netscape 4.x; simpler rules are in ns4_only.css. see <http://style.tigris.org/> */
/* colors, backgrounds, borders, link indication */
body {
background: #fff;
color: #000;
}
.app h3, .app h4, .app th, .tabs td, .tabs th, .functnbar {
background-image: url(../images/nw_min.gif);
background-repeat: no-repeat;
}
#navcolumn div div, body.docs #toc li li {
background-image: url(../images/strich.gif);
background-repeat: no-repeat;
background-position: .5em .5em;
}
#navcolumn div div.heading {
background-image: none;
}
.app h3, .app h4 {
color: #fff;
}
.app h3 {
background-color: #036;
}
.app h4 {
background-color: #888;
}
.a td {
background: #ddd;
}
.b td {
background: #efefef;
}
table, th, td {
border: none
}
.mtb {
border-top: solid 1px #ddd;
}
div.colbar {
background: #bbb;
}
div#banner {
border-top: 1px solid #369;
border-bottom: 1px solid #003;
}
div#helptext th {
border-bottom: 1px solid #996;
border-right: 1px solid #996;
}
div#helptext td {
border-bottom: 1px solid #cc9;
border-right: 1px solid #cc9;
}
.tabs {
border-bottom: .75em #888 solid;
}
.tabs th, .tabs td {
border-right: 1px solid #333;
}
.tabs td {
border-bottom: 1px solid #ddd;
}
#navcolumn {
background: #eee;
border-right: 1px solid #aaa;
border-bottom: 1px solid #aaa;
}
#breadcrumbs {
border-bottom: 1px solid #aaa;
background-color: #ddd;
}
#navcolumn, #breadcrumbs {
border-top: 1px solid #fff;
}
#rightcol div.www, #rightcol div.help {
border: 1px solid #ddd;
}
div#navcolumn div.focus {
border-top: 1px solid #aaa;
border-left: 1px solid #aaa;
background-color: #fff;
}
body.docs div.docs {
background: #fff;
border-left: 1px solid #ddd;
border-top: 1px solid #ddd;
}
body.docs {
background: #eee url(../images/help_logo.gif) top right no-repeat !important;
}
.docs h3, .docs h4 {
border-top: solid 1px #000;
}
#alerterrormessage {
background: url(../images/icon_alert.gif) top left no-repeat !important;
}
.functnbar {
background-color: #aaa;
}
.functnbar2, .functnbar3 {
background: #aaa url(../images/sw_min.gif) no-repeat bottom left;
}
.functnbar3 {
background-color: #ddd;
}
.functnbar, .functnbar2, .functnbar3 {
color: #000;
}
.functnbar a, .functnbar2 a, .functnbar3 a {
color: #000;
text-decoration: underline;
}
#topmodule {
background: #ddd;
border-top: 1px solid #fff;
border-bottom: 1px solid #aaa;
border-right: 1px solid #aaa;
}
#topmodule #issueid {
border-right: 1px solid #aaa;
}
a:link, #navcolumn a:visited, .app a:visited, .tasknav a:visited {
color: blue;
}
a:active, a:hover, #leftcol a:active, #leftcol a:hover {
color: #f30 !important;
}
#login a:link, #login a:visited {
color: white;
text-decoration: underline;
}
#banner a:active, #banner a:hover {
color: #f90 !important;
}
#leftcol a, #breadcrumbs a {
text-decoration: none;
}
a:link.selfref, a:visited.selfref {
color: #555 !important;
text-decoration: none;
}
h2 .lastchild {
color: #777
}
.tabs td, .tabs th {
background-color: #ddd;
}
.app th {
background-color: #bbb;
}
.tabs th {
background-color: #888;
color: #fff;
}
.axial th {
background-color: #ddd;
color: black
}
.tabs td {
background-color: #ddd;
}
.alert {
color: #c00;
}
.confirm {
color: green;
}
.info {
color: blue;
}
.selection {
background: #ffc;
}
#login {
color: #fff;
}
#helptext th {
background: #cc9;
}
#helptext td {
background: #ffc;
}
.tabs a {
text-decoration: none;
}
#navcolumn div strong {
color: #000;
}
#banner, #banner td {
background: #036;
color: #fff;
}
body #banner #login a {
color: #fff;
}
/* font and text properties, exclusive of link indication, alignment, text-indent */
body, th, td, input, select, textarea, h2 small {
font-family: Verdana, Helvetica, Arial, sans-serif;
}
code, pre {
font-family: 'Andale Mono', Courier, monospace;
}
html body, body th, body td, textarea, h2 small, .app h3, .app h4, #rightcol h3, #bodycol pre, #bodycol code {
font-size: x-small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: small
}
html>body, html>body th, html>body td, html>body input, html>body select, html>body textarea, html>body h2 small, html>body .app h3, html>body .app h4, html>body #rightcol h3, html>body #bodycol pre, html>body #bodycol code {
font-size: small
}
small, div#footer td, div#login, div#helptext th, div#helptext td, div.tabs th, div.tabs td, input, select, .paginate, .functnbar, .functnbar2, .functnbar3, #breadcrumbs td, .courtesylinks, #rightcol div.help, .colbar, .tasknav, body.docs div#toc {
font-size: xx-small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: x-small
}
html>body small, html>body div#footer td, html>body div#login, html>body div#helptext td, html>body div#helptext th, html>body div.tabs th, html>body div.tabs td, html>body input, html>body select, html>body .paginate, html>body .functnbar, html>body .functnbar2, html>body .functnbar3, html>body #breadcrumbs td, html>body .courtesylinks, html>body #rightcol div.help, html>body .colbar, html>body .tasknav, html>body.docs #toc {
font-size: x-small
}
#bodycol h2 {
font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif;
font-size: 1.5em;
font-weight: normal;
}
h2 small {
font-weight: bold;
letter-spacing: .06em;
}
dt {
font-weight: bold
}
#login .username {
font-weight: bold;
}
h4 {
font-size: 1em;
}
#breadcrumbs td {
font-weight: bold;
}
.selection {
font-weight: bold
}
/* box properties (exclusive of borders), positioning, alignments, list types, text-indent */
#bodycol h2 {
margin-top: .3em;
margin-bottom: .5em;
}
p, ul, ol, dl {
margin-top: .67em;
margin-bottom: .67em;
}
h3, h4 {
margin-bottom: 0;
}
form {
margin-top: 0;
margin-bottom: 0;
}
#bodycol {
padding-left: 12px;
padding-right: 12px;
width: 100%;
voice-family: "\"}\"";
voice-family: inherit;
width: auto;
}
html>body #bodycol {
width: auto;
}
.docs {
line-height: 1.4;
}
.app h3, .app h4 {
padding: 5px;
margin-right: 2px;
margin-left: 2px;
}
.h3 p, .h4 p, .h3 dt, .h4 dt {
margin-right: 7px;
margin-left: 7px;
}
.tasknav {
margin-bottom: 1.33em
}
div.colbar {
padding: 4px;
margin: 2px 2px 0;
}
.tabs {
margin-top: .67em;
margin-right: 2px;
margin-left: 2px;
}
#leftcol {
padding-bottom: .5em;
}
#breadcrumbs td {
vertical-align: middle;
padding: 2px 8px;
}
#rightcol div.www, #rightcol div.help {
padding: 0 .5em
}
#navcolumn {
margin: -8px -8px 0 -8px;
padding: 4px;
}
#navcolumn div {
padding-left: 5px
}
div#navcolumn div div {
margin-top: .3em;
margin-bottom: .3em;
}
div#navcolumn div.focus {
margin-top: -.1em;
padding: .2em 4px;
}
body.docs #toc {
position: absolute;
top: 15px;
left: 0px;
width: 120px;
padding: 0 20px 0 0
}
body.docs #toc ul, #toc ol {
margin-left: 0;
padding-left: 0;
}
body.docs #toc li {
margin-top: 7px;
padding-left: 10px;
list-style-type: none;
}
body.docs div.docs {
margin: 61px 0 0 150px;
padding: 1em 2em 1em 1em !important;
}
.docs p+p {
text-indent: 5%;
margin-top: -.67em
}
.docs h3, .docs h4 {
margin-bottom: .1em;
padding-top: .3em;
}
#alerterrormessage {
padding-left: 100px;
}
.functnbar, .functnbar2, .functnbar3 {
padding: 5px;
margin: .67em 2px;
}
#topmodule td {
vertical-align: middle;
padding: 2px 8px
}
body {
padding: 1em;
}
body.composite, body.docs {
margin: 0;
padding: 0;
}
th, td {
text-align: left;
vertical-align: top
}
.right {
text-align: right !important;
}
.center {
text-align: center !important;
}
.tabs td, .tabs th {
padding-left: 7px;
padding-right: 7px;
}
.axial th {
text-align: right;
}
.app .axial td th {
text-align: left;
}
body td .stb {
margin-top: 1em;
text-indent: 0;
}
body td .mtb {
margin-top: 2em;
text-indent: 0;
}
dd {
margin-bottom: .67em;
}
#footer {
margin: 4px
}
#helptext {
margin-top: 1em
}
#helptext td div {
margin: .5em
}
.courtesylinks {
margin-top: 1em;
padding-top: 1em
}
#navcolumn div {
margin-bottom: .5em;
}
#navcolumn div div {
margin-top: .3em
}
#navcolumn div div {
padding-left: 1em;
}
#banner, #banner td {
vertical-align: middle;
}
body.docs, body.nonav {
margin: 1em
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="style-path"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="document">
<xsl:variable name="tigris-css"
select="concat($style-path, '/tigris.css')"/>
<xsl:variable name="maven-css" select="concat($style-path, '/maven.css')"/>
<html>
<style type="text/css">
@import url("<xsl:value-of select="$tigris-css"/>");
@import url("<xsl:value-of select="$maven-css"/>");
</style>
<head>
<title><xsl:value-of select="properties/title"/></title>
</head>
<xsl:apply-templates select="body"/>
</html>
</xsl:template>
<xsl:template match="body">
<body>
<table border="0" cellspacing="0" cellpadding="8" width="100%">
<tr valign="top">
<td rowspan="2">
<div id="bodycol">
<div class="app">
<xsl:apply-templates select="section"/>
</div>
</div>
</td>
</tr>
</table>
</body>
</xsl:template>
<!-- process a documentation section -->
<xsl:template match="section">
<div class="h3">
<xsl:if test="@name">
<h3>
<a name="{@name}"><xsl:value-of select="@name"/></a>
</h3>
</xsl:if>
<xsl:apply-templates select="*"/>
</div>
</xsl:template>
<xsl:template match="subsection">
<div class="h4">
<xsl:if test="@name">
<h4>
<a name="{@name}"><xsl:value-of select="@name"/></a>
</h4>
</xsl:if>
<xsl:apply-templates select="*"/>
</div>
</xsl:template>
<xsl:template match="source">
<div id="source">
<pre><xsl:value-of select="."/></pre>
</div>
</xsl:template>
<xsl:template match="footer">
<tr>
<td>
<xsl:apply-templates select="*"/>
</td>
</tr>
</xsl:template>
<xsl:template match="table">
<table cellpadding="3" cellspacing="2" border="1" width="100%">
<xsl:apply-templates select="*"/>
</table>
</xsl:template>
<xsl:template match="tr">
<xsl:variable name="class">
<xsl:choose>
<xsl:when test="(position() mod 2) = 0">a</xsl:when>
<xsl:otherwise>b</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{$class}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="*"/>
</tr>
</xsl:template>
<!-- copy any other elements through -->
<xsl:template match = "node()|@*" >
<xsl:copy >
<xsl:apply-templates select = "node()|@*" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,202 +0,0 @@
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "Exolab" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of Exoffice Technologies. For written permission,
* please contact jima@intalio.com.
*
* 4. Products derived from this Software may not be called "Exolab"
* nor may "Exolab" appear in their names without prior written
* permission of Exoffice Technologies. Exolab is a registered
* trademark of Exoffice Technologies.
*
* 5. Due credit should be given to the Exolab Project
* (http://www.exolab.org/).
*
* THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2001, 2003 (C) Exoffice Technologies Inc. All Rights Reserved.
* Copyright 2005 (C) Hiram Chirino
*
* $Id: ActiveMQProvider.java,v 1.1.1.1 2005/03/11 21:15:21 jstrachan Exp $
*/
package org.exolab.jmscts.activemq;
import java.util.HashMap;
import javax.jms.JMSException;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import org.apache.commons.logging.LogFactory;
import org.activemq.ActiveMQConnection;
import org.activemq.ActiveMQConnectionFactory;
import org.activemq.ActiveMQXAConnectionFactory;
import org.activemq.message.ActiveMQDestination;
import org.activemq.message.ActiveMQQueue;
import org.activemq.message.ActiveMQTopic;
import org.exolab.jmscts.provider.Administrator;
import org.exolab.jmscts.provider.Provider;
/**
* This class provides methods for obtaining and manipulating administered
* objects managed by the ActiveMQ implementation of JMS
*
* @author <a href="mailto:james@protique.com">James Strahcan</a>
* @author <a href="mailto:hiram@protique.com">Hiram Chirino</a>
* @version $Revision: 1.1.1.1 $ $Date: 2005/03/11 21:15:21 $
*/
public class ActiveMQProvider implements Provider, Administrator {
private String brokerURL = System.getProperty("url", "vm://localhost");
private HashMap directory = new HashMap();
private ActiveMQConnection adminConnection = null;
/**
* Initialises the administation interface
*
* @throws JMSException if the administration interface can't be
* initialised
*/
public void initialise(boolean start) throws JMSException {
System.out.println("==================================");
System.out.println("ActiveMQ provider starting up.");
System.out.println("==================================");
directory.put(getQueueConnectionFactory(), new ActiveMQConnectionFactory(brokerURL));
directory.put(getTopicConnectionFactory(), new ActiveMQConnectionFactory(brokerURL));
directory.put(getXAQueueConnectionFactory(), new ActiveMQXAConnectionFactory(brokerURL));
directory.put(getXATopicConnectionFactory(), new ActiveMQXAConnectionFactory(brokerURL));
if( adminConnection!=null )
throw new JMSException("Admin connection allready established.");
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerURL);
adminConnection = (ActiveMQConnection) factory.createConnection();
adminConnection.setClientID("admin");
adminConnection.start();
}
/**
* This method cleans up the administrator
* @throws JMSException
*/
public void cleanup(boolean stop) throws JMSException {
System.out.println("==================================");
System.out.println("ActiveMQ provider sutting down.");
System.out.println("==================================");
adminConnection.close();
adminConnection=null;
directory.clear();
}
/**
* Returns the administration interface
*/
public Administrator getAdministrator() {
return this;
}
/**
* Look up the named administered object
*
* @param name the name that the administered object is bound to
* @return the administered object bound to name
* @throws javax.naming.NamingException if the object is not bound, or the lookup fails
*/
public Object lookup(String name) throws NamingException {
Object result = directory.get(name);
if (result == null) {
throw new NameNotFoundException("Name not found: " + name);
}
return result;
}
/**
* Create an administered destination
*
* @param name the destination name
* @param queue if true, create a queue, else create a topic
* @throws JMSException if the destination cannot be created
*/
public void createDestination(String name, boolean queue)
throws JMSException {
if (queue) {
directory.put(name, new ActiveMQQueue(name));
}
else {
directory.put(name, new ActiveMQTopic(name));
}
}
/**
* Destroy an administered destination
*
* @param name the destination name
* @throws JMSException if the destination cannot be destroyed
*/
public void destroyDestination(String name) throws JMSException {
Object object = directory.remove(name);
if( object!=null && object instanceof ActiveMQDestination ) {
adminConnection.destroyDestination((ActiveMQDestination) object);
}
}
/**
* Returns true if an administered destination exists
*
* @param name the destination name
* @throws JMSException for any internal JMS provider error
*/
public boolean destinationExists(String name)
throws JMSException {
return directory.containsKey(name);
}
public String getQueueConnectionFactory() {
return "QueueConnectionFactory";
}
public String getTopicConnectionFactory() {
return "TopicConnectionFactory";
}
public String getXAQueueConnectionFactory() {
return "XAQueueConnectionFactory";
}
public String getXATopicConnectionFactory() {
return "XATopicConnectionFactory";
}
public String getBrokerURL() {
return brokerURL;
}
public void setBrokerURL(String brokerURL) {
LogFactory.getLog("TEST").info("!!!!!!!!!!!!!! setting url to "+brokerURL);
this.brokerURL = brokerURL;
}
}

View File

@ -1,63 +0,0 @@
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="default" xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven">
<goal name="default" prereqs="clean, test"/>
<goal name="wsdl:generate" prereqs="setclasspath">
<taskdef resource="axis-tasks.properties" classpathref="test.classpath"/>
<mkdir dir="${basedir}/target/generated/java"/>
<axis-wsdl2java
output="${basedir}/target/generated/java"
verbose="true"
noimports="false"
all="true"
serverSide="true"
testCase="true"
helperGen="true"
url="src/wsdl/eventing-binding.wsdl">
<mapping
namespace="http://schemas.xmlsoap.org/ws/2004/08/eventing"
package="org.activemq.ws.schema.eventing"/>
<mapping
namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"
package="org.activemq.ws.schema.addressing"/>
</axis-wsdl2java>
</goal>
<goal name="setclasspath">
<!--
<j:if test="${empty(skip_compile)}">
<attainGoal name="test:compile"/>
</j:if>
-->
<path id="test.classpath">
<pathelement path="${maven.build.dest}"/>
<pathelement path="target/classes"/>
<pathelement path="target/test-classes"/>
<path refid="maven.dependency.classpath"/>
</path>
<!--
<taskdef name="javacc" classname="javacc" classpathref="test.classpath"/>
-->
</goal>
</project>

View File

@ -1,21 +0,0 @@
##---------------------------------------------------------------------------
## 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Build Properties
# -------------------------------------------------------------------
maven.multiproject.type=rar

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE project>
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../../../etc/project.xml</extend>
<name>ActiveMQ :: Use Cases</name>
<id>activemq-usecases</id>
<description>
A collection of user supplied use cases which may be slow and so are outside of the core build
</description>
<package>org.activemq.usecases</package>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_2.4_spec</artifactId>
<version>${geronimo_spec_servlet_version}</version>
<properties>
<war.bundle>false</war.bundle>
<!-- <eclipse.dependency>true</eclipse.dependency> -->
</properties>
</dependency>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${pom.currentVersion}</version>
<properties>
<eclipse.dependency>truex</eclipse.dependency>
</properties>
</dependency>
</dependencies>
</project>

View File

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<beans>
<!-- ==================================================================== -->
<!-- ActiveMQ Broker Configuration -->
<!-- ==================================================================== -->
<broker>
<connector>
<tcpServerTransport uri="tcp://localhost:61616" backlog="1000" useAsyncSend="true" maxOutstandingMessages="50"/>
</connector>
<persistence>
<cachePersistence>
<journalPersistence directory="../var/journal">
<jdbcPersistence dataSourceRef="axion-ds"/>
<!-- Choose one of the following three configurationss to work with mysql-ds-->
<!--
<jdbcPersistence dataSourceRef="mysql-ds"
adapterClass="org.activemq.store.jdbc.adapter.BytesJDBCAdaptor"/>
<jdbcPersistence dataSourceRef="mysql-ds"
adapterClass="org.activemq.store.jdbc.adapter.BlobJDBCAdaptor"/>
<jdbcPersistence dataSourceRef="mysql-ds"
adapterClass="org.activemq.store.jdbc.adapter.StreamJDBCAdaptor"/>
-->
</journalPersistence>
</cachePersistence>
</persistence>
</broker>
<!-- ==================================================================== -->
<!-- JDBC DataSource Configurations -->
<!-- ==================================================================== -->
<bean name="axion-ds" class="org.axiondb.jdbc.AxionDataSource" autowire="constructor">
<constructor-arg><value>jdbc:axiondb:activemqdb:target/data/axion</value></constructor-arg>
</bean>
<!-- The Derby Datasource that will be used by the Broker -->
<bean id="derby-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
</property>
<property name="url">
<!-- Use a URL like 'jdbc:hsqldb:hsql://localhost:9001' if you want to connect to a remote hsqldb -->
<value>jdbc:derby:derbydb;create=true</value>
</property>
<property name="username">
<value></value>
</property>
<property name="password">
<value></value>
</property>
<property name="poolPreparedStatements">
<value>true</value>
</property>
</bean>
<!-- The MYSQL Datasource that will be used by the Broker -->
<bean id="mysql-ds"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost/activemq</value>
</property>
<property name="username">
<value>myname</value>
</property>
<property name="password">
<value>mypassword</value>
</property>
<property name="poolPreparedStatements">
<value>true</value>
</property>
</bean>
</beans>

View File

@ -1,99 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package blah;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Properties;
import javax.jms.*;
import javax.naming.*;
public class ActiveMQQueueReceiver {
public static void main(String[] args) {
Queue queue = null;
QueueConnectionFactory queueConnectionFactory = null;
QueueConnection queueConnection = null;
try {
Properties props = new Properties();
//props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
//props.setProperty(Context.PROVIDER_URL, "ormi://10.1.0.99:3202/default");
//props.setProperty(Context.SECURITY_PRINCIPAL, "dan");
//props.setProperty(Context.SECURITY_CREDENTIALS, "abc123");
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "tcp://hostname:61616");
props.setProperty("queue.BlahQueue", "example.BlahQueue");
// use the following if you with to make the receiver a broker
//props.setProperty("useEmbeddedBroker", "true");
Context jndiContext = new InitialContext(props);
//queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("jms/QueueConnectionFactory");
//queue = (Queue) jndiContext.lookup("jms/demoQueue");
queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("QueueConnectionFactory");
queue = (Queue) jndiContext.lookup("BlahQueue");
}
catch (NamingException e) {
System.out.println("---------------------------ERROR-----------------------------");
e.printStackTrace();
System.exit(-1);
}
try {
queueConnection = queueConnectionFactory.createQueueConnection();
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueReceiver queueReceiver = queueSession.createReceiver(queue);
queueConnection.start();
//while (true)
//{
System.out.println("Starting to receive");
TextMessage message = (TextMessage) queueReceiver.receive(10000);
if (message != null) {
Date timestamp = new Date(message.getJMSTimestamp());
System.out.println("Blah: " + message.getStringProperty("Blah"));
System.out.println("Timestamp: " + timestamp);
System.out.println("Payload: " + message.getText());
}
else {
System.out.println("NO MESSAGES");
}
System.out.println();
//Thread.sleep(10000);
//}
}
catch (Exception e) {
System.out.println("SOMETHING WENT WRONG WHILE CONSUMING");
e.printStackTrace();
}
finally {
if (queueConnection != null) {
try {
queueConnection.close();
}
catch (Exception ignored) {
}
}
}
}
}

View File

@ -1,96 +0,0 @@
/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package blah;
import java.util.Properties;
import javax.jms.*;
import javax.naming.*;
public class ActiveMQQueueSender
{
public static void main(String[] args)
{
String msg = args.length < 1 ? "This is the default message" : args[0];
Queue queue = null;
QueueConnectionFactory queueConnectionFactory = null;
QueueConnection queueConnection = null;
try
{
Properties props = new Properties();
//props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
//props.setProperty(Context.PROVIDER_URL, "ormi://10.1.0.99:3202/default");
//props.setProperty(Context.SECURITY_PRINCIPAL, "dan");
//props.setProperty(Context.SECURITY_CREDENTIALS, "abc123");
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "tcp://hostname:61616");
props.setProperty("queue.BlahQueue", "example.BlahQueue");
Context jndiContext = new InitialContext(props);
//queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("jms/QueueConnectionFactory");
//queue = (Queue) jndiContext.lookup("jms/demoQueue");
queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("QueueConnectionFactory");
queue = (Queue) jndiContext.lookup("BlahQueue");
}
catch (NamingException e)
{
System.out.println("---------------------------ERROR-----------------------------");
e.printStackTrace();
System.exit(-1);
}
try
{
queueConnection = queueConnectionFactory.createQueueConnection();
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender = queueSession.createSender(queue);
//queueSender.setDeliveryMode(DeliveryMode.PERSISTENT);
//queueSender.setTimeToLive(1000*60*60);
TextMessage message = queueSession.createTextMessage();
message.setText(msg);
message.setStringProperty("Blah", "Hello!");
queueSender.send(message);
System.out.println("Message sent");
}
catch (JMSException e)
{
System.out.println("SOMETHING WENT WRONG WHILE SENDING");
e.printStackTrace();
}
finally
{
if (queueConnection != null)
{
try
{
queueConnection.close();
}
catch (Exception ignored)
{
}
}
}
}
}

View File

@ -1,400 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.usecases;
import junit.framework.TestCase;
import org.activemq.ActiveMQConnectionFactory;
import org.activemq.broker.BrokerContainer;
import org.activemq.broker.impl.BrokerContainerImpl;
import org.activemq.store.vm.VMPersistenceAdapter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
/**
* TODO this test case relies on a perfect distribution of messages, dispatched one by one to each consumer.
* So this test case can only really work with an explicit setting of 'prefetch = 1' or something similar.
* The default out of the box dispatcher eagerly dispatches messages as quickly as possible.
*
* Ensures that if there is a network of brokers that a message is always dispatched to an available consumer * regardless of which broker it is on.
*
* @version $Revision: 1.1 $
*/
public class AvailableConsumerTest extends TestCase {
private static final transient Log log = LogFactory.getLog(AvailableConsumerTest.class);
private static final long BROKER_INITIALIZATION_DELAY = 7000;
public void testOneBroker() throws Throwable {
String[] urls = new String[]{"tcp://localhost:9000"};
runSimulation(urls, 2, "QUEUE_NAME");
//runSimulation(urls, 5, "QUEUE_NAME");
//runSimulation(urls, 10, "QUEUE_NAME");
}
public void testTwoBrokers() throws Throwable {
String[] urls = new String[]{"tcp://localhost:9000", "tcp://localhost:9001"};
runSimulation(urls, 2, "QUEUE_NAME");
runSimulation(urls, 5, "QUEUE_NAME");
runSimulation(urls, 10, "QUEUE_NAME");
}
public void testTenBrokers() throws Throwable {
String[] urls = new String[]{
"tcp://localhost:9000", "tcp://localhost:9001", "tcp://localhost:9002", "tcp://localhost:9003", "tcp://localhost:9004",
"tcp://localhost:9005", "tcp://localhost:9006", "tcp://localhost:9007", "tcp://localhost:9008", "tcp://localhost:9009"
};
runSimulation(urls, 2, "QUEUE_NAME");
runSimulation(urls, 5, "QUEUE_NAME");
runSimulation(urls, 10, "QUEUE_NAME");
}
private void runSimulation(String[] brokerURLs, int numConsumers, String queue) throws Throwable {
assertTrue("More than one consumer is required", numConsumers > 1);
BrokerThread[] brokers = null;
BlockingConsumer[] consumers = null;
MessagePublisher[] publishers = null;
try {
String reliableURL = createReliableURL(brokerURLs);
brokers = createBrokers(brokerURLs);
consumers = createConsumers(reliableURL, numConsumers, queue);
publishers = createPublishers(reliableURL, 1, queue);
// Now get all of the consumers blocked except for one
{
for (int i = 0; i < consumers.length - 1; i++) {
publishers[0].sendMessage();
}
waitUntilNumBlocked(consumers, consumers.length - 1);
}
// Now send one more message which should cause all of the consumers to be blocked
{
publishers[0].sendMessage();
waitUntilNumBlocked(consumers, consumers.length);
}
// Unblock a consumer and make sure it is unblocked
{
synchronized (consumers[0]) {
consumers[0].notifyAll();
}
waitUntilNumBlocked(consumers, consumers.length - 1);
}
// Send another message and make sure it is blocked again
{
publishers[0].sendMessage();
waitUntilNumBlocked(consumers, consumers.length);
}
// Finally queue up a message for each consumer but one, then unblock them all and make sure one is still unblocked
{
for (int i = 0; i < consumers.length - 1; i++) {
publishers[0].sendMessage();
}
for (int i = 0; i < consumers.length; i++) {
synchronized (consumers[i]) {
consumers[i].notifyAll();
}
}
waitUntilNumBlocked(consumers, consumers.length - 1);
}
}
finally {
cleanupSimulation(brokers, publishers, consumers);
}
}
private static void cleanupSimulation(BrokerThread[] brokers, MessagePublisher[] publishers, BlockingConsumer[] consumers) {
try {
for (int i = 0; i < publishers.length; i++) {
publishers[i].done();
}
}
catch (Throwable t) {
log.warn("Non-fatal error during cleanup", t);
}
try {
for (int i = 0; i < consumers.length; i++) {
// Unblock it in case it is blocked
synchronized (consumers[i]) {
consumers[i].notifyAll();
}
consumers[i].done();
}
}
catch (Throwable t) {
log.warn("Non-fatal error during cleanup", t);
}
try {
for (int i = 0; i < brokers.length; i++) {
brokers[i].done();
}
}
catch (Throwable t) {
log.warn("Non-fatal error during cleanup", t);
}
}
private static BrokerThread[] createBrokers(String[] brokerURLs) throws InterruptedException {
BrokerThread[] threads = new BrokerThread[brokerURLs.length];
for (int i = 0; i < threads.length; i++) {
threads[i] = new BrokerThread(Integer.toString(i), brokerURLs[i], brokerURLs);
threads[i].start();
}
// Delay so that the brokers have a chance to come up fully and connect to each other
log.debug("Created " + threads.length + " brokers, giving them time to initialize...");
Object temp = new Object();
synchronized (temp) {
temp.wait(BROKER_INITIALIZATION_DELAY * brokerURLs.length);
}
log.debug("Brokers should be initialized now");
return threads;
}
private static BlockingConsumer[] createConsumers(String brokerURL, int numConsumers, String queue) throws JMSException {
BlockingConsumer[] consumers = new BlockingConsumer[numConsumers];
for (int i = 0; i < consumers.length; i++) {
consumers[i] = new BlockingConsumer(brokerURL, queue);
}
return consumers;
}
private static MessagePublisher[] createPublishers(String brokerURL, int numPublishers, String queue) throws JMSException {
MessagePublisher[] publishers = new MessagePublisher[numPublishers];
for (int i = 0; i < publishers.length; i++) {
publishers[i] = new MessagePublisher(brokerURL, queue);
}
return publishers;
}
private static String createReliableURL(String[] brokerURLs) {
StringBuffer sb = new StringBuffer("reliable:");
for (int i = 0; i < brokerURLs.length; i++) {
if (i != 0) {
sb.append(',');
}
sb.append(brokerURLs[i]);
}
return sb.toString();
}
private static void waitUntilNumBlocked(BlockingConsumer[] consumers, int expectedNumBlocked) throws InterruptedException {
boolean found = false;
int maxIterations = 50;
for (int iteration = 0; iteration < maxIterations; iteration++) {
int numBlocked = 0;
for (int i = 0; i < consumers.length; i++) {
numBlocked += consumers[i].isBlocked() ? 1 : 0;
}
if (numBlocked == expectedNumBlocked) {
found = true;
break;
}
log.debug("Waiting for " + expectedNumBlocked + " consumers to block, currently only " + numBlocked + " are blocked.");
Object temp = new Object();
synchronized (temp) {
temp.wait(250);
}
}
assertTrue("Never saw " + expectedNumBlocked + " consumers blocked", found);
}
private static final class BrokerThread extends Thread {
private final String m_id;
private final String m_myURL;
private final String[] m_linkedURLs;
private BrokerContainer m_container;
public BrokerThread(String id, String myURL, String[] linkedURLs) {
m_id = id;
m_myURL = myURL;
m_linkedURLs = linkedURLs;
}
public void run() {
try {
m_container = new BrokerContainerImpl(m_id);
m_container.setPersistenceAdapter(new VMPersistenceAdapter());
m_container.addConnector(m_myURL);
for (int i = 0; i < m_linkedURLs.length; i++) {
if (!m_myURL.equals(m_linkedURLs[i])) {
m_container.addNetworkConnector("reliable:" + m_linkedURLs[i]);
}
}
m_container.start();
}
catch (JMSException e) {
log.error("Unexpected exception", e);
}
}
public void done() {
try {
m_container.stop();
}
catch (JMSException e) {
log.error("Unexpected exception", e);
}
}
}
private static final class MessagePublisher {
private final String m_url;
private final Connection m_connection;
private final Session m_session;
private final Queue m_queue;
private final MessageProducer m_producer;
public MessagePublisher(String url, String queue) throws JMSException {
this(url, queue, DeliveryMode.PERSISTENT);
}
public MessagePublisher(String url, String queue, int deliveryMode) throws JMSException {
m_url = url;
m_connection = new ActiveMQConnectionFactory(m_url).createConnection();
m_connection.start();
m_session = m_connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
m_queue = m_session.createQueue(queue);
m_producer = m_session.createProducer(m_queue);
m_producer.setDeliveryMode(deliveryMode);
}
public void done() {
try {
m_producer.close();
}
catch (Throwable ignored) {
}
try {
m_session.close();
}
catch (Throwable ignored) {
}
try {
m_connection.close();
}
catch (Throwable ignored) {
}
}
public void sendMessage() throws JMSException {
Message message = m_session.createMessage();
m_producer.send(message);
}
}
private static final class BlockingConsumer implements MessageListener {
private final String m_url;
private final Connection m_connection;
private final Session m_session;
private final Queue m_queue;
private final MessageConsumer m_consumer;
private boolean m_blocked;
public BlockingConsumer(String url, String queue) throws JMSException {
m_url = url;
m_connection = new ActiveMQConnectionFactory(m_url).createConnection();
m_connection.start();
m_session = m_connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
m_queue = m_session.createQueue(queue);
m_consumer = m_session.createConsumer(m_queue);
m_consumer.setMessageListener(this);
m_blocked = false;
}
public boolean isBlocked() {
return m_blocked;
}
public void done() {
try {
m_consumer.setMessageListener(null);
}
catch (Throwable ignored) {
}
try {
m_consumer.close();
}
catch (Throwable ignored) {
}
try {
m_session.close();
}
catch (Throwable ignored) {
}
try {
m_connection.close();
}
catch (Throwable ignored) {
}
}
public void onMessage(Message message) {
m_blocked = true;
synchronized (this) {
try {
wait();
}
catch (InterruptedException e) {
log.error("Unexpected InterruptedException during onMessage", e);
}
}
m_blocked = false;
}
}
}

View File

@ -1,566 +0,0 @@
/**
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activemq.usecases;
import junit.framework.TestCase;
import org.activemq.ActiveMQConnectionFactory;
import org.activemq.broker.BrokerContainer;
import org.activemq.broker.impl.BrokerContainerImpl;
import org.activemq.store.vm.VMPersistenceAdapter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.jms.*;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* @author bbeck
* @version $Revision: 1.1 $
*/
public class BecksNetworkTest extends TestCase {
private static final Log log = LogFactory.getLog(BecksNetworkTest.class);
private static final int NUM_BROKERS = 10;
private static final int NUM_PRODUCERS = 10;
private static final int NUM_CONSUMERS = 1;
private static final int NUM_MESSAGES = 1;
private static final long MESSAGE_SEND_DELAY = 100;
private static final long MESSAGE_RECEIVE_DELAY = 50;
private static final int BASE_PORT = 9500;
private static final String QUEUE_NAME = "QUEUE";
private static final String MESSAGE_PRODUCER_KEY = "PRODUCER";
private static final String MESSAGE_BODY_KEY = "BODY";
public void testCase() throws Throwable {
main(new String[]{});
}
public static void main(String[] args) throws Throwable {
String[] addresses = new String[NUM_BROKERS];
for (int i = 0; i < NUM_BROKERS; i++) {
addresses[i] = "tcp://localhost:" + (BASE_PORT + i);
}
log.info("Starting brokers");
BrokerContainer[] brokers = startBrokers(addresses);
String reliableURL = createAddressString(addresses, "reliable:", null);
log.info("Creating simulation state");
final SimulationState state = new SimulationState(NUM_PRODUCERS * NUM_MESSAGES);
Thread stateWatcher = new Thread("Simulation State Watcher Thread") {
public void run() {
while (state.getState() != SimulationState.FINISHED) {
log.info("State: " + state);
synchronized (this) {
try {
wait(5000);
}
catch (InterruptedException ignored) {
}
}
}
}
};
stateWatcher.setDaemon(true);
stateWatcher.start();
log.info("Starting components");
MessageProducerComponent[] producers = new MessageProducerComponent[NUM_PRODUCERS];
MessageConsumerComponent[] consumers = new MessageConsumerComponent[NUM_CONSUMERS];
{
for (int i = 0; i < NUM_PRODUCERS; i++) {
producers[i] = new MessageProducerComponent(state, "MessageProducer[" + i + "]", reliableURL, NUM_MESSAGES);
producers[i].start();
}
for (int i = 0; i < NUM_CONSUMERS; i++) {
consumers[i] = new MessageConsumerComponent(state, "MessageConsumer[" + i + "]", reliableURL);
consumers[i].start();
}
}
// Start the simulation
log.info("##### Starting the simulation...");
state.setState(SimulationState.RUNNING);
for (int i = 0; i < producers.length; i++) {
producers[i].join();
}
log.info("Producers finished");
for (int i = 0; i < consumers.length; i++) {
consumers[i].join();
log.info(consumers[i].getId() + " consumed " + consumers[i].getNumberOfMessagesConsumed() + " messages.");
}
log.info("Consumers finished");
log.info("State: " + state);
state.waitForSimulationState(SimulationState.FINISHED);
log.info("Stopping brokers");
for (int i = 0; i < brokers.length; i++) {
brokers[i].stop();
}
}
private static BrokerContainer[] startBrokers(String[] addresses) throws JMSException {
BrokerContainer[] containers = new BrokerContainer[addresses.length];
for (int i = 0; i < containers.length; i++) {
containers[i] = new BrokerContainerImpl(Integer.toString(i));
containers[i].setPersistenceAdapter(new VMPersistenceAdapter());
containers[i].addConnector(addresses[i]);
for (int j = 0; j < addresses.length; j++) {
if (i == j) {
continue;
}
containers[i].addNetworkConnector("reliable:" + addresses[j]);
}
containers[i].start();
log.debug("Created broker on " + addresses[i]);
}
// Delay so this broker has a chance to come up fully...
try {
Thread.sleep(2000 * containers.length);
}
catch (InterruptedException ignored) {
}
return containers;
}
/*
private static BrokerContainer[] startBrokers(String[] addresses) throws JMSException, IOException
{
for(int i = 0; i < addresses.length; i++) {
File temp = File.createTempFile("broker_" + i + "_", ".xml");
temp.deleteOnExit();
PrintWriter fout = new PrintWriter(new FileWriter(temp));
fout.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
fout.println("<!DOCTYPE beans PUBLIC \"-//ACTIVEMQ//DTD//EN\" \"http://activemq.codehaus.org/dtd/activemq.dtd\">");
fout.println("<beans>");
fout.println(" <broker name=\"" + "receiver" + i + "\">");
fout.println(" <connector>");
fout.println(" <tcpServerTransport uri=\"" + addresses[i] + "\"/>");
fout.println(" </connector>");
if(addresses.length > 1) {
String otherAddresses = createAddressString(addresses, "list:", addresses[i]);
otherAddresses = "tcp://localhost:9000";
fout.println(" <networkConnector>");
fout.println(" <networkChannel uri=\"" + otherAddresses + "\"/>");
fout.println(" </networkConnector>");
}
fout.println(" <persistence>");
fout.println(" <vmPersistence/>");
fout.println(" </persistence>");
fout.println(" </broker>");
fout.println("</beans>");
fout.close();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://" + i);
factory.setUseEmbeddedBroker(true);
factory.setBrokerXmlConfig("file:" + temp.getAbsolutePath());
factory.setBrokerName("broker-" + addresses[i]);
factory.start();
Connection c = factory.createConnection();
c.start();
}
// Delay so this broker has a chance to come up fully...
try { Thread.sleep(2000*addresses.length); }
catch(InterruptedException ignored) {}
return null;
}
*/
private static String createAddressString(String[] addresses, String prefix, String addressToSkip) {
StringBuffer sb = new StringBuffer(prefix);
boolean first = true;
for (int i = 0; i < addresses.length; i++) {
if (addressToSkip != null && addressToSkip.equals(addresses[i])) {
continue;
}
if (!first) {
sb.append(',');
}
sb.append(addresses[i]);
first = false;
}
return sb.toString();
}
private static final class SimulationState {
public static final int INITIALIZED = 1;
public static final int RUNNING = 2;
public static final int FINISHED = 3;
private final Object m_stateLock;
private int m_state;
private final int m_numExpectedMessages;
private final Set m_messagesProduced;
private final Set m_messagesConsumed;
public SimulationState(int numMessages) {
m_stateLock = new Object();
synchronized (m_stateLock) {
m_state = INITIALIZED;
m_numExpectedMessages = numMessages;
m_messagesProduced = new HashSet();
m_messagesConsumed = new HashSet();
}
}
public int getState() {
synchronized (m_stateLock) {
return m_state;
}
}
public void setState(int newState) {
synchronized (m_stateLock) {
m_state = newState;
m_stateLock.notifyAll();
}
}
public void waitForSimulationState(int state) throws InterruptedException {
synchronized (m_stateLock) {
while (m_state != state) {
m_stateLock.wait();
}
}
}
public void onMessageProduced(String producerId, String messageBody) {
log.debug("-> onMessageProduced(" + producerId + ", " + messageBody + ")");
synchronized (m_stateLock) {
if (m_state == INITIALIZED) {
throw new RuntimeException("Message produced before the simulation has begun: messageBody=" + messageBody);
}
if (m_state == FINISHED) {
throw new RuntimeException("Message produced after the simulation has finished: messageBody=" + messageBody);
}
if (!m_messagesProduced.add(messageBody)) {
throw new RuntimeException("Duplicate message produced: messageBody=" + messageBody);
}
}
}
public void onMessageConsumed(String consumerId, String messageBody) {
log.debug("<- onMessageConsumed(" + consumerId + ", " + messageBody + ")");
synchronized (m_stateLock) {
if (m_state != RUNNING) {
throw new RuntimeException("Message consumed while the simulation wasn't running: state = " + m_state + ", messageBody=" + messageBody);
}
if (!m_messagesProduced.contains(messageBody)) {
throw new RuntimeException("Message consumed that wasn't produced: messageBody=" + messageBody);
}
if (!m_messagesConsumed.add(messageBody)) {
throw new RuntimeException("Message consumed more than once: messageBody=" + messageBody);
}
if (m_messagesConsumed.size() == m_numExpectedMessages) {
setState(FINISHED);
log.info("All expected messages have been consumed, finishing simulation.");
}
}
}
public String toString() {
synchronized (m_stateLock) {
SortedMap unconsumed = new TreeMap();
for (Iterator iter = m_messagesProduced.iterator(); iter.hasNext();) {
String message = (String) iter.next();
int colonIndex = message.indexOf(':');
String producerId = message.substring(0, colonIndex);
Integer numMessages = (Integer) unconsumed.get(producerId);
numMessages = (numMessages == null) ? new Integer(1) : new Integer(numMessages.intValue() + 1);
unconsumed.put(producerId, numMessages);
}
for (Iterator iter = m_messagesConsumed.iterator(); iter.hasNext();) {
String message = (String) iter.next();
int colonIndex = message.indexOf(':');
String producerId = message.substring(0, colonIndex);
Integer numMessages = (Integer) unconsumed.get(producerId);
numMessages = (numMessages == null) ? new Integer(-1) : new Integer(numMessages.intValue() - 1);
if (numMessages.intValue() == 0) {
unconsumed.remove(producerId);
}
else {
unconsumed.put(producerId, numMessages);
}
}
return "SimulationState["
+ "state=" + m_state + " "
+ "numExpectedMessages=" + m_numExpectedMessages + " "
+ "numMessagesProduced=" + m_messagesProduced.size() + " "
+ "numMessagesConsumed=" + m_messagesConsumed.size() + " "
+ "unconsumed=" + unconsumed;
}
}
}
private static abstract class SimulationComponent extends Thread {
protected final SimulationState m_simulationState;
protected final String m_id;
protected abstract void _initialize() throws Throwable;
protected abstract void _run() throws Throwable;
protected abstract void _cleanup() throws Throwable;
public SimulationComponent(SimulationState state, String id) {
super(id);
m_simulationState = state;
m_id = id;
}
public String getId() {
return m_id;
}
public final void run() {
try {
try {
_initialize();
}
catch (Throwable t) {
log.error("Error during initialization", t);
return;
}
try {
if (m_simulationState.getState() == SimulationState.FINISHED) {
log.info(m_id + " : NO NEED TO WAIT FOR RUNNING - already FINISHED");
}
else {
log.info(m_id + ": WAITING for RUNNING started");
m_simulationState.waitForSimulationState(SimulationState.RUNNING);
log.info(m_id + ": WAITING for RUNNING finished");
}
}
catch (InterruptedException e) {
log.error("Interrupted during wait for the simulation to begin", e);
return;
}
try {
_run();
}
catch (Throwable t) {
log.error("Error during running", t);
}
}
finally {
try {
_cleanup();
}
catch (Throwable t) {
log.error("Error during cleanup", t);
}
}
}
}
private static abstract class JMSComponent extends SimulationComponent {
protected final String m_url;
protected Connection m_connection;
protected Session m_session;
protected Queue m_queue;
public JMSComponent(SimulationState state, String id, String url) {
super(state, id);
m_url = url;
}
protected void _initialize() throws JMSException {
m_connection = new ActiveMQConnectionFactory(m_url).createConnection();
m_connection.start();
m_session = m_connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
m_queue = m_session.createQueue(QUEUE_NAME);
}
protected void _cleanup() throws JMSException {
if (m_session != null) {
m_session.close();
}
if (m_connection != null) {
m_connection.close();
}
}
}
private static final class MessageProducerComponent extends JMSComponent {
private final int m_numMessagesToSend;
private MessageProducer m_producer;
public MessageProducerComponent(SimulationState state, String id, String url, int numMessages) {
super(state, id, url);
m_numMessagesToSend = numMessages;
}
protected void _initialize() throws JMSException {
super._initialize();
m_producer = m_session.createProducer(m_queue);
m_producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
}
protected void _cleanup() throws JMSException {
if (m_producer != null) {
m_producer.close();
}
super._cleanup();
}
public void _run() throws JMSException, InterruptedException {
log.debug(m_id + ": started");
for (int num = 0; num < m_numMessagesToSend; num++) {
String messageBody = createMessageBody(m_id, num);
MapMessage message = m_session.createMapMessage();
message.setString(MESSAGE_PRODUCER_KEY, m_id);
message.setString(MESSAGE_BODY_KEY, messageBody);
// Pretend to be doing some work....
Thread.sleep(MESSAGE_SEND_DELAY);
m_simulationState.onMessageProduced(m_id, messageBody);
m_producer.send(message);
}
}
private static String createMessageBody(String id, int num) {
return id + ":" + Integer.toString(num);
}
}
private static final class MessageConsumerComponent extends JMSComponent implements MessageListener {
private final Object m_stateLock;
private boolean m_inOnMessage;
private MessageConsumer m_consumer;
private int m_numMessagesConsumed;
public MessageConsumerComponent(SimulationState state, String id, String url) {
super(state, id, url);
m_stateLock = new Object();
m_inOnMessage = false;
}
protected void _initialize() throws JMSException {
super._initialize();
m_consumer = m_session.createConsumer(m_queue);
m_consumer.setMessageListener(this);
m_numMessagesConsumed = 0;
}
protected void _cleanup() throws JMSException {
if (m_consumer != null) {
m_consumer.close();
}
super._cleanup();
}
public void _run() throws InterruptedException {
log.info(m_id + ": WAITING for FINISHED started");
m_simulationState.waitForSimulationState(SimulationState.FINISHED);
log.info(m_id + ": WAITING for FINISHED finished");
}
public int getNumberOfMessagesConsumed() {
return m_numMessagesConsumed;
}
public void onMessage(Message msg) {
synchronized (m_stateLock) {
if (m_inOnMessage) {
log.error("Already in onMessage!!!");
}
m_inOnMessage = true;
}
try {
MapMessage message = (MapMessage) msg;
String messageBody = message.getString(MESSAGE_BODY_KEY);
m_simulationState.onMessageConsumed(m_id, messageBody);
m_numMessagesConsumed++;
// Pretend to be doing some work....
Thread.sleep(MESSAGE_RECEIVE_DELAY);
}
catch (Throwable t) {
log.error("Unexpected error during onMessage: message=" + msg, t);
}
finally {
synchronized (m_stateLock) {
if (!m_inOnMessage) {
log.error("Not already in onMessage!!!");
}
m_inOnMessage = false;
}
}
}
}
}

View File

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<beans>
<!-- ==================================================================== -->
<!-- ActiveMQ Broker Configuration -->
<!-- ==================================================================== -->
<broker>
<connector>
<tcpServerTransport uri="tcp://localhost:0" backlog="1000" useAsyncSend="true" maxOutstandingMessages="50"/>
</connector>
<networkConnector>
<networkChannel uri="remote://reliable:(tcp://localhost:61616)"/>
</networkConnector>
<persistence>
<cachePersistence>
<journalPersistence directory="journal2">
<jdbcPersistence dataSourceRef="derby-ds"/>
<!-- Choose one of the following three configurationss to work with mysql-ds-->
<!--
<jdbcPersistence dataSourceRef="mysql-ds"
adapterClass="org.activemq.store.jdbc.adapter.BytesJDBCAdaptor"/>
<jdbcPersistence dataSourceRef="mysql-ds"
adapterClass="org.activemq.store.jdbc.adapter.BlobJDBCAdaptor"/>
<jdbcPersistence dataSourceRef="mysql-ds"
adapterClass="org.activemq.store.jdbc.adapter.StreamJDBCAdaptor"/>
-->
</journalPersistence>
</cachePersistence>
</persistence>
</broker>
<!-- ==================================================================== -->
<!-- JDBC DataSource Configurations -->
<!-- ==================================================================== -->
<!-- The Derby Datasource that will be used by the Broker -->
<bean id="derby-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
</property>
<property name="url">
<!-- Use a URL like 'jdbc:hsqldb:hsql://localhost:9001' if you want to connect to a remote hsqldb -->
<value>jdbc:derby:derbydb;create=true</value>
</property>
<property name="username">
<value></value>
</property>
<property name="password">
<value></value>
</property>
<property name="poolPreparedStatements">
<value>true</value>
</property>
</bean>
<!-- The MYSQL Datasource that will be used by the Broker -->
<bean id="mysql-ds"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost/activemq</value>
</property>
<property name="username">
<value>myname</value>
</property>
<property name="password">
<value>mypassword</value>
</property>
<property name="poolPreparedStatements">
<value>true</value>
</property>
</bean>
</beans>

Some files were not shown because too many files have changed in this diff Show More