Z
- The type definition for the MatsSerializer
employed. This defines the type which STOs and DTOs are
serialized into. When employing JSON for the "outer" serialization of MatsTrace, it does not make that
much sense to use a binary (Z=byte[]) "inner" representation of the DTOs and STOs, because JSON is
terrible at serializing byte arrays.public class Extension_MatsGeneric<Z> extends AbstractMatsTest<Z> implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
Extension_Mats
, provides a full MATS harness for unit testing by creating MatsFactory
utilizing an in-vm Active MQ broker. The difference between the two is that this Extension is open to
the usage of more customized MatsSerializer
s.
Extension_MatsGeneric
shall be annotated with RegisterExtension
and
the instance field shall be static for the Jupiter life cycle to pick up the extension at the correct time.
Extension_MatsGeneric
can be viewed in the same manner as one would view a ClassRule in JUnit4.
public class YourTestClass { @RegisterExtension public static Extension_MatsGeneric<Z> mats = new Extension_MatsGeneric(new YourSerializer()) }This will ensure that Extension_MatsGeneric sets up the test harness correctly.
AbstractMatsTest
_createdMatsFactories, _dataSource, _matsFactory, _matsFuturizer, _matsInitiator, _matsSerializer, _matsTestBroker, _matsTestBrokerInterface, _matsTestLatch, log
Modifier | Constructor and Description |
---|---|
protected |
Extension_MatsGeneric(MatsSerializer<Z> matsSerializer) |
protected |
Extension_MatsGeneric(MatsSerializer<Z> matsSerializer,
javax.sql.DataSource dataSource) |
Modifier and Type | Method and Description |
---|---|
void |
afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
Executed by Jupiter after all test methods have been executed.
|
void |
beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
Executed by Jupiter before any test method is executed.
|
static <Z> Extension_MatsGeneric<Z> |
create(MatsSerializer<Z> matsSerializer)
Creates an
Extension_MatsGeneric utilizing the user provided MatsSerializer . |
static <Z> Extension_MatsGeneric<Z> |
createWithDb(MatsSerializer<Z> matsSerializer) |
TestH2DataSource |
getDataSource() |
afterAll, beforeAll, cleanMatsFactories, cleanMatsFactory, createMatsFactory, getJmsConnectionFactory, getMatsFactory, getMatsFuturizer, getMatsInitiator, getMatsInterceptableMatsFactory, getMatsTestBrokerInterface, getMatsTestLatch, id
protected Extension_MatsGeneric(MatsSerializer<Z> matsSerializer)
protected Extension_MatsGeneric(MatsSerializer<Z> matsSerializer, javax.sql.DataSource dataSource)
public static <Z> Extension_MatsGeneric<Z> create(MatsSerializer<Z> matsSerializer)
Extension_MatsGeneric
utilizing the user provided MatsSerializer
.public static <Z> Extension_MatsGeneric<Z> createWithDb(MatsSerializer<Z> matsSerializer)
public TestH2DataSource getDataSource()
getDataSource
in class AbstractMatsTest<Z>
IllegalStateException
otherwise.public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
beforeAll
in interface org.junit.jupiter.api.extension.BeforeAllCallback
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
afterAll
in interface org.junit.jupiter.api.extension.AfterAllCallback