incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1553124 [2/2] - in /sling/trunk/contrib/extensions/cassandra: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/java/org/apache/sling/cassandra/ src/main/java/org/apache/...
Date Mon, 23 Dec 2013 15:06:30 GMT
Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataAddTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataAddTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataAddTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataAddTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Assert;
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.util.CassandraResourceProviderUtil;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class CassandraDataAddTest {
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraDataAddTest.class);
+
+    @Test
+    public void testAddData() {
+        String cf = "p1";
+        try {
+            String r1 = getrowID("/content/cassandra/" + cf + "/c1");
+            String r2 = getrowID("/content/cassandra/" + cf + "/c1/c2");
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+            addData(cassandraResourceProvider.getKeyspace(), cf, new StringSerializer(),
+                    new String[]{
+                            "'" + r1 + "','/content/cassandra/" + cf + "/c1','nt:cassandra1','nt:supercass1','resolutionPathInfo=json'",
+                            "'" + r2 + "','/content/cassandra/" + cf + "/c1/c2','nt:cassandra','nt:supercass2','resolutionPathInfo=json'"
+                    });
+
+        Assert.assertTrue(true);
+        } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+            Assert.fail("Failed to add data to cassandra");
+        }
+
+    }
+
+    private String getrowID(String path) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+        MessageDigest md = MessageDigest.getInstance("SHA1");
+        String rowID = new String(Base64.encodeBase64(md.digest(CassandraResourceProviderUtil.getRemainingPath(path).getBytes("UTF-8"))));
+        return rowID;
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists " + ignore.getMessage());
+        }
+    }
+
+    private void addData(Keyspace keyspace, String cf, StringSerializer se, String[] dataArray) {
+        for (String data : dataArray) {
+            CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+            String query = "insert into " + cf + " (KEY,path,resourceType,resourceSuperType,metadata) values (" + data + ");";
+            cqlQuery.setQuery(query);
+            QueryResult<CqlRows<String, String, String>> result = cqlQuery.execute();
+            LOGGER.info("Added " + result.toString());
+        }
+    }
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeIterableTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeIterableTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeIterableTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeIterableTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Test;
+import org.junit.Assert;
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceResolver;
+import org.apache.sling.cassandra.resource.provider.util.CassandraResourceProviderUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Iterator;
+
+public class CassandraDataChildNodeIterableTest {
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraDataChildNodeIterableTest.class);
+
+    @Test
+    public void testGetChildrenData() {
+        String cf = "p1";
+        try {
+            String r1 = getrowID("/content/cassandra/" + cf + "/c1");
+            String r2 = getrowID("/content/cassandra/" + cf + "/c1/c2");
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+          addData(cassandraResourceProvider.getKeyspace(), cf, new StringSerializer(),
+                    new String[]{
+                            "'" + r1 + "','/content/cassandra/" + cf + "/c1','nt:cassandra1','nt:supercass1','resolutionPathInfo=json'",
+                            "'" + r2 + "','/content/cassandra/" + cf + "/c1/c2','nt:cassandra','nt:supercass2','resolutionPathInfo=json'"
+                    });
+
+            getChildrenData(cassandraResourceProvider, cf);
+       } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+       }
+    }
+
+    private void getChildrenData(CassandraResourceProvider cassandraResourceProvider, String cf) {
+        Resource resource = cassandraResourceProvider.getResource(new CassandraResourceResolver(), "/content/cassandra/" + cf + "/c1");
+        Assert.assertNotNull(resource);
+        Iterable<Resource> iterableChildren = resource.getChildren();
+        Iterator<Resource> children = iterableChildren.iterator();
+        boolean hasChild = false;
+        while(children.hasNext()){
+            Resource r = children.next();
+            if(r.getPath().equals("/content/cassandra/" + cf + "/c1/c2")) {
+            Assert.assertNotNull(r);
+            Assert.assertEquals("/content/cassandra/" + cf + "/c1/c2",r.getPath());
+            hasChild = true;
+            }
+        }
+        Assert.assertTrue(hasChild);
+    }
+
+    private String getrowID(String path) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+        MessageDigest md = MessageDigest.getInstance("SHA1");
+        String rowID = new String(Base64.encodeBase64(md.digest(CassandraResourceProviderUtil.getRemainingPath(path).getBytes("UTF-8"))));
+        return rowID;
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists "+ignore.getMessage());
+        }
+    }
+
+    private void addData(Keyspace keyspace, String cf, StringSerializer se, String[] dataArray) {
+        for (String data : dataArray) {
+            CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+            String query = "insert into " + cf + " (KEY,path,resourceType,resourceSuperType,metadata) values (" + data + ");";
+            cqlQuery.setQuery(query);
+            cqlQuery.execute();
+        }
+    }
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataChildNodeTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Assert;
+import org.junit.Test;
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceResolver;
+import org.apache.sling.cassandra.resource.provider.util.CassandraResourceProviderUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Iterator;
+
+public class CassandraDataChildNodeTest{
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraDataChildNodeTest.class);
+
+    @Test
+    public void testGetChildrenData() {
+        String cf = "p1";
+        try {
+                String r1 = getrowID("/content/cassandra/" + cf + "/c1");
+            String r2 = getrowID("/content/cassandra/" + cf + "/c1/c2");
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+            addData(cassandraResourceProvider.getKeyspace(), cf, new StringSerializer(),
+                           new String[]{
+                                   "'" + r1 + "','/content/cassandra/" + cf + "/c1','nt:cassandra1','nt:supercass1','resolutionPathInfo=json'",
+                                   "'" + r2 + "','/content/cassandra/" + cf + "/c1/c2','nt:cassandra','nt:supercass2','resolutionPathInfo=json'"
+                           });
+
+            getChildrenData(cassandraResourceProvider, cf);
+       } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+       }
+    }
+
+    private void getChildrenData(CassandraResourceProvider cassandraResourceProvider, String cf) {
+        Resource resource = cassandraResourceProvider.getResource(new CassandraResourceResolver(), "/content/cassandra/" + cf + "/c1");
+        Assert.assertNotNull(resource);
+        Iterator<Resource> children = resource.listChildren();
+        boolean hasChild = false;
+        while(children.hasNext()){
+            Resource r = children.next();
+            if(r.getPath().equals("/content/cassandra/" + cf + "/c1/c2")) {
+            Assert.assertNotNull(r);
+            Assert.assertEquals("/content/cassandra/" + cf + "/c1/c2",r.getPath());
+            hasChild = true;
+            }
+        }
+        Assert.assertTrue(hasChild);
+    }
+
+    private String getrowID(String path) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+        MessageDigest md = MessageDigest.getInstance("SHA1");
+        String rowID = new String(Base64.encodeBase64(md.digest(CassandraResourceProviderUtil.getRemainingPath(path).getBytes("UTF-8"))));
+        return rowID;
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists "+ignore.getMessage());
+        }
+    }
+
+    private void addData(Keyspace keyspace, String cf, StringSerializer se, String[] dataArray) {
+        for (String data : dataArray) {
+            CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+            String query = "insert into " + cf + " (KEY,path,resourceType,resourceSuperType,metadata) values (" + data + ");";
+            cqlQuery.setQuery(query);
+            cqlQuery.execute();
+        }
+    }
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataParentNodeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataParentNodeTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataParentNodeTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataParentNodeTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Assert;
+import org.junit.Test;
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceResolver;
+import org.apache.sling.cassandra.resource.provider.util.CassandraResourceProviderUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class CassandraDataParentNodeTest {
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraDataParentNodeTest.class);
+
+    @Test
+    public void testGetParentData() {
+        String cf = "p1";
+        try {
+
+           String r1 = getrowID("/content/cassandra/" + cf + "/c1");
+            String r2 = getrowID("/content/cassandra/" + cf + "/c1/c2");
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+           addData(cassandraResourceProvider.getKeyspace(), cf, new StringSerializer(),
+                           new String[]{
+                                   "'" + r1 + "','/content/cassandra/" + cf + "/c1','nt:cassandra1','nt:supercass1','resolutionPathInfo=json'",
+                                   "'" + r2 + "','/content/cassandra/" + cf + "/c1/c2','nt:cassandra','nt:supercass2','resolutionPathInfo=json'"
+                           });
+
+            getParentData(cassandraResourceProvider, cf);
+       } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+       }
+
+
+    }
+
+    private void getParentData(CassandraResourceProvider cassandraResourceProvider, String cf) {
+        Resource resource = cassandraResourceProvider.getResource(new CassandraResourceResolver(), "/content/cassandra/" + cf + "/c1/c2");
+        Assert.assertNotNull(resource);
+        Resource parent = resource.getParent();
+        Assert.assertNotNull(parent);
+        Assert.assertEquals("/content/cassandra/" + cf + "/c1",parent.getPath());
+    }
+
+    private String getrowID(String path) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+        MessageDigest md = MessageDigest.getInstance("SHA1");
+        String rowID = new String(Base64.encodeBase64(md.digest(CassandraResourceProviderUtil.getRemainingPath(path).getBytes("UTF-8"))));
+        return rowID;
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists "+ignore.getMessage());
+        }
+    }
+
+    private void addData(Keyspace keyspace, String cf, StringSerializer se, String[] dataArray) {
+        for (String data : dataArray) {
+            CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+            String query = "insert into " + cf + " (KEY,path,resourceType,resourceSuperType,metadata) values (" + data + ");";
+            cqlQuery.setQuery(query);
+            cqlQuery.execute();
+        }
+    }
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataReadTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataReadTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataReadTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraDataReadTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Assert;
+import org.junit.Test;
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceResolver;
+import org.apache.sling.cassandra.resource.provider.util.CassandraResourceProviderUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class CassandraDataReadTest {
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraDataReadTest.class);
+
+    @Test
+    public void testReadData() {
+        String cf = "p1";
+        try {
+
+            String r1 = getrowID("/content/cassandra/" + cf + "/c1");
+             String r2 = getrowID("/content/cassandra/" + cf + "/c1/c2");
+
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+        addData(cassandraResourceProvider.getKeyspace(), cf, new StringSerializer(),
+                           new String[]{
+                                   "'" + r1 + "','/content/cassandra/" + cf + "/c1','nt:cassandra1','nt:supercass1','resolutionPathInfo=json'",
+                                   "'" + r2 + "','/content/cassandra/" + cf + "/c1/c2','nt:cassandra','nt:supercass2','resolutionPathInfo=json'"
+                           });
+
+            readData(cassandraResourceProvider, cf);
+       } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+       }
+
+
+    }
+
+    private void readData(CassandraResourceProvider cassandraResourceProvider, String cf) {
+        Resource resource = cassandraResourceProvider.getResource(new CassandraResourceResolver(), "/content/cassandra/" + cf + "/c1/c2");
+        Assert.assertNotNull(resource);
+    }
+
+
+    private String getrowID(String path) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+        MessageDigest md = MessageDigest.getInstance("SHA1");
+        String rowID = new String(Base64.encodeBase64(md.digest(CassandraResourceProviderUtil.getRemainingPath(path).getBytes("UTF-8"))));
+        return rowID;
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists "+ignore.getMessage());
+        }
+    }
+
+    private void addData(Keyspace keyspace, String cf, StringSerializer se, String[] dataArray) {
+        for (String data : dataArray) {
+            CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+            String query = "insert into " + cf + " (KEY,path,resourceType,resourceSuperType,metadata) values (" + data + ");";
+            cqlQuery.setQuery(query);
+            QueryResult<CqlRows<String, String, String>> result = cqlQuery.execute();
+            LOGGER.info("Added " + result.toString());
+        }
+    }
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderAddTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderAddTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderAddTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderAddTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import org.apache.commons.codec.binary.Base64;
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceResolver;
+import org.apache.sling.cassandra.resource.provider.util.CassandraResourceProviderUtil;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CassandraModifyResourceProviderAddTest {
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraModifyResourceProviderAddTest.class);
+
+    @Test
+    public void testAddData() {
+        String cf = "p2";
+        try {
+            String path1 ="/content/cassandra/" + cf + "/c1";
+
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+            Map<String,Object> map1 = new HashMap<String, Object>();
+            map1.put("metadata", "resolutionPathInfo=json");
+            map1.put("resourceType", "nt:cassandra0");
+            map1.put("resourceSuperType", "nt:supercass1");
+
+            CassandraResourceResolver resolver =  new CassandraResourceResolver();
+            cassandraResourceProvider.create(resolver,path1,map1);
+            Assert.assertNull("Before Commiting Resource should be null",cassandraResourceProvider.getResource(resolver,path1));
+            cassandraResourceProvider.commit(resolver);
+            Assert.assertNotNull("Commited Resource cannot be null",cassandraResourceProvider.getResource(resolver,path1));
+
+        } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+            Assert.fail("Failed to add data to cassandra");
+        }
+
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists " + ignore.getMessage());
+        }
+    }
+
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderDeleteTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderDeleteTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderDeleteTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderDeleteTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceResolver;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class CassandraModifyResourceProviderDeleteTest {
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraModifyResourceProviderDeleteTest.class);
+
+    @Test
+    public void testDeleteData() {
+        String cf = "p3";
+        try {
+            String path1 ="/content/cassandra/" + cf + "/c1";
+
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+            Map<String,Object> map1 = new HashMap<String, Object>();
+            map1.put("metadata", "resolutionPathInfo=json");
+            map1.put("resourceType", "nt:cassandra0");
+            map1.put("resourceSuperType", "nt:supercass1");
+
+            CassandraResourceResolver resolver =  new CassandraResourceResolver();
+            cassandraResourceProvider.create(resolver,path1,map1);
+            Assert.assertNull("Before Commiting Resource should be null", cassandraResourceProvider.getResource(resolver, path1));
+            cassandraResourceProvider.commit(resolver);
+            Assert.assertNotNull("Commited Resource cannot be null", cassandraResourceProvider.getResource(resolver, path1));
+
+            cassandraResourceProvider.delete(resolver,path1);
+            Assert.assertNotNull("Uncommited deleted resource cannot be null",cassandraResourceProvider.getResource(resolver,path1));
+            cassandraResourceProvider.commit(resolver);
+            Assert.assertNull("Deleted resource should be null", cassandraResourceProvider.getResource(resolver, path1));
+
+        } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+            Assert.fail("Failed to add data to cassandra");
+        }
+
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists " + ignore.getMessage());
+        }
+    }
+
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderRevertTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderRevertTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderRevertTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraModifyResourceProviderRevertTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.cassandra.test.data.populator;
+
+
+import me.prettyprint.cassandra.model.CqlQuery;
+import me.prettyprint.cassandra.model.CqlRows;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.exceptions.HInvalidRequestException;
+import me.prettyprint.hector.api.query.QueryResult;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceProvider;
+import org.apache.sling.cassandra.resource.provider.CassandraResourceResolver;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class CassandraModifyResourceProviderRevertTest {
+    private static Logger LOGGER = LoggerFactory.getLogger(CassandraModifyResourceProviderRevertTest.class);
+
+    @Test
+    public void testRevertData() {
+        String cf = "p4";
+        try {
+            String path1 ="/content/cassandra/" + cf + "/c1";
+
+            CassandraResourceProvider cassandraResourceProvider = new CassandraResourceProvider();
+            createColumnFamily(cf, cassandraResourceProvider.getKeyspace(), new StringSerializer());
+            cassandraResourceProvider.setColumnFamily(cf);
+
+            Map<String,Object> map1 = new HashMap<String, Object>();
+            map1.put("metadata", "resolutionPathInfo=json");
+            map1.put("resourceType", "nt:cassandra0");
+            map1.put("resourceSuperType", "nt:supercass1");
+
+            CassandraResourceResolver resolver =  new CassandraResourceResolver();
+            cassandraResourceProvider.create(resolver,path1,map1);
+            Assert.assertNull("Before Commiting resource should be null", cassandraResourceProvider.getResource(resolver, path1));
+            cassandraResourceProvider.revert(resolver);
+            Assert.assertNull("Reverted resource should be null", cassandraResourceProvider.getResource(resolver, path1));
+
+        } catch (Exception e) {
+            LOGGER.info("Ignore err" + e.getMessage());
+            Assert.fail("Failed to add data to cassandra");
+        }
+
+    }
+
+    private void createColumnFamily(String cf, Keyspace keyspace, StringSerializer se) {
+        String createCF = "CREATE COLUMNFAMILY " + cf + " (KEY varchar PRIMARY KEY,path varchar,resourceType varchar,resourceSuperType varchar,metadata varchar);";
+        CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
+        cqlQuery.setQuery(createCF);
+        try{
+        QueryResult<CqlRows<String, String, String>> result1 = cqlQuery.execute();
+        LOGGER.info(result1.get().getList().size() + " Finished.!");
+        }catch(HInvalidRequestException ignore){
+            LOGGER.debug("Column Family already exists " + ignore.getMessage());
+        }
+    }
+
+}
+

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraResourceProviderPerformanceTestClient.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraResourceProviderPerformanceTestClient.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraResourceProviderPerformanceTestClient.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/CassandraResourceProviderPerformanceTestClient.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.cassandra.test.data.populator;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test the PlanetsResourceProvider that the test-services bundles provides
+ */
+public class CassandraResourceProviderPerformanceTestClient extends HttpTestBase {
+
+    private static List<String> exerciseList = new ArrayList<String>();
+    private static List<String> testList = new ArrayList<String>();
+    private static List<Long> firstRun = new ArrayList<Long>();
+    private static List<Long> secondRun = new ArrayList<Long>();
+
+    private static File file = new File("/home/dishara/mystuff/sling/svn/slinglatest/launchpad/integration-tests/CassandraLatencyReport.txt");
+                     private static FileWriter fileWriter;
+    static {
+        loadTestLists();
+        if(!file.exists()){
+            try {
+                file.createNewFile();
+            } catch (IOException ignore) {
+            }
+        }
+        try {
+            fileWriter = new FileWriter(file, true);
+        } catch (IOException ignore) {
+        }
+
+    }
+
+    private static void loadTestLists() {
+        int exerciseCount = 0;
+        int testCount = 0;
+
+        for (int i = 0; i < 1000; i++) {
+            if (i % 2 == 0) {
+                if (exerciseCount < 100) {
+                    exerciseList.add(String.valueOf(i));
+                    System.out.println("Exercise: " + i);
+                    exerciseCount++;
+                }
+            } else {
+                if (testCount < 100) {
+                    testList.add(String.valueOf(i));
+                    System.out.println("Test: " + i);
+                    testCount++;
+                }
+            }
+        }
+
+    }
+
+    private void getAllExerciseData(String parentNode) throws IOException {
+        for (String s : exerciseList) {
+            getContent(HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s + ".json", CONTENT_TYPE_JSON);
+        }
+    }
+    private void writeToFile(String s) throws IOException {
+         fileWriter.write(s+"\n");
+    }
+
+    private void getAllTestData(String parentNode, List<Long> result, Map<String, Long> nodeMap) throws IOException {
+        writeToFile("#######################################################################################################################");
+        writeToFile("############################ HTTP Latency Report on Test Data under " + parentNode + " ################################");
+        writeToFile("#######################################################################################################################");
+
+        long subTotal = 0;
+        for (String s : testList) {
+            long startTime = System.currentTimeMillis();
+            String url = HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s + ".json";
+            String content = getContent(url, CONTENT_TYPE_JSON);
+            long latency = System.currentTimeMillis() - startTime;
+            result.add(latency);
+            subTotal = subTotal + latency;
+            writeToFile("[TEST] Latency: " + latency + " (ms) HTTP URI " + content);
+        }
+        nodeMap.put(parentNode,subTotal);
+    }
+
+    public void testMovieResource() throws Exception {
+
+        String[] nodes = new String[]{"A", "B", "C", "D","E","F"};
+        Map<String,Long> firstNodeMap = new HashMap<String,Long>();
+        Map<String,Long> secondNodeMap = new HashMap<String,Long>();
+
+        writeToFile("============================================ FIRST RUN ============================================================");
+        for (String s : nodes) {
+            getAllExerciseData(s);
+            getAllTestData(s,firstRun,firstNodeMap);
+        }
+        writeToFile("============================================ SECOND RUN ============================================================");
+        for (String s : nodes) {
+            getAllExerciseData(s);
+            getAllTestData(s, secondRun, secondNodeMap);
+        }
+
+        long firstRunTotal = 0;
+        long secondRunTotal = 0;
+
+        for(long l1:firstRun){
+            firstRunTotal = firstRunTotal + l1;
+        }
+
+        for(long l2:secondRun){
+            secondRunTotal = secondRunTotal + l2;
+        }
+
+        writeToFile("===========================================================================================================================");
+        writeToFile("========================================== FIRST RUN TEST SUMMERY==========================================================");
+        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + firstNodeMap.get("A")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + firstNodeMap.get("B")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + firstNodeMap.get("C")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + firstNodeMap.get("D")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + firstNodeMap.get("E")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + firstNodeMap.get("F")/testList.size() +" (ms)");
+        writeToFile("[FIRST RUN] #TOTAL CALLS = " + firstRun.size() + " Total Average Latency = " + firstRunTotal/firstRun.size() + " (ms)");
+        writeToFile("===========================================================================================================================");
+        writeToFile("========================================== SECOND RUN TEST SUMMERY==========================================================");
+        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + secondNodeMap.get("A")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + secondNodeMap.get("B")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + secondNodeMap.get("C")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + secondNodeMap.get("D")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + secondNodeMap.get("E")/testList.size() +" (ms)");
+        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + secondNodeMap.get("F")/testList.size() +" (ms)");
+        writeToFile("[FIRST RUN] #TOTAL CALLS = " + secondRun.size() + " Total Average Latency = " + secondRunTotal/secondRun.size() + " (ms)");
+        writeToFile("===========================================================================================================================");
+        fileWriter.close();
+    }
+
+
+}

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderCreateTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderCreateTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderCreateTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderCreateTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.cassandra.test.data.populator.perf;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.apache.sling.servlets.post.SlingPostConstants;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test the PlanetsResourceProvider that the test-services bundles provides
+ */
+public class CassandraResourceProviderCreateTest extends HttpTestBase {
+
+    private static List<String> exerciseList = new ArrayList<String>();
+    private static List<String> testList = new ArrayList<String>();
+    private static List<Long> firstRun = new ArrayList<Long>();
+    private static List<Long> secondRun = new ArrayList<Long>();
+
+    private static File file = new File("/home/dishara/mystuff/sling/svn/slinglatest/launchpad/integration-tests/CassandraCreateLatencyReport.txt");
+    private static FileWriter fileWriter;
+
+    static {
+        loadTestLists();
+        if (!file.exists()) {
+            try {
+                file.createNewFile();
+            } catch (IOException ignore) {
+            }
+        }
+        try {
+            fileWriter = new FileWriter(file, true);
+        } catch (IOException ignore) {
+        }
+
+    }
+
+    private static void loadTestLists() {
+        int exerciseCount = 0;
+        int testCount = 0;
+
+        for (int i = 0; i < 1000; i++) {
+            if (i % 2 == 0) {
+                if (exerciseCount < 100) {
+                    exerciseList.add(String.valueOf(i));
+                    System.out.println("Exercise: " + i);
+                    exerciseCount++;
+                }
+            } else {
+                if (testCount < 100) {
+                    testList.add(String.valueOf(i));
+                    System.out.println("Test: " + i);
+                    testCount++;
+                }
+            }
+        }
+
+    }
+
+    private void createAllExerciseData(String parentNode) throws IOException {
+        Map<String, String> props = new HashMap<String, String>();
+        props.put(SlingPostConstants.RP_CONTENT_TYPE, "json");
+        Map<String, String> props1 = new HashMap<String, String>();
+        props1.put("metadata", "resolutionPathInfo=json");
+        props1.put("resourceType", "nt:cassandra0");
+        props1.put("resourceSuperType", "nt:supercass1");
+        props.put(SlingPostConstants.RP_CHECKIN, "true");
+
+        for (String s : exerciseList) {
+            testClient.createNode(HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s, props, props1, true);
+        }
+
+    }
+
+    private void writeToFile(String s) throws IOException {
+        fileWriter.write(s + "\n");
+    }
+
+    private void createAllTestData(String parentNode, List<Long> result, Map<String, Long> nodeMap) throws IOException {
+        Map<String, String> props = new HashMap<String, String>();
+        props.put(SlingPostConstants.RP_CONTENT_TYPE, "json");
+        Map<String, String> props1 = new HashMap<String, String>();
+        props1.put("metadata", "resolutionPathInfo=json");
+        props1.put("resourceType", "nt:cassandra0");
+        props1.put("resourceSuperType", "nt:supercass1");
+        props.put(SlingPostConstants.RP_CHECKIN, "true");
+
+        writeToFile("#######################################################################################################################");
+        writeToFile("############################ HTTP CUD Latency Report on Test Data under " + parentNode + " ################################");
+        writeToFile("#######################################################################################################################");
+
+        long subTotal = 0;
+
+        for (String s : testList) {
+            long startTime = System.currentTimeMillis();
+
+            String url = HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s;
+            testClient.createNode(url, props, props1, true);
+            long latency = System.currentTimeMillis() - startTime;
+            result.add(latency);
+            subTotal = subTotal + latency;
+            writeToFile("[TEST] Latency: " + latency + " (ms) HTTP URI " + url);
+            System.out.println(url);
+        }
+        nodeMap.put(parentNode, subTotal);
+    }
+
+    public void testMovieResource() throws Exception {
+        String[] nodes = new String[]{"LA", "MA", "SA"};
+//        String[] nodes = new String[]{"A", "B", "C", "D", "E", "F"};
+        Map<String, Long> firstNodeMap = new HashMap<String, Long>();
+        Map<String, Long> secondNodeMap = new HashMap<String, Long>();
+
+        writeToFile("============================================ FIRST RUN ============================================================");
+        for (String s : nodes) {
+            createAllTestData(s, firstRun, firstNodeMap);
+        }
+        long firstRunTotal = 0;
+        long secondRunTotal = 0;
+
+        for (long l1 : firstRun) {
+            firstRunTotal = firstRunTotal + l1;
+        }
+
+        for (long l2 : secondRun) {
+            secondRunTotal = secondRunTotal + l2;
+        }
+
+        writeToFile("===========================================================================================================================");
+        writeToFile("========================================== FIRST RUN TEST SUMMERY==========================================================");
+        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + firstNodeMap.get("LA") / testList.size() + " (ms)");
+        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + firstNodeMap.get("MA") / testList.size() + " (ms)");
+        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + firstNodeMap.get("SA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + firstNodeMap.get("D") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + firstNodeMap.get("E") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + firstNodeMap.get("F") / testList.size() + " (ms)");
+        writeToFile("[FIRST RUN] #TOTAL CALLS = " + firstRun.size() + " Total Average Latency = " + firstRunTotal / firstRun.size() + " (ms)");
+        writeToFile("===========================================================================================================================");
+//        writeToFile("========================================== SECOND RUN TEST SUMMERY==========================================================");
+//        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + secondNodeMap.get("LA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + secondNodeMap.get("MA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + secondNodeMap.get("SA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + secondNodeMap.get("D") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + secondNodeMap.get("E") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + secondNodeMap.get("F") / testList.size() + " (ms)");
+//        writeToFile("[FIRST RUN] #TOTAL CALLS = " + secondRun.size() + " Total Average Latency = " + secondRunTotal / secondRun.size() + " (ms)");
+        writeToFile("===========================================================================================================================");
+        fileWriter.close();
+    }
+
+
+}

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderDeleteTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderDeleteTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderDeleteTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderDeleteTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.cassandra.test.data.populator.perf;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test the PlanetsResourceProvider that the test-services bundles provides
+ */
+public class CassandraResourceProviderDeleteTest extends HttpTestBase {
+
+    private static List<String> exerciseList = new ArrayList<String>();
+    private static List<String> testList = new ArrayList<String>();
+    private static List<Long> firstRun = new ArrayList<Long>();
+    private static List<Long> secondRun = new ArrayList<Long>();
+
+    private static File file = new File("/home/dishara/mystuff/sling/svn/slinglatest/launchpad/integration-tests/CassandraDeleteLatencyReport.txt");
+    private static FileWriter fileWriter;
+
+    static {
+        loadTestLists();
+        if (!file.exists()) {
+            try {
+                file.createNewFile();
+            } catch (IOException ignore) {
+            }
+        }
+        try {
+            fileWriter = new FileWriter(file, true);
+        } catch (IOException ignore) {
+        }
+
+    }
+
+    private static void loadTestLists() {
+        int exerciseCount = 0;
+        int testCount = 0;
+
+        for (int i = 0; i < 1000; i++) {
+            if (i % 2 == 0) {
+                if (exerciseCount < 100) {
+                    exerciseList.add(String.valueOf(i));
+                    System.out.println("Exercise: " + i);
+                    exerciseCount++;
+                }
+            } else {
+                if (testCount < 100) {
+                    testList.add(String.valueOf(i));
+                    System.out.println("Test: " + i);
+                    testCount++;
+                }
+            }
+        }
+
+    }
+
+    private void writeToFile(String s) throws IOException {
+        fileWriter.write(s + "\n");
+    }
+
+    private void deleteAllTestData(String parentNode, List<Long> result, Map<String, Long> nodeMap) throws IOException {
+        writeToFile("#######################################################################################################################");
+        writeToFile("############################ HTTP CUD Latency Report on Test Data under " + parentNode + " ################################");
+        writeToFile("#######################################################################################################################");
+
+        long subTotal = 0;
+
+        for (String s : testList) {
+            long startTime = System.currentTimeMillis();
+
+            String url = HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s;
+            testClient.delete(url);
+            long latency = System.currentTimeMillis() - startTime;
+            result.add(latency);
+            subTotal = subTotal + latency;
+            writeToFile("[TEST] Latency: " + latency + " (ms) HTTP URI " + url);
+            System.out.println(url);
+        }
+        nodeMap.put(parentNode, subTotal);
+    }
+
+    public void testMovieResource() throws Exception {
+        String[] nodes = new String[]{"LA", "MA", "SA"};
+        Map<String, Long> firstNodeMap = new HashMap<String, Long>();
+
+        writeToFile("============================================ FIRST RUN ============================================================");
+        for (String s : nodes) {
+            deleteAllTestData(s, firstRun, firstNodeMap);
+        }
+        long firstRunTotal = 0;
+        long secondRunTotal = 0;
+
+        for (long l1 : firstRun) {
+            firstRunTotal = firstRunTotal + l1;
+        }
+
+        for (long l2 : secondRun) {
+            secondRunTotal = secondRunTotal + l2;
+        }
+
+        writeToFile("===========================================================================================================================");
+        writeToFile("========================================== FIRST RUN TEST SUMMERY==========================================================");
+        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + firstNodeMap.get("LA") / testList.size() + " (ms)");
+        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + firstNodeMap.get("MA") / testList.size() + " (ms)");
+        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + firstNodeMap.get("SA") / testList.size() + " (ms)");
+        writeToFile("[FIRST RUN] #TOTAL CALLS = " + firstRun.size() + " Total Average Latency = " + firstRunTotal / firstRun.size() + " (ms)");
+        writeToFile("===========================================================================================================================");
+        writeToFile("===========================================================================================================================");
+        fileWriter.close();
+    }
+
+
+}

