-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding unit test for the assigned tables
- Loading branch information
Showing
2 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,15 @@ package com.datamountaineer.streamreactor.connect.cassandra.config | |
import com.datamountaineer.streamreactor.connect.cassandra.TestConfig | ||
import org.scalatest.{Matchers, WordSpec} | ||
|
||
import scala.collection.JavaConversions._ | ||
|
||
/** | ||
* Created by [email protected] on 28/04/16. | ||
* stream-reactor | ||
*/ | ||
class TestCassandraSourceSettings extends WordSpec with Matchers with TestConfig { | ||
"CassandraSettings should return setting for a source" in { | ||
val taskConfig = CassandraConfigSource(getCassandraConfigSourcePropsBulk) | ||
val taskConfig = CassandraConfigSource(getCassandraConfigSourcePropsBulk) | ||
val assigned = List(TABLE1, TABLE2) | ||
val settings = CassandraSettings.configureSource(taskConfig).toList | ||
settings.size shouldBe 2 | ||
|
@@ -36,4 +38,19 @@ class TestCassandraSourceSettings extends WordSpec with Matchers with TestConfig | |
settings(1).routes.getTarget shouldBe TOPIC2 | ||
settings(1).bulkImportMode shouldBe true | ||
} | ||
|
||
"CassandraSettings should return setting for a source with one table" in { | ||
val map = Map( | ||
CassandraConfigConstants.CONTACT_POINTS -> CONTACT_POINT, | ||
CassandraConfigConstants.KEY_SPACE -> CASSANDRA_KEYSPACE, | ||
CassandraConfigConstants.USERNAME -> USERNAME, | ||
CassandraConfigConstants.PASSWD -> PASSWD, | ||
CassandraConfigConstants.SOURCE_KCQL_QUERY -> "INSERT INTO cassandra-source SELECT * FROM orders PK created", | ||
CassandraConfigConstants.IMPORT_MODE -> CassandraConfigConstants.INCREMENTAL, | ||
CassandraConfigConstants.POLL_INTERVAL -> "1000" | ||
) | ||
val taskConfig = CassandraConfigSource(map) | ||
val settings = CassandraSettings.configureSource(taskConfig).toList | ||
settings.size shouldBe 1 | ||
} | ||
} |