Author: dejanb
Date: Wed Jun 17 13:08:20 2009
New Revision: 785581
URL: http://svn.apache.org/viewvc?rev=785581&view=rev
Log:
fixing problem with setting default virtual host and adding store configuration
in tests
Added:
activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/jaxb/JAXBComplexConfigTest.java
Removed:
activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/jaxb/JAXBConfigTest.java
Modified:
activemq/sandbox/activemq-flow/activemq-all/src/test/resources/activemq.xml
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
Added:
activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/jaxb/JAXBComplexConfigTest.java
URL:
http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/jaxb/JAXBComplexConfigTest.java?rev=785581&view=auto
==============================================================================
---
activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/jaxb/JAXBComplexConfigTest.java
(added)
+++
activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/jaxb/JAXBComplexConfigTest.java
Wed Jun 17 13:08:20 2009
@@ -0,0 +1,61 @@
+/**
+ * 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.jaxb;
+
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.apollo.broker.Broker;
+import org.apache.activemq.apollo.broker.BrokerFactory;
+import org.apache.activemq.broker.store.kahadb.KahaDBStore;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JAXBComplexConfigTest extends TestCase {
+
+ private static final Log LOG =
LogFactory.getLog(JAXBComplexConfigTest.class);
+
+ Broker broker;
+
+ @Before
+ public void setUp() throws Exception {
+ broker = createBroker();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testBrokerConfiguredCorrectly() throws Exception {
+ assertNotNull(broker);
+ assertEquals("tcp://localhost:61616?wireFormat=openwire",
broker.getTransportServers().get(0).getConnectURI().toString());
+ KahaDBStore store =
(KahaDBStore)broker.getDefaultVirtualHost().getDatabase().getStore();
+ }
+
+ protected Broker createBroker() throws Exception {
+ URI uri = new URI("jaxb:classpath:activemq.xml");
+ LOG.info("Loading broker configuration from the classpath with URI: "
+ uri);
+ return BrokerFactory.createBroker(uri);
+ }
+
+}
Modified:
activemq/sandbox/activemq-flow/activemq-all/src/test/resources/activemq.xml
URL:
http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-all/src/test/resources/activemq.xml?rev=785581&r1=785580&r2=785581&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/resources/activemq.xml
(original)
+++ activemq/sandbox/activemq-flow/activemq-all/src/test/resources/activemq.xml
Wed Jun 17 13:08:20 2009
@@ -24,6 +24,8 @@
<virtual-host>
<host-name>localhost</host-name>
<host-name>test.localhost</host-name>
+
+ <kahadb-store/>
</virtual-host>
</broker>
\ No newline at end of file
Modified:
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
URL:
http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java?rev=785581&r1=785580&r2=785581&view=diff
==============================================================================
---
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
(original)
+++
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
Wed Jun 17 13:08:20 2009
@@ -296,9 +296,8 @@
for (AsciiBuffer name : hostNames) {
virtualHosts.put(name, host);
}
-
// The first virtual host defined is the default virtual host.
- if (virtualHosts.size() == 1) {
+ if (defaultVirtualHost == null) {
setDefaultVirtualHost(host);
}
}
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=785581&r1=785580&r2=785581&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 13:08:20 2009
@@ -51,7 +51,7 @@
assertEquals(2, broker.getVirtualHosts().size());
-// assertNotNull(broker.getDefaultVirtualHost().getDatabase());
+ assertNotNull(broker.getDefaultVirtualHost().getDatabase());
}