You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2009/06/17 20:15:25 UTC
svn commit: r785747 - in /activemq/sandbox/activemq-flow:
activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/
activemq-broker/src/main/java/org/apache/activemq/apollo/transport/vm/
activemq-broker/src/main/resources/ activemq-broker/src/test...
Author: chirino
Date: Wed Jun 17 18:15:24 2009
New Revision: 785747
URL: http://svn.apache.org/viewvc?rev=785747&view=rev
Log:
- added missing license headers
- More tweaks to the VMTransportFactory and ActiveMQConnectionFactoryTest to get more tests to pass.
Modified:
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/transport/vm/VMTransportFactory.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml
activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java
activemq/sandbox/activemq-flow/activemq-transport/src/main/java/org/apache/activemq/transport/TransportFactory.java
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java Wed Jun 17 18:15:24 2009
@@ -1,3 +1,19 @@
+/**
+ * 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.apache.activemq.apollo.jaxb;
import java.io.File;
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java Wed Jun 17 18:15:24 2009
@@ -1,3 +1,19 @@
+/**
+ * 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.apache.activemq.apollo.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java Wed Jun 17 18:15:24 2009
@@ -1,3 +1,19 @@
+/**
+ * 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.apache.activemq.apollo.jaxb;
import javax.xml.bind.annotation.XmlType;
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java Wed Jun 17 18:15:24 2009
@@ -49,7 +49,7 @@
@XmlElement(name="host-name", required=true)
private ArrayList<AsciiBuffer> hostNames = new ArrayList<AsciiBuffer>();
- @XmlElementRef
+ @XmlElementRef
private StoreXml store;
public VirtualHost createVirtualHost(BrokerXml brokerXml) throws Exception {
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/transport/vm/VMTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/transport/vm/VMTransportFactory.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/transport/vm/VMTransportFactory.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/transport/vm/VMTransportFactory.java Wed Jun 17 18:15:24 2009
@@ -59,18 +59,13 @@
@Override
protected PipeTransport createClientTransport(Pipe<Object> pipe) {
+ refs.incrementAndGet();
+
return new PipeTransport(pipe) {
- AtomicBoolean started = new AtomicBoolean();
- @Override
- public void start() throws Exception {
- if( started.compareAndSet(false, true) ) {
- refs.incrementAndGet();
- super.start();
- }
- }
+ AtomicBoolean stopped = new AtomicBoolean();
@Override
public void stop() throws Exception {
- if( started.compareAndSet(true, false) ) {
+ if( stopped.compareAndSet(false, true) ) {
super.stop();
if( refs.decrementAndGet() == 0 ) {
stopBroker();
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml Wed Jun 17 18:15:24 2009
@@ -16,10 +16,8 @@
limitations under the License.
-->
<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
- <dispatcher name="test dispatcher" threads="4"/>
-
<virtual-host>
<host-name>default</host-name>
+ <memory-store/>
</virtual-host>
-
</broker>
\ No newline at end of file
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java Wed Jun 17 18:15:24 2009
@@ -24,6 +24,7 @@
import org.apache.activemq.apollo.broker.Broker;
import org.apache.activemq.apollo.broker.BrokerFactory;
+import org.apache.activemq.broker.store.memory.MemoryStore;
import org.apache.activemq.dispatch.AbstractPooledDispatcher;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,6 +53,8 @@
assertEquals(2, broker.getVirtualHosts().size());
assertNotNull(broker.getDefaultVirtualHost().getDatabase());
+ assertNotNull(broker.getDefaultVirtualHost().getDatabase().getStore());
+ assertTrue( broker.getDefaultVirtualHost().getDatabase().getStore() instanceof MemoryStore );
}
Modified: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java Wed Jun 17 18:15:24 2009
@@ -100,7 +100,7 @@
"vm://localhost?jms.redeliveryPolicy.maximumRedeliveries=2");
assertEquals("connection redeliveries", 2, cf.getRedeliveryPolicy().getMaximumRedeliveries());
- ActiveMQConnection connection = (ActiveMQConnection)cf.createConnection();
+ connection = (ActiveMQConnection)cf.createConnection();
assertEquals("connection redeliveries", 2, connection.getRedeliveryPolicy().getMaximumRedeliveries());
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -111,7 +111,7 @@
}
public void testCreateVMConnectionWithEmbdeddBroker() throws URISyntaxException, JMSException {
- ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+ ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker=jaxb:classpath:non-persistent-activemq.xml");
// Make sure the broker is not created until the connection is
// instantiated.
assertNull(VMTransportFactory.lookup("localhost"));
@@ -128,7 +128,7 @@
}
public void testGetBrokerName() throws URISyntaxException, JMSException {
- ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+ ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker=jaxb:classpath:non-persistent-activemq.xml");
connection = (ActiveMQConnection)cf.createConnection();
connection.start();
@@ -138,16 +138,8 @@
assertNotNull("No broker name available!", brokerName);
}
- public void testCreateTcpConnectionUsingAllocatedPort() throws Exception {
- assertCreateConnection("tcp://localhost:0?wireFormat.tcpNoDelayEnabled=true");
- }
-
- public void testCreateTcpConnectionUsingKnownPort() throws Exception {
- assertCreateConnection("tcp://localhost:61610?wireFormat.tcpNoDelayEnabled=true");
- }
-
public void testConnectionFailsToConnectToVMBrokerThatIsNotRunning() throws Exception {
- ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost?create=false");
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://doesnotexist?create=false");
try {
factory.createConnection();
fail("Expected connection failure.");
@@ -174,6 +166,7 @@
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker=jaxb:classpath:non-persistent-activemq.xml");
connection = (ActiveMQConnection)cf.createConnection();
assertNull(connection.getExceptionListener());
+ connection.close();
ExceptionListener exListener = new ExceptionListener() {
public void onException(JMSException arg0) {
@@ -184,13 +177,21 @@
connection = (ActiveMQConnection)cf.createConnection();
assertNotNull(connection.getExceptionListener());
assertEquals(exListener, connection.getExceptionListener());
+ connection.close();
connection = (ActiveMQConnection)cf.createConnection();
assertEquals(exListener, connection.getExceptionListener());
-
assertEquals(exListener, cf.getExceptionListener());
}
+
+ public void testCreateTcpConnectionUsingAllocatedPort() throws Exception {
+ assertCreateConnection("tcp://localhost:0?wireFormat.tcpNoDelayEnabled=true");
+ }
+
+ public void testCreateTcpConnectionUsingKnownPort() throws Exception {
+ assertCreateConnection("tcp://localhost:61610?wireFormat.tcpNoDelayEnabled=true");
+ }
protected void assertCreateConnection(String uri) throws Exception {
// Start up a broker with a tcp connector.
Modified: activemq/sandbox/activemq-flow/activemq-transport/src/main/java/org/apache/activemq/transport/TransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-transport/src/main/java/org/apache/activemq/transport/TransportFactory.java?rev=785747&r1=785746&r2=785747&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-transport/src/main/java/org/apache/activemq/transport/TransportFactory.java (original)
+++ activemq/sandbox/activemq-flow/activemq-transport/src/main/java/org/apache/activemq/transport/TransportFactory.java Wed Jun 17 18:15:24 2009
@@ -138,6 +138,11 @@
Transport transport = createTransport(location, wf);
Transport rc = configure(transport, wf, options);
if (!options.isEmpty()) {
+ // Release the transport resource as we are erroring out...
+ try {
+ rc.stop();
+ } catch (Throwable cleanup) {
+ }
throw new IllegalArgumentException("Invalid connect parameters: " + options);
}
return rc;