public interface StoreCreateCommand extends DraftBasedCreateCommandDsl<Store,StoreDraft,StoreCreateCommand>, MetaModelReferenceExpansionDsl<Store,StoreCreateCommand,StoreExpansionModel<Store>>
Store
.
final String key = SphereTestUtils.randomKey(); final LocalizedString name = SphereTestUtils.randomLocalizedString(); final List<String> languages = Collections.singletonList(Locale.ENGLISH.toLanguageTag()); final StoreDraft storeDraft = StoreDraftBuilder.of(key, name, languages).build(); StoreFixtures.withStore(client(), storeDraft, store -> { Assertions.assertThat(store).isNotNull(); Assertions.assertThat(store.getKey()).isEqualTo(key); Assertions.assertThat(store.getName()).isEqualTo(name); Assertions.assertThat(store.getLanguages()).isEqualTo(languages); assertEventually(() -> { final PagedQueryResult<StoreCreatedMessage> pagedQueryResult = client().executeBlocking( MessageQuery.of().withPredicates(m -> m.resource().is(store)) .forMessageType(StoreCreatedMessage.MESSAGE_HINT) ); final Optional<StoreCreatedMessage> storeCreatedMessage = pagedQueryResult.head(); assertThat(storeCreatedMessage).isPresent(); assertThat(storeCreatedMessage.get().getResource().getId()).isEqualTo(store.getId()); }); });
See the test code.
StoreDraft
,
Store
Modifier and Type | Method and Description |
---|---|
static StoreCreateCommand |
of(StoreDraft draft)
Creates a command object to create a
Store . |
getDraft, withDraft
canDeserialize, deserialize, httpRequestIntent
plusExpansionPaths, withExpansionPaths
plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths
expansionPaths
static StoreCreateCommand of(StoreDraft draft)
Store
.draft
- template to create the new object