From: Teryk Bellahsene Date: Thu, 15 Sep 2016 16:17:45 +0000 (+0200) Subject: SONAR-8069 replace organisation by organization X-Git-Tag: 6.1-RC1~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5bb2c160615ba90e5458a205aadcc5815659082b;p=sonarqube.git SONAR-8069 replace organisation by organization --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdGenerator.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdGenerator.java index 7439b6dd60d..d2b959b05bd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdGenerator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdGenerator.java @@ -60,8 +60,8 @@ public class ServerIdGenerator { this.acceptPrivateAddress = acceptPrivateAddress; } - public boolean validate(String organisationName, String ipAddress, String expectedServerId) { - String organization = organisationName.trim(); + public boolean validate(String organizationName, String ipAddress, String expectedServerId) { + String organization = organizationName.trim(); String ip = ipAddress.trim(); if (isBlank(ip) || isBlank(organization) || !isValidOrganizationName(organization)) { return false; @@ -86,8 +86,8 @@ public class ServerIdGenerator { return toId(organization, inetAddress); } - static boolean isValidOrganizationName(String organisation) { - return ORGANIZATION_PATTERN.matcher(organisation).matches(); + static boolean isValidOrganizationName(String organization) { + return ORGANIZATION_PATTERN.matcher(organization).matches(); } boolean isFixed(InetAddress address) { @@ -97,8 +97,8 @@ public class ServerIdGenerator { return acceptPrivateAddress || (!address.isLoopbackAddress() && !address.isLinkLocalAddress()); } - static String toId(String organisation, InetAddress address) { - String id = new StringBuilder().append(organisation).append("-").append(address.getHostAddress()).toString(); + static String toId(String organization, InetAddress address) { + String id = new StringBuilder().append(organization).append("-").append(address.getHostAddress()).toString(); return VERSION + DigestUtils.sha1Hex(id.getBytes(StandardCharsets.UTF_8)).substring(0, CHECKSUM_SIZE); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdLoader.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdLoader.java index 6ca91d6e2c8..1c38704a08c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdLoader.java @@ -45,11 +45,11 @@ public class ServerIdLoader { return Optional.absent(); } - String organisation = settings.getString(CoreProperties.ORGANISATION); + String organization = settings.getString(CoreProperties.ORGANISATION); String ipAddress = settings.getString(CoreProperties.SERVER_ID_IP_ADDRESS); - boolean validated = organisation != null + boolean validated = organization != null && ipAddress != null - && idGenerator.validate(organisation, ipAddress, rawId.get()); + && idGenerator.validate(organization, ipAddress, rawId.get()); return Optional.of(new ServerId(rawId.get(), validated)); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/serverid/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/serverid/ws/ShowAction.java index 5230714dda4..4d5ecf493d4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/serverid/ws/ShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/serverid/ws/ShowAction.java @@ -94,15 +94,15 @@ public class ShowAction implements ServerIdWsAction { Optional serverId = getSettingValue(properties.get(PERMANENT_SERVER_ID)); if (serverId.isPresent()) { responseBuilder.setServerId(serverId.get()); - Optional organisation = getSettingValue(properties.get(ORGANISATION)); - if (organisation.isPresent()) { - responseBuilder.setOrganization(organisation.get()); + Optional organization = getSettingValue(properties.get(ORGANISATION)); + if (organization.isPresent()) { + responseBuilder.setOrganization(organization.get()); } Optional ip = getSettingValue(properties.get(SERVER_ID_IP_ADDRESS)); if (ip.isPresent()) { responseBuilder.setIp(ip.get()); } - boolean isValidServId = isValidServerId(serverId.get(), organisation, ip); + boolean isValidServId = isValidServerId(serverId.get(), organization, ip); if (!isValidServId) { responseBuilder.setInvalidServerId(true); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/startup/LogServerId.java b/server/sonar-server/src/main/java/org/sonar/server/startup/LogServerId.java index 52638e6b931..e0693256170 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/startup/LogServerId.java +++ b/server/sonar-server/src/main/java/org/sonar/server/startup/LogServerId.java @@ -43,14 +43,14 @@ public final class LogServerId implements Startable { PropertyDto serverIdProp = selectProperty(dbSession, propertyKey); if (serverIdProp != null) { // a server ID has been generated, let's print out the other useful information that can help debugging license issues - PropertyDto organisationProp = selectProperty(dbSession, CoreProperties.ORGANISATION); + PropertyDto organizationProp = selectProperty(dbSession, CoreProperties.ORGANISATION); PropertyDto ipAddressProp = selectProperty(dbSession, CoreProperties.SERVER_ID_IP_ADDRESS); StringBuilder message = new StringBuilder("Server information:\n"); message.append(" - ID : "); addQuotedValue(serverIdProp, message); - message.append(" - Organisation : "); - addQuotedValue(organisationProp, message); + message.append(" - Organization : "); + addQuotedValue(organizationProp, message); message.append(" - Registered IP: "); addQuotedValue(ipAddressProp, message); diff --git a/server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java index e819d6ca025..d616f8ee46d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java @@ -58,7 +58,7 @@ public class ListActionTest { private static final String LICENSE_KEY_SAMPLE = "sonar.governance.license.secured"; private static final String LICENSE_NAME_SAMPLE = "Governance"; - private static final String ORGANISATION_SAMPLE = "SonarSource"; + private static final String ORGANIZATION_SAMPLE = "SonarSource"; private static final String SERVER_ID_SAMPLE = "12345"; private static final String PRODUCT_SAMPLE = "governance"; private static final String TYPE_SAMPLE = "PRODUCTION"; @@ -159,7 +159,7 @@ public class ListActionTest { setUserAsSystemAdmin(); addServerIdSettings(SERVER_ID_SAMPLE); addLicenseSetting(LICENSE_KEY_SAMPLE, LICENSE_NAME_SAMPLE, - createBase64License(ORGANISATION_SAMPLE, "Other", SERVER_ID_SAMPLE, EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); + createBase64License(ORGANIZATION_SAMPLE, "Other", SERVER_ID_SAMPLE, EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); ListWsResponse result = executeRequest(); @@ -176,7 +176,7 @@ public class ListActionTest { setUserAsSystemAdmin(); addServerIdSettings(SERVER_ID_SAMPLE); addLicenseSetting(LICENSE_KEY_SAMPLE, LICENSE_NAME_SAMPLE, - createBase64License(ORGANISATION_SAMPLE, PRODUCT_SAMPLE, "Other", EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); + createBase64License(ORGANIZATION_SAMPLE, PRODUCT_SAMPLE, "Other", EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); ListWsResponse result = executeRequest(); @@ -192,7 +192,7 @@ public class ListActionTest { public void return_bad_server_id_when_server_has_no_server_id() throws Exception { setUserAsSystemAdmin(); addLicenseSetting(LICENSE_KEY_SAMPLE, LICENSE_NAME_SAMPLE, - createBase64License(ORGANISATION_SAMPLE, PRODUCT_SAMPLE, SERVER_ID_SAMPLE, EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); + createBase64License(ORGANIZATION_SAMPLE, PRODUCT_SAMPLE, SERVER_ID_SAMPLE, EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); ListWsResponse result = executeRequest(); @@ -205,7 +205,7 @@ public class ListActionTest { public void does_not_return_invalid_server_id_when_all_servers_accepted_and_no_server_id_setting() throws Exception { setUserAsSystemAdmin(); addLicenseSetting(LICENSE_KEY_SAMPLE, LICENSE_NAME_SAMPLE, - createBase64License(ORGANISATION_SAMPLE, PRODUCT_SAMPLE, "*", EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); + createBase64License(ORGANIZATION_SAMPLE, PRODUCT_SAMPLE, "*", EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); ListWsResponse result = executeRequest(); @@ -220,7 +220,7 @@ public class ListActionTest { setUserAsSystemAdmin(); addServerIdSettings(SERVER_ID_SAMPLE); addLicenseSetting(LICENSE_KEY_SAMPLE, LICENSE_NAME_SAMPLE, - createBase64License(ORGANISATION_SAMPLE, PRODUCT_SAMPLE, "*", EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); + createBase64License(ORGANIZATION_SAMPLE, PRODUCT_SAMPLE, "*", EXPIRATION_SAMPLE, TYPE_SAMPLE, Collections.emptyMap())); ListWsResponse result = executeRequest(); @@ -235,7 +235,7 @@ public class ListActionTest { setUserAsSystemAdmin(); addServerIdSettings(SERVER_ID_SAMPLE); addLicenseSetting(LICENSE_KEY_SAMPLE, LICENSE_NAME_SAMPLE, - createBase64License(ORGANISATION_SAMPLE, PRODUCT_SAMPLE, SERVER_ID_SAMPLE, "2010-01-01", TYPE_SAMPLE, Collections.emptyMap())); + createBase64License(ORGANIZATION_SAMPLE, PRODUCT_SAMPLE, SERVER_ID_SAMPLE, "2010-01-01", TYPE_SAMPLE, Collections.emptyMap())); ListWsResponse result = executeRequest(); @@ -305,10 +305,10 @@ public class ListActionTest { return Base64.encodeBase64String((data.getBytes(StandardCharsets.UTF_8))); } - private static String createBase64License(@Nullable String organisation, @Nullable String product, @Nullable String serverId, @Nullable String expirationDate, + private static String createBase64License(@Nullable String organization, @Nullable String product, @Nullable String serverId, @Nullable String expirationDate, @Nullable String type, Map additionalProperties) { StringBuilder data = new StringBuilder(); - data.append("Organisation: ").append(organisation).append(" \n"); + data.append("Organisation: ").append(organization).append(" \n"); data.append("Server: ").append(serverId).append(" \n"); data.append("Product: ").append(product).append(" \n"); data.append("Expiration: ").append(expirationDate).append(" \n"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java index 62f5105c54d..2a0412d8735 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java @@ -123,7 +123,7 @@ public class ServerIdGeneratorTest { } @Test - public void idShouldBeUniquePerOrganisation() { + public void idShouldBeUniquePerOrganization() { ServerIdGenerator generator = new ServerIdGenerator(true); String k1 = generator.generate("Corp One", "127.0.0.1"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdLoaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdLoaderTest.java index 89b87c8367d..7ac459d1e09 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdLoaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdLoaderTest.java @@ -35,7 +35,7 @@ public class ServerIdLoaderTest { private static final String AN_ID = "ABC"; private static final String AN_IP = "1.2.3.4"; - public static final String AN_ORGANISATION = "corp"; + public static final String AN_ORGANIZATION = "corp"; Settings settings = new MapSettings(); ServerIdGenerator idGenerator = mock(ServerIdGenerator.class); @@ -43,7 +43,7 @@ public class ServerIdLoaderTest { @Test public void get_returns_absent_if_id_property_is_not_set() { - settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANISATION); + settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANIZATION); settings.setProperty(CoreProperties.SERVER_ID_IP_ADDRESS, AN_IP); Optional serverIdOpt = underTest.get(); @@ -54,17 +54,17 @@ public class ServerIdLoaderTest { @Test public void get_returns_valid_id() { settings.setProperty(CoreProperties.PERMANENT_SERVER_ID, AN_ID); - settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANISATION); + settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANIZATION); settings.setProperty(CoreProperties.SERVER_ID_IP_ADDRESS, AN_IP); - when(idGenerator.validate(AN_ORGANISATION, AN_IP, AN_ID)).thenReturn(true); + when(idGenerator.validate(AN_ORGANIZATION, AN_IP, AN_ID)).thenReturn(true); Optional serverIdOpt = underTest.get(); verifyServerId(serverIdOpt.get(), AN_ID, true); - verify(idGenerator).validate(AN_ORGANISATION, AN_IP, AN_ID); + verify(idGenerator).validate(AN_ORGANIZATION, AN_IP, AN_ID); } @Test - public void get_returns_invalid_id_if_id_cant_be_generated_because_missing_organisation() { + public void get_returns_invalid_id_if_id_cant_be_generated_because_missing_organization() { settings.setProperty(CoreProperties.PERMANENT_SERVER_ID, AN_ID); settings.setProperty(CoreProperties.SERVER_ID_IP_ADDRESS, AN_IP); @@ -76,7 +76,7 @@ public class ServerIdLoaderTest { @Test public void get_returns_invalid_id_if_id_cant_be_generated_because_missing_ip() { settings.setProperty(CoreProperties.PERMANENT_SERVER_ID, AN_ID); - settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANISATION); + settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANIZATION); Optional serverIdOpt = underTest.get(); @@ -85,7 +85,7 @@ public class ServerIdLoaderTest { } @Test - public void get_returns_invalid_id_if_id_cant_be_generated_because_missing_ip_and_organisation() { + public void get_returns_invalid_id_if_id_cant_be_generated_because_missing_ip_and_organization() { settings.setProperty(CoreProperties.PERMANENT_SERVER_ID, AN_ID); Optional serverIdOpt = underTest.get(); @@ -97,14 +97,14 @@ public class ServerIdLoaderTest { @Test public void get_returns_invalid_id_if_input_is_different_than_newly_generated_id() { settings.setProperty(CoreProperties.PERMANENT_SERVER_ID, AN_ID); - settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANISATION); + settings.setProperty(CoreProperties.ORGANISATION, AN_ORGANIZATION); settings.setProperty(CoreProperties.SERVER_ID_IP_ADDRESS, AN_IP); - when(idGenerator.generate(AN_ORGANISATION, AN_IP)).thenReturn("OTHER"); + when(idGenerator.generate(AN_ORGANIZATION, AN_IP)).thenReturn("OTHER"); Optional serverIdOpt = underTest.get(); verifyServerId(serverIdOpt.get(), AN_ID, false); - verify(idGenerator).validate(AN_ORGANISATION, AN_IP, AN_ID); + verify(idGenerator).validate(AN_ORGANIZATION, AN_IP, AN_ID); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/LogServerIdTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/LogServerIdTest.java index 7b3206e852f..193c5f0e0d0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/LogServerIdTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/LogServerIdTest.java @@ -121,7 +121,7 @@ public class LogServerIdTest { private void verifyLog(String expectedId, String expectedOrganisation, String expectedIp) { assertThat(logTester.logs(LoggerLevel.INFO)).contains("Server information:\n" + " - ID : " + expectedId + "\n" - + " - Organisation : " + expectedOrganisation + "\n" + + " - Organization : " + expectedOrganisation + "\n" + " - Registered IP: " + expectedIp + "\n"); } diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 7b898c8676c..2f6354fd0e5 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3019,16 +3019,16 @@ property.category.licenses.description=In case of any issue or question about li property.category.licenses.server_id=Server ID server_id_configuration.generate_button=Generate ID server_id_configuration.generating_button=Generating ID... -server_id_configuration.bad_key=The ID is not valid anymore. Please check the organisation and the IP address. -server_id_configuration.information=The Server ID is a unique identifier of this SonarQube instance. It is used for example to obtain a license key for the SonarSource's commercial plugins. Two fields have to be provided to generate the ID : organisation name and one of the IP addresses of the machine that hosts this server. There is no need to restart the server after generating a new server ID. -server_id_configuration.organisation.title=Organisation -server_id_configuration.organisation.desc=Name of the organisation +server_id_configuration.bad_key=The ID is not valid anymore. Please check the organization and the IP address. +server_id_configuration.information=The Server ID is a unique identifier of this SonarQube instance. It is used for example to obtain a license key for the SonarSource's commercial plugins. Two fields have to be provided to generate the ID : organization name and one of the IP addresses of the machine that hosts this server. There is no need to restart the server after generating a new server ID. +server_id_configuration.organisation.title=Organization +server_id_configuration.organisation.desc=Name of the organization server_id_configuration.organisation.pattern=Only letters, digits and whitespaces are allowed. server_id_configuration.ip.title=Fixed IP Address server_id_configuration.ip.desc=A server ID is linked to the IP address of the hosting machine that runs SonarQube. If the server IP address was to change, the server ID will have to be regenerated. The valid addresses are : -server_id_configuration.generation_error=Organisation and/or IP address are not valid. -server_id_configuration.fields_cannot_be_blank=Organisation and IP address cannot be blank. -server_id_configuration.does_not_match_organisation_pattern=Organisation does not match the required pattern. +server_id_configuration.generation_error=Organization and/or IP address are not valid. +server_id_configuration.fields_cannot_be_blank=Organization and IP address cannot be blank. +server_id_configuration.does_not_match_organisation_pattern=Organization does not match the required pattern. licenses.list.product=Product licenses.list.organization=Organization licenses.list.expiration=Expiration