-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove ReferenceServerTests in favor of Sep24Tests.kt
- Loading branch information
Showing
1 changed file
with
1 addition
and
80 deletions.
There are no files selected for viewing
81 changes: 1 addition & 80 deletions
81
...c/testFixtures/kotlin/org/stellar/anchor/platform/integrationtest/ReferenceServerTests.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 |
---|---|---|
@@ -1,82 +1,3 @@ | ||
package org.stellar.anchor.platform.integrationtest | ||
|
||
import io.ktor.http.* | ||
import java.util.UUID | ||
import kotlinx.coroutines.runBlocking | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
import org.skyscreamer.jsonassert.JSONAssert | ||
import org.stellar.anchor.api.callback.SendEventRequest | ||
import org.stellar.anchor.platform.AbstractIntegrationTests | ||
import org.stellar.anchor.platform.TestConfig | ||
import org.stellar.anchor.platform.gson | ||
import org.stellar.anchor.util.StringHelper.json | ||
import org.stellar.reference.client.AnchorReferenceServerClient | ||
|
||
class ReferenceServerTests : AbstractIntegrationTests(TestConfig(testProfileName = "default")) { | ||
@Test | ||
fun `test if the reference server records the events sent by sendEvent() method`() { | ||
val client = AnchorReferenceServerClient(Url("http://localhost:8091")) | ||
val sendEventRequest1 = gson.fromJson(sendEventRequestJson, SendEventRequest::class.java) | ||
val sendEventRequest2 = gson.fromJson(sendEventRequestJson2, SendEventRequest::class.java) | ||
sendEventRequest1.id = UUID.randomUUID().toString() | ||
sendEventRequest2.id = UUID.randomUUID().toString() | ||
runBlocking { | ||
// Send event1 | ||
client.sendEvent(sendEventRequest1) | ||
// send event2 | ||
client.sendEvent(sendEventRequest2) | ||
// check if these events are recorded | ||
client | ||
.getEvents() | ||
.stream() | ||
.filter { it.id == sendEventRequest1.id } | ||
.findFirst() | ||
.get() | ||
.apply { JSONAssert.assertEquals(json(this), json(sendEventRequest1), true) } | ||
client | ||
.getEvents() | ||
.stream() | ||
.filter { it.id == sendEventRequest2.id } | ||
.findFirst() | ||
.get() | ||
.apply { JSONAssert.assertEquals(json(this), json(sendEventRequest2), true) } | ||
} | ||
} | ||
|
||
companion object { | ||
val sendEventRequestJson = | ||
""" | ||
{ | ||
"timestamp": "2011-10-05T14:48:00.000Z", | ||
"id": "2a419880-0dde-4821-90cb-f3bfcb671ea3", | ||
"type": "transaction_created", | ||
"payload": { | ||
"transaction": { | ||
"amount_in": { | ||
"amount": "10.0", | ||
"asset": "USDC" | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
.trimIndent() | ||
|
||
val sendEventRequestJson2 = | ||
""" | ||
{ | ||
"id": "2a419880-0dde-4821-90cb-f3bfcb671ea3", | ||
"timestamp": "2011-10-05T14:48:00.000Z", | ||
"type": "quote_created", | ||
"payload": { | ||
"quote": { | ||
"sell_amount": "10.0", | ||
"buy_amount": "1" | ||
} | ||
} | ||
} | ||
""" | ||
.trimIndent() | ||
} | ||
} | ||
// The test is removed in favor of Sep24Tests.kt |