Skip to content

Commit 972d7b0

Browse files
committed
Remove extra Command Gateway extensions
1 parent 0a8ec43 commit 972d7b0

File tree

2 files changed

+0
-77
lines changed

2 files changed

+0
-77
lines changed

kotlin/src/main/kotlin/org/axonframework/extensions/kotlin/CommandGatewayExtensions.kt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package org.axonframework.extensions.kotlin
1818
import org.axonframework.commandhandling.CommandMessage
1919
import org.axonframework.commandhandling.gateway.CommandGateway
2020
import org.axonframework.messaging.MetaData
21-
import java.util.concurrent.TimeUnit
2221

2322
/**
2423
* Callback-style [CommandGateway.send] with dedicated on-success and on-error functions
@@ -34,25 +33,3 @@ fun <C : Any, R : Any?> CommandGateway.send(
3433
onSuccess: (commandMessage: CommandMessage<out C>, result: R, metaData: MetaData) -> Unit = { _, _, _ -> },
3534
onError: (commandMessage: CommandMessage<out C>, exception: Throwable, metaData: MetaData) -> Unit = { _, _, _ -> }
3635
): Unit = this.send(command, ResultDiscriminatorCommandCallback<C, R>(onSuccess, onError))
37-
38-
/**
39-
* Reified version of [CommandGateway.sendAndWait]
40-
* @param command The command to send
41-
* @param [R] The expected type of return value
42-
* @return The result of the command handler execution
43-
* @throws org.axonframework.commandhandling.CommandExecutionException when command execution threw a checked exception
44-
*/
45-
inline fun <reified R : Any?> CommandGateway.sendAndWaitWithResponse(command: Any): R =
46-
this.sendAndWait<R>(command)
47-
48-
/**
49-
* Reified version of [CommandGateway.sendAndWait] with a timeout (defaulting to [TimeUnit.MILLISECONDS] unit)
50-
* @param command The command to send
51-
* @param timeout The maximum time to wait
52-
* @param unit The time unit of the timeout argument. Defaults to [TimeUnit.MILLISECONDS]
53-
* @param [R] The expected type of return value
54-
* @return The result of the command handler execution
55-
* @throws org.axonframework.commandhandling.CommandExecutionException when command execution threw a checked exception
56-
*/
57-
inline fun <reified R : Any?> CommandGateway.sendAndWaitWithResponse(command: Any, timeout: Long, unit: TimeUnit = TimeUnit.MILLISECONDS): R =
58-
this.sendAndWait<R>(command, timeout, unit)

kotlin/src/test/kotlin/org/axonframework/extensions/kotlin/CommandGatewayExtensionsTest.kt

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -60,58 +60,4 @@ class CommandGatewayExtensionsTest {
6060

6161
verify { subjectGateway.send(exampleCommand, any<CommandCallback<ExampleCommand, Any>>()) }
6262
}
63-
64-
@Test
65-
fun `SendAndWaitWithResponse extension should invoke correct method on the gateway`() {
66-
every { subjectGateway.sendAndWait<Any>(exampleCommand) } returns Unit
67-
68-
subjectGateway.sendAndWaitWithResponse<Any>(exampleCommand)
69-
70-
verify { subjectGateway.sendAndWait<Any>(exampleCommand) }
71-
}
72-
73-
@Test
74-
fun `SendAndWaitWithResponse extension should invoke correct method on the gateway without explicit generic parameter`() {
75-
every { subjectGateway.sendAndWait<Any>(exampleCommand) } returns Unit
76-
77-
fun methodWithExplicitReturnValue(): Unit = subjectGateway.sendAndWaitWithResponse(exampleCommand)
78-
79-
methodWithExplicitReturnValue()
80-
81-
verify { subjectGateway.sendAndWait<Any>(exampleCommand) }
82-
}
83-
84-
@Test
85-
fun `SendAndWaitWithResponse with timeout extension should invoke correct method on the gateway`() {
86-
every { subjectGateway.sendAndWait<Any>(exampleCommand, timeoutInterval, TimeUnit.MICROSECONDS) } returns Unit
87-
88-
subjectGateway.sendAndWaitWithResponse<Any>(command = exampleCommand, timeout = timeoutInterval, unit = TimeUnit.MICROSECONDS)
89-
90-
verify { subjectGateway.sendAndWait<Any>(exampleCommand, timeoutInterval, TimeUnit.MICROSECONDS) }
91-
}
92-
93-
@Test
94-
fun `SendAndWaitWithResponse with timeout extension should invoke correct method on the gateway without explicit generic parameter`() {
95-
every { subjectGateway.sendAndWait<Any>(exampleCommand, timeoutInterval, TimeUnit.MICROSECONDS) } returns Unit
96-
97-
fun methodWithExplicitReturnValue(): Unit =
98-
subjectGateway.sendAndWaitWithResponse(
99-
command = exampleCommand,
100-
timeout = timeoutInterval,
101-
unit = TimeUnit.MICROSECONDS
102-
)
103-
104-
methodWithExplicitReturnValue()
105-
106-
verify { subjectGateway.sendAndWait<Any>(exampleCommand, timeoutInterval, TimeUnit.MICROSECONDS) }
107-
}
108-
109-
@Test
110-
fun `SendAndWaitWithResponse with timeout extension should invoke correct method on the gateway with default Timeunit`() {
111-
every { subjectGateway.sendAndWait<Any>(exampleCommand, timeoutInterval, defaultTimeUnit) } returns Unit
112-
113-
subjectGateway.sendAndWaitWithResponse<Any>(command = exampleCommand, timeout = timeoutInterval)
114-
115-
verify { subjectGateway.sendAndWait<Any>(exampleCommand, timeoutInterval, defaultTimeUnit) }
116-
}
11763
}

0 commit comments

Comments
 (0)