You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@omid.apache.org by fp...@apache.org on 2016/05/11 18:06:22 UTC
[15/50] [abbrv] incubator-omid git commit: Remove JUnit asserts
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompaction.java
----------------------------------------------------------------------
diff --git a/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompaction.java b/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompaction.java
index c219b87..f7e791c 100644
--- a/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompaction.java
+++ b/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompaction.java
@@ -20,14 +20,6 @@ package org.apache.omid.transaction;
import com.google.common.util.concurrent.SettableFuture;
import com.google.inject.Guice;
import com.google.inject.Injector;
-import org.apache.omid.HBaseShims;
-import org.apache.omid.TestUtils;
-import org.apache.omid.committable.CommitTable;
-import org.apache.omid.metrics.NullMetricsProvider;
-import org.apache.omid.committable.hbase.HBaseCommitTableConfig;
-import org.apache.omid.timestamp.storage.HBaseTimestampStorageConfig;
-import org.apache.omid.tso.TSOServer;
-import org.apache.omid.tso.TSOServerConfig;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
@@ -50,6 +42,14 @@ import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.coprocessor.AggregationClient;
import org.apache.hadoop.hbase.client.coprocessor.LongColumnInterpreter;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.omid.HBaseShims;
+import org.apache.omid.TestUtils;
+import org.apache.omid.committable.CommitTable;
+import org.apache.omid.committable.hbase.HBaseCommitTableConfig;
+import org.apache.omid.metrics.NullMetricsProvider;
+import org.apache.omid.timestamp.storage.HBaseTimestampStorageConfig;
+import org.apache.omid.tso.TSOServer;
+import org.apache.omid.tso.TSOServerConfig;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.slf4j.Logger;
@@ -72,11 +72,11 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.spy;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
public class TestCompaction {
@@ -105,11 +105,7 @@ public class TestCompaction {
private AggregationClient aggregationClient;
private CommitTable commitTable;
-//<<<<<<< HEAD
-// private TSOClient client;
private PostCommitActions syncPostCommitter;
-//=======
-//>>>>>>> open-source-master
@BeforeClass
public void setupTestCompation() throws Exception {
@@ -132,18 +128,16 @@ public class TestCompaction {
setupTSO();
commitTable = injector.getInstance(CommitTable.class);
-
-//<<<<<<< HEAD
-// client = TSOClient.newBuilder().withConfiguration(clientConf).build();
-//
-//=======
-//>>>>>>> open-source-master
}
private void setupHBase() throws Exception {
- LOG.info("********** Setting up HBase **********");
+ LOG.info("--------------------------------------------------------------------------------------------------");
+ LOG.info("Setting up HBase");
+ LOG.info("--------------------------------------------------------------------------------------------------");
hbaseTestUtil = new HBaseTestingUtility(hbaseConf);
- LOG.info("********** Creating HBase MiniCluster **********");
+ LOG.info("--------------------------------------------------------------------------------------------------");
+ LOG.info("Creating HBase MiniCluster");
+ LOG.info("--------------------------------------------------------------------------------------------------");
hbaseCluster = hbaseTestUtil.startMiniCluster(1);
}
@@ -199,17 +193,6 @@ public class TestCompaction {
}
private TransactionManager newTransactionManager() throws Exception {
-//<<<<<<< HEAD
-// CommitTable.Client commitTableClient = commitTable.getClient();
-// syncPostCommitter =
-// spy(new HBaseSyncPostCommitter(new NullMetricsProvider(),commitTableClient));
-//
-// return HBaseTransactionManager.newBuilder()
-// .withConfiguration(hbaseConf)
-// .withCommitTableClient(commitTableClient)
-// .withTSOClient(client)
-// .postCommitter(syncPostCommitter)
-//=======
HBaseOmidClientConfiguration hbaseOmidClientConf = new HBaseOmidClientConfiguration();
hbaseOmidClientConf.setConnectionString("localhost:1234");
hbaseOmidClientConf.setHBaseConfiguration(hbaseConf);
@@ -219,7 +202,6 @@ public class TestCompaction {
return HBaseTransactionManager.builder(hbaseOmidClientConf)
.postCommitter(syncPostCommitter)
.commitTableClient(commitTableClient)
-//>>>>>>> open-source-master
.build();
}
@@ -266,7 +248,7 @@ public class TestCompaction {
LOG.info("Waking up after 3 secs");
// No rows should have been discarded after compacting
- assertEquals("Rows in table after compacting should be " + ROWS_TO_ADD, ROWS_TO_ADD, rowCount(TEST_TABLE, fam));
+ assertEquals(rowCount(TEST_TABLE, fam), ROWS_TO_ADD, "Rows in table after compacting should be " + ROWS_TO_ADD);
}
@Test
@@ -292,18 +274,12 @@ public class TestCompaction {
// Do nothing
}
- assertTrue("Cell should be there",
- CellUtils.hasCell(Bytes.toBytes(row),
- fam,
- qual,
- problematicTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertFalse("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(row),
- fam,
- qual,
- problematicTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
+ assertTrue(CellUtils.hasCell(Bytes.toBytes(row), fam, qual, problematicTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should be there");
+ assertFalse(CellUtils.hasShadowCell(Bytes.toBytes(row), fam, qual, problematicTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
// Return a LWM that triggers compaction and has all the possible start timestamps below it
LOG.info("Regions in table {}: {}", TEST_TABLE, hbaseCluster.getRegions(Bytes.toBytes(TEST_TABLE)).size());
@@ -326,18 +302,12 @@ public class TestCompaction {
Thread.sleep(3000);
LOG.info("Waking up after 3 secs");
- assertTrue("Cell should be there",
- CellUtils.hasCell(Bytes.toBytes(row),
- fam,
- qual,
- problematicTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertTrue("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(row),
- fam,
- qual,
- problematicTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
+ assertTrue(CellUtils.hasCell(Bytes.toBytes(row), fam, qual, problematicTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should be there");
+ assertTrue(CellUtils.hasShadowCell(Bytes.toBytes(row), fam, qual, problematicTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
}
@Test
@@ -355,18 +325,12 @@ public class TestCompaction {
Put put = new Put(Bytes.toBytes(rowId));
put.add(fam, qual, data);
txTable.put(neverendingTxBelowLowWatermark, put);
- assertTrue("Cell should be there",
- CellUtils.hasCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTxBelowLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertFalse("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTxBelowLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
+ assertTrue(CellUtils.hasCell(Bytes.toBytes(rowId), fam, qual, neverendingTxBelowLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should be there");
+ assertFalse(CellUtils.hasShadowCell(Bytes.toBytes(rowId), fam, qual, neverendingTxBelowLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
// The KV in this transaction should be added without the shadow cells
HBaseTransaction neverendingTxAboveLowWatermark = (HBaseTransaction) tm.begin();
@@ -374,23 +338,17 @@ public class TestCompaction {
put = new Put(Bytes.toBytes(anotherRowId));
put.add(fam, qual, data);
txTable.put(neverendingTxAboveLowWatermark, put);
- assertTrue("Cell should be there",
- CellUtils.hasCell(Bytes.toBytes(anotherRowId),
- fam,
- qual,
- neverendingTxAboveLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertFalse("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(anotherRowId),
- fam,
- qual,
- neverendingTxAboveLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
-
- assertEquals("Rows in table before flushing should be 2", 2, rowCount(TEST_TABLE, fam));
+ assertTrue(CellUtils.hasCell(Bytes.toBytes(anotherRowId), fam, qual, neverendingTxAboveLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should be there");
+ assertFalse(CellUtils.hasShadowCell(Bytes.toBytes(anotherRowId), fam, qual, neverendingTxAboveLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
+
+ assertEquals(rowCount(TEST_TABLE, fam), 2, "Rows in table before flushing should be 2");
LOG.info("Flushing table {}", TEST_TABLE);
admin.flush(TEST_TABLE);
- assertEquals("Rows in table after flushing should be 2", 2, rowCount(TEST_TABLE, fam));
+ assertEquals(rowCount(TEST_TABLE, fam), 2, "Rows in table after flushing should be 2");
// Return a LWM that triggers compaction and stays between both ST of TXs, so assign 1st TX's start timestamp
LOG.info("Regions in table {}: {}", TEST_TABLE, hbaseCluster.getRegions(Bytes.toBytes(TEST_TABLE)).size());
@@ -410,33 +368,21 @@ public class TestCompaction {
LOG.info("Waking up after 3 secs");
// One row should have been discarded after compacting
- assertEquals("There should be only one row in table after compacting", 1, rowCount(TEST_TABLE, fam));
+ assertEquals(rowCount(TEST_TABLE, fam), 1, "There should be only one row in table after compacting");
// The row from the TX below the LWM should not be there (nor its Shadow Cell)
- assertFalse("Cell should not be there",
- CellUtils.hasCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTxBelowLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertFalse("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTxBelowLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
+ assertFalse(CellUtils.hasCell(Bytes.toBytes(rowId), fam, qual, neverendingTxBelowLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should not be there");
+ assertFalse(CellUtils.hasShadowCell(Bytes.toBytes(rowId), fam, qual, neverendingTxBelowLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
// The row from the TX above the LWM should be there without the Shadow Cell
- assertTrue("Cell should be there",
- CellUtils.hasCell(Bytes.toBytes(anotherRowId),
- fam,
- qual,
- neverendingTxAboveLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertFalse("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(anotherRowId),
- fam,
- qual,
- neverendingTxAboveLowWatermark.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
+ assertTrue(CellUtils.hasCell(Bytes.toBytes(anotherRowId), fam, qual, neverendingTxAboveLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should be there");
+ assertFalse(CellUtils.hasShadowCell(Bytes.toBytes(anotherRowId), fam, qual, neverendingTxAboveLowWatermark.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
}
@@ -453,23 +399,17 @@ public class TestCompaction {
Put put = new Put(Bytes.toBytes(rowId));
put.add(fam, qual, data);
txTable.put(neverendingTx, put);
- assertTrue("Cell should be there",
- CellUtils.hasCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertFalse("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
-
- assertEquals("There should be only one rows in table before flushing", 1, rowCount(TEST_TABLE, fam));
+ assertTrue(CellUtils.hasCell(Bytes.toBytes(rowId), fam, qual, neverendingTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should be there");
+ assertFalse(CellUtils.hasShadowCell(Bytes.toBytes(rowId), fam, qual, neverendingTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
+
+ assertEquals(rowCount(TEST_TABLE, fam), 1, "There should be only one rows in table before flushing");
LOG.info("Flushing table {}", TEST_TABLE);
admin.flush(TEST_TABLE);
- assertEquals("There should be only one rows in table after flushing", 1, rowCount(TEST_TABLE, fam));
+ assertEquals(rowCount(TEST_TABLE, fam), 1, "There should be only one rows in table after flushing");
// Break access to CommitTable functionality in Compactor
LOG.info("Regions in table {}: {}", TEST_TABLE, hbaseCluster.getRegions(Bytes.toBytes(TEST_TABLE)).size());
@@ -490,19 +430,13 @@ public class TestCompaction {
LOG.info("Waking up after 3 secs");
// All rows should be there after the failed compaction
- assertEquals("There should be only one row in table after compacting", 1, rowCount(TEST_TABLE, fam));
- assertTrue("Cell should be there",
- CellUtils.hasCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
- assertFalse("Shadow cell should not be there",
- CellUtils.hasShadowCell(Bytes.toBytes(rowId),
- fam,
- qual,
- neverendingTx.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
+ assertEquals(rowCount(TEST_TABLE, fam), 1, "There should be only one row in table after compacting");
+ assertTrue(CellUtils.hasCell(Bytes.toBytes(rowId), fam, qual, neverendingTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should be there");
+ assertFalse(CellUtils.hasShadowCell(Bytes.toBytes(rowId), fam, qual, neverendingTx.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Shadow cell should not be there");
}
@Test
@@ -523,36 +457,35 @@ public class TestCompaction {
Transaction tx = tm.begin();
Get get = new Get(Bytes.toBytes(rowId));
get.setMaxVersions(2 * MAX_VERSIONS);
- assertEquals("Max versions should be set to " + (2 * MAX_VERSIONS), (2 * MAX_VERSIONS), get.getMaxVersions());
+ assertEquals(get.getMaxVersions(), (2 * MAX_VERSIONS), "Max versions should be set to " + (2 * MAX_VERSIONS));
get.addColumn(fam, qual);
Result result = txTable.get(tx, get);
tm.commit(tx);
List<Cell> column = result.getColumnCells(fam, qual);
- assertEquals("There should be only one version in the result", 1, column.size());
+ assertEquals(column.size(), 1, "There should be only one version in the result");
- assertEquals("There should be only one row in table before flushing", 1, rowCount(TEST_TABLE, fam));
+ assertEquals(rowCount(TEST_TABLE, fam), 1, "There should be only one row in table before flushing");
LOG.info("Flushing table {}", TEST_TABLE);
admin.flush(TEST_TABLE);
- assertEquals("There should be only one row in table after flushing", 1, rowCount(TEST_TABLE, fam));
+ assertEquals(rowCount(TEST_TABLE, fam), 1, "There should be only one row in table after flushing");
// Return a LWM that triggers compaction
compactEverything(TEST_TABLE);
// One row should have been discarded after compacting
- assertEquals("There should be only one row in table after compacting", 1, rowCount(TEST_TABLE, fam));
+ assertEquals(rowCount(TEST_TABLE, fam), 1, "There should be only one row in table after compacting");
tx = tm.begin();
get = new Get(Bytes.toBytes(rowId));
get.setMaxVersions(2 * MAX_VERSIONS);
- assertEquals("Max versions should be set to " + (2 * MAX_VERSIONS), (2 * MAX_VERSIONS), get.getMaxVersions());
+ assertEquals(get.getMaxVersions(), (2 * MAX_VERSIONS), "Max versions should be set to " + (2 * MAX_VERSIONS));
get.addColumn(fam, qual);
result = txTable.get(tx, get);
tm.commit(tx);
column = result.getColumnCells(fam, qual);
- assertEquals("There should be only one version in the result", 1, column.size());
- assertEquals("Values don't match",
- "testWrite-" + (2 * MAX_VERSIONS),
- Bytes.toString(CellUtil.cloneValue(column.get(0))));
+ assertEquals(column.size(), 1, "There should be only one version in the result");
+ assertEquals(Bytes.toString(CellUtil.cloneValue(column.get(0))), "testWrite-" + (2 * MAX_VERSIONS),
+ "Values don't match");
}
// manually flush the regions on the region server.
@@ -594,36 +527,36 @@ public class TestCompaction {
// Before compaction, the three timestamped values for the cell should be there
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertTrue("Put cell of Tx1 should be there",
- CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter));
- assertTrue("Put shadow cell of Tx1 should be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter));
- assertTrue("Put cell of Tx2 cell should be there",
- CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter));
- assertTrue("Put shadow cell of Tx2 should be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter));
- assertTrue("Put cell of Tx3 cell should be there",
- CellUtils.hasCell(rowId, fam, qual, tx3.getStartTimestamp(), getter));
- assertTrue("Put shadow cell of Tx3 should be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx3.getStartTimestamp(), getter));
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put cell of Tx1 should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell of Tx1 should be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put cell of Tx2 cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put shadow cell of Tx2 should be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx3.getStartTimestamp(), getter),
+ "Put cell of Tx3 cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx3.getStartTimestamp(), getter),
+ "Put shadow cell of Tx3 should be there");
// Compact
HBaseTransaction lwmTx = (HBaseTransaction) tm.begin();
compactWithLWM(lwmTx.getStartTimestamp(), TEST_TABLE);
// After compaction, only the last value for the cell should have survived
- assertFalse("Put cell of Tx1 should not be there",
- CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter));
- assertFalse("Put shadow cell of Tx1 should not be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter));
- assertFalse("Put cell of Tx2 should not be there",
- CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter));
- assertFalse("Put shadow cell of Tx2 should not be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter));
- assertTrue("Put cell of Tx3 cell should be there",
- CellUtils.hasCell(rowId, fam, qual, tx3.getStartTimestamp(), getter));
- assertTrue("Put shadow cell of Tx3 should be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx3.getStartTimestamp(), getter));
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put cell of Tx1 should not be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell of Tx1 should not be there");
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put cell of Tx2 should not be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put shadow cell of Tx2 should not be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx3.getStartTimestamp(), getter),
+ "Put cell of Tx3 cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx3.getStartTimestamp(), getter),
+ "Put shadow cell of Tx3 should be there");
// A new transaction after compaction should read the last value written
HBaseTransaction newTx1 = (HBaseTransaction) tm.begin();
@@ -650,22 +583,22 @@ public class TestCompaction {
// Only two values -the new written by newTx1 and the last value
// for the cell after compaction- should have survived
- assertFalse("Put cell of Tx1 should not be there",
- CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter));
- assertFalse("Put shadow cell of Tx1 should not be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter));
- assertFalse("Put cell of Tx2 should not be there",
- CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter));
- assertFalse("Put shadow cell of Tx2 should not be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter));
- assertTrue("Put cell of Tx3 cell should be there",
- CellUtils.hasCell(rowId, fam, qual, tx3.getStartTimestamp(), getter));
- assertTrue("Put shadow cell of Tx3 should be there",
- CellUtils.hasShadowCell(rowId, fam, qual, tx3.getStartTimestamp(), getter));
- assertTrue("Put cell of NewTx1 cell should be there",
- CellUtils.hasCell(rowId, fam, qual, newTx1.getStartTimestamp(), getter));
- assertTrue("Put shadow cell of NewTx1 should be there",
- CellUtils.hasShadowCell(rowId, fam, qual, newTx1.getStartTimestamp(), getter));
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put cell of Tx1 should not be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell of Tx1 should not be there");
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put cell of Tx2 should not be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put shadow cell of Tx2 should not be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx3.getStartTimestamp(), getter),
+ "Put cell of Tx3 cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx3.getStartTimestamp(), getter),
+ "Put shadow cell of Tx3 should be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, newTx1.getStartTimestamp(), getter),
+ "Put cell of NewTx1 cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, newTx1.getStartTimestamp(), getter),
+ "Put shadow cell of NewTx1 should be there");
}
/**
@@ -773,10 +706,9 @@ public class TestCompaction {
Thread.sleep(3000);
// check if the cell that should be compacted, is compacted
- assertFalse("Cell should not be be there",
- CellUtils.hasCell(rowToBeCompactedAway, fam, qual,
- tx1.getStartTimestamp(),
- new TTableCellGetterAdapter(txTable)));
+ assertFalse(CellUtils.hasCell(rowToBeCompactedAway, fam, qual, tx1.getStartTimestamp(),
+ new TTableCellGetterAdapter(txTable)),
+ "Cell should not be be there");
}
@Test(timeOut = 60000)
@@ -806,18 +738,14 @@ public class TestCompaction {
Get g = new Get(rowId);
Result result = txTable.getHTable().get(g);
- assertEquals("Should be there, precompact",
- 1, result.getColumnCells(nonOmidCF, nonOmidQual).size());
- assertEquals("Should be there, precompact",
- 1, result.getColumnCells(fam, qual).size());
+ assertEquals(result.getColumnCells(nonOmidCF, nonOmidQual).size(), 1, "Should be there, precompact");
+ assertEquals(result.getColumnCells(fam, qual).size(), 1, "Should be there, precompact");
compactEverything(TEST_TABLE);
result = txTable.getHTable().get(g);
- assertEquals("Should be there, postcompact",
- 1, result.getColumnCells(nonOmidCF, nonOmidQual).size());
- assertEquals("Should not be there, postcompact",
- 0, result.getColumnCells(fam, qual).size());
+ assertEquals(result.getColumnCells(nonOmidCF, nonOmidQual).size(), 1, "Should be there, postcompact");
+ assertEquals(result.getColumnCells(fam, qual).size(), 0, "Should not be there, postcompact");
}
// ----------------------------------------------------------------------------------------------------------------
@@ -858,7 +786,7 @@ public class TestCompaction {
ResultScanner scannerResults = table.getScanner(scan);
// ...and test the deleted cell is not there anymore
- assertNull("There should be no results in scan results", scannerResults.next());
+ assertNull(scannerResults.next(), "There should be no results in scan results");
table.close();
@@ -936,9 +864,8 @@ public class TestCompaction {
listOfCellsScanned = scanResult.listCells(); // equivalent to rawCells()
count++;
}
- assertEquals("There should be only one result in scan results", 1, count);
- assertEquals("There should be three cell entries in the scan results (2 puts, 1 delete)", 3,
- listOfCellsScanned.size());
+ assertEquals(count, 1, "There should be only one result in scan results");
+ assertEquals(listOfCellsScanned.size(), 3, "There should be 3 cell entries in scan results (2 puts, 1 del)");
boolean wasDeletedCellFound = false;
int numberOfDeletedCellsFound = 0;
for (Cell cell : listOfCellsScanned) {
@@ -947,8 +874,8 @@ public class TestCompaction {
numberOfDeletedCellsFound++;
}
}
- assertTrue("We should have found a non-transactionally deleted cell", wasDeletedCellFound);
- assertEquals("There should be only only one deleted cell", 1, numberOfDeletedCellsFound);
+ assertTrue(wasDeletedCellFound, "We should have found a non-transactionally deleted cell");
+ assertEquals(numberOfDeletedCellsFound, 1, "There should be only only one deleted cell");
table.close();
}
@@ -1007,30 +934,20 @@ public class TestCompaction {
// Checks on results after compaction
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertFalse("Put cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx0.getStartTimestamp(), getter));
- assertFalse("Put shadow cell should be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx0.getStartTimestamp(), getter));
- assertTrue("Put cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Put shadow cell should be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Delete cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- deleteTx.getStartTimestamp(), getter));
- assertTrue("Delete shadow cell should be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- deleteTx.getStartTimestamp(), getter));
- assertTrue("Put cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- lastTx.getStartTimestamp(), getter));
- assertTrue("Put shadow cell should be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- lastTx.getStartTimestamp(), getter));
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx0.getStartTimestamp(), getter), "Put cell should be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx0.getStartTimestamp(), getter),
+ "Put shadow cell should be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter), "Put cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell should be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, deleteTx.getStartTimestamp(), getter),
+ "Delete cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, deleteTx.getStartTimestamp(), getter),
+ "Delete shadow cell should be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, lastTx.getStartTimestamp(), getter),
+ "Put cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, lastTx.getStartTimestamp(), getter),
+ "Put shadow cell should be there");
}
@@ -1060,18 +977,14 @@ public class TestCompaction {
tm.commit(tx2);
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertTrue("Put cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Put shadow cell should be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Delete cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
- assertTrue("Delete shadow cell should be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell should be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Delete cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Delete shadow cell should be there");
}
/**
@@ -1100,18 +1013,14 @@ public class TestCompaction {
compactWithLWM(lwmTx.getStartTimestamp(), TEST_TABLE);
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertFalse("Put cell shouldn't be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertFalse("Put shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertFalse("Delete cell shouldn't be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
- assertFalse("Delete shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put cell shouldn't be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell shouldn't be there");
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Delete cell shouldn't be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Delete shadow cell shouldn't be there");
}
/**
@@ -1140,18 +1049,14 @@ public class TestCompaction {
compactWithLWM(lwmTx.getStartTimestamp(), TEST_TABLE);
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertTrue("Put cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Put shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertFalse("Delete cell shouldn't be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
- assertFalse("Delete shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell shouldn't be there");
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Delete cell shouldn't be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Delete shadow cell shouldn't be there");
}
/**
@@ -1180,18 +1085,14 @@ public class TestCompaction {
compactWithLWM(lwmTx.getStartTimestamp(), TEST_TABLE);
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertTrue("Put cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Put shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Delete cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
- assertFalse("Delete shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Put shadow cell shouldn't be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual,tx2.getStartTimestamp(), getter),
+ "Delete cell should be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Delete shadow cell shouldn't be there");
}
/**
@@ -1214,12 +1115,10 @@ public class TestCompaction {
compactWithLWM(lwmTx.getStartTimestamp(), TEST_TABLE);
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertFalse("Delete cell shouldn't be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertFalse("Delete shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Delete cell shouldn't be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Delete shadow cell shouldn't be there");
}
/**
@@ -1248,18 +1147,14 @@ public class TestCompaction {
compactWithLWM(lwmTx.getStartTimestamp(), TEST_TABLE);
TTableCellGetterAdapter getter = new TTableCellGetterAdapter(txTable);
- assertFalse("Delete cell shouldn't be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertFalse("Delete shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx1.getStartTimestamp(), getter));
- assertTrue("Put cell should be there",
- CellUtils.hasCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
- assertTrue("Put shadow cell shouldn't be there",
- CellUtils.hasShadowCell(rowId, fam, qual,
- tx2.getStartTimestamp(), getter));
+ assertFalse(CellUtils.hasCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Delete cell shouldn't be there");
+ assertFalse(CellUtils.hasShadowCell(rowId, fam, qual, tx1.getStartTimestamp(), getter),
+ "Delete shadow cell shouldn't be there");
+ assertTrue(CellUtils.hasCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put cell should be there");
+ assertTrue(CellUtils.hasShadowCell(rowId, fam, qual, tx2.getStartTimestamp(), getter),
+ "Put shadow cell shouldn't be there");
}
private void setCompactorLWM(long lwm, String tableName) throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompactorScanner.java
----------------------------------------------------------------------
diff --git a/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompactorScanner.java b/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompactorScanner.java
index 4de3dc9..c2aca8a 100644
--- a/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompactorScanner.java
+++ b/hbase-coprocessor/src/test/java/org/apache/omid/transaction/TestCompactorScanner.java
@@ -18,8 +18,6 @@
package org.apache.omid.transaction;
import com.google.common.util.concurrent.SettableFuture;
-import org.apache.omid.committable.CommitTable;
-import org.apache.omid.committable.CommitTable.Client;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
@@ -29,6 +27,8 @@ import org.apache.hadoop.hbase.regionserver.CompactorScanner;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.omid.committable.CommitTable;
+import org.apache.omid.committable.CommitTable.Client;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.DataProvider;
@@ -39,8 +39,8 @@ import java.util.Queue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
public class TestCompactorScanner {
@@ -94,10 +94,10 @@ public class TestCompactorScanner {
KeyValue deleteFamilyVersionKV = new KeyValue(Bytes.toBytes("test-row"), TEST_TS, Type.DeleteFamilyVersion);
assertFalse(scanner.shouldRetainNonTransactionallyDeletedCell(regularKV));
- assertEquals(retainOption, scanner.shouldRetainNonTransactionallyDeletedCell(deleteKV));
- assertEquals(retainOption, scanner.shouldRetainNonTransactionallyDeletedCell(deleteColumnKV));
- assertEquals(retainOption, scanner.shouldRetainNonTransactionallyDeletedCell(deleteFamilyKV));
- assertEquals(retainOption, scanner.shouldRetainNonTransactionallyDeletedCell(deleteFamilyVersionKV));
+ assertEquals(scanner.shouldRetainNonTransactionallyDeletedCell(deleteKV), retainOption);
+ assertEquals(scanner.shouldRetainNonTransactionallyDeletedCell(deleteColumnKV), retainOption);
+ assertEquals(scanner.shouldRetainNonTransactionallyDeletedCell(deleteFamilyKV), retainOption);
+ assertEquals(scanner.shouldRetainNonTransactionallyDeletedCell(deleteFamilyVersionKV), retainOption);
}
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/timestamp-storage/src/test/java/org/apache/omid/timestamp/storage/TestHBaseTimestampStorage.java
----------------------------------------------------------------------
diff --git a/timestamp-storage/src/test/java/org/apache/omid/timestamp/storage/TestHBaseTimestampStorage.java b/timestamp-storage/src/test/java/org/apache/omid/timestamp/storage/TestHBaseTimestampStorage.java
index 0f3ba80..a69dfe9 100644
--- a/timestamp-storage/src/test/java/org/apache/omid/timestamp/storage/TestHBaseTimestampStorage.java
+++ b/timestamp-storage/src/test/java/org/apache/omid/timestamp/storage/TestHBaseTimestampStorage.java
@@ -36,8 +36,9 @@ import org.testng.annotations.Test;
import java.io.IOException;
-import static org.apache.omid.timestamp.storage.HBaseTimestampStorageConfig.*;
-import static org.testng.AssertJUnit.assertEquals;
+import static org.apache.omid.timestamp.storage.HBaseTimestampStorageConfig.DEFAULT_TIMESTAMP_STORAGE_CF_NAME;
+import static org.apache.omid.timestamp.storage.HBaseTimestampStorageConfig.DEFAULT_TIMESTAMP_STORAGE_TABLE_NAME;
+import static org.testng.Assert.assertEquals;
public class TestHBaseTimestampStorage {
@@ -111,7 +112,7 @@ public class TestHBaseTimestampStorage {
HBaseTimestampStorage tsStorage = new HBaseTimestampStorage(hbaseConf, config);
// Test that the first time we get the timestamp is the initial value
- assertEquals("Initial value should be " + INITIAL_TS_VALUE, INITIAL_TS_VALUE, tsStorage.getMaxTimestamp());
+ assertEquals(tsStorage.getMaxTimestamp(), INITIAL_TS_VALUE, "Initial value should be " + INITIAL_TS_VALUE);
// Test that updating the timestamp succeeds when passing the initial value as the previous one
long newTimestamp = 1;
@@ -125,12 +126,13 @@ public class TestHBaseTimestampStorage {
} catch (IOException e) {
// Correct behavior
}
- assertEquals("Value should be still " + newTimestamp, newTimestamp, tsStorage.getMaxTimestamp());
+ assertEquals(tsStorage.getMaxTimestamp(), newTimestamp, "Value should be still " + newTimestamp);
// Test we can set a new timestamp when passing the right previous max timestamp
long veryNewTimestamp = 40;
tsStorage.updateMaxTimestamp(newTimestamp, veryNewTimestamp);
- assertEquals("Value should be " + veryNewTimestamp, veryNewTimestamp, tsStorage.getMaxTimestamp());
+ assertEquals(tsStorage.getMaxTimestamp(), veryNewTimestamp, "Value should be " + veryNewTimestamp);
+
}
}
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/transaction-client/src/test/java/org/apache/omid/tso/client/TestMockTSOClient.java
----------------------------------------------------------------------
diff --git a/transaction-client/src/test/java/org/apache/omid/tso/client/TestMockTSOClient.java b/transaction-client/src/test/java/org/apache/omid/tso/client/TestMockTSOClient.java
index 8e586db..1ad54e3 100644
--- a/transaction-client/src/test/java/org/apache/omid/tso/client/TestMockTSOClient.java
+++ b/transaction-client/src/test/java/org/apache/omid/tso/client/TestMockTSOClient.java
@@ -21,13 +21,13 @@ import com.google.common.collect.Sets;
import org.apache.omid.committable.CommitTable;
import org.apache.omid.committable.InMemoryCommitTable;
import org.apache.omid.tso.util.DummyCellIdImpl;
-import org.testng.Assert;
-import org.testng.AssertJUnit;
import org.testng.annotations.Test;
import java.util.concurrent.ExecutionException;
-import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
public class TestMockTSOClient {
@@ -46,9 +46,9 @@ public class TestMockTSOClient {
try {
client.commit(tr2, Sets.newHashSet(c1, c2)).get();
- Assert.fail("Shouldn't have committed");
+ fail("Shouldn't have committed");
} catch (ExecutionException ee) {
- assertEquals("Should have aborted", ee.getCause().getClass(), AbortException.class);
+ assertEquals(ee.getCause().getClass(), AbortException.class, "Should have aborted");
}
}
@@ -67,6 +67,6 @@ public class TestMockTSOClient {
client.commit(tr2, Sets.newHashSet(c1)).get();
long newWatermark = commitTableClient.readLowWatermark().get();
- AssertJUnit.assertTrue("new low watermark should be bigger", newWatermark > initWatermark);
+ assertTrue(newWatermark > initWatermark, "new low watermark should be bigger");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/tso-server/src/test/java/org/apache/omid/tso/TestBatch.java
----------------------------------------------------------------------
diff --git a/tso-server/src/test/java/org/apache/omid/tso/TestBatch.java b/tso-server/src/test/java/org/apache/omid/tso/TestBatch.java
index 0fe4a22..844a98d 100644
--- a/tso-server/src/test/java/org/apache/omid/tso/TestBatch.java
+++ b/tso-server/src/test/java/org/apache/omid/tso/TestBatch.java
@@ -26,17 +26,16 @@ import org.mockito.MockitoAnnotations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
-import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
public class TestBatch {
@@ -73,15 +72,15 @@ public class TestBatch {
PersistenceProcessorImpl.Batch batch = new PersistenceProcessorImpl.Batch(BATCH_SIZE);
// Test initial state is OK
- AssertJUnit.assertFalse("Batch shouldn't be full", batch.isFull());
- AssertJUnit.assertEquals("Num events should be 0", 0, batch.getNumEvents());
+ assertFalse(batch.isFull(), "Batch shouldn't be full");
+ assertEquals(batch.getNumEvents(), 0, "Num events should be 0");
// Test adding a single commit event is OK
MonitoringContext monCtx = new MonitoringContext(metrics);
monCtx.timerStart("commitPersistProcessor");
batch.addCommit(0, 1, channel, monCtx);
- AssertJUnit.assertFalse("Batch shouldn't be full", batch.isFull());
- AssertJUnit.assertEquals("Num events should be 1", 1, batch.getNumEvents());
+ assertFalse(batch.isFull(), "Batch shouldn't be full");
+ assertEquals(batch.getNumEvents(), 1, "Num events should be 1");
// Test when filling the batch with events, batch is full
for (int i = 0; i < (BATCH_SIZE - 1); i++) {
@@ -95,8 +94,8 @@ public class TestBatch {
batch.addCommit(i, i + 1, channel, monCtx);
}
}
- AssertJUnit.assertTrue("Batch should be full", batch.isFull());
- AssertJUnit.assertEquals("Num events should be " + BATCH_SIZE, BATCH_SIZE, batch.getNumEvents());
+ assertTrue(batch.isFull(), "Batch should be full");
+ assertEquals(batch.getNumEvents(), BATCH_SIZE, "Num events should be " + BATCH_SIZE);
// Test an exception is thrown when batch is full and a new element is going to be added
try {
@@ -105,7 +104,7 @@ public class TestBatch {
batch.addCommit(0, 1, channel, new MonitoringContext(metrics));
Assert.fail("Should throw an IllegalStateException");
} catch (IllegalStateException e) {
- AssertJUnit.assertEquals("message returned doesn't match", "batch full", e.getMessage());
+ assertEquals(e.getMessage(), "batch full", "message returned doesn't match");
LOG.debug("IllegalStateException catched properly");
}
@@ -115,8 +114,8 @@ public class TestBatch {
.timestampResponse(anyLong(), any(Channel.class), any(MonitoringContext.class));
verify(replyProcessor, timeout(100).times(BATCH_SIZE / 2))
.commitResponse(anyLong(), anyLong(), any(Channel.class), any(MonitoringContext.class));
- AssertJUnit.assertFalse("Batch shouldn't be full", batch.isFull());
- AssertJUnit.assertEquals("Num events should be 0", 0, batch.getNumEvents());
+ assertFalse(batch.isFull(), "Batch shouldn't be full");
+ assertEquals(batch.getNumEvents(), 0, "Num events should be 0");
}
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/tso-server/src/test/java/org/apache/omid/tso/TestLeaseManager.java
----------------------------------------------------------------------
diff --git a/tso-server/src/test/java/org/apache/omid/tso/TestLeaseManager.java b/tso-server/src/test/java/org/apache/omid/tso/TestLeaseManager.java
index 62c3435..32a060c 100644
--- a/tso-server/src/test/java/org/apache/omid/tso/TestLeaseManager.java
+++ b/tso-server/src/test/java/org/apache/omid/tso/TestLeaseManager.java
@@ -44,8 +44,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
public class TestLeaseManager {
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/tso-server/src/test/java/org/apache/omid/tso/TestRequestProcessor.java
----------------------------------------------------------------------
diff --git a/tso-server/src/test/java/org/apache/omid/tso/TestRequestProcessor.java b/tso-server/src/test/java/org/apache/omid/tso/TestRequestProcessor.java
index d1272a7..8dd66d3 100644
--- a/tso-server/src/test/java/org/apache/omid/tso/TestRequestProcessor.java
+++ b/tso-server/src/test/java/org/apache/omid/tso/TestRequestProcessor.java
@@ -37,7 +37,7 @@ import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
-import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.Assert.assertTrue;
public class TestRequestProcessor {
@@ -113,7 +113,7 @@ public class TestRequestProcessor {
ArgumentCaptor<Long> commitTScapture = ArgumentCaptor.forClass(Long.class);
verify(persist, timeout(100).times(1)).persistCommit(eq(firstTS), commitTScapture.capture(), any(Channel.class), any(MonitoringContext.class));
- assertTrue("Commit TS must be greater than start TS", commitTScapture.getValue() > firstTS);
+ assertTrue(commitTScapture.getValue() > firstTS, "Commit TS must be greater than start TS");
// test conflict
requestProc.timestampRequest(null, new MonitoringContext(metrics));
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/tso-server/src/test/java/org/apache/omid/tso/TestRetryProcessor.java
----------------------------------------------------------------------
diff --git a/tso-server/src/test/java/org/apache/omid/tso/TestRetryProcessor.java b/tso-server/src/test/java/org/apache/omid/tso/TestRetryProcessor.java
index d971e6c..7c4afac 100644
--- a/tso-server/src/test/java/org/apache/omid/tso/TestRetryProcessor.java
+++ b/tso-server/src/test/java/org/apache/omid/tso/TestRetryProcessor.java
@@ -34,10 +34,9 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
-import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertEquals;
public class TestRetryProcessor {
@@ -80,7 +79,7 @@ public class TestRetryProcessor {
verify(replyProc, timeout(100).times(1)).abortResponse(firstTScapture.capture(), any(Channel.class), any(MonitoringContext.class));
long startTS = firstTScapture.getValue();
- assertEquals("Captured timestamp should be the same as NON_EXISTING_ST_TX", NON_EXISTING_ST_TX, startTS);
+ assertEquals(startTS, NON_EXISTING_ST_TX, "Captured timestamp should be the same as NON_EXISTING_ST_TX");
// Test we'll reply with a commit for a retry request when the start timestamp IS in the commit table
commitTable.getWriter().addCommittedTransaction(ST_TX_1, CT_TX_1); // Add a tx to commit table
@@ -92,8 +91,8 @@ public class TestRetryProcessor {
startTS = firstTScapture.getValue();
long commitTS = secondTScapture.getValue();
- assertEquals("Captured timestamp should be the same as ST_TX_1", ST_TX_1, startTS);
- assertEquals("Captured timestamp should be the same as CT_TX_1", CT_TX_1, commitTS);
+ assertEquals(startTS, ST_TX_1, "Captured timestamp should be the same as ST_TX_1");
+ assertEquals(commitTS, CT_TX_1, "Captured timestamp should be the same as CT_TX_1");
}
@Test(timeOut = 10_000)
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/tso-server/src/test/java/org/apache/omid/tso/TestTSOStateManager.java
----------------------------------------------------------------------
diff --git a/tso-server/src/test/java/org/apache/omid/tso/TestTSOStateManager.java b/tso-server/src/test/java/org/apache/omid/tso/TestTSOStateManager.java
index 2b4b250..b472d7f 100644
--- a/tso-server/src/test/java/org/apache/omid/tso/TestTSOStateManager.java
+++ b/tso-server/src/test/java/org/apache/omid/tso/TestTSOStateManager.java
@@ -31,7 +31,7 @@ import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.Assert.assertTrue;
public class TestTSOStateManager {
@@ -57,8 +57,8 @@ public class TestTSOStateManager {
TSOState initialState = stateManager.initialize();
assertEquals(initialState.getLowWatermark(), INITIAL_STATE_VALUE);
assertEquals(initialState.getEpoch(), INITIAL_STATE_VALUE);
- assertTrue("In this implementation low watermark should be equal to epoch",
- initialState.getLowWatermark() == initialState.getEpoch());
+ assertTrue(initialState.getLowWatermark() == initialState.getEpoch(),
+ "In this implementation low watermark should be equal to epoch");
// Then, simulate a change in the state returned by the Timestamp Oracle...
when(timestampOracle.getLast()).thenReturn(NEW_STATE_VALUE);
@@ -66,8 +66,8 @@ public class TestTSOStateManager {
TSOState secondState = stateManager.initialize();
assertEquals(secondState.getLowWatermark(), NEW_STATE_VALUE);
assertEquals(secondState.getEpoch(), NEW_STATE_VALUE);
- assertTrue("In this implementation low watermark should be equal to epoch",
- secondState.getLowWatermark() == secondState.getEpoch());
+ assertTrue(secondState.getLowWatermark() == secondState.getEpoch(),
+ "In this implementation low watermark should be equal to epoch");
}
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/4323560f/tso-server/src/test/java/org/apache/omid/tso/client/TestIntegrationOfTSOClientServerBasicFunctionality.java
----------------------------------------------------------------------
diff --git a/tso-server/src/test/java/org/apache/omid/tso/client/TestIntegrationOfTSOClientServerBasicFunctionality.java b/tso-server/src/test/java/org/apache/omid/tso/client/TestIntegrationOfTSOClientServerBasicFunctionality.java
index 7fbd77f..e997685 100644
--- a/tso-server/src/test/java/org/apache/omid/tso/client/TestIntegrationOfTSOClientServerBasicFunctionality.java
+++ b/tso-server/src/test/java/org/apache/omid/tso/client/TestIntegrationOfTSOClientServerBasicFunctionality.java
@@ -40,8 +40,8 @@ import java.util.concurrent.ExecutionException;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertNotNull;
public class TestIntegrationOfTSOClientServerBasicFunctionality {
@@ -186,7 +186,7 @@ public class TestIntegrationOfTSOClientServerBasicFunctionality {
assertTrue(commitTsForTx1 > startTsForTx1, "Commit TS should be higher than Start TS for the same tx");
Long commitTs1InCommitTable = commitTableClient.getCommitTimestamp(startTsForTx1).get().get().getValue();
- assertNotNull("Tx is committed, should return as such from Commit Table", commitTs1InCommitTable);
+ assertNotNull(commitTs1InCommitTable, "Tx is committed, should return as such from Commit Table");
assertEquals(commitTsForTx1, (long) commitTs1InCommitTable,
"getCommitTimestamp() & commit() should report same Commit TS value for same tx");
assertTrue(commitTs1InCommitTable > startTsForTx2, "Commit TS should be higher than tx's Start TS");