-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
142 additions
and
49 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
24 changes: 0 additions & 24 deletions
24
integration-tests/src/test/kotlin/org/stellar/anchor/platform/test/test.json
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 |
---|---|---|
@@ -1,24 +0,0 @@ | ||
{ | ||
"type": "QUOTE_CREATED", | ||
"id": "123", | ||
"sep": "38", | ||
"quote": { | ||
"id": "QUOTE-ID-123", | ||
"sell_amount": "103", | ||
"sell_asset": "USDC", | ||
"buy_amount": "100", | ||
"buy_asset": "USD", | ||
"expires_at": "2021-01-01T00:00:00Z", | ||
"price": "1.02", | ||
"total_price": "1.03", | ||
"creator": { | ||
"id": "CREATOR-ID-1234", | ||
"account": "GDQOE23CFSUMSVQK4Y5JHPPYK73VYCNHZHA7ENKCV37P6SUEO6XQBKPP" | ||
}, | ||
"created_at": "2021-01-01T00:00:00Z", | ||
"fee": { | ||
"total": "0.01", | ||
"asset": "GDQOE23CFSUMSVQK4Y5JHPPYK73VYCNHZHA7ENKCV37P6SUEO6XQBKPP" | ||
} | ||
} | ||
} | ||
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
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
60 changes: 60 additions & 0 deletions
60
platform/src/test/kotlin/org/stellar/anchor/platform/event/DefaultEventServiceTest.kt
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.stellar.anchor.platform.event | ||
|
||
import org.apache.commons.lang3.NotImplementedException | ||
import org.junit.jupiter.api.AfterEach | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.assertThrows | ||
import org.stellar.anchor.config.event.QueueConfig.QueueType.* | ||
import org.stellar.anchor.event.EventService.EventQueue.TRANSACTION | ||
import org.stellar.anchor.platform.config.PropertyEventConfig | ||
import org.stellar.anchor.util.GsonUtils | ||
|
||
internal class DefaultEventServiceTest { | ||
private lateinit var eventConfig: PropertyEventConfig | ||
|
||
@BeforeEach | ||
fun setUp() { | ||
eventConfig = | ||
GsonUtils.getInstance().fromJson(eventConfigJson, PropertyEventConfig::class.java)!! | ||
} | ||
|
||
@AfterEach fun tearDown() {} | ||
|
||
@Test | ||
fun `test if the create session returns correct Session class`() { | ||
// Test create Kafka session | ||
eventConfig.queue.type = KAFKA | ||
var defaultEventService = DefaultEventService(eventConfig) | ||
var session = defaultEventService.createSession("test", TRANSACTION) | ||
assert(session is KafkaSession) | ||
var kafkaSession: KafkaSession = session as KafkaSession | ||
assertEquals(kafkaSession.topic, "TRANSACTION") | ||
|
||
// Test create SQS session should throw not implemented exception | ||
eventConfig.queue.type = SQS | ||
assertThrows<NotImplementedException> { defaultEventService.createSession("test", TRANSACTION) } | ||
// Test create MSK session should throw not implemented exception | ||
eventConfig.queue.type = MSK | ||
assertThrows<NotImplementedException> { defaultEventService.createSession("test", TRANSACTION) } | ||
} | ||
|
||
val eventConfigJson = | ||
""" | ||
{ | ||
"enabled": true, | ||
"queue": { | ||
"type": "KAFKA", | ||
"kafka": { | ||
"bootstrapServer": "kafka:29092", | ||
"clientId": "testOk", | ||
"retries": 0, | ||
"lingerMs": 1000, | ||
"batchSize": 10, | ||
"pollTimeoutSeconds": 10 | ||
} | ||
} | ||
} | ||
""" | ||
} |
25 changes: 25 additions & 0 deletions
25
platform/src/test/kotlin/org/stellar/anchor/platform/event/KafkaSessionTest.kt
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.stellar.anchor.platform.event | ||
|
||
import org.junit.jupiter.api.AfterEach | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class KafkaSessionTest { | ||
@BeforeEach fun setUp() {} | ||
|
||
@AfterEach fun tearDown() {} | ||
|
||
@Test fun publish() {} | ||
|
||
@Test fun read() {} | ||
|
||
@Test fun ack() {} | ||
|
||
@Test fun close() {} | ||
|
||
@get:Test | ||
val sessionName: Unit | ||
get() {} | ||
|
||
@Test fun createConsumer() {} | ||
} |