Skip to content

Commit

Permalink
upgraded to latest version related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sunitparekhtw committed Sep 8, 2022
1 parent 951b180 commit 4ef7dcb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.dataanon</groupId>
<artifactId>data-anon</artifactId>
<version>0.9.8</version>
<version>0.9.9</version>
<packaging>jar</packaging>

<name>data-anon</name>
Expand All @@ -18,8 +18,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>1.3.50</kotlin.version>
<version.jacoco>0.8.4</version.jacoco>
<kotlin.version>1.7.0</kotlin.version>
<version.jacoco>0.8.8</version.jacoco>
</properties>

<scm>
Expand Down Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.3.0.RELEASE</version>
<version>3.4.22</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
Expand All @@ -102,13 +102,13 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<version>2.1.214</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.1</version>
<version>42.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,12 @@ class SpecialFeaturesIntegrationTest : FunSpec() {
records.size should beLessThan(3)

val errors = DataAnonTestLogHandler.records.filter { it.level.intValue() > Level.INFO.intValue() }
errors.size shouldBe 6
errors.size shouldBe 5
errors[0].message should haveSubstring("'Really Long Genre To be fail 1' (30)")
errors[1].message should haveSubstring("'Really Long Genre To be fail 2' (30)")
errors[2].message should haveSubstring("'Really Long Genre To be fail 3' (30)")
errors[3].message should haveSubstring("'Really Long Genre To be fail 4' (30)")
errors[4].message should haveSubstring("Total number of errors occurred is 4 for table MOVIES exceeds allowed 3")
errors[5].message should haveSubstring("Too many errors while processing table MOVIES. Exceeds 3 errors hence terminating table processing.")

destTable.close()
sourceTable.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ class BlacklistRatingsCompositePrimaryKeyIntegrationTest : FunSpec() {
.insert("Movie 2", "User 2", 4, LocalDateTime.ofEpochSecond(1509701310, 0, ZoneOffset.UTC))

Blacklist(dbConfig)
.table("DENORMALISEDRATINGS", primaryKey = listOf("MOVIE", "USER")) {
anonymize("USER").using(FixedString("Anonymous"))
.table("DENORMALISEDRATINGS", primaryKey = listOf("MOVIE", "USERNAME")) {
anonymize("USERNAME").using(FixedString("Anonymous"))
}.execute(progressBarEnabled = false)

val records = denormalizedRatingsTable.findAll()

records.size shouldBe 2
records[0]["MOVIE"] shouldBe "Movie 1"
records[0]["USER"] shouldBe "Anonymous"
records[0]["USERNAME"] shouldBe "Anonymous"
records[0]["RATING"] shouldBe 3
records[0]["CREATED_AT"] shouldBe LocalDateTime.ofEpochSecond(1509701304, 0, ZoneOffset.UTC)

records[1]["MOVIE"] shouldBe "Movie 2"
records[1]["USER"] shouldBe "Anonymous"
records[1]["USERNAME"] shouldBe "Anonymous"
records[1]["RATING"] shouldBe 4
records[1]["CREATED_AT"] shouldBe LocalDateTime.ofEpochSecond(1509701310, 0, ZoneOffset.UTC)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class DenormalizedRatingsTable(dbConfig: DbConfig) {
conn.createStatement().executeUpdate("DROP TABLE IF EXISTS DENORMALIZEDRATINGS")
val createDenormalizedRatingsTable = "CREATE TABLE DENORMALISEDRATINGS( " +
"MOVIE VARCHAR2(255), " +
"USER VARCHAR2(255), " +
"USERNAME VARCHAR2(255), " +
"RATING INT, " +
"CREATED_AT TIMESTAMP, " +
"PRIMARY KEY(MOVIE, USER) )"
"PRIMARY KEY(MOVIE, USERNAME) )"
conn.createStatement().executeUpdate(createDenormalizedRatingsTable)
}

fun insert(movie: String, user: String, rating: Int, createdAt: LocalDateTime): DenormalizedRatingsTable {
val stmt = conn.prepareStatement("INSERT INTO DENORMALISEDRATINGS(MOVIE,USER,RATING,CREATED_AT) VALUES(?,?,?,?)")
val stmt = conn.prepareStatement("INSERT INTO DENORMALISEDRATINGS(MOVIE,USERNAME,RATING,CREATED_AT) VALUES(?,?,?,?)")
stmt.setString(1, movie)
stmt.setString(2, user)
stmt.setInt(3, rating)
Expand All @@ -36,7 +36,7 @@ class DenormalizedRatingsTable(dbConfig: DbConfig) {
while (rs.next()) {
val record = hashMapOf<String, Any>()
record["MOVIE"] = rs.getString("MOVIE")
record["USER"] = rs.getString("USER")
record["USERNAME"] = rs.getString("USERNAME")
record["RATING"] = rs.getInt("RATING")
record["CREATED_AT"] = rs.getTimestamp("CREATED_AT").toLocalDateTime()
records.add(record)
Expand Down

0 comments on commit 4ef7dcb

Please sign in to comment.