-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove 'extends AbstractFulfillmentSpec'
- Loading branch information
1 parent
68708e9
commit a6b963f
Showing
3 changed files
with
82 additions
and
82 deletions.
There are no files selected for viewing
42 changes: 21 additions & 21 deletions
42
src/fulfillment/tck/src/main/groovy/mushop/AbstractFulfillmentControllerSpec.groovy
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,21 +1,21 @@ | ||
/** | ||
* Copyright © 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
**/ | ||
package mushop | ||
|
||
import io.micronaut.http.client.HttpClient | ||
import io.micronaut.http.client.annotation.Client | ||
import jakarta.inject.Inject | ||
|
||
abstract class AbstractFulfillmentControllerSpec extends AbstractFulfillmentSpec { | ||
|
||
@Inject | ||
@Client("/fulfillment") | ||
HttpClient httpClient | ||
|
||
void 'test Fulfillment Controller'() { | ||
expect: | ||
httpClient.toBlocking().retrieve("/123") == "Order 123 is fulfilled" | ||
} | ||
} | ||
/** | ||
* Copyright © 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
**/ | ||
package mushop | ||
|
||
import io.micronaut.http.client.HttpClient | ||
import io.micronaut.http.client.annotation.Client | ||
import jakarta.inject.Inject | ||
|
||
abstract class AbstractFulfillmentControllerSpec { | ||
|
||
@Inject | ||
@Client("/fulfillment") | ||
HttpClient httpClient | ||
|
||
void 'test Fulfillment Controller'() { | ||
expect: | ||
httpClient.toBlocking().retrieve("/123") == "Order 123 is fulfilled" | ||
} | ||
} |
100 changes: 50 additions & 50 deletions
100
src/fulfillment/tck/src/main/groovy/mushop/AbstractFulfillmentListenerSpec.groovy
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,50 +1,50 @@ | ||
/** | ||
* Copyright © 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
**/ | ||
package mushop | ||
|
||
import io.micronaut.http.client.HttpClient | ||
import io.micronaut.http.client.annotation.Client | ||
import io.micronaut.nats.annotation.NatsListener | ||
import io.micronaut.nats.annotation.Subject | ||
import jakarta.inject.Inject | ||
import spock.util.concurrent.AsyncConditions | ||
|
||
abstract class AbstractFulfillmentListenerSpec extends AbstractFulfillmentSpec { | ||
|
||
@Inject | ||
@Client("/fulfillment") | ||
HttpClient httpClient | ||
|
||
@Inject | ||
ShipmentListener shipmentListener | ||
|
||
@Inject | ||
OrdersPublisher ordersPublisher | ||
|
||
void 'test it adds shipment details to order'() { | ||
given: | ||
def asyncCond = new AsyncConditions() | ||
shipmentListener.setAsyncConditions(asyncCond) | ||
|
||
when: | ||
ordersPublisher.publishOrder(new OrderUpdate(123, null)) | ||
|
||
then: | ||
asyncCond.await() | ||
} | ||
|
||
@NatsListener | ||
static class ShipmentListener { | ||
AsyncConditions asyncConditions | ||
|
||
@Subject("mushop-shipments") | ||
void handleShipment(OrderUpdate orderUpdate) { | ||
assert asyncConditions | ||
asyncConditions.evaluate(() -> { | ||
assert orderUpdate.shipment | ||
}) | ||
} | ||
} | ||
} | ||
/** | ||
* Copyright © 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
**/ | ||
package mushop | ||
|
||
import io.micronaut.http.client.HttpClient | ||
import io.micronaut.http.client.annotation.Client | ||
import io.micronaut.nats.annotation.NatsListener | ||
import io.micronaut.nats.annotation.Subject | ||
import jakarta.inject.Inject | ||
import spock.util.concurrent.AsyncConditions | ||
|
||
abstract class AbstractFulfillmentListenerSpec { | ||
|
||
@Inject | ||
@Client("/fulfillment") | ||
HttpClient httpClient | ||
|
||
@Inject | ||
ShipmentListener shipmentListener | ||
|
||
@Inject | ||
OrdersPublisher ordersPublisher | ||
|
||
void 'test it adds shipment details to order'() { | ||
given: | ||
def asyncCond = new AsyncConditions() | ||
shipmentListener.setAsyncConditions(asyncCond) | ||
|
||
when: | ||
ordersPublisher.publishOrder(new OrderUpdate(123, null)) | ||
|
||
then: | ||
asyncCond.await() | ||
} | ||
|
||
@NatsListener | ||
static class ShipmentListener { | ||
AsyncConditions asyncConditions | ||
|
||
@Subject("mushop-shipments") | ||
void handleShipment(OrderUpdate orderUpdate) { | ||
assert asyncConditions | ||
asyncConditions.evaluate(() -> { | ||
assert orderUpdate.shipment | ||
}) | ||
} | ||
} | ||
} |
22 changes: 11 additions & 11 deletions
22
src/fulfillment/tck/src/main/groovy/mushop/OrdersPublisher.groovy
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,11 +1,11 @@ | ||
package mushop | ||
|
||
import io.micronaut.nats.annotation.NatsClient | ||
import io.micronaut.nats.annotation.Subject | ||
|
||
@NatsClient | ||
interface OrdersPublisher { | ||
|
||
@Subject("mushop-orders") | ||
void publishOrder(OrderUpdate orderUpdate) | ||
} | ||
package mushop | ||
|
||
import io.micronaut.nats.annotation.NatsClient | ||
import io.micronaut.nats.annotation.Subject | ||
|
||
@NatsClient | ||
interface OrdersPublisher { | ||
|
||
@Subject("mushop-orders") | ||
void publishOrder(OrderUpdate orderUpdate) | ||
} |