Search in sources :

Example 46 with Metadata

use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.

the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataByVersion.

@Test
public void shouldMatchMetadataByVersion() throws Exception {
    final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withVersion(VERSION).build();
    assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withVersion(VERSION));
}
Also used : Metadata(uk.gov.justice.services.messaging.Metadata) Test(org.junit.Test)

Example 47 with Metadata

use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.

the class JsonEnvelopeMetadataMatcherTest method shouldFailIfIdDoesNotMatch.

@Test(expected = AssertionError.class)
public void shouldFailIfIdDoesNotMatch() throws Exception {
    final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).build();
    assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withId(randomUUID()));
}
Also used : Metadata(uk.gov.justice.services.messaging.Metadata) Test(org.junit.Test)

Example 48 with Metadata

use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.

the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataById.

@Test
public void shouldMatchMetadataById() throws Exception {
    final Metadata metadata = metadataOf(ID, EVENT_NAME).build();
    assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withId(ID));
}
Also used : Metadata(uk.gov.justice.services.messaging.Metadata) Test(org.junit.Test)

Example 49 with Metadata

use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.

the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataByCausation.

@Test
public void shouldMatchMetadataByCausation() throws Exception {
    final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withCausation(CAUSATION_ID).build();
    assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withCausationIds(CAUSATION_ID));
}
Also used : Metadata(uk.gov.justice.services.messaging.Metadata) Test(org.junit.Test)

Example 50 with Metadata

use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.

the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataByUserId.

@Test
public void shouldMatchMetadataByUserId() throws Exception {
    final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withUserId(USER_ID).build();
    assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withUserId(USER_ID));
}
Also used : Metadata(uk.gov.justice.services.messaging.Metadata) Test(org.junit.Test)

Aggregations

Metadata (uk.gov.justice.services.messaging.Metadata)67 Test (org.junit.Test)58 JsonEnvelope (uk.gov.justice.services.messaging.JsonEnvelope)19 UUID (java.util.UUID)17 UUID.randomUUID (java.util.UUID.randomUUID)11 JsonObject (javax.json.JsonObject)10 JsonObjects.getJsonObject (uk.gov.justice.services.messaging.JsonObjects.getJsonObject)8 MetadataBuilder (uk.gov.justice.services.messaging.MetadataBuilder)6 JsonObjectBuilder (javax.json.JsonObjectBuilder)5 JsonValue (javax.json.JsonValue)3 JsonObjects.getString (uk.gov.justice.services.messaging.JsonObjects.getString)3 Json.createObjectBuilder (javax.json.Json.createObjectBuilder)2 HttpHeaders (javax.ws.rs.core.HttpHeaders)2 UtcClock (uk.gov.justice.services.common.util.UtcClock)2 Interceptor (uk.gov.justice.services.core.interceptor.Interceptor)2 InterceptorChain (uk.gov.justice.services.core.interceptor.InterceptorChain)2 InterceptorContext (uk.gov.justice.services.core.interceptor.InterceptorContext)2 JsonEnvelope.metadataBuilder (uk.gov.justice.services.messaging.JsonEnvelope.metadataBuilder)2 EqualsTester (com.google.common.testing.EqualsTester)1 String.format (java.lang.String.format)1