本文整理汇总了Java中io.sphere.sdk.categories.commands.CategoryCreateCommand类的典型用法代码示例。如果您正苦于以下问题:Java CategoryCreateCommand类的具体用法?Java CategoryCreateCommand怎么用?Java CategoryCreateCommand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CategoryCreateCommand类属于io.sphere.sdk.categories.commands包,在下文中一共展示了CategoryCreateCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildChangeSlugUpdateAction_WithDifferentLocaleOrder_ShouldNotBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildChangeSlugUpdateAction_WithDifferentLocaleOrder_ShouldNotBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(LocalizedString.of(Locale.ENGLISH, "modern classic furniture"),
LocalizedString.of(Locale.GERMAN, "klassische-moebel", Locale.ENGLISH, "classic-furniture"))
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
// Prepare new category draft with a different order locales of slug
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory).build();
// Build change slug update action
final UpdateAction<Category> changeSlugUpdateAction =
buildChangeSlugUpdateAction(oldCategory, draftFromCategory).orElse(null);
assertThat(changeSlugUpdateAction).isNull();
}
示例2: setup
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
/**
* Deletes Categories and Types from the target CTP projects, then it populates it with category test data.
*/
@BeforeClass
public static void setup() {
deleteAllCategories(CTP_TARGET_CLIENT);
deleteTypes(CTP_TARGET_CLIENT);
// Create a mock old category in the target project.
final CategoryDraft oldCategoryDraft = CategoryDraftBuilder
.of(
LocalizedString.of(Locale.ENGLISH, "classic furniture"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture"))
.metaDescription(
LocalizedString.of(Locale.ENGLISH, "classic furniture meta desc",
Locale.GERMAN, "Klassische Möbel Meta desc"))
.build();
oldCategory = CTP_TARGET_CLIENT.execute(CategoryCreateCommand.of(oldCategoryDraft))
.toCompletableFuture()
.join();
}
示例3: setup
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
/**
* Deletes Categories and Types from the target CTP projects, then it populates it with category test data.
*/
@BeforeClass
public static void setup() {
deleteAllCategories(CTP_TARGET_CLIENT);
deleteTypes(CTP_TARGET_CLIENT);
// Create a mock old category in the target project.
final CategoryDraft oldCategoryDraft = CategoryDraftBuilder
.of(
LocalizedString.of(Locale.ENGLISH, "classic furniture"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture"))
.metaDescription(
LocalizedString.of(Locale.ENGLISH, "classic furniture metaKeywords",
Locale.GERMAN, "Klassische Möbel metaKeywords"))
.build();
oldCategory = CTP_TARGET_CLIENT.execute(CategoryCreateCommand.of(oldCategoryDraft))
.toCompletableFuture()
.join();
}
示例4: setup
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
/**
* Deletes Categories and Types from source and target CTP projects, then it populates target CTP project with
* category test data.
*/
@BeforeClass
public static void setup() {
deleteAllCategories(CTP_SOURCE_CLIENT);
deleteAllCategories(CTP_TARGET_CLIENT);
deleteTypesFromTargetAndSource();
final CategoryDraft oldCategoryDraft = CategoryDraftBuilder
.of(LocalizedString.of(Locale.ENGLISH, "classic furniture"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture"))
.orderHint("0.1")
.build();
oldCategory = CTP_TARGET_CLIENT.execute(CategoryCreateCommand.of(oldCategoryDraft))
.toCompletableFuture()
.join();
}
示例5: buildChangeOrderHintUpdateAction_WithDifferentValues_ShouldBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildChangeOrderHintUpdateAction_WithDifferentValues_ShouldBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(oldCategory.getName(), oldCategory.getSlug())
.orderHint("0.2")
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
// Prepare new category draft with a different orderHint
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategoryDraft).build();
// Build change OrderHint update action
final UpdateAction<Category> changeOrderHintUpdateAction =
buildChangeOrderHintUpdateAction(oldCategory, draftFromCategory, categorySyncOptions)
.orElse(null);
assertThat(changeOrderHintUpdateAction).isNotNull();
assertThat(changeOrderHintUpdateAction.getAction()).isEqualTo("changeOrderHint");
assertThat(((ChangeOrderHint) changeOrderHintUpdateAction).getOrderHint())
.isEqualTo(newCategory.getOrderHint());
assertThat(callBackResponses).isEmpty();
}
示例6: buildChangeOrderHintUpdateAction_WithSameValues_ShouldNotBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildChangeOrderHintUpdateAction_WithSameValues_ShouldNotBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(oldCategory.getName(), oldCategory.getSlug())
.orderHint(oldCategory.getOrderHint())
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
// Prepare new category draft with a different orderHint
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory).build();
// Build change OrderHint update action for root categories with same orderHint
final UpdateAction<Category> changeOrderHintUpdateAction =
buildChangeOrderHintUpdateAction(oldCategory, draftFromCategory, categorySyncOptions)
.orElse(null);
assertThat(changeOrderHintUpdateAction).isNull();
assertThat(callBackResponses).isEmpty();
}
示例7: buildChangeOrderHintUpdateAction_WithNullValue_ShouldNotBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildChangeOrderHintUpdateAction_WithNullValue_ShouldNotBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(oldCategory.getName(), oldCategory.getSlug())
.orderHint(null)
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory)
.orderHint(null)
.build();
// Build change OrderHint update action
final UpdateAction<Category> changeOrderHintUpdateAction =
buildChangeOrderHintUpdateAction(oldCategory, draftFromCategory, categorySyncOptions)
.orElse(null);
assertThat(changeOrderHintUpdateAction).isNull();
assertThat(callBackResponses).hasSize(1);
assertThat(callBackResponses.get(0)).isEqualTo(format("Cannot unset 'orderHint' field of category with id "
+ "'%s'.", oldCategory.getId()));
}
示例8: setup
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
/**
* Deletes Categories and Types from source and target CTP projects, then it populates target CTP project with
* category test data.
*/
@BeforeClass
public static void setup() {
deleteAllCategories(CTP_SOURCE_CLIENT);
deleteAllCategories(CTP_TARGET_CLIENT);
deleteTypesFromTargetAndSource();
final CategoryDraft oldCategoryDraft = CategoryDraftBuilder
.of(LocalizedString.of(Locale.ENGLISH, "classic furniture", Locale.GERMAN, "klassische moebel"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture", Locale.GERMAN, "klassische-moebel"))
.metaTitle(
LocalizedString.of(Locale.ENGLISH, "classic-furniture", Locale.GERMAN, "klassische-moebel"))
.build();
oldCategory = CTP_TARGET_CLIENT.execute(CategoryCreateCommand.of(oldCategoryDraft))
.toCompletableFuture()
.join();
}
示例9: buildSetMetaTitleUpdateAction_WithDifferentValues_ShouldBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildSetMetaTitleUpdateAction_WithDifferentValues_ShouldBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(LocalizedString.of(Locale.ENGLISH, "modern classic furniture"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture", Locale.GERMAN, "klassische-moebel"))
.metaTitle(
LocalizedString.of(Locale.ENGLISH, "new-furniture", Locale.GERMAN, "neue-moebel"))
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory).build();
// Build set metatitle data update action
final UpdateAction<Category> setMetaTitleUpdateAction =
buildSetMetaTitleUpdateAction(oldCategory, draftFromCategory).orElse(null);
assertThat(setMetaTitleUpdateAction).isNotNull();
assertThat(setMetaTitleUpdateAction.getAction()).isEqualTo("setMetaTitle");
assertThat(((SetMetaTitle) setMetaTitleUpdateAction).getMetaTitle())
.isEqualTo(draftFromCategory.getMetaTitle());
}
示例10: buildSetMetaTitleUpdateAction_WithSameValues_ShouldNotBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildSetMetaTitleUpdateAction_WithSameValues_ShouldNotBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(LocalizedString.of(Locale.ENGLISH, "modern classic furniture"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture", Locale.GERMAN, "klassische-moebel"))
.metaTitle(
LocalizedString.of(Locale.ENGLISH, "classic-furniture", Locale.GERMAN, "klassische-moebel"))
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
// Prepare new category draft with the same metaTitle
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory).build();
// Build set metatitle update action
final UpdateAction<Category> setMetaTitleUpdateAction =
buildSetMetaTitleUpdateAction(oldCategory, draftFromCategory).orElse(null);
assertThat(setMetaTitleUpdateAction).isNull();
}
示例11: buildSetMetaTitleUpdateAction_WithDifferentLocaleOrder_ShouldNotBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildSetMetaTitleUpdateAction_WithDifferentLocaleOrder_ShouldNotBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(LocalizedString.of(Locale.ENGLISH, "modern classic furniture"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture", Locale.GERMAN, "klassische-moebel"))
.metaTitle(
LocalizedString.of(Locale.GERMAN, "klassische-moebel", Locale.ENGLISH, "classic-furniture"))
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
// Prepare new category draft with a different order of locales of name
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory).build();
// Build set metatitle update action
final UpdateAction<Category> setMetaTitleUpdateAction =
buildSetMetaTitleUpdateAction(oldCategory, draftFromCategory).orElse(null);
assertThat(setMetaTitleUpdateAction).isNull();
}
示例12: setup
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
/**
* Deletes Categories and Types from source and target CTP projects, then it populates target CTP project with
* category test data.
*/
@BeforeClass
public static void setup() {
deleteAllCategories(CTP_SOURCE_CLIENT);
deleteAllCategories(CTP_TARGET_CLIENT);
deleteTypesFromTargetAndSource();
final CategoryDraft oldCategoryDraft = CategoryDraftBuilder
.of(LocalizedString.of(Locale.ENGLISH, "classic furniture"),
LocalizedString.of(Locale.ENGLISH, "classic-furniture"))
.description(LocalizedString.of(Locale.ENGLISH, "nice description", Locale.GERMAN, "nett Beschreibung"))
.build();
oldCategory = CTP_TARGET_CLIENT.execute(CategoryCreateCommand.of(oldCategoryDraft))
.toCompletableFuture()
.join();
}
示例13: buildChangeDescriptionUpdateAction_WithDifferentValues_ShouldBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildChangeDescriptionUpdateAction_WithDifferentValues_ShouldBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(oldCategory.getName(), oldCategory.getSlug())
.description(LocalizedString.of(Locale.ENGLISH, "cool description"))
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategoryDraft).build();
// Build set description update action
final UpdateAction<Category> setDescriptionUpdateAction =
buildSetDescriptionUpdateAction(oldCategory, draftFromCategory).orElse(null);
assertThat(setDescriptionUpdateAction).isNotNull();
assertThat(setDescriptionUpdateAction.getAction()).isEqualTo("setDescription");
assertThat(((SetDescription) setDescriptionUpdateAction).getDescription())
.isEqualTo(newCategory.getDescription());
}
示例14: buildChangeDescriptionUpdateAction_WithSameValues_ShouldNotBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildChangeDescriptionUpdateAction_WithSameValues_ShouldNotBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(oldCategory.getName(), oldCategory.getSlug())
.description(oldCategory.getDescription())
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
// Prepare new category draft with a same description
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory).build();
// Build set description update action for root categories with same description
final UpdateAction<Category> setDescriptionUpdateAction =
buildSetDescriptionUpdateAction(oldCategory, draftFromCategory)
.orElse(null);
assertThat(setDescriptionUpdateAction).isNull();
}
示例15: buildChangeDescriptionUpdateAction_WithDifferentLocaleOrder_ShouldNotBuildUpdateAction
import io.sphere.sdk.categories.commands.CategoryCreateCommand; //导入依赖的package包/类
@Test
public void buildChangeDescriptionUpdateAction_WithDifferentLocaleOrder_ShouldNotBuildUpdateAction() {
final CategoryDraft newCategoryDraft = CategoryDraftBuilder
.of(oldCategory.getName(), oldCategory.getSlug())
.description(LocalizedString.of(Locale.GERMAN, "nett Beschreibung", Locale.ENGLISH, "nice description"))
.build();
final Category newCategory = CTP_SOURCE_CLIENT.execute(CategoryCreateCommand.of(newCategoryDraft))
.toCompletableFuture()
.join();
// Prepare new category draft with a different order locales of description
final CategoryDraft draftFromCategory = CategoryDraftBuilder.of(newCategory).build();
// Build set description update action
final UpdateAction<Category> setDescriptionUpdateAction =
buildSetDescriptionUpdateAction(oldCategory, draftFromCategory).orElse(null);
assertThat(setDescriptionUpdateAction).isNull();
}