[jboss-svn-commits] JBL Code SVN: r5630 - in labs/jbossesb/trunk/product/core: common/src/org/jboss/soa/esb/common common/src/org/jboss/soa/esb/connection common/src/org/jboss/soa/esb/helpers/persist common/tests/src/org/jboss/soa/esb/common/tests services/src/org/jboss/soa/esb/internal/core/objectstore services/tests/src/org/jboss/soa/esb services/tests/src/org/jboss/soa/esb/internal services/tests/src/org/jboss/soa/esb/internal/core services/tests/src/org/jboss/soa/esb/internal/core/objectstore

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 9 05:09:18 EDT 2006


Author: tfennelly
Date: 2006-08-09 05:09:07 -0400 (Wed, 09 Aug 2006)
New Revision: 5630

Added:
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest_config1.xml
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTableUnitTest.java
Modified:
   labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java
   labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/PoolDataSource.java
   labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
Log:
add some unit tests

Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -115,5 +115,4 @@
 				org.jboss.soa.esb.services.DefaultEncryptionFactory.class
 						.getName());
 	}
-
 }
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/PoolDataSource.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/PoolDataSource.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/PoolDataSource.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -84,6 +84,7 @@
             m_oConnProps.setProperty(ConnectionProperties.USERNAME, username);
             m_oConnProps.setProperty(ConnectionProperties.PASSWORD, password);
         }
+        // REVIEW:  This class isn't thread safe at this point???
         return createConnectionPool().getConnection();
     }
 

Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -22,12 +22,16 @@
 
 package org.jboss.soa.esb.helpers.persist;
 
-import java.util.*;
-import java.sql.*;
-import javax.sql.*;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.List;
 
-import org.apache.log4j.*;
+import javax.sql.DataSource;
 
+import org.apache.log4j.Logger;
+
 public class JdbcCleanConn {
 	private DataSource m_oDS = null;
 
@@ -119,7 +123,7 @@
 				return;
 			} catch (Exception e) {
 				if (null == eRet)
-					eRet = new Exception(e.getMessage());
+					eRet = e;
 				// System.out.println("Retrying "+i1);
 				Thread.sleep(100 + (new Double(100 * Math.random()))
 						.longValue());
@@ -138,7 +142,7 @@
 				break;
 			} catch (Exception e) {
 				if (null == eRet)
-					eRet = new Exception(e.getMessage());
+					eRet = e;
 				System.out.println("Connecting " + i1);
 				Thread.sleep(2000 + (new Double(100 * Math.random()))
 						.longValue());

Modified: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -21,10 +21,14 @@
 */
 package org.jboss.soa.esb.common.tests;
 
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
 import java.util.HashMap;
 
 import org.apache.log4j.Logger;
 import org.apache.log4j.Priority;
+import org.jboss.soa.esb.common.SystemProperties;
 
 import junit.framework.TestCase;
 
@@ -98,4 +102,51 @@
 	   
 	    return systemParameters;
     }
