diff options
Diffstat (limited to 'id/server/idserverlib/src/test')
5 files changed, 510 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/DummyTransactionStorage.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/DummyTransactionStorage.java index 9f1fc5f2d..ab08c0f5c 100644 --- a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/DummyTransactionStorage.java +++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/DummyTransactionStorage.java @@ -131,5 +131,17 @@ public class DummyTransactionStorage implements ITransactionStorage { return null; } + @Override + public Object getAssertionStore(String key) throws MOADatabaseException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void putAssertionStore(Object element) throws MOADatabaseException { + // TODO Auto-generated method stub + + } + }
\ No newline at end of file diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/DBTransactionStorageTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/DBTransactionStorageTest.java new file mode 100644 index 000000000..4b7f61ef5 --- /dev/null +++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/DBTransactionStorageTest.java @@ -0,0 +1,122 @@ +package at.gv.egovernment.moa.id.storage.test; + +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; +import at.gv.egovernment.moa.id.storage.DBTransactionStorage; +import at.gv.egovernment.moa.id.storage.ITransactionStorage; +import at.gv.egovernment.moa.util.Constants; +import at.gv.util.DOMUtils; + +public class DBTransactionStorageTest { + + public static void main (String[] args) throws SAXException, IOException, ParserConfigurationException, MOADatabaseException{ + DBTransactionStorageTest t = new DBTransactionStorageTest(); + t.test(); + } + + @Autowired + DBTransactionStorage rts; + + public DBTransactionStorageTest(){ + + } + + + public void test() throws SAXException, IOException, ParserConfigurationException, MOADatabaseException{ + + + ApplicationContext context = new FileSystemXmlApplicationContext("src/test/java/testBeans.xml"); + + + String requestString = + "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + + "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + + "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + + "</samlp:Request>"; + Element request = DOMUtils.parseDocument(requestString, false, Constants.ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); + + ITransactionStorage rts = (ITransactionStorage) context.getBean("DBTransactionStorage"); + //GenericToStringSerializer redisStringSerializer = (GenericToStringSerializer) context.getBean("valueObjectSerializer"); + + // rts.getTemplate().setValueSerializer(new GenericToStringSerializer<Object>(Object.class)); + // rts.getTemplate().setHashValueSerializer(new GenericToStringSerializer<Object>(Object.class)); + + int cnt = 10; + int averageCnt = 10; + long putTime = 0, getTime = 0, changeTime = 0, removeTime = 0; + long total = 0; + for(int a=0;a<averageCnt;a++){ + long totalPerRound = 0; + + System.out.println("Starting MySql store operation."); + long start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + rts.put("test"+i, request,-1); + long end = System.currentTimeMillis(); + putTime += end-start; + System.out.println("MySql store operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + + Element test; + System.out.println("Starting MySql get operation."); + start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + test = (Element)rts.get("test"+i); + end = System.currentTimeMillis(); + getTime += end-start; + System.out.println("MySql get operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + //Element test = (Element)rts.get("test0"); + //System.out.println("Read Element from Redis Store: "+test.getTextContent()); + + String requestString2 = + "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + + "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"test_new\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + + "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + + "</samlp:Request>"; + Element request2 = DOMUtils.parseDocument(requestString2, false, Constants.ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); + + System.out.println("Starting MySql change operation."); + start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + rts.changeKey("test"+i, "test_new"+i, request2); + end = System.currentTimeMillis(); + changeTime += end-start; + System.out.println("MySql change operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + + + + System.out.println("Starting MySql remove operation."); + start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + rts.remove("test_new"+i); + end = System.currentTimeMillis(); + removeTime += end-start; + System.out.println("MySql remove operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + total+=totalPerRound; + + System.out.println("Redis Total Time in this round: "+totalPerRound+" ms."); + System.out.println("______________________________________________________"); + } + System.out.println("______________________________________________________"); + System.out.println("Redis average get time over " + averageCnt +" rounds: "+getTime/averageCnt+" ms."); + System.out.println("Redis average put time over " + averageCnt +" rounds: "+putTime/averageCnt+" ms."); + System.out.println("Redis average change time over " + averageCnt +" rounds: "+changeTime/averageCnt+" ms."); + System.out.println("Redis average remove time over " + averageCnt +" rounds: "+removeTime/averageCnt+" ms."); + System.out.println("Redis average total time over " + averageCnt +" rounds: "+total/averageCnt+" ms."); + ((ConfigurableApplicationContext)context).close(); + } + +} diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionMultiThreadTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionMultiThreadTest.java new file mode 100644 index 000000000..60b55f497 --- /dev/null +++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionMultiThreadTest.java @@ -0,0 +1,130 @@ +package at.gv.egovernment.moa.id.storage.test; + +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; +import org.springframework.core.task.TaskExecutor; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; +import at.gv.egovernment.moa.id.storage.RedisTransactionStorage; +import at.gv.egovernment.moa.util.Constants; +import at.gv.util.DOMUtils; + +public class RedisTransactionMultiThreadTest { + + private ApplicationContext context; + + public RedisTransactionMultiThreadTest() throws SAXException, IOException, ParserConfigurationException, MOADatabaseException{ + this.context = new FileSystemXmlApplicationContext("src/test/java/testBeans.xml"); + TaskExecutor te = (TaskExecutor) context.getBean("taskExecutor"); + + for(int i=0;i<50;i++){ + te.execute(new RedisTask("Task"+i)); + } + + + } + + public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException, MOADatabaseException{ + + RedisTransactionMultiThreadTest t = new RedisTransactionMultiThreadTest(); + System.out.println("End"); + +// String requestString = +// "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + +// "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + +// "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + +// "</samlp:Request>"; +// Element request = DOMUtils.parseDocument(requestString, false, Constants.ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); +// +// +// +// +// RedisTransactionStorage rts = (RedisTransactionStorage) context.getBean("TransactionStorage"); +// //GenericToStringSerializer redisStringSerializer = (GenericToStringSerializer) context.getBean("valueObjectSerializer"); +// +//// rts.getTemplate().setValueSerializer(new GenericToStringSerializer<Object>(Object.class)); +//// rts.getTemplate().setHashValueSerializer(new GenericToStringSerializer<Object>(Object.class)); +// +// +// rts.put("test", request,-1); +// System.out.println("Redis store operation done!"); +// +// Element test = (Element)rts.get("test"); +// System.out.println("Read Element from Redis Store: "+test.getTextContent()); +// +// String requestString2 = +// "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + +// "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"test_new\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + +// "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + +// "</samlp:Request>"; +// Element request2 = DOMUtils.parseDocument(requestString2, false, Constants.ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); +// +// +// rts.changeKey("test", "test_new", request2); +// +// rts.remove("test"); +// rts.remove("test_new"); +// +// ((ConfigurableApplicationContext)context).close(); + } + + private class RedisTask implements Runnable { + + private String message; + + public RedisTask(String message) throws SAXException, IOException, ParserConfigurationException, MOADatabaseException { + + this.message = message; + + + + } + + public void run() { + String requestString = + "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + + "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + + "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + + "</samlp:Request>"; + + Element request = null; + try { + request = DOMUtils.parseDocument(requestString, false, Constants.ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); + } catch (SAXException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } catch (ParserConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + + RedisTransactionStorage rts = (RedisTransactionStorage) context.getBean("RedisTransactionStorage"); + + try { + rts.put(message, request,-1); + rts.changeKey(message, message+"n", request); + } catch (MOADatabaseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + System.out.println("Done with task "+message); + } + + } + +} diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionStorageTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionStorageTest.java new file mode 100644 index 000000000..e957ffe05 --- /dev/null +++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionStorageTest.java @@ -0,0 +1,116 @@ +package at.gv.egovernment.moa.id.storage.test; + +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; +import at.gv.egovernment.moa.id.storage.DBTransactionStorage; +import at.gv.egovernment.moa.id.storage.RedisTransactionStorage; +import at.gv.egovernment.moa.util.Constants; +import at.gv.util.DOMUtils; + +public class RedisTransactionStorageTest { + + + public RedisTransactionStorageTest(){ + + } + + public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException, MOADatabaseException{ + + + ApplicationContext context = new FileSystemXmlApplicationContext("src/test/java/testBeans.xml"); + + + String requestString = + "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + + "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + + "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + + "</samlp:Request>"; + Element request = DOMUtils.parseDocument(requestString, false, Constants.ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); + + RedisTransactionStorage rts = (RedisTransactionStorage) context.getBean("RedisTransactionStorage"); + //GenericToStringSerializer redisStringSerializer = (GenericToStringSerializer) context.getBean("valueObjectSerializer"); + + // rts.getTemplate().setValueSerializer(new GenericToStringSerializer<Object>(Object.class)); + // rts.getTemplate().setHashValueSerializer(new GenericToStringSerializer<Object>(Object.class)); + + int cnt = 100; + int averageCnt = 10; + long putTime = 0, getTime = 0, changeTime = 0, removeTime = 0; + long total = 0; + for(int a=0;a<averageCnt;a++){ + long totalPerRound = 0; + + System.out.println("Starting Redis store operation."); + long start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + rts.put("test"+i, request,-1); + long end = System.currentTimeMillis(); + putTime += end-start; + System.out.println("Redis store operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + + Element test; + System.out.println("Starting Redis get operation."); + start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + test = (Element)rts.get("test"+i); + end = System.currentTimeMillis(); + getTime += end-start; + System.out.println("Redis get operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + //Element test = (Element)rts.get("test0"); + //System.out.println("Read Element from Redis Store: "+test.getTextContent()); + + String requestString2 = + "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + + "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"test_new\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + + "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + + "</samlp:Request>"; + Element request2 = DOMUtils.parseDocument(requestString2, false, Constants.ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); + + System.out.println("Starting Redis change operation."); + start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + rts.changeKey("test"+i, "test_new"+i, request2); + end = System.currentTimeMillis(); + changeTime += end-start; + System.out.println("Redis change operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + + + + System.out.println("Starting Redis remove operation."); + start = System.currentTimeMillis(); + for(int i=0; i<cnt;i++) + rts.remove("test_new"+i); + end = System.currentTimeMillis(); + removeTime += end-start; + System.out.println("Redis remove operation done in "+(end-start)+" ms."); + totalPerRound+=(end-start); + total+=totalPerRound; + + System.out.println("Redis Total Time in this round: "+totalPerRound+" ms."); + System.out.println("______________________________________________________"); + } + System.out.println("______________________________________________________"); + System.out.println("Redis average get time over " + averageCnt +" rounds: "+getTime/averageCnt+" ms."); + System.out.println("Redis average put time over " + averageCnt +" rounds: "+putTime/averageCnt+" ms."); + System.out.println("Redis average change time over " + averageCnt +" rounds: "+changeTime/averageCnt+" ms."); + System.out.println("Redis average remove time over " + averageCnt +" rounds: "+removeTime/averageCnt+" ms."); + System.out.println("Redis average total time over " + averageCnt +" rounds: "+total/averageCnt+" ms."); + + ((ConfigurableApplicationContext)context).close(); + + + } + +} diff --git a/id/server/idserverlib/src/test/java/testBeans.xml b/id/server/idserverlib/src/test/java/testBeans.xml new file mode 100644 index 000000000..238a571cb --- /dev/null +++ b/id/server/idserverlib/src/test/java/testBeans.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:p="http://www.springframework.org/schema/p" + xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> + +<context:annotation-config /> + <bean id="configPropertyDao" + class="at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl"/> + + <bean id="moaidconfig" class="at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfigurationImpl" /> + + <bean name="config" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> + <property name="dataSource" ref="dataSource" /> + <property name="jpaVendorAdapter" ref="jpaVendorAdapter" /> + <property name="persistenceUnitName" value="config" /> + </bean> + + <bean name="transactionManager" id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + <tx:annotation-driven transaction-manager="transactionManager"/> + + <bean id="RedisTransactionStorage" + class="at.gv.egovernment.moa.id.storage.RedisTransactionStorage"/> + + <bean id="DBTransactionStorage" + class="at.gv.egovernment.moa.id.storage.DBTransactionStorage"/> + + <!-- Redis Beans --> + <bean id="jedisConnFactory" + class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" + p:use-pool="true" + p:poolConfig-ref="jedisPoolConfig"/> + + <bean id="jedisPoolConfig" + class="redis.clients.jedis.JedisPoolConfig" + p:maxTotal="100" + p:maxIdle="10"/> + + <bean id="RedisStringSerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer" /> + <bean id="assertionStoreSerializer" class="org.springframework.data.redis.serializer.JacksonJsonRedisSerializer"> + <constructor-arg type="java.lang.Class" value="at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore"/> + </bean> + + <bean id="redisTemplate" + class="org.springframework.data.redis.core.RedisTemplate" + p:connection-factory-ref="jedisConnFactory" + p:value-serializer-ref="RedisStringSerializer" + p:key-serializer-ref="RedisStringSerializer" + p:enableTransactionSupport="true"/> + + <context:property-placeholder location="${moa.id.configuration}"/> + + <bean id="moaidauthconfig" class="at.gv.egovernment.moa.id.config.auth.PropertyBasedAuthConfigurationProvider"> + <constructor-arg value="#{systemProperties['moa.id.configuration']}"/> + </bean> + + <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" lazy-init="true" destroy-method="close"> + <aop:scoped-proxy/> + <property name="driverClassName" value="${configuration.hibernate.connection.driver_class}" /> + <property name="url" value="${configuration.hibernate.connection.url}"/> + <property name="username" value="${configuration.hibernate.connection.username}" /> + <property name="password" value="${configuration.hibernate.connection.password}" /> + + <property name="connectionProperties" value="${configuration.dbcp.connectionProperties}" /> + <property name="initialSize" value="${configuration.dbcp.initialSize}" /> + <property name="maxTotal" value="${configuration.dbcp.maxActive}" /> + <property name="maxIdle" value="${configuration.dbcp.maxIdle}" /> + <property name="minIdle" value="${configuration.dbcp.minIdle}" /> + <!-- property name="maxWait" value="${configuration.dbcp.maxWaitMillis}" / --> + <property name="testOnBorrow" value="${configuration.dbcp.testOnBorrow}" /> + <property name="testOnReturn" value="${configuration.dbcp.testOnReturn}" /> + <property name="testWhileIdle" value="${configuration.dbcp.testWhileIdle}" /> + <property name="validationQuery" value="${configuration.dbcp.validationQuery}" /> + </bean> + + <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> + <property name="showSql" value="${configuration.hibernate.show_sql}" /> + <property name="generateDdl" value="${configuration.jpaVendorAdapter.generateDdl}" /> + <property name="databasePlatform" value="${configuration.hibernate.dialect}" /> + </bean> + + <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> + <property name="corePoolSize" value="1" /> + <property name="maxPoolSize" value="50" /> + <property name="queueCapacity" value="50" /> + </bean> + + <bean id="sessionDataSource" class="org.apache.commons.dbcp2.BasicDataSource" lazy-init="true" destroy-method="close"> + <aop:scoped-proxy/> + <property name="driverClassName" value="${moasession.hibernate.connection.driver_class}" /> + <property name="url" value="${moasession.hibernate.connection.url}"/> + <property name="username" value="${moasession.hibernate.connection.username}" /> + <property name="password" value="${moasession.hibernate.connection.password}" /> + + <property name="connectionProperties" value="${moasession.dbcp.connectionProperties}" /> + <property name="initialSize" value="${moasession.dbcp.initialSize}" /> + <property name="maxTotal" value="${moasession.dbcp.maxActive}" /> + <property name="maxIdle" value="${moasession.dbcp.maxIdle}" /> + <property name="minIdle" value="${moasession.dbcp.minIdle}" /> + <!-- property name="maxWait" value="${moasession.dbcp.maxWaitMillis}" / --> + <property name="testOnBorrow" value="${moasession.dbcp.testOnBorrow}" /> + <property name="testOnReturn" value="${moasession.dbcp.testOnReturn}" /> + <property name="testWhileIdle" value="${moasession.dbcp.testWhileIdle}" /> + <property name="validationQuery" value="${moasession.dbcp.validationQuery}" /> + </bean> + + <bean id="sessionJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> + <property name="showSql" value="${moasession.hibernate.show_sql}" /> + <property name="generateDdl" value="${moasession.jpaVendorAdapter.generateDdl}" /> + <property name="databasePlatform" value="${moasession.hibernate.dialect}" /> + </bean> + + <bean name="sessionEntityManagerFactory" id="sessionEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> + <property name="dataSource" ref="sessionDataSource" /> + <property name="jpaVendorAdapter" ref="sessionJpaVendorAdapter" /> + <property name="persistenceUnitName" value="session" /> + </bean> + + <bean name="sessionTransactionManager" id="sessionTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> + <property name="entityManagerFactory" ref="sessionEntityManagerFactory" /> + </bean> +</beans>
\ No newline at end of file |