You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pirk.apache.org by ea...@apache.org on 2016/07/31 20:05:58 UTC
incubator-pirk git commit: [PIRK-36]: Ensure Schema Properties and
Registries are Reset at the Beginning of Relevant Tests -- closes
apache/incubator-pirk#38
Repository: incubator-pirk
Updated Branches:
refs/heads/master 0237de6dd -> 9d7b46d66
[PIRK-36]: Ensure Schema Properties and Registries are Reset at the Beginning of Relevant Tests -- closes apache/incubator-pirk#38
Project: http://git-wip-us.apache.org/repos/asf/incubator-pirk/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-pirk/commit/9d7b46d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-pirk/tree/9d7b46d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-pirk/diff/9d7b46d6
Branch: refs/heads/master
Commit: 9d7b46d660fd8019e6787ffdb754ca949dc30fd1
Parents: 0237de6
Author: eawilliams <ea...@apache.org>
Authored: Sun Jul 31 16:05:43 2016 -0400
Committer: eawilliams <ea...@apache.org>
Committed: Sun Jul 31 16:05:43 2016 -0400
----------------------------------------------------------------------
src/test/java/test/general/PaillierTest.java | 26 +++++++++++---------
.../java/test/general/PartitionUtilsTest.java | 5 ----
.../java/test/general/QueryParserUtilsTest.java | 24 ++++++++++++++----
.../wideskies/standalone/StandaloneTest.java | 25 +++++++++++++++++--
4 files changed, 56 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/9d7b46d6/src/test/java/test/general/PaillierTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/test/general/PaillierTest.java b/src/test/java/test/general/PaillierTest.java
index abb50fa..833798a 100644
--- a/src/test/java/test/general/PaillierTest.java
+++ b/src/test/java/test/general/PaillierTest.java
@@ -27,6 +27,7 @@ import java.util.Random;
import org.apache.pirk.encryption.Paillier;
import org.apache.pirk.utils.PIRException;
import org.apache.pirk.utils.SystemConfiguration;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,22 +40,23 @@ public class PaillierTest
{
private static final Logger logger = LoggerFactory.getLogger(PaillierTest.class);
- private BigInteger p = null; // large prime
- private BigInteger q = null; // large prime
- private BigInteger N = null; // N=pq, RSA modulus
- private BigInteger NSquared = null; // N^2
- private BigInteger lambdaN = null; // lambda(N) = lcm(p-1,q-1)
+ private static BigInteger p = null; // large prime
+ private static BigInteger q = null; // large prime
+ private static BigInteger N = null; // N=pq, RSA modulus
+ private static BigInteger NSquared = null; // N^2
+ private static BigInteger lambdaN = null; // lambda(N) = lcm(p-1,q-1)
- private int bitLength = 0; // bit length of the modulus N
- private int certainty = 64; // prob that new BigInteger values represents primes will exceed (1 - (1/2)^certainty)
+ private static int bitLength = 0; // bit length of the modulus N
+ private static int certainty = 64; // prob that new BigInteger values represents primes will exceed (1 - (1/2)^certainty)
- private BigInteger r1 = null; // random number in (Z/NZ)*
- private BigInteger r2 = null; // random number in (Z/NZ)*
+ private static BigInteger r1 = null; // random number in (Z/NZ)*
+ private static BigInteger r2 = null; // random number in (Z/NZ)*
- private BigInteger m1 = null; // message to encrypt
- private BigInteger m2 = null; // message to encrypt
+ private static BigInteger m1 = null; // message to encrypt
+ private static BigInteger m2 = null; // message to encrypt
- public PaillierTest()
+ @BeforeClass
+ public static void setup()
{
p = BigInteger.valueOf(7);
q = BigInteger.valueOf(17);
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/9d7b46d6/src/test/java/test/general/PartitionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/test/general/PartitionUtilsTest.java b/src/test/java/test/general/PartitionUtilsTest.java
index f226cb5..2c85406 100644
--- a/src/test/java/test/general/PartitionUtilsTest.java
+++ b/src/test/java/test/general/PartitionUtilsTest.java
@@ -39,11 +39,6 @@ public class PartitionUtilsTest
{
private static final Logger logger = LoggerFactory.getLogger(PartitionUtilsTest.class);
- public PartitionUtilsTest()
- {
- PrimitiveTypePartitioner primitivePartitioner = new PrimitiveTypePartitioner();
- }
-
@Test
public void testMask()
{
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/9d7b46d6/src/test/java/test/general/QueryParserUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/test/general/QueryParserUtilsTest.java b/src/test/java/test/general/QueryParserUtilsTest.java
index 9a086f8..669a347 100644
--- a/src/test/java/test/general/QueryParserUtilsTest.java
+++ b/src/test/java/test/general/QueryParserUtilsTest.java
@@ -33,6 +33,8 @@ import org.apache.pirk.utils.QueryParserUtils;
import org.apache.pirk.utils.StringUtils;
import org.apache.pirk.utils.SystemConfiguration;
import org.json.simple.JSONObject;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,16 +46,18 @@ public class QueryParserUtilsTest
{
private static final Logger logger = LoggerFactory.getLogger(QueryParserUtilsTest.class);
- private MapWritable doc = null; // MapWritable with arrays in json string representation
- private MapWritable docWAW = null; // MapWritable with arrays as WritableArrayWritable objects
- private Map<String,Object> docMap = null; // arrays as ArrayList<String>
+ private static MapWritable doc = null; // MapWritable with arrays in json string representation
+ private static MapWritable docWAW = null; // MapWritable with arrays as WritableArrayWritable objects
+ private static Map<String,Object> docMap = null; // arrays as ArrayList<String>
- private DataSchema dSchema = null;
+ private static DataSchema dSchema = null;
- public QueryParserUtilsTest() throws Exception
+ @BeforeClass
+ public static void setup() throws Exception
{
ArrayList<JSONObject> dataElementsJSON = Inputs.createJSONDataElements();
+ // Reset the schema properties and registries
DataSchemaRegistry.clearRegistry();
QuerySchemaRegistry.clearRegistry();
SystemConfiguration.setProperty("data.schemas", "none");
@@ -72,6 +76,16 @@ public class QueryParserUtilsTest
docMap = StringUtils.jsonStringToMap(dataElementsJSON.get(0).toJSONString(), dSchema);
}
+ @AfterClass
+ public static void teardown()
+ {
+ // Reset the schema properties and registries
+ DataSchemaRegistry.clearRegistry();
+ QuerySchemaRegistry.clearRegistry();
+ SystemConfiguration.setProperty("data.schemas", "none");
+ SystemConfiguration.setProperty("query.schemas", "none");
+ }
+
@Test
public void testSingleQuery()
{
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/9d7b46d6/src/test/java/test/wideskies/standalone/StandaloneTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/test/wideskies/standalone/StandaloneTest.java b/src/test/java/test/wideskies/standalone/StandaloneTest.java
index 4b52981..b4fd255 100644
--- a/src/test/java/test/wideskies/standalone/StandaloneTest.java
+++ b/src/test/java/test/wideskies/standalone/StandaloneTest.java
@@ -20,11 +20,15 @@ package test.wideskies.standalone;
import java.util.ArrayList;
+import org.apache.pirk.schema.data.DataSchemaRegistry;
+import org.apache.pirk.schema.query.QuerySchemaRegistry;
import org.apache.pirk.schema.query.filter.StopListFilter;
import org.apache.pirk.test.utils.BaseTests;
import org.apache.pirk.test.utils.Inputs;
import org.apache.pirk.utils.SystemConfiguration;
import org.json.simple.JSONObject;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,10 +49,17 @@ public class StandaloneTest
private static final String STOPLIST_FILE = "testStopListFile";
- private String stopListFileProp = null;
+ private static String stopListFileProp = null;
- public StandaloneTest() throws Exception
+ @BeforeClass
+ public static void setup() throws Exception
{
+ // Reset the schema properties and registries
+ DataSchemaRegistry.clearRegistry();
+ QuerySchemaRegistry.clearRegistry();
+ SystemConfiguration.setProperty("data.schemas", "none");
+ SystemConfiguration.setProperty("query.schemas", "none");
+
// Create the stoplist file
stopListFileProp = SystemConfiguration.getProperty("pir.stopListFile");
SystemConfiguration.setProperty("pir.stopListFile", STOPLIST_FILE);
@@ -60,6 +71,16 @@ public class StandaloneTest
Inputs.createSchemaFiles(StopListFilter.class.getName());
}
+ @AfterClass
+ public static void teardown()
+ {
+ // Reset the schema properties and registries
+ DataSchemaRegistry.clearRegistry();
+ QuerySchemaRegistry.clearRegistry();
+ SystemConfiguration.setProperty("data.schemas", "none");
+ SystemConfiguration.setProperty("query.schemas", "none");
+ }
+
@Test
public void runTests() throws Exception
{