Search in sources :

Example 11 with CountryCode

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");
    });
}
Also used : Locale(java.util.Locale) ExternalOAuth(io.sphere.sdk.projects.ExternalOAuth) Project(io.sphere.sdk.projects.Project) CountryCode(com.neovisionaries.i18n.CountryCode) URL(java.net.URL) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 12 with CountryCode

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;
}
Also used : CountryCode(com.neovisionaries.i18n.CountryCode) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

CountryCode (com.neovisionaries.i18n.CountryCode)12 Test (org.junit.Test)3 LinkedHashMap (java.util.LinkedHashMap)2 Set (java.util.Set)2 AchievementItemController (com.faforever.client.achievements.AchievementItemController)1 AchievementService (com.faforever.client.achievements.AchievementService)1 AchievementState (com.faforever.client.achievements.AchievementService.AchievementState)1 UNLOCKED (com.faforever.client.achievements.AchievementService.AchievementState.UNLOCKED)1 AchievementDefinition (com.faforever.client.api.dto.AchievementDefinition)1 PlayerAchievement (com.faforever.client.api.dto.PlayerAchievement)1 PlayerEvent (com.faforever.client.api.dto.PlayerEvent)1 RatingHistoryDataPoint (com.faforever.client.domain.RatingHistoryDataPoint)1 EventService (com.faforever.client.events.EventService)1 EVENT_AEON_PLAYS (com.faforever.client.events.EventService.EVENT_AEON_PLAYS)1 EVENT_AEON_WINS (com.faforever.client.events.EventService.EVENT_AEON_WINS)1 EVENT_BUILT_AIR_UNITS (com.faforever.client.events.EventService.EVENT_BUILT_AIR_UNITS)1 EVENT_BUILT_LAND_UNITS (com.faforever.client.events.EventService.EVENT_BUILT_LAND_UNITS)1 EVENT_BUILT_NAVAL_UNITS (com.faforever.client.events.EventService.EVENT_BUILT_NAVAL_UNITS)1 EVENT_BUILT_TECH_1_UNITS (com.faforever.client.events.EventService.EVENT_BUILT_TECH_1_UNITS)1 EVENT_BUILT_TECH_2_UNITS (com.faforever.client.events.EventService.EVENT_BUILT_TECH_2_UNITS)1