當前位置: 首頁>>代碼示例>>Java>>正文


Java ProductTypeDraft類代碼示例

本文整理匯總了Java中io.sphere.sdk.producttypes.ProductTypeDraft的典型用法代碼示例。如果您正苦於以下問題:Java ProductTypeDraft類的具體用法?Java ProductTypeDraft怎麽用?Java ProductTypeDraft使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ProductTypeDraft類屬於io.sphere.sdk.producttypes包,在下文中一共展示了ProductTypeDraft類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fetchCachedProductTypeId_OnSecondTime_ShouldNotFindProductTypeInCache

import io.sphere.sdk.producttypes.ProductTypeDraft; //導入依賴的package包/類
@Test
public void fetchCachedProductTypeId_OnSecondTime_ShouldNotFindProductTypeInCache() {
    // Fetch any product type to populate cache
    productTypeService.fetchCachedProductTypeId("anyTypeKey").toCompletableFuture().join();

    // Create new type
    final String newProductTypeKey = "new_type_key";
    final ProductTypeDraft draft = ProductTypeDraftBuilder
        .of(newProductTypeKey, "typeName", "typeDescription", new ArrayList<>()).build();
    CTP_TARGET_CLIENT.execute(ProductTypeCreateCommand.of(draft)).toCompletableFuture().join();

    final Optional<String> newProductTypeId =
        productTypeService.fetchCachedProductTypeId(newProductTypeKey).toCompletableFuture().join();

    assertThat(newProductTypeId).isEmpty();
}
 
開發者ID:commercetools,項目名稱:commercetools-sync-java,代碼行數:17,代碼來源:ProductTypeServiceIT.java

示例2: createProductType

import io.sphere.sdk.producttypes.ProductTypeDraft; //導入依賴的package包/類
/**
 * This method blocks to create a product Type on the CTP project defined by the supplied {@code ctpClient} with
 * the supplied data.
 *
 * @param productTypeKey the product type key
 * @param locale         the locale to be used for specifying the product type name and field definitions names.
 * @param name           the name of the product type.
 * @param ctpClient      defines the CTP project to create the product type on.
 */
public static void createProductType(@Nonnull final String productTypeKey,
                                     @Nonnull final Locale locale,
                                     @Nonnull final String name,
                                     @Nonnull final SphereClient ctpClient) {
    if (!productTypeExists(productTypeKey, ctpClient)) {
        final ProductTypeDraft productTypeDraft = ProductTypeDraftBuilder
            .of(productTypeKey, name, "description", buildAttributeDefinitions(locale))
            .build();
        ctpClient.execute(ProductTypeCreateCommand.of(productTypeDraft)).toCompletableFuture().join();
    }
}
 
開發者ID:commercetools,項目名稱:commercetools-sync-java,代碼行數:21,代碼來源:ProductTypeITUtils.java

示例3: createProductType

import io.sphere.sdk.producttypes.ProductTypeDraft; //導入依賴的package包/類
public static ProductType createProductType(final BlockingSphereClient sphereClient) {
    final ProductTypeDraft productTypeDraft =
            ProductTypeDraft.of(RandomStringUtils.randomAlphabetic(10), "name", "a 'T' shaped cloth", Collections.emptyList());
    final ProductType productType = sphereClient.executeBlocking(ProductTypeCreateCommand.of(productTypeDraft));
    return productType;
}
 
開發者ID:commercetools,項目名稱:commercetools-sunrise-data,代碼行數:7,代碼來源:TestUtils.java

示例4: withProductType

import io.sphere.sdk.producttypes.ProductTypeDraft; //導入依賴的package包/類
public static void withProductType(final BlockingSphereClient client, final ProductTypeDraft productTypeDraft, final Function<ProductType, ProductType> test) {
    final ProductType productType = client.executeBlocking(ProductTypeCreateCommand.of(productTypeDraft));
    final ProductType productTypeAfterTest = test.apply(productType);
    deleteProductTypeWithRetry(client, productTypeAfterTest);
}
 
開發者ID:commercetools,項目名稱:commercetools-sunrise-java,代碼行數:6,代碼來源:ProductTypeTestFixtures.java

示例5: productTypeDraft

import io.sphere.sdk.producttypes.ProductTypeDraft; //導入依賴的package包/類
public static ProductTypeDraft productTypeDraft() {
    return ProductTypeDraftBuilder.of(randomKey(), randomKey(), "Description", emptyList()).build();
}
 
開發者ID:commercetools,項目名稱:commercetools-sunrise-java,代碼行數:4,代碼來源:ProductTypeTestFixtures.java


注:本文中的io.sphere.sdk.producttypes.ProductTypeDraft類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。