]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8069 replace organisation by organization 1259/head
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 15 Sep 2016 16:17:45 +0000 (18:17 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 16 Sep 2016 15:08:12 +0000 (17:08 +0200)
server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdGenerator.java
server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdLoader.java
server/sonar-server/src/main/java/org/sonar/server/serverid/ws/ShowAction.java
server/sonar-server/src/main/java/org/sonar/server/startup/LogServerId.java
server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdLoaderTest.java
server/sonar-server/src/test/java/org/sonar/server/startup/LogServerIdTest.java
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 7439b6dd60dde8b5a08e77f85538667c3ec31bac..d2b959b05bd8d93a0d67ad70f500803555a7138e 100644 (file)
@@ -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);
   }
 
index 6ca91d6e2c8fa2956ef6e7004c13cdf69088380e..1c38704a08cf8007388caac23412ed596a253d50 100644 (file)
@@ -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));
   }
index 5230714dda4efd18251c5fb87ff02944fdb84ab1..4d5ecf493d4a59cb4a7c16a331ce2380b485b1ba 100644 (file)
@@ -94,15 +94,15 @@ public class ShowAction implements ServerIdWsAction {
     Optional<String> serverId = getSettingValue(properties.get(PERMANENT_SERVER_ID));
     if (serverId.isPresent()) {
       responseBuilder.setServerId(serverId.get());
-      Optional<String> organisation = getSettingValue(properties.get(ORGANISATION));
-      if (organisation.isPresent()) {
-        responseBuilder.setOrganization(organisation.get());
+      Optional<String> organization = getSettingValue(properties.get(ORGANISATION));
+      if (organization.isPresent()) {
+        responseBuilder.setOrganization(organization.get());
       }
       Optional<String> 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);
       }
index 52638e6b93149713cf16ae2cdbab3cbafe20497d..e06932561702a2b70fd5b97b635bfc10184f6c76 100644 (file)
@@ -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);
 
index e819d6ca02577cf4cc7ab93547cb23fd180b3e00..d616f8ee46dddd62a413c4a7cf7152ade23a7b26 100644 (file)
@@ -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<String, String> 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");
index 62f5105c54da6a4fbbadbfe9734281b1c8c69192..2a0412d8735e82b64dc7f1a00c4a892b293ab0e5 100644 (file)
@@ -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");
index 89b87c8367d60640cb9d97faff8ae555f55fd00e..7ac459d1e098007fe5cea7e55abd36e7e71601a0 100644 (file)
@@ -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<ServerId> 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<ServerId> 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<ServerId> 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<ServerId> 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<ServerId> 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
index 7b3206e852f3df1de95b12ff4bdf762dc5d255ce..193c5f0e0d0867fdade4dc79fa4e296e45197afe 100644 (file)
@@ -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");
   }
 
index 7b898c8676cf262f0bcc3ffc3e1bf0ecaa3153ea..2f6354fd0e567fa1fe7ca36cc788c545794c4a9e 100644 (file)
@@ -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