+    
+    protected String getDbUrl() {
+    	return SYSTEM_PARAMETERS.get(DB_URL);
+    }
+    
+    protected String getDbUser() {
+    	return SYSTEM_PARAMETERS.get(DB_USERNAME);
+    }
+    
+    protected String getDbPassword() {
+    	return SYSTEM_PARAMETERS.get(DB_PASSWORD);
+    }
+    
+    protected String getDbDriver() {
+    	return SYSTEM_PARAMETERS.get(DB_DRIVER);
+    }
+    
+    public Connection getDbConnection() throws SQLException {
+    	registerJdbcDriver();
+    	return DriverManager.getConnection(getDbUrl(), getDbUser(), getDbPassword());
+    }
+
+    public Connection getDbConnection(String username, String password) throws SQLException {
+    	registerJdbcDriver();
+    	return DriverManager.getConnection(getDbUrl(), username, password);
+	}
+    
+    /**
+     * Set the test ObjStoreConfigFile location in the classpath/filesystem.
+     * @param filePath Classpath/filesystem location.
+     */
+    public void setObjStoreConfigFile(String filePath) {
+    	if(filePath == null) {    	
+    		System.getProperties().remove(SystemProperties.OBJECT_STORE_CONFIG_FILE);
+    	} else {
+    		System.setProperty(SystemProperties.OBJECT_STORE_CONFIG_FILE, filePath);
+    	}    	
+    }
+
+	private void registerJdbcDriver() {
+		try {
+			Class.forName(getDbDriver()).newInstance();
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail("JDBC Driver [" + getDbDriver() + "] not available in classpath.");
+		}
+	}
 }

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.common.tests;
+
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+
+/**
+ * Mock {@link javax.sql.DataSource} implementation.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockDataSource implements DataSource {
+
+	private BaseTest testClass;
+	private int loginTimeout;
+	private PrintWriter printWriter;
+
+	/**
+	 * Construct from a BaseTest 
+	 */
+	public MockDataSource(BaseTest testClass) {
+		if(testClass == null) {
+			throw new IllegalArgumentException("null 'testClass' arg.");
+		}
+		this.testClass = testClass;
+		printWriter = new PrintWriter(System.out);
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.sql.DataSource#getConnection()
+	 */
+	public Connection getConnection() throws SQLException {
+		return testClass.getDbConnection();
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
+	 */
+	public Connection getConnection(String username, String password) throws SQLException {
+		return testClass.getDbConnection(username, password);
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.sql.DataSource#getLogWriter()
+	 */
+	public PrintWriter getLogWriter() throws SQLException {
+		return printWriter;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
+	 */
+	public void setLogWriter(PrintWriter printWriter) throws SQLException {
+		this.printWriter = printWriter;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.sql.DataSource#getLoginTimeout()
+	 */
+	public int getLoginTimeout() throws SQLException {
+		return loginTimeout;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.sql.DataSource#setLoginTimeout(int)
+	 */
+	public void setLoginTimeout(int loginTimeout) throws SQLException {
+		this.loginTimeout = loginTimeout;
+	}
+
+}

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -27,7 +27,11 @@
 import org.jboss.soa.esb.util.BaseBusinessObject;
 import org.jboss.soa.esb.util.BobjStdDTO;
 import org.jboss.soa.esb.util.Util;
+import org.xml.sax.SAXException;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -35,6 +39,19 @@
 import java.util.Map;
 
 public class BobjStore {
+	protected static final String DATA_SOURCE_JNDI_NAME = "dataSourceJndiName";
+	protected static final String BATCH_TABLE = "batchTable";
+	protected static final String UID_TABLE = "uidTable";
+
+	protected static final String CLASS_TYPE_ATTR = "type";
+	protected static final String CLASS_TABLE_ATTR = "table";
+	protected static final String CLASS_ENCRYPT_ATTR = "encrypt";
+	protected static final String CLASS_NAME_ATTR = "name";
+	protected static final String CLASS_ELEMENT = "Class";
+
+	protected static final String INDEX_ELEMENT = "Index";
+	protected static final String INDEX_TABLE_ATTR = "table";
+	
 	private static String DATASRC_JNDI_NAME;
 
 	public static void setDataSourceJndi(String p_s) {
@@ -55,8 +72,15 @@
 		return TBL_UIDS;
 	}
 
+	protected static void setStoreConfig(DomElement storeConfig) {
+		BobjStore.storeConfig = storeConfig;
+	}
+
+
 	private static String TBL_BATCHES;
 
+	private static DomElement storeConfig;
+
 	public static void setBatchTableName(String p_s) {
 		TBL_BATCHES = p_s;
 	}
@@ -69,36 +93,88 @@
 
 	static {
 		try {
-			String objectConfigFile = SystemProperties.getObjStoreConfigFile();
-			URI objStoreConfig = URI.create(
-					objectConfigFile);
-			DomElement oConf = DomElement.fromInputStream(
-					objStoreConfig.toURL().openStream());
+			configureStore();
+		} catch (Exception e) {
+			// REVIEW: Can we just carry on regardless here???
+			Util.getDefaultLogger(BobjStore.class).error(
+					"BobjStore configuration FAILED", e);
+		}
+	}
 
-			if (null != oConf) {
-				setDataSourceJndi(oConf.getAttr("dataSourceJndiName"));
-				setUidTableName(oConf.getAttr("uidTable"));
-				setBatchTableName(oConf.getAttr("batchTable"));
-				for (DomElement oCurr : oConf.getElementChildren("Class")) {
-					String sClass = oCurr.getAttr("name");
-					boolean bCrypt = "true".equalsIgnoreCase(oCurr
-							.getAttr("encrypt"));
+	/**
+	 * Configure/Reconfigure the BobjStore.
+	 * <p/>
+	 * The configuration is set either through a prior call to {@link #setStoreConfig(DomElement)}, or
+	 * through a URI resource lookup configured by the "org.jboss.soa.esb.objStore.configfile" System property.
+	 * @throws SAXException 
+	 * @throws IOException 
+	 * @throws MalformedURLException 
+	 */
+	protected static void configureStore() throws MalformedURLException, IOException, SAXException {
+		// storeConfig can be set for testing purposes - if already set, don't try reading from the configured URI.
+		if(storeConfig == null) {
+			storeConfig = readConfiguration();
+		}
 
-					BobjStore oNew = new BobjStore(oCurr.getAttr("type"), oCurr
-							.getAttr("table"), null, sClass
-							.substring(1 + sClass.lastIndexOf(".")), bCrypt);
+		if(storeConfig != null) {
+			setDataSourceJndi(storeConfig.getAttr(DATA_SOURCE_JNDI_NAME));
+			setUidTableName(storeConfig.getAttr(UID_TABLE));
+			setBatchTableName(storeConfig.getAttr(BATCH_TABLE));
+			
+			for (DomElement oCurr : storeConfig.getElementChildren(CLASS_ELEMENT)) {
+				String sClass = oCurr.getAttr(CLASS_NAME_ATTR);
+				boolean bCrypt = "true".equalsIgnoreCase(oCurr
+						.getAttr(CLASS_ENCRYPT_ATTR));
 
-					for (DomElement oIcurr : oCurr.getElementChildren("Index"))
-						oNew.addLocatorTable(oIcurr.getAttr("table"));
-					s_oStoreMap.put(sClass, oNew);
+				BobjStore oNew = new BobjStore(oCurr.getAttr(CLASS_TYPE_ATTR), 
+						oCurr.getAttr(CLASS_TABLE_ATTR), null, 
+						sClass.substring(1 + sClass.lastIndexOf(".")), bCrypt);
+
+				for (DomElement oIcurr : oCurr.getElementChildren(INDEX_ELEMENT)) {
+					oNew.addLocatorTable(oIcurr.getAttr(INDEX_TABLE_ATTR));
 				}
+				s_oStoreMap.put(sClass, oNew);
 			}
-		} catch (Exception e) {
-			Util.getDefaultLogger(BobjStore.class).error(
-					"BobjStore configuration FAILED", e);
 		}
+	}
 
-	};
+	/**
+	 * Read the configuration.
+	 * <p/>
+	 * Tries reading it from the classpath. If that fails, tries reading it through a URI stream.
+	 */
+	protected static DomElement readConfiguration() throws IOException, MalformedURLException, SAXException {
+		String configPath = SystemProperties.getObjStoreConfigFile();
+		URI configURI;
+		InputStream configStream = null;
+		
+		if(configPath == null) {
+			throw new IllegalStateException("ObjStoreConfigFile location not configured (param name: " + SystemProperties.OBJECT_STORE_CONFIG_FILE + ").");
+		}		
+		
+		configURI = URI.create(configPath);
+		if(!configURI.isAbsolute() || configURI.getPath() == null) {
+			throw new IllegalStateException("ObjStoreConfigFile location configuration error (" + SystemProperties.OBJECT_STORE_CONFIG_FILE + "=" + configPath + ").  Must be an absolute URI e.g. http://, file:/, classpath:/ etc.");
+		}
+		
+		// Is it on the classpath...
+		if(configURI.getScheme().equals("classpath")) {
+			configStream = BobjStore.class.getResourceAsStream(configURI.getPath());
+		} else {
+			// OK, so can we load it through the URI stream...
+			try {
+				configStream = configURI.toURL().openStream();
+			} catch(IOException e) {
+				throw new IllegalStateException("Unable to locate and read ObjStoreConfigFile: " + configPath, e);
+			}
+		}
+		
+		if(configStream == null) {
+			throw new IllegalStateException("Unable to locate and read ObjStoreConfigFile: " + configPath);
+		}
+		
+		return DomElement.fromInputStream(configStream);
+	}
 
 	private String m_sSnapType, m_sSnapTbl, m_sClass;
 

Added: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.internal.core.objectstore;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.jboss.soa.esb.common.tests.BaseTest;
+import org.jboss.soa.esb.helpers.DomElement;
+import org.xml.sax.SAXException;
+
+/**
+ * BobjStore unit tests.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BobjStoreUnitTest extends BaseTest {
+	
+	protected void tearDown() throws Exception {
+		setObjStoreConfigFile(null);
+	}
+
+	public void test_readConfiguration_invalidconfig() throws MalformedURLException, IOException, SAXException {
+		// Test URI not set
+		test_invalidURI(null);
+		// Test for no scheme in URI...
+		test_invalidURI("/nonexistent/classpath/location/config.xml");
+		// Test for no path in URI...
+		test_invalidURI("file:");
+		// Test non existent classpath URI path...
+		test_invalidURI("classpath:/nonexistent/classpath/location/config.xml");
+		// Test non existent http URI path...
+		test_invalidURI("http://nonexistent/classpath/location/config.xml");
+		// Test non existent file URI path...
+		test_invalidURI("file:/nonexistent/classpath/location/config.xml");
+	}
+
+	private void test_invalidURI(String uri) throws IOException, MalformedURLException, SAXException {
+		setObjStoreConfigFile("/nonexistent/classpath/location/config.xml");
+		try {
+			BobjStore.readConfiguration();
+			fail("expected IllegalStateException");
+		} catch (IllegalStateException e) {
+			// expected
+		}
+	}
+
+	public void test_readConfiguration_validconfig() throws MalformedURLException, IOException, SAXException {
+		String resPath = getResourceClasspath("BobjStoreUnitTest_config1.xml");
+		DomElement config1, config2;
+		
+		// Test a read from a valid classpath resource...
+		setObjStoreConfigFile("classpath:" + resPath);
+		config1 = BobjStore.readConfiguration();
+		
+		// Test a read from a valid file resource...
+		File file = new File("core/services/tests/src" + resPath);
+		setObjStoreConfigFile(file.toURI().toString());
+		config2 = BobjStore.readConfiguration();
+		assertEquals(config1.toString(), config2.toString());
+	}
+	
+	public void test_BobjStore() throws MalformedURLException, IOException, SAXException {
+		setObjStoreConfigFile("classpath:" + getResourceClasspath("BobjStoreUnitTest_config1.xml"));
+		BobjStore.configureStore();
+
+		assertEquals("batchtable", BobjStore.getBatchTableName());
+		assertEquals("jndi-name", BobjStore.getDataSourceJndi());
+		assertEquals("uidtable", BobjStore.getUidTableName());
+		
+		BobjStore bob = BobjStore.getStore("org.jboss.SomeClass1");
+		assertEquals("snaptable-1", bob.getSnapTable());
+		assertEquals("snaptype-1", bob.getSnapType());
+		assertTrue(bob.isEncrypted());
+		assertEquals("locator-table-1", bob.getLocatorTable(0));
+		assertEquals(null, bob.getLocatorTable(1));
+		
+		bob = BobjStore.getStore("org.jboss.SomeClass2");
+		assertEquals("snaptable-2", bob.getSnapTable());
+		assertEquals("snaptype-2", bob.getSnapType());
+		assertTrue(!bob.isEncrypted());
+		assertEquals(null, bob.getLocatorTable(0));
+	}
+
+	private String getResourceClasspath(String resource) {
+		return "/" + BobjStoreUnitTest.class.getPackage().getName().replace('.', '/') + "/" + resource;
+	}
+}

Added: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest_config1.xml
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest_config1.xml	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest_config1.xml	2006-08-09 09:09:07 UTC (rev 5630)
@@ -0,0 +1,6 @@
+<config dataSourceJndiName="jndi-name" batchTable="batchtable" uidTable="uidtable">
+	<Class name="org.jboss.SomeClass1" type="snaptype-1" encrypt="true" table="snaptable-1">
+		<Index table="locator-table-1" />
+	</Class>
+	<Class name="org.jboss.SomeClass2" type="snaptype-2" encrypt="false" table="snaptable-2" />
+</config>
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTableUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTableUnitTest.java	2006-08-09 08:35:43 UTC (rev 5629)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTableUnitTest.java	2006-08-09 09:09:07 UTC (rev 5630)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.internal.core.objectstore;
+
+import org.jboss.soa.esb.common.tests.BaseTest;
+import org.jboss.soa.esb.common.tests.MockDataSource;
+import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
+
+/**
+ * DaoUidTable unit tests.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DaoUidTableUnitTest extends BaseTest {
+
+	public void test_DaoUidTable() throws Exception {
+		JdbcCleanConn conn = new JdbcCleanConn(new MockDataSource(this));
+		
+		//conn.prepareStatement("select * from table1;");
+		
+		// TODO: Figure out how to test these DAO classes.  I suspect these classes
+		// will need a full JBossESB database (or a good part of) before we can do
+		// anything with them.  Currently we use an in-memory HSQLDB which gets 
+		// instanciated for each test.  It we create and distroy a DB for each test
+		// we'll prob grind the tests to a hault.  Need to try it I suppose!
+	}
+}




More information about the jboss-svn-commits mailing list