当前位置: 首页>>代码示例>>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;未经允许,请勿转载。