tephra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject incubator-tephra git commit: (TEPHRA-261) Make TransactionSystemTest extensible for other projects
Date Wed, 13 Sep 2017 22:44:52 GMT
Repository: incubator-tephra
Updated Branches:
  refs/heads/master bff3ed573 -> c12a14618


(TEPHRA-261) Make TransactionSystemTest extensible for other projects

This closes #59 from GitHub.

Signed-off-by: anew <anew@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-tephra/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tephra/commit/c12a1461
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tephra/tree/c12a1461
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tephra/diff/c12a1461

Branch: refs/heads/master
Commit: c12a14618037c2e9bfd7336ae745cf81553e622d
Parents: bff3ed5
Author: anew <anew@apache.org>
Authored: Wed Sep 13 14:43:19 2017 -0700
Committer: anew <anew@apache.org>
Committed: Wed Sep 13 15:44:34 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/tephra/ThriftTransactionSystemTest.java  | 2 +-
 .../test/java/org/apache/tephra/TransactionManagerTest.java  | 2 +-
 .../test/java/org/apache/tephra/TransactionSystemTest.java   | 8 ++++++--
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/c12a1461/tephra-core/src/test/java/org/apache/tephra/ThriftTransactionSystemTest.java
----------------------------------------------------------------------
diff --git a/tephra-core/src/test/java/org/apache/tephra/ThriftTransactionSystemTest.java
b/tephra-core/src/test/java/org/apache/tephra/ThriftTransactionSystemTest.java
index 0d7d9bf..757b620 100644
--- a/tephra-core/src/test/java/org/apache/tephra/ThriftTransactionSystemTest.java
+++ b/tephra-core/src/test/java/org/apache/tephra/ThriftTransactionSystemTest.java
@@ -73,7 +73,7 @@ public class ThriftTransactionSystemTest extends TransactionSystemTest {
     zkServer = InMemoryZKServer.builder().setDataDir(tmpFolder.newFolder()).build();
     zkServer.startAndWait();
 
-    Configuration conf = getCommonConfiguration();
+    Configuration conf = getCommonConfiguration(null);
     conf.setBoolean(TxConstants.Manager.CFG_DO_PERSIST, false);
     conf.set(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM, zkServer.getConnectionStr());
     // we want to use a retry strategy that lets us query the number of times it retried:

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/c12a1461/tephra-core/src/test/java/org/apache/tephra/TransactionManagerTest.java
----------------------------------------------------------------------
diff --git a/tephra-core/src/test/java/org/apache/tephra/TransactionManagerTest.java b/tephra-core/src/test/java/org/apache/tephra/TransactionManagerTest.java
index b16d93d..5cc1354 100644
--- a/tephra-core/src/test/java/org/apache/tephra/TransactionManagerTest.java
+++ b/tephra-core/src/test/java/org/apache/tephra/TransactionManagerTest.java
@@ -58,7 +58,7 @@ public class TransactionManagerTest extends TransactionSystemTest {
 
   @BeforeClass
   public static void beforeClass() {
-    conf = getCommonConfiguration();
+    conf = getCommonConfiguration(null);
     conf.setInt(TxConstants.Manager.CFG_TX_CLEANUP_INTERVAL, 0); // no cleanup thread
     // todo should create two sets of tests, one with LocalFileTxStateStorage and one with
InMemoryTxStateStorage
     txStateStorage = new InMemoryTransactionStateStorage();

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/c12a1461/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java
----------------------------------------------------------------------
diff --git a/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java b/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java
index 6cbda2f..b09c6c0 100644
--- a/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java
+++ b/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java
@@ -31,6 +31,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
+import javax.annotation.Nullable;
 
 /**
  * Base class for testing implementations of {@link TransactionSystemClient}.
@@ -45,9 +46,12 @@ public abstract class TransactionSystemTest {
   /**
    * Sets up the common properties required for the test cases defined here.
    * Subclasses can call this and add more properties as needed.
+   *
+   * @param existing An existing configuration to be modified. If null, a new confoguration
is created.
    */
-  static Configuration getCommonConfiguration() {
-    Configuration conf = new Configuration();
+  @SuppressWarnings("WeakerAccess")
+  protected static Configuration getCommonConfiguration(@Nullable Configuration existing)
{
+    Configuration conf = existing != null ? existing : new Configuration();
     conf.setInt(TxConstants.Manager.CFG_TX_MAX_TIMEOUT, (int) TimeUnit.DAYS.toSeconds(5));
// very long limit
     conf.setInt(TxConstants.Manager.CFG_TX_CHANGESET_COUNT_LIMIT, 50);
     conf.setInt(TxConstants.Manager.CFG_TX_CHANGESET_COUNT_WARN_THRESHOLD, 40);


Mime
View raw message