diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-09-05 17:19:17 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-09-13 15:50:54 +0200 |
commit | b49a62254e8266d1a421ed626851c4f3bb780e0b (patch) | |
tree | 3a730607f575596957e31c08bd528b6465058420 /server/sonar-process | |
parent | 542c6c6f062a1897362606a62ca0ebe8938fd796 (diff) | |
download | sonarqube-b49a62254e8266d1a421ed626851c4f3bb780e0b.tar.gz sonarqube-b49a62254e8266d1a421ed626851c4f3bb780e0b.zip |
SONAR-9741 move NodeType to sonar-cluster
Diffstat (limited to 'server/sonar-process')
-rw-r--r-- | server/sonar-process/src/main/java/org/sonar/process/NodeType.java | 49 | ||||
-rw-r--r-- | server/sonar-process/src/test/java/org/sonar/process/NodeTypeTest.java | 47 |
2 files changed, 0 insertions, 96 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/NodeType.java b/server/sonar-process/src/main/java/org/sonar/process/NodeType.java deleted file mode 100644 index ecd8e44bc95..00000000000 --- a/server/sonar-process/src/main/java/org/sonar/process/NodeType.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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)); - } -} diff --git a/server/sonar-process/src/test/java/org/sonar/process/NodeTypeTest.java b/server/sonar-process/src/test/java/org/sonar/process/NodeTypeTest.java deleted file mode 100644 index 180600a5ecb..00000000000 --- a/server/sonar-process/src/test/java/org/sonar/process/NodeTypeTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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"); - } -} |