public final class ProductSlugChangedMessage extends GenericMessageImpl<Product>
ChangeSlug
update action.
withUpdateableProduct(client(), product -> { final LocalizedString oldSlug = product.getMasterData().getStaged().getSlug(); final LocalizedString newSlug = LocalizedString.ofEnglish("new-slug-" + RANDOM.nextInt()); final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(product, ChangeSlug.of(newSlug))); assertThat(updatedProduct.getMasterData().getStaged().getSlug()).isEqualTo(newSlug); //query message assertEventually(() -> { final Query<ProductSlugChangedMessage> query = MessageQuery.of() .withPredicates(m -> m.resource().is(product)) .forMessageType(ProductSlugChangedMessage.MESSAGE_HINT); final List<ProductSlugChangedMessage> results = client().executeBlocking(query).getResults(); assertThat(results).hasSize(1); final ProductSlugChangedMessage message = results.get(0); assertThat(message.getSlug()).isEqualTo(newSlug); assertThat(message.getOldSlug()).isEqualTo(oldSlug); }); return updatedProduct; });
See the test code.
Modifier and Type | Field and Description |
---|---|
static MessageDerivateHint<ProductSlugChangedMessage> |
MESSAGE_HINT |
static String |
MESSAGE_TYPE |
resource, resourceUserProvidedIdentifiers, resourceVersion, sequenceNumber, type
Modifier and Type | Method and Description |
---|---|
LocalizedString |
getOldSlug() |
LocalizedString |
getSlug() |
as, equals, getPayload, getResource, getResourceUserProvidedIdentifiers, getResourceVersion, getSequenceNumber, getType, hashCode, toReference
getCreatedAt, getId, getLastModifiedAt, getVersion
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
referenceOfId, referenceTypeId, typeReference
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
public static final String MESSAGE_TYPE
public static final MessageDerivateHint<ProductSlugChangedMessage> MESSAGE_HINT
public LocalizedString getSlug()
public LocalizedString getOldSlug()