public static SetDescription of(final LocalizedStrings description, final ProductUpdateScope productUpdateScope) { return new SetDescription(description, productUpdateScope); }
public static SetDescription of(final LocalizedString description) { return of(description, null); }
public static SetDescription of(final LocalizedStrings description, final ProductUpdateScope productUpdateScope) { return new SetDescription(description, productUpdateScope); }
public static SetDescription of(final LocalizedString description) { return of(description, null); }
public static SetDescription of(final LocalizedString description) { return new SetDescription(description); }
public void setDescriptionWithStaged(final Boolean staged) { withUpdateableProduct(client(), product -> { assertThat(product.getMasterData().hasStagedChanges()).isFalse(); final LocalizedString newDescription = LocalizedString.ofEnglish("new description " + RANDOM.nextInt()); final ProductUpdateCommand cmd = ProductUpdateCommand.of(product, SetDescription.of(newDescription, staged)); final Product updatedProduct = client().executeBlocking(cmd); assertThat(updatedProduct.getMasterData().getStaged().getDescription()).isEqualTo(newDescription); assertThat(updatedProduct.getMasterData().hasStagedChanges()).isEqualTo(staged); return updatedProduct; }); }
public static SetDescription of(final LocalizedString description, @Nullable final Boolean staged) { return new SetDescription(description, staged); }
@Test public void setDescription() throws Exception { withUpdateableProduct(client(), product -> { final LocalizedString newDescription = LocalizedString.ofEnglish("new description " + RANDOM.nextInt()); final ProductUpdateCommand cmd = ProductUpdateCommand.of(product, SetDescription.of(newDescription)); final Product updatedProduct = client().executeBlocking(cmd); assertThat(updatedProduct.getMasterData().getStaged().getDescription()).isEqualTo(newDescription); return updatedProduct; }); }
public static SetDescription of(final LocalizedString description, @Nullable final Boolean staged) { return new SetDescription(description, staged); }
@Test public void revertStagedChanges() throws Exception { withUpdateableProduct(client(), product -> { //changing only staged and not current final LocalizedString oldDescriptionOption = product.getMasterData().getStaged().getDescription(); final LocalizedString newDescription = LocalizedString.ofEnglish("new description " + RANDOM.nextInt()); final ProductUpdateCommand cmd = ProductUpdateCommand.of(product, asList(Publish.of(), SetDescription.of(newDescription))); final Product updatedProduct = client().executeBlocking(cmd); assertThat(oldDescriptionOption).isNotEqualTo(newDescription); assertThat(updatedProduct.getMasterData().getStaged().getDescription()).isEqualTo(newDescription); assertThat(updatedProduct.getMasterData().getCurrent().getDescription()).isEqualTo(oldDescriptionOption); final Product revertedProduct = client().executeBlocking(ProductUpdateCommand.of(updatedProduct, RevertStagedChanges.of())); assertThat(revertedProduct.getMasterData().getStaged().getDescription()).isEqualTo(oldDescriptionOption); assertThat(revertedProduct.getMasterData().getCurrent().getDescription()).isEqualTo(oldDescriptionOption); return revertedProduct; }); }