aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/test/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/test/java/at')
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/DummyTransactionStorage.java147
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java2
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java2
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/DBTransactionStorageTest.java122
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionMultiThreadTest.java130
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/storage/test/RedisTransactionStorageTest.java116
6 files changed, 517 insertions, 2 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
new file mode 100644
index 000000000..ab08c0f5c
--- /dev/null
+++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/DummyTransactionStorage.java
@@ -0,0 +1,147 @@
+package at.gv.egovernment.moa.id.process.spring.test;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.sql.DataSource;
+
+import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
+import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
+import at.gv.egovernment.moa.id.storage.ITransactionStorage;
+import at.gv.egovernment.moa.logging.Logger;
+
+/**
+ * Dummy DataSource implementation for convenience in test cases where a
+ * database connection will never actually be acquired.
+ *
+ * @see DataSource
+ * @author Chris Beams
+ */
+public class DummyTransactionStorage implements ITransactionStorage {
+
+ public class DummyDBEntry{
+ public DummyDBEntry(String key, Object value){
+ this.obj =value;
+ this.key = key;
+ }
+ public String getKey() {
+ return key;
+ }
+ public void setKey(String key) {
+ this.key = key;
+ }
+ public Object getObj() {
+ return obj;
+ }
+ public void setObj(Object obj) {
+ this.obj = obj;
+ }
+ private String key;
+ private Object obj;
+ }
+
+ private ArrayList<DummyDBEntry> ds = new ArrayList<DummyDBEntry>();
+
+
+
+ @Override
+ public boolean containsKey(String key) {
+ // TODO Auto-generated method stub
+ Iterator<DummyDBEntry> it = ds.iterator();
+ while(it.hasNext()){
+ DummyDBEntry t = it.next();
+ if(t.getKey().equals(key))
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void put(String key, Object value, int timeout_ms)
+ throws MOADatabaseException {
+ // TODO Auto-generated method stub
+ this.remove(key);
+ this.ds.add(new DummyDBEntry(key, value));
+
+ }
+
+ @Override
+ public Object get(String key) throws MOADatabaseException {
+ // TODO Auto-generated method stub
+ Iterator<DummyDBEntry> it = ds.iterator();
+ while(it.hasNext()){
+ DummyDBEntry t = it.next();
+ if(t.getKey().equals(key))
+ return t;
+ }
+ return null;
+ }
+
+ @Override
+ public <T> T get(String key, Class<T> clazz) throws MOADatabaseException {
+
+ DummyDBEntry o = (DummyDBEntry) get(key);
+ if(o == null)
+ return null;
+ try {
+ @SuppressWarnings("unchecked")
+ T test = (T) (clazz.cast(o.getObj()));
+ return test;
+
+ } catch (Exception e) {
+ Logger.warn("Sessioninformation Cast-Exception by using Artifact=" + key);
+ throw new MOADatabaseException("Sessioninformation Cast-Exception");
+
+ }
+ }
+
+ @Override
+ public <T> T get(String key, Class<T> clazz, long dataTimeOut)
+ throws MOADatabaseException, AuthenticationException {
+ // TODO Auto-generated method stub
+ return get(key,clazz);
+ }
+
+ @Override
+ public void changeKey(String oldKey, String newKey, Object value)
+ throws MOADatabaseException {
+ this.remove(oldKey);
+ this.put(newKey, value, -1);
+
+ }
+
+ @Override
+ public void remove(String key) {
+ Iterator<DummyDBEntry> it = ds.iterator();
+ while(it.hasNext()){
+ DummyDBEntry t = it.next();
+ if(t.getKey().equals(key)){
+ this.ds.remove(t);
+ return;
+ }
+ }
+
+ }
+
+ @Override
+ public List<String> clean(Date now, long dataTimeOut) {
+ // TODO Auto-generated method stub
+ 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/process/spring/test/SpringExpressionAwareProcessEngineTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java
index 2cb2a3278..b308e2fa8 100644
--- a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java
+++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java
@@ -78,7 +78,7 @@ public class SpringExpressionAwareProcessEngineTest {
config.addProperties(props);
//config.addAnnotatedClass(ProcessInstanceStore.class);
config.addAnnotatedClass(AssertionStore.class);
- MOASessionDBUtils.initHibernate(config, props);
+ //MOASessionDBUtils.initHibernate(config, props);
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java
index a7e351e25..197627a66 100644
--- a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java
+++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java
@@ -73,7 +73,7 @@ public class ProcessEngineTest {
config.addProperties(props);
//config.addAnnotatedClass(ProcessInstanceStore.class);
config.addAnnotatedClass(AssertionStore.class);
- MOASessionDBUtils.initHibernate(config, props);
+ //MOASessionDBUtils.initHibernate(config, props);
} catch (Exception e) {
e.printStackTrace();
}
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();
+
+
+ }
+
+}