Added: sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderUpdateTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderUpdateTest.java?rev=1553124&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderUpdateTest.java (added)
+++ sling/trunk/contrib/extensions/cassandra/src/test/java/org/apache/sling/cassandra/test/data/populator/perf/CassandraResourceProviderUpdateTest.java Mon Dec 23 15:06:29 2013
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.cassandra.test.data.populator.perf;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.apache.sling.servlets.post.SlingPostConstants;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test the PlanetsResourceProvider that the test-services bundles provides
+ */
+public class CassandraResourceProviderUpdateTest extends HttpTestBase {
+
+    private static List<String> exerciseList = new ArrayList<String>();
+    private static List<String> testList = new ArrayList<String>();
+    private static List<Long> firstRun = new ArrayList<Long>();
+    private static List<Long> secondRun = new ArrayList<Long>();
+
+    private static File file = new File("/home/dishara/mystuff/sling/svn/slinglatest/launchpad/integration-tests/CassandraUpdateLatencyReport.txt");
+    private static FileWriter fileWriter;
+
+    static {
+        loadTestLists();
+        if (!file.exists()) {
+            try {
+                file.createNewFile();
+            } catch (IOException ignore) {
+            }
+        }
+        try {
+            fileWriter = new FileWriter(file, true);
+        } catch (IOException ignore) {
+        }
+
+    }
+
+    private static void loadTestLists() {
+        int exerciseCount = 0;
+        int testCount = 0;
+
+        for (int i = 0; i < 1000; i++) {
+            if (i % 2 == 0) {
+                if (exerciseCount < 100) {
+                    exerciseList.add(String.valueOf(i));
+                    System.out.println("Exercise: " + i);
+                    exerciseCount++;
+                }
+            } else {
+                if (testCount < 100) {
+                    testList.add(String.valueOf(i));
+                    System.out.println("Test: " + i);
+                    testCount++;
+                }
+            }
+        }
+
+    }
+
+    private void createAllExerciseData(String parentNode) throws IOException {
+        Map<String, String> props = new HashMap<String, String>();
+        props.put(SlingPostConstants.RP_CONTENT_TYPE, "json");
+        Map<String, String> props1 = new HashMap<String, String>();
+        props1.put("metadata", "resolutionPathInfo=json");
+        props1.put("resourceType", "nt:cassandra9");
+        props1.put("resourceSuperType", "nt:supercass9");
+        props.put(SlingPostConstants.RP_CHECKIN, "true");
+
+        for (String s : exerciseList) {
+            testClient.createNode(HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s, props, props1, true);
+        }
+
+    }
+
+    private void writeToFile(String s) throws IOException {
+        fileWriter.write(s + "\n");
+    }
+
+    private void createAllTestData(String parentNode, List<Long> result, Map<String, Long> nodeMap) throws IOException {
+        Map<String, String> props = new HashMap<String, String>();
+        props.put(SlingPostConstants.RP_CONTENT_TYPE, "json");
+        Map<String, String> props1 = new HashMap<String, String>();
+        props1.put("metadata", "resolutionPathInfo=json");
+        props1.put("resourceType", "nt:cassandra9");
+        props1.put("resourceSuperType", "nt:supercass9");
+        props.put(SlingPostConstants.RP_CHECKIN, "true");
+
+        writeToFile("#######################################################################################################################");
+        writeToFile("############################ HTTP CUD Latency Report on Test Data under " + parentNode + " ################################");
+        writeToFile("#######################################################################################################################");
+
+        long subTotal = 0;
+
+        for (String s : testList) {
+            long startTime = System.currentTimeMillis();
+
+            String url = HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s;
+            testClient.createNode(url, props, props1, true);
+            long latency = System.currentTimeMillis() - startTime;
+            result.add(latency);
+            subTotal = subTotal + latency;
+            writeToFile("[TEST] Latency: " + latency + " (ms) HTTP URI " + url);
+            System.out.println(url);
+        }
+        nodeMap.put(parentNode, subTotal);
+    }
+
+    public void testMovieResource() throws Exception {
+        String[] nodes = new String[]{"LA", "MA", "SA"};
+        Map<String, Long> firstNodeMap = new HashMap<String, Long>();
+
+        writeToFile("============================================ FIRST RUN ============================================================");
+        for (String s : nodes) {
+            createAllTestData(s, firstRun, firstNodeMap);
+        }
+        long firstRunTotal = 0;
+        long secondRunTotal = 0;
+
+        for (long l1 : firstRun) {
+            firstRunTotal = firstRunTotal + l1;
+        }
+
+        for (long l2 : secondRun) {
+            secondRunTotal = secondRunTotal + l2;
+        }
+
+        writeToFile("===========================================================================================================================");
+        writeToFile("========================================== FIRST RUN TEST SUMMERY==========================================================");
+        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + firstNodeMap.get("LA") / testList.size() + " (ms)");
+        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + firstNodeMap.get("MA") / testList.size() + " (ms)");
+        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + firstNodeMap.get("SA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + firstNodeMap.get("D") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + firstNodeMap.get("E") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + firstNodeMap.get("F") / testList.size() + " (ms)");
+        writeToFile("[FIRST RUN] #TOTAL CALLS = " + firstRun.size() + " Total Average Latency = " + firstRunTotal / firstRun.size() + " (ms)");
+        writeToFile("===========================================================================================================================");
+//        writeToFile("========================================== SECOND RUN TEST SUMMERY==========================================================");
+//        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + secondNodeMap.get("LA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + secondNodeMap.get("MA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + secondNodeMap.get("SA") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + secondNodeMap.get("D") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + secondNodeMap.get("E") / testList.size() + " (ms)");
+//        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + secondNodeMap.get("F") / testList.size() + " (ms)");
+//        writeToFile("[FIRST RUN] #TOTAL CALLS = " + secondRun.size() + " Total Average Latency = " + secondRunTotal / secondRun.size() + " (ms)");
+        writeToFile("===========================================================================================================================");
+        fileWriter.close();
+    }
+
+
+}



Mime
View raw message