Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
Merge "[SLINGCSCF-1959] Improve test coverage in commit-table module"
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-perez-sorrosal authored and Gerrit Code Review committed May 18, 2015
2 parents 371e116 + a934e74 commit 1477a71
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 93 deletions.
28 changes: 28 additions & 0 deletions commit-table/pom.xml
Expand Up @@ -21,6 +21,34 @@
<version>${guava.version}</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<!-- this create jar file of code from src/test/java so modules with tests can share code -->
<build>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>

</build>

</project>

This file was deleted.

@@ -0,0 +1,45 @@
package com.yahoo.omid.committable;

import org.testng.annotations.Test;
import static org.testng.Assert.assertNull;

/**
* TODO: Remove this class when removing this class from production code
*/
public class NullCommitTableTest {

private static final long TEST_ST = 1L;
private static final long TEST_CT = 2L;
private static final long TEST_LWM = 1L;

@Test
public void testClientAndWriter() throws Exception {

CommitTable commitTable = new NullCommitTable();

try (CommitTable.Client commitTableClient = commitTable.getClient().get();
CommitTable.Writer commitTableWriter = commitTable.getWriter().get()) {

// Test client
try {
commitTableClient.readLowWatermark().get();
} catch (UnsupportedOperationException e) {
// expected
}

try {
commitTableClient.getCommitTimestamp(TEST_ST).get();
} catch (UnsupportedOperationException e) {
// expected
}

assertNull(commitTableClient.completeTransaction(TEST_ST).get());

// Test writer
commitTableWriter.updateLowWatermark(TEST_LWM);
commitTableWriter.addCommittedTransaction(TEST_ST, TEST_CT);
assertNull(commitTableWriter.flush().get());
}
}

}
7 changes: 7 additions & 0 deletions hbase-client/pom.xml
Expand Up @@ -56,6 +56,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.yahoo.omid</groupId>
<artifactId>commit-table</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
<!-- End of Dependencies on Omid modules -->

<!--logging-->
Expand Down
7 changes: 7 additions & 0 deletions transaction-client/pom.xml
Expand Up @@ -26,6 +26,13 @@
<artifactId>commit-table</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.omid</groupId>
<artifactId>commit-table</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
<!-- End of Dependencies on Omid modules -->

<!-- distributed comm -->
Expand Down
7 changes: 7 additions & 0 deletions tso-server/pom.xml
Expand Up @@ -93,6 +93,13 @@
<artifactId>hbase-commit-table</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yahoo.omid</groupId>
<artifactId>commit-table</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
<!-- End of Dependencies on Omid modules -->

<!-- Dependencies on Yahoo libraries -->
Expand Down

0 comments on commit 1477a71

Please sign in to comment.