Tabnine Logo
Publish.ofScope
Code IndexAdd Tabnine to your IDE (free)

How to use
ofScope
method
in
io.sphere.sdk.products.commands.updateactions.Publish

Best Java code snippets using io.sphere.sdk.products.commands.updateactions.Publish.ofScope (Showing top 4 results out of 315)

origin: com.commercetools.sdk.jvm.core/commercetools-models

public static Publish of() {
  return ofScope(null);
}
origin: commercetools/commercetools-jvm-sdk

public static Publish of() {
  return ofScope(null);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void publishWithPriceScope() throws Exception {
  withUpdateableProduct(client(), (Product product) -> {
    final ProductData stagedData = product.getMasterData().getStaged();
    final Product publishedProduct = client().executeBlocking(ProductUpdateCommand.of(product, Publish.of()));
    final ProductData currentData = publishedProduct.getMasterData().getCurrent();
    assertThat(stagedData.getMasterVariant().getImages()).hasSize(0);
    assertThat(stagedData.getMasterVariant().getPrices()).hasSize(0);
    assertThat(currentData).isEqualTo(stagedData);
    final PriceDraft expectedPrice = PriceDraft.of(EURO_10);
    final Image image = createExternalImage();
    final List<UpdateAction<Product>> updateActions = asList(
        AddExternalImage.of(image, MASTER_VARIANT_ID),
        AddPrice.of(MASTER_VARIANT_ID, expectedPrice),
        Publish.ofScope(PublishScope.PRICES)
    );
    final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(publishedProduct, updateActions));
    List<Price> prices = updatedProduct.getMasterData().getCurrent().getMasterVariant().getPrices();
    //Verify published price in the current product
    assertThat(prices).hasSize(1);
    assertThat(expectedPrice).isEqualTo(PriceDraft.of(prices.get(0)));
    //Verify that the image has not been published
    assertThat(updatedProduct.getMasterData().getCurrent().getMasterVariant().getImages()).hasSize(0);
    return updatedProduct;
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void publishWithAllScope() throws Exception {
  withUpdateableProduct(client(), (Product product) -> {
    final ProductData stagedData = product.getMasterData().getStaged();
    final Product publishedProduct = client().executeBlocking(ProductUpdateCommand.of(product, Publish.of()));
    final ProductData currentData = publishedProduct.getMasterData().getCurrent();
    assertThat(stagedData.getMasterVariant().getImages()).hasSize(0);
    assertThat(stagedData.getMasterVariant().getPrices()).hasSize(0);
    assertThat(currentData).isEqualTo(stagedData);
    final PriceDraft expectedPrice = PriceDraft.of(EURO_10);
    final Image image = createExternalImage();
    final List<UpdateAction<Product>> updateActions = asList(
        AddExternalImage.of(image, MASTER_VARIANT_ID),
        AddPrice.of(MASTER_VARIANT_ID, expectedPrice),
        Publish.ofScope(PublishScope.ALL)
    );
    final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(publishedProduct, updateActions));
    List<Price> prices = updatedProduct.getMasterData().getCurrent().getMasterVariant().getPrices();
    assertThat(prices).hasSize(1);
    assertThat(expectedPrice).isEqualTo(PriceDraft.of(prices.get(0)));
    assertThat(updatedProduct.getMasterData().getCurrent().getMasterVariant().getImages()).isEqualTo(asList(image));
    return updatedProduct;
  });
}
io.sphere.sdk.products.commands.updateactionsPublishofScope

Popular methods of Publish

  • <init>
  • of

Popular in Java

  • Reactive rest calls using spring rest template
  • getSystemService (Context)
  • findViewById (Activity)
  • requestLocationUpdates (LocationManager)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Notification (javax.management)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now