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 2006/03/21 16:47:51 UTC
svn commit: r387553 - in /incubator/activemq/trunk/assembly/src:
sample-conf/journal-example.xml
test/java/org/apache/activemq/config/ConfigTest.java
test/resources/org/apache/activemq/config/example.xml
Author: chirino
Date: Tue Mar 21 07:47:41 2006
New Revision: 387553
URL: http://svn.apache.org/viewcvs?rev=387553&view=rev
Log:
derby is not to happy about being started up multiple times in the same vm with different homes.
Modified:
incubator/activemq/trunk/assembly/src/sample-conf/journal-example.xml
incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java
incubator/activemq/trunk/assembly/src/test/resources/org/apache/activemq/config/example.xml
Modified: incubator/activemq/trunk/assembly/src/sample-conf/journal-example.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/assembly/src/sample-conf/journal-example.xml?rev=387553&r1=387552&r2=387553&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/src/sample-conf/journal-example.xml (original)
+++ incubator/activemq/trunk/assembly/src/sample-conf/journal-example.xml Tue Mar 21 07:47:41 2006
@@ -15,13 +15,7 @@
</constructor-arg>
<constructor-arg index="1">
- <amq:jdbcPersistenceAdapter>
- <property name="cleanupPeriod" value="60000"/>
- <property name="dataSource" ref="embedded-ds"/>
- <property name="wireFormat">
- <bean id="myWireFormat" class="org.activeio.command.DefaultWireFormat"/>
- </property>
- </amq:jdbcPersistenceAdapter>
+ <amq:memoryPersistenceAdapter init-method="createTransactionStore"/>
</constructor-arg>
<constructor-arg index="2">
@@ -46,9 +40,4 @@
</constructor-arg>
</bean>
- <!-- The Datasource that will be used by the Broker -->
- <bean id="embedded-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
- <property name="databaseName" value="testJournalConfig/derbydb"/>
- <property name="createDatabase" value="create"/>
- </bean>
</beans>
Modified: incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java?rev=387553&r1=387552&r2=387553&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java (original)
+++ incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java Tue Mar 21 07:47:41 2006
@@ -65,7 +65,72 @@
* directory is not created under target/test-data/. The test in unable to change the derby
* root directory for succeeding creation. It uses the first created directory as the root.
*/
-
+
+ /*
+ * This tests creating a journal persistence adapter using the persistence adapter factory bean
+ */
+ public void testJournaledJDBCConfig() throws Exception {
+ System.out.print("Checking journaled JDBC persistence adapter configuration... ");
+
+ File journalFile = new File(JOURNAL_ROOT + "testJournaledJDBCConfig/journal");
+ recursiveDelete(journalFile);
+
+ File derbyFile = new File(DERBY_ROOT + "testJournaledJDBCConfig/derbydb"); // Default derby name
+ recursiveDelete(derbyFile);
+
+ BrokerService broker;
+ broker = createBroker(new FileSystemResource(CONF_ROOT + "journaledjdbc-example.xml"));
+ try {
+ assertEquals("Broker Config Error (brokerName)", "brokerJournaledJDBCConfigTest", broker.getBrokerName());
+
+ PersistenceAdapter adapter = broker.getPersistenceAdapter();
+
+ assertTrue("Should have created a journal persistence adapter", adapter instanceof JournalPersistenceAdapter);
+ assertTrue("Should have created a derby directory at " + derbyFile.getAbsolutePath(), derbyFile.exists());
+ assertTrue("Should have created a journal directory at " + journalFile.getAbsolutePath(), journalFile.exists());
+
+
+ // Check persistence factory configurations
+ System.out.print("Checking persistence adapter factory settings... ");
+ JournalPersistenceAdapter pa = (JournalPersistenceAdapter) broker.getPersistenceAdapter();
+
+ System.out.println("Success");
+ } finally {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+ }
+
+ /*
+ * This tests creating a jdbc persistence adapter using xbeans-spring
+ */
+ public void testJdbcConfig() throws Exception {
+ System.out.print("Checking jdbc persistence adapter configuration... ");
+
+ BrokerService broker;
+ broker = createBroker(new FileSystemResource(CONF_ROOT + "jdbc-example.xml"));
+ try {
+ assertEquals("Broker Config Error (brokerName)", "brokerJdbcConfigTest", broker.getBrokerName());
+
+ PersistenceAdapter adapter = broker.getPersistenceAdapter();
+
+ assertTrue("Should have created a jdbc persistence adapter", adapter instanceof JDBCPersistenceAdapter);
+ assertEquals("JDBC Adapter Config Error (cleanupPeriod)", 60000,
+ ((JDBCPersistenceAdapter)adapter).getCleanupPeriod());
+ assertTrue("Should have created an EmbeddedDataSource",
+ ((JDBCPersistenceAdapter)adapter).getDataSource() instanceof EmbeddedDataSource);
+ assertTrue("Should have created a DefaultWireFormat",
+ ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof DefaultWireFormat);
+
+ System.out.println("Success");
+ } finally {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+ }
+
/*
* This tests configuring the different broker properties using xbeans-spring
*/
@@ -181,23 +246,6 @@
assertEquals("UsageManager Config Error (percentUsageMinDelta)", 20, memMgr.getPercentUsageMinDelta());
System.out.println("Success");
- // Check persistence factory configurations
- System.out.print("Checking persistence adapter factory settings... ");
- PersistenceAdapterFactory factory = broker.getPersistenceFactory();
- assertTrue("Should have a default persistence factory", factory instanceof DefaultPersistenceAdapterFactory);
- assertEquals("PersistenceFactory Config Error (journalLogFileSize)", 32768,
- ((DefaultPersistenceAdapterFactory)factory).getJournalLogFileSize());
- assertEquals("PersistenceFactory Config Error (journalLogFiles)", 4,
- ((DefaultPersistenceAdapterFactory)factory).getJournalLogFiles());
- assertEquals("PersistenceFactory Config Error (useJournal)", true,
- ((DefaultPersistenceAdapterFactory)factory).isUseJournal());
- assertEquals("PersistenceFactory Config Error (dataDirectory)", journalFile.getAbsolutePath(),
- ((DefaultPersistenceAdapterFactory)factory).getDataDirectory().getAbsolutePath());
- System.out.println("Success");
-
- // Check journal configurations
- System.out.print("Checking if persistence adapter was succesfully created... ");
- assertTrue("Should have created a journal persistence adapter", broker.getPersistenceAdapter() instanceof JournalPersistenceAdapter);
System.out.println("Success");
} finally {
if (broker != null) {
@@ -215,9 +263,6 @@
File journalFile = new File(JOURNAL_ROOT + "testJournalConfig/journal");
recursiveDelete(journalFile);
- File derbyFile = new File(DERBY_ROOT + "testJournalConfig/derbydb");
- recursiveDelete(derbyFile);
-
BrokerService broker;
broker = createBroker(new FileSystemResource(CONF_ROOT + "journal-example.xml"));
try {
@@ -226,71 +271,6 @@
PersistenceAdapter adapter = broker.getPersistenceAdapter();
assertTrue("Should have created a journal persistence adapter", adapter instanceof JournalPersistenceAdapter);
- assertTrue("Should have created a derby directory at " + derbyFile.getAbsolutePath(), derbyFile.exists());
- assertTrue("Should have created a journal directory at " + journalFile.getAbsolutePath(), journalFile.exists());
-
- System.out.println("Success");
- } finally {
- if (broker != null) {
- broker.stop();
- }
- }
- }
-
- /*
- * This tests creating a jdbc persistence adapter using xbeans-spring
- */
- public void testJdbcConfig() throws Exception {
- System.out.print("Checking jdbc persistence adapter configuration... ");
-
- File derbyFile = new File(DERBY_ROOT + "testJdbcConfig");
- recursiveDelete(derbyFile);
-
- BrokerService broker;
- broker = createBroker(new FileSystemResource(CONF_ROOT + "jdbc-example.xml"));
- try {
- assertEquals("Broker Config Error (brokerName)", "brokerJdbcConfigTest", broker.getBrokerName());
-
- PersistenceAdapter adapter = broker.getPersistenceAdapter();
-
- assertTrue("Should have created a jdbc persistence adapter", adapter instanceof JDBCPersistenceAdapter);
- assertEquals("JDBC Adapter Config Error (cleanupPeriod)", 60000,
- ((JDBCPersistenceAdapter)adapter).getCleanupPeriod());
- assertTrue("Should have created an EmbeddedDataSource",
- ((JDBCPersistenceAdapter)adapter).getDataSource() instanceof EmbeddedDataSource);
- assertTrue("Should have created a DefaultWireFormat",
- ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof DefaultWireFormat);
- assertTrue("Should have created a derby directory at " + derbyFile.getAbsolutePath(), derbyFile.exists());
-
- System.out.println("Success");
- } finally {
- if (broker != null) {
- broker.stop();
- }
- }
- }
-
- /*
- * This tests creating a journal persistence adapter using the persistence adapter factory bean
- */
- public void testJournaledJDBCConfig() throws Exception {
- System.out.print("Checking journaled JDBC persistence adapter configuration... ");
-
- File journalFile = new File(JOURNAL_ROOT + "testJournaledJDBCConfig");
- recursiveDelete(journalFile);
-
- File derbyFile = new File(DERBY_ROOT + "derbydb"); // Default derby name
- recursiveDelete(derbyFile);
-
- BrokerService broker;
- broker = createBroker(new FileSystemResource(CONF_ROOT + "journaledjdbc-example.xml"));
- try {
- assertEquals("Broker Config Error (brokerName)", "brokerJournaledJDBCConfigTest", broker.getBrokerName());
-
- PersistenceAdapter adapter = broker.getPersistenceAdapter();
-
- assertTrue("Should have created a journal persistence adapter", adapter instanceof JournalPersistenceAdapter);
- assertTrue("Should have created a derby directory at " + derbyFile.getAbsolutePath(), derbyFile.exists());
assertTrue("Should have created a journal directory at " + journalFile.getAbsolutePath(), journalFile.exists());
System.out.println("Success");
Modified: incubator/activemq/trunk/assembly/src/test/resources/org/apache/activemq/config/example.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/assembly/src/test/resources/org/apache/activemq/config/example.xml?rev=387553&r1=387552&r2=387553&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/src/test/resources/org/apache/activemq/config/example.xml (original)
+++ incubator/activemq/trunk/assembly/src/test/resources/org/apache/activemq/config/example.xml Tue Mar 21 07:47:41 2006
@@ -82,18 +82,10 @@
<amq:usageManager limit="200000" percentUsageMinDelta="20"/>
</amq:memoryManager>
- <amq:persistenceFactory>
- <bean id="myPersistenceFactory" class="org.apache.activemq.store.DefaultPersistenceAdapterFactory">
- <property name="journalLogFileSize" value="32768" />
- <property name="journalLogFiles" value="4" />
- <property name="useJournal" value="true" />
- <property name="dataDirectory" value="target/test-data" />
- </bean>
- </amq:persistenceFactory>
-
<amq:persistenceAdapter>
- <amq:journaledJDBC journalLogFiles="4" journalLogFileSize="32768" dataDirectory="target/test-data" />
+ <amq:memoryPersistenceAdapter init-method="createTransactionStore"/>
</amq:persistenceAdapter>
+
</amq:broker>
<!-- testing normal Spring stuff inside the same config file -->