mirror of https://github.com/apache/activemq.git
tidy up some jdbc directory usage - move into target
This commit is contained in:
parent
01d0155149
commit
c6837acefe
|
@ -196,6 +196,7 @@ public abstract class TestSupport extends CombinationTestSupport {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
broker.setPersistenceAdapter(adapter);
|
broker.setPersistenceAdapter(adapter);
|
||||||
|
adapter.setDirectory(broker.getBrokerDataDirectory());
|
||||||
return adapter;
|
return adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,14 @@ import junit.framework.Test;
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.command.ActiveMQTopic;
|
import org.apache.activemq.command.ActiveMQTopic;
|
||||||
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
||||||
|
import org.apache.activemq.util.IOHelper;
|
||||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.jms.Connection;
|
import javax.jms.Connection;
|
||||||
import javax.jms.*;
|
import javax.jms.*;
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
@ -58,6 +60,8 @@ public class AMQ4351Test extends BrokerTestSupport {
|
||||||
broker.setOfflineDurableSubscriberTaskSchedule(500);
|
broker.setOfflineDurableSubscriberTaskSchedule(500);
|
||||||
broker.setOfflineDurableSubscriberTimeout(2000); // lets delete durable subs much faster.
|
broker.setOfflineDurableSubscriberTimeout(2000); // lets delete durable subs much faster.
|
||||||
|
|
||||||
|
System.setProperty("derby.system.home", new File(IOHelper.getDefaultDataDirectory()).getCanonicalPath());
|
||||||
|
|
||||||
JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
|
JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
|
||||||
EmbeddedDataSource dataSource = new EmbeddedDataSource();
|
EmbeddedDataSource dataSource = new EmbeddedDataSource();
|
||||||
dataSource.setDatabaseName("derbyDb");
|
dataSource.setDatabaseName("derbyDb");
|
||||||
|
|
|
@ -16,10 +16,12 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.broker;
|
package org.apache.activemq.broker;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import org.apache.activemq.command.ActiveMQDestination;
|
import org.apache.activemq.command.ActiveMQDestination;
|
||||||
import org.apache.activemq.command.ActiveMQQueue;
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
||||||
|
import org.apache.activemq.util.IOHelper;
|
||||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||||
import org.apache.derby.jdbc.EmbeddedXADataSource;
|
import org.apache.derby.jdbc.EmbeddedXADataSource;
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@ public class JdbcXARecoveryBrokerTest extends XARecoveryBrokerTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
|
System.setProperty("derby.system.home", new File(IOHelper.getDefaultDataDirectory()).getCanonicalPath());
|
||||||
dataSource = new EmbeddedXADataSource();
|
dataSource = new EmbeddedXADataSource();
|
||||||
dataSource.setDatabaseName("derbyDb");
|
dataSource.setDatabaseName("derbyDb");
|
||||||
dataSource.setCreateDatabase("create");
|
dataSource.setCreateDatabase("create");
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package org.apache.activemq.bugs;
|
package org.apache.activemq.bugs;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
@ -55,11 +56,13 @@ import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.apache.activemq.network.ConditionalNetworkBridgeFilterFactory;
|
import org.apache.activemq.network.ConditionalNetworkBridgeFilterFactory;
|
||||||
import org.apache.activemq.network.NetworkConnector;
|
import org.apache.activemq.network.NetworkConnector;
|
||||||
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
||||||
|
import org.apache.activemq.util.IOHelper;
|
||||||
import org.apache.activemq.util.IntrospectionSupport;
|
import org.apache.activemq.util.IntrospectionSupport;
|
||||||
import org.apache.activemq.util.Wait;
|
import org.apache.activemq.util.Wait;
|
||||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
@ -125,6 +128,11 @@ public class AMQ4952Test {
|
||||||
return Arrays.asList(new Object[][] { { Boolean.TRUE }, { Boolean.FALSE } });
|
return Arrays.asList(new Object[][] { { Boolean.TRUE }, { Boolean.FALSE } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void dbHomeSysProp() throws Exception {
|
||||||
|
System.setProperty("derby.system.home", new File(IOHelper.getDefaultDataDirectory()).getCanonicalPath());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConsumerBrokerRestart() throws Exception {
|
public void testConsumerBrokerRestart() throws Exception {
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.store.jdbc;
|
package org.apache.activemq.store.jdbc;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.SQLFeatureNotSupportedException;
|
import java.sql.SQLFeatureNotSupportedException;
|
||||||
|
@ -24,23 +25,28 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import javax.jms.Connection;
|
import javax.jms.Connection;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
|
import org.apache.activemq.util.IOHelper;
|
||||||
import org.apache.activemq.util.LeaseLockerIOExceptionHandler;
|
import org.apache.activemq.util.LeaseLockerIOExceptionHandler;
|
||||||
import org.apache.activemq.util.Wait;
|
import org.apache.activemq.util.Wait;
|
||||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
import static junit.framework.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test to see if the JDBCExceptionIOHandler will restart the transport connectors correctly after
|
* Test to see if the JDBCExceptionIOHandler will restart the transport connectors correctly after
|
||||||
* the underlying DB has been stopped and restarted
|
* the underlying DB has been stopped and restarted
|
||||||
*
|
*
|
||||||
* see AMQ-4575
|
* see AMQ-4575
|
||||||
*/
|
*/
|
||||||
public class JDBCIOExceptionHandlerTest extends TestCase {
|
public class JDBCIOExceptionHandlerTest {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(JDBCIOExceptionHandlerTest.class);
|
private static final Logger LOG = LoggerFactory.getLogger(JDBCIOExceptionHandlerTest.class);
|
||||||
private static final String TRANSPORT_URL = "tcp://0.0.0.0:0";
|
private static final String TRANSPORT_URL = "tcp://0.0.0.0:0";
|
||||||
|
@ -50,6 +56,11 @@ public class JDBCIOExceptionHandlerTest extends TestCase {
|
||||||
private ReconnectingEmbeddedDataSource dataSource;
|
private ReconnectingEmbeddedDataSource dataSource;
|
||||||
private BrokerService broker;
|
private BrokerService broker;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void dbHomeSysProp() throws Exception {
|
||||||
|
System.setProperty("derby.system.home", new File(IOHelper.getDefaultDataDirectory()).getCanonicalPath());
|
||||||
|
}
|
||||||
|
|
||||||
protected BrokerService createBroker(boolean withJMX) throws Exception {
|
protected BrokerService createBroker(boolean withJMX) throws Exception {
|
||||||
return createBroker("localhost", withJMX, true, true);
|
return createBroker("localhost", withJMX, true, true);
|
||||||
}
|
}
|
||||||
|
@ -94,6 +105,7 @@ public class JDBCIOExceptionHandlerTest extends TestCase {
|
||||||
/*
|
/*
|
||||||
* run test without JMX enabled
|
* run test without JMX enabled
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testRecoverWithOutJMX() throws Exception {
|
public void testRecoverWithOutJMX() throws Exception {
|
||||||
recoverFromDisconnectDB(false);
|
recoverFromDisconnectDB(false);
|
||||||
}
|
}
|
||||||
|
@ -101,14 +113,17 @@ public class JDBCIOExceptionHandlerTest extends TestCase {
|
||||||
/*
|
/*
|
||||||
* run test with JMX enabled
|
* run test with JMX enabled
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testRecoverWithJMX() throws Exception {
|
public void testRecoverWithJMX() throws Exception {
|
||||||
recoverFromDisconnectDB(true);
|
recoverFromDisconnectDB(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSlaveStoppedLease() throws Exception {
|
public void testSlaveStoppedLease() throws Exception {
|
||||||
testSlaveStopped(true);
|
testSlaveStopped(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSlaveStoppedDefault() throws Exception {
|
public void testSlaveStoppedDefault() throws Exception {
|
||||||
testSlaveStopped(false);
|
testSlaveStopped(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,22 +23,21 @@ import java.sql.ResultSet;
|
||||||
import java.sql.ResultSetMetaData;
|
import java.sql.ResultSetMetaData;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.broker.region.cursors.NegativeQueueTest;
|
import org.apache.activemq.broker.region.cursors.NegativeQueueTest;
|
||||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||||
|
|
||||||
public class JDBCNegativeQueueTest extends NegativeQueueTest {
|
public class JDBCNegativeQueueTest extends NegativeQueueTest {
|
||||||
|
|
||||||
EmbeddedDataSource dataSource;
|
DataSource dataSource;
|
||||||
|
|
||||||
protected void configureBroker(BrokerService answer) throws Exception {
|
protected void configureBroker(BrokerService answer) throws Exception {
|
||||||
super.configureBroker(answer);
|
super.configureBroker(answer);
|
||||||
JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
|
JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
|
||||||
dataSource = new EmbeddedDataSource();
|
jdbc.setDataSource(dataSource);
|
||||||
dataSource.setDatabaseName("derbyDb");
|
|
||||||
dataSource.setCreateDatabase("create");
|
|
||||||
jdbc.setDataSource(dataSource);
|
|
||||||
answer.setPersistenceAdapter(jdbc);
|
answer.setPersistenceAdapter(jdbc);
|
||||||
|
dataSource = jdbc.getDataSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue