use of com.neovisionaries.i18n.CountryCode in project commercetools-jvm-sdk by commercetools.
the class ProjectUpdateActionsIntegrationTest method execution.
@Ignore("Disable because of problems with External OAuth")
@Test
public void execution() throws Exception {
final Project project = client().executeBlocking(ProjectGet.of());
final String new_project_name = "NewName";
final List<String> new_project_currencies = Arrays.asList(USD.getCurrencyCode());
final List<CountryCode> new_project_countries = Arrays.asList(CountryCode.CA);
final List<Locale> new_project_locales = Arrays.asList(Locale.FRANCE);
final List<String> new_project_languages = new_project_locales.stream().map(Locale::toLanguageTag).collect(Collectors.toList());
final Boolean new_project_messages_enabled = false;
final Long delete_days_after_activation = 20L;
final URL url = new URL("https://invalid.cmo");
final ExternalOAuth externalOAuth = ExternalOAuth.of("customheader: customValue", url);
final ProjectUpdateCommand updateCommand = ProjectUpdateCommand.of(project, Arrays.asList(ChangeName.of(new_project_name), ChangeCurrencies.of(new_project_currencies), ChangeCountries.of(new_project_countries), ChangeLanguages.of(new_project_languages), ChangeMessagesConfiguration.of(MessagesConfigurationDraft.of(new_project_messages_enabled, delete_days_after_activation)), SetShippingRateInputType.ofUnset(), SetExternalOAuth.of(externalOAuth)));
final Project updatedProject = client().executeBlocking(updateCommand);
softAssert(soft -> {
soft.assertThat(updatedProject.getKey()).isEqualTo(getSphereClientConfig().getProjectKey());
soft.assertThat(updatedProject.getName()).as("name").isEqualTo(new_project_name);
soft.assertThat(updatedProject.getCountries()).as("countries").isEqualTo(new_project_countries);
soft.assertThat(updatedProject.getLanguages()).as("languages").isEqualTo(new_project_languages);
soft.assertThat(updatedProject.getLanguageLocales()).as("languages as locale").isEqualTo(new_project_locales);
soft.assertThat(updatedProject.getCreatedAt()).as("createdAt").isNotNull();
soft.assertThat(updatedProject.getCurrencies()).as("currencies").isEqualTo(new_project_currencies);
soft.assertThat(updatedProject.getCurrencyUnits()).as("currencies as unit").contains(USD);
soft.assertThat(updatedProject.getMessages().isEnabled()).isEqualTo(new_project_messages_enabled);
soft.assertThat(updatedProject.getMessages().getDeleteDaysAfterCreation()).isEqualTo(delete_days_after_activation);
soft.assertThat(updatedProject.getShippingRateInputType()).isNull();
soft.assertThat(updatedProject.getExternalOAuth()).isEqualToIgnoringGivenFields(externalOAuth, "authorizationHeader");
});
}
use of com.neovisionaries.i18n.CountryCode in project EVSUPERVISION by EnergyTIC.
the class CountryCodesProvider method getCountryCodes.
public static Map<String, String> getCountryCodes() {
CountryCode[] codes = CountryCode.values();
Arrays.sort(codes, Comparator.comparing(CountryCode::getName));
Map<String, String> map = new LinkedHashMap<>(codes.length + 1);
map.put("", EMPTY_OPTION);
for (CountryCode c : codes) {
if (shouldInclude(c)) {
map.put(c.getAlpha2(), c.getName());
}
}
return map;
}
Aggregations