gpt4 book ai didi

io.sphere.sdk.zones.commands.ZoneUpdateCommand.of()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 06:17:31 27 4
gpt4 key购买 nike

本文整理了Java中io.sphere.sdk.zones.commands.ZoneUpdateCommand.of()方法的一些代码示例,展示了ZoneUpdateCommand.of()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneUpdateCommand.of()方法的具体详情如下:
包路径:io.sphere.sdk.zones.commands.ZoneUpdateCommand
类名称:ZoneUpdateCommand
方法名:of

ZoneUpdateCommand.of介绍

[英]Creates a command to update a Zone selected by its ID using one update action.
[中]创建一个命令,以使用一个更新操作更新由其ID选择的分区。

代码示例

代码示例来源:origin: io.sphere.sdk.jvm/sphere-models

static ZoneUpdateCommand of(final Versioned<Zone> versioned, final UpdateAction<Zone> updateAction) {
  return of(versioned, Collections.singletonList(updateAction));
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void updateByKey() throws Exception {
  ZoneFixtures.withUpdateableZone(client(), zone -> {
    final String newKey = randomKey();
    assertThat(zone.getKey()).isNotEqualTo(newKey);
    final ZoneUpdateCommand command = ZoneUpdateCommand.of(zone, SetKey.of(newKey));
    final Zone updatedZone = client().executeBlocking(command);
    assertThat(updatedZone.getKey()).isEqualTo(newKey);
    final String newKey2 = randomKey();
    final ZoneUpdateCommand commandByKey = ZoneUpdateCommand.ofKey(updatedZone.getKey(),updatedZone.getVersion(), SetKey.of(newKey2));
    final Zone updatedZone2 = client().executeBlocking(commandByKey);
    assertThat(updatedZone2.getKey()).isEqualTo(newKey2);
    return updatedZone2;
  }, CountryCode.AM);
}

代码示例来源:origin: io.sphere.sdk.jvm/models

public static ZoneUpdateCommand of(final Versioned<Zone> versioned, final UpdateAction<Zone> updateAction) {
  return of(versioned, asList(updateAction));
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
  public void addLocationAndRemoveLocation() throws Exception {
    ZoneFixtures.withUpdateableZone(client(), zone -> {
      //adding a location
      final Location newLocation = Location.of(CountryCode.AQ, "state");
      assertThat(zone.getLocations().contains(newLocation)).isFalse();
      final ZoneUpdateCommand addCommand = ZoneUpdateCommand.of(zone, AddLocation.of(newLocation));
      final Zone zoneWithNewLocation = client().executeBlocking(addCommand);
      assertThat(zoneWithNewLocation.getLocations()).contains(newLocation);

      //removing a location
      final ZoneUpdateCommand removeCommand = ZoneUpdateCommand.of(zoneWithNewLocation, RemoveLocation.of(newLocation));
      final Zone zoneWithoutNewLocation = client().executeBlocking(removeCommand);
      assertThat(zoneWithoutNewLocation.getLocations().contains(newLocation)).isFalse();

      return zoneWithoutNewLocation;
    }, CountryCode.AO);
  }
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void setKey() throws Exception {
  ZoneFixtures.withUpdateableZone(client(), zone -> {
    final String newKey = randomKey();
    assertThat(zone.getKey()).isNotEqualTo(newKey);
    final ZoneUpdateCommand command = ZoneUpdateCommand.of(zone, SetKey.of(newKey));
    final Zone updatedZone = client().executeBlocking(command);
    assertThat(updatedZone.getKey()).isEqualTo(newKey);
    return updatedZone;
  }, CountryCode.AM);
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void changeName() throws Exception {
  ZoneFixtures.withUpdateableZone(client(), zone -> {
    final String newName = randomString();
    assertThat(zone.getName()).isNotEqualTo(newName);
    final ZoneUpdateCommand command = ZoneUpdateCommand.of(zone, ChangeName.of(newName));
    final Zone updatedZone = client().executeBlocking(command);
    assertThat(updatedZone.getName()).isEqualTo(newName);
    return updatedZone;
  }, CountryCode.AM);
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void setDescription() throws Exception {
  ZoneFixtures.withUpdateableZone(client(), zone -> {
    final String newDescription = randomString();
    assertThat(zone.getDescription()).isNotEqualTo(newDescription);
    final ZoneUpdateCommand command = ZoneUpdateCommand.of(zone, SetDescription.of(newDescription));
    final Zone updatedZone = client().executeBlocking(command);
    assertThat(updatedZone.getDescription()).isEqualTo(newDescription);
    return updatedZone;
  }, CountryCode.AN);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com