|
| 1 | +// |
| 2 | +// Copyright (c) 2018 Contributors to the Eclipse Foundation |
| 3 | +// |
| 4 | +// See the NOTICE file(s) distributed with this work for additional |
| 5 | +// information regarding copyright ownership. |
| 6 | +// |
| 7 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +// you may not use this file except in compliance with the License. |
| 9 | +// You may obtain a copy of the License at |
| 10 | +// |
| 11 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +// |
| 13 | +// Unless required by applicable law or agreed to in writing, software |
| 14 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +// See the License for the specific language governing permissions and |
| 17 | +// limitations under the License. |
| 18 | +// |
| 19 | + |
| 20 | += MicroProfile Reactive Messaging TCK |
| 21 | + |
| 22 | +This project contains the TCK for MicroProfile Reactive Messaging. |
| 23 | + |
| 24 | +== Running the TCK against an implementation |
| 25 | + |
| 26 | +The TCK uses http://arquillian.org/[Arquillian], so an implementation needs Arquillian container support to run. In addition, the implementation must also implement the TCK's SPI in order to allow the TCK to interact and make assertions on messages sent and received from topics under test. |
| 27 | + |
| 28 | +=== `TckContainer` |
| 29 | + |
| 30 | +The primary entry point into the tck is the `org.eclipse.microprofile.reactive.messaging.tck.spi.TckContainer`. An instance of this must be provided through the JDK `ServiceLoader` mechanism (that is, provide a `META-INF/services/org.eclipse.microprofile.reactive.messaging.tck.spi.TckContainer` file that contains the fully qualified classname of the implementation). |
| 31 | + |
| 32 | +This class provides a number of methods for telling the TCK which parts of the spec this implementation implements, for example, an implementation does not have to provide support for both incoming and outgoing messages, so this can be used to configure which ones it does support. Additionally, it allows the TCK to instruct the container to deploy and prepare topics for being published to and subscribed from. |
| 33 | + |
| 34 | +=== `org.eclipse.microprofile.reactive.messaging.tck.spi.TestEnvironment` |
| 35 | + |
| 36 | +The `TestEnvironment` provides a mechanism for general environment configuration, such as what timeouts to use for various assertions. |
| 37 | + |
| 38 | +=== `TckMessagingPuppet` |
| 39 | + |
| 40 | +The `org.eclipse.microprofile.reactive.messaging.tck.spi.TckMessagingPuppet` is for use in the container. It is the responsiblity of the `TckContainer` to return a deployment from its `createDeployments` method that provides a `TckMessagingPuppet` that can be injected into the tests and beans under test. This is used to trigger the container to send a message to certain queues, and receive messages from queues. |
| 41 | + |
| 42 | +== TCK design |
| 43 | + |
| 44 | +In general, each test class defines a single bean that it returns in a deployment. This bean will generally have one `@Incoming` or `@Outgoing` annotated method per test method, each working with a unique topic name. This ensures isolation between tests. The test class defines an `@Topics` annotation that allows the TCK to discover which topics the test uses, it then passes this list of topics to the SPI implementation to instruct it to create and/or reset the topics before each class is run. |
| 45 | + |
| 46 | +In each test method, `MockedSender` and `MockedReceiver` are used to register the receipt of individual messages, or to create publishers and subscribers to be returned by the method. These then capture messages received, and enqueue messages to be sent, so that the test cases can work with them. A `TckMessagingManager` holds a map of topics to `MockedSender` and `MockedReceiver` instances, so that both the bean and the tests can access them easily. |
0 commit comments