public static final String NODE_NAME = "NODE_NAME";
/**
* The role of the sonar-application inside the SonarQube cluster
- * {@link org.sonar.process.NodeType}
+ * {@link org.sonar.cluster.NodeType}
*/
public static final String NODE_TYPE = "NODE_TYPE";
/**
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.cluster;
+
+import static java.util.Arrays.stream;
+import static org.sonar.cluster.ClusterProperties.CLUSTER_NODE_TYPE;
+
+public enum NodeType {
+ APPLICATION("application"), SEARCH("search");
+
+ private final String value;
+
+ NodeType(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public static NodeType parse(String nodeType) {
+ return stream(values())
+ .filter(t -> nodeType.equals(t.value))
+ .findFirst()
+ .orElseThrow(() -> new IllegalArgumentException("Invalid value for [" + CLUSTER_NODE_TYPE + "]: [" + nodeType + "]"));
+ }
+
+ public static boolean isValid(String nodeType) {
+ return stream(values())
+ .anyMatch(t -> nodeType.equals(t.value));
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.cluster;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class NodeTypeTest {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void test_parse() {
+ assertThat(NodeType.parse("application")).isEqualTo(NodeType.APPLICATION);
+ assertThat(NodeType.parse("search")).isEqualTo(NodeType.SEARCH);
+ }
+
+ @Test
+ public void parse_an_unknown_value_must_throw_IAE() {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Invalid value for ");
+
+ NodeType.parse("XYZ");
+ }
+}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.application.config.AppSettings;
-import org.sonar.process.NodeType;
+import org.sonar.cluster.NodeType;
import static org.sonar.cluster.ClusterProperties.CLUSTER_HOSTS;
import static org.sonar.cluster.ClusterProperties.CLUSTER_NODE_HOST;
import org.sonar.cluster.ClusterObjectKeys;
import org.sonar.cluster.localclient.HazelcastClient;
import org.sonar.process.MessageException;
-import org.sonar.process.NodeType;
+import org.sonar.cluster.NodeType;
import org.sonar.process.ProcessId;
import static java.lang.String.format;
import java.util.function.Consumer;
import org.apache.commons.lang.StringUtils;
import org.sonar.process.MessageException;
-import org.sonar.process.NodeType;
+import org.sonar.cluster.NodeType;
import org.sonar.process.ProcessId;
import org.sonar.process.Props;
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.process;
-
-import static java.util.Arrays.stream;
-import static org.sonar.cluster.ClusterProperties.CLUSTER_NODE_TYPE;
-
-public enum NodeType {
- APPLICATION("application"), SEARCH("search");
-
- private final String value;
-
- NodeType(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- public static NodeType parse(String nodeType) {
- return stream(values())
- .filter(t -> nodeType.equals(t.value))
- .findFirst()
- .orElseThrow(() -> new IllegalArgumentException("Invalid value for [" + CLUSTER_NODE_TYPE + "]: [" + nodeType + "]"));
- }
-
- public static boolean isValid(String nodeType) {
- return stream(values())
- .anyMatch(t -> nodeType.equals(t.value));
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-package org.sonar.process;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class NodeTypeTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Test
- public void test_parse() {
- assertThat(NodeType.parse("application")).isEqualTo(NodeType.APPLICATION);
- assertThat(NodeType.parse("search")).isEqualTo(NodeType.SEARCH);
- }
-
- @Test
- public void parse_an_unknown_value_must_throw_IAE() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Invalid value for ");
-
- NodeType.parse("XYZ");
- }
-}
import org.sonar.api.server.ServerSide;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
-import org.sonar.process.NodeType;
+import org.sonar.cluster.NodeType;
import org.sonar.process.ProcessProperties;
import static org.sonar.cluster.ClusterProperties.CLUSTER_ENABLED;
import static org.sonar.cluster.ClusterProperties.CLUSTER_NAME;
import static org.sonar.cluster.ClusterProperties.CLUSTER_NODE_TYPE;
import static org.sonar.cluster.ClusterProperties.CLUSTER_SEARCH_HOSTS;
-import static org.sonar.process.NodeType.SEARCH;
+import static org.sonar.cluster.NodeType.SEARCH;
@ComputeEngineSide
@ServerSide