|
35 | 35 | import com.commercetools.api.models.customer.CustomerUpdateAction; |
36 | 36 | import com.commercetools.api.models.customer_group.CustomerGroup; |
37 | 37 | import com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifierBuilder; |
| 38 | +import com.commercetools.api.models.project.Project; |
| 39 | +import com.commercetools.api.models.project.ProjectUpdateActionBuilder; |
| 40 | +import com.commercetools.api.models.project.ProjectUpdateBuilder; |
38 | 41 | import com.commercetools.api.models.store.Store; |
39 | 42 | import com.commercetools.api.models.store.StoreResourceIdentifierBuilder; |
40 | 43 | import com.commercetools.api.models.type.CustomFieldsDraftBuilder; |
|
47 | 50 | import com.commercetools.sync.integration.commons.utils.ITUtils; |
48 | 51 | import com.commercetools.sync.integration.commons.utils.TestClientUtils; |
49 | 52 | import com.neovisionaries.i18n.CountryCode; |
| 53 | +import io.vrap.rmf.base.client.ApiHttpResponse; |
50 | 54 | import java.time.LocalDate; |
51 | 55 | import java.util.ArrayList; |
52 | 56 | import java.util.List; |
@@ -194,6 +198,28 @@ void sync_WithUpdatedCustomer_ShouldUpdateCustomer() { |
194 | 198 |
|
195 | 199 | @Test |
196 | 200 | void sync_WithUpdatedAllFieldsOfCustomer_ShouldUpdateCustomerWithAllExpectedActions() { |
| 201 | + final List<String> languages = List.of("de-DE", "en", Locale.FRENCH.toLanguageTag()); |
| 202 | + final Project project = |
| 203 | + TestClientUtils.CTP_TARGET_CLIENT |
| 204 | + .get() |
| 205 | + .execute() |
| 206 | + .thenApply(ApiHttpResponse::getBody) |
| 207 | + .join(); |
| 208 | + final boolean hasLanguagesBeenAdded = project.getLanguages().containsAll(languages); |
| 209 | + if (!hasLanguagesBeenAdded) { |
| 210 | + TestClientUtils.CTP_TARGET_CLIENT |
| 211 | + .post( |
| 212 | + ProjectUpdateBuilder.of() |
| 213 | + .actions( |
| 214 | + ProjectUpdateActionBuilder.of() |
| 215 | + .changeLanguagesBuilder() |
| 216 | + .languages(languages) |
| 217 | + .build()) |
| 218 | + .version(project.getVersion()) |
| 219 | + .build()) |
| 220 | + .executeBlocking(); |
| 221 | + } |
| 222 | + |
197 | 223 | final Store storeCologne = |
198 | 224 | CustomerITUtils.ensureStore(TestClientUtils.CTP_TARGET_CLIENT, "store-cologne"); |
199 | 225 | final CustomerGroup customerGroupSilverMember = |
|
0 commit comments