aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/build.gradle13
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/ClusterFeature.java31
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/telemetry/LicenseReader.java32
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/util/GlobalLockManager.java59
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java57
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java56
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/GlobalLockManagerTest.java76
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java63
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/LongTypeValidationTest.java62
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java56
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java47
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java47
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationModuleTest.java34
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java72
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTesting.java40
15 files changed, 0 insertions, 745 deletions
diff --git a/server/sonar-server/build.gradle b/server/sonar-server/build.gradle
index 13ff9a20c67..063ee7dcfcb 100644
--- a/server/sonar-server/build.gradle
+++ b/server/sonar-server/build.gradle
@@ -80,16 +80,3 @@ dependencies {
runtime 'io.jsonwebtoken:jjwt-jackson'
}
-
-task testJar(type: Jar) {
- classifier = 'tests'
- from sourceSets.test.output
-}
-
-configurations {
- tests
-}
-
-artifacts {
- tests testJar
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ClusterFeature.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ClusterFeature.java
deleted file mode 100644
index 24d8617a4e1..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/ClusterFeature.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.platform;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-@ServerSide
-@ExtensionPoint
-public interface ClusterFeature {
-
- boolean isEnabled();
-
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/telemetry/LicenseReader.java b/server/sonar-server/src/main/java/org/sonar/server/telemetry/LicenseReader.java
deleted file mode 100644
index 22029d62a36..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/telemetry/LicenseReader.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.telemetry;
-
-import java.util.Optional;
-import org.sonar.api.server.ServerSide;
-
-@ServerSide
-public interface LicenseReader {
- Optional<License> read();
-
- interface License {
- String getType();
- }
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/util/GlobalLockManager.java b/server/sonar-server/src/main/java/org/sonar/server/util/GlobalLockManager.java
deleted file mode 100644
index 81f13b22a1d..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/util/GlobalLockManager.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-
-/**
- * Provide a simple mechanism to manage global locks across multiple nodes running in a cluster.
- * In the target use case multiple nodes try to execute something at around the same time,
- * and only the first should succeed, and the rest do nothing.
- */
-@ComputeEngineSide
-@ServerSide
-public class GlobalLockManager {
-
- static final int DEFAULT_LOCK_DURATION_SECONDS = 180;
-
- private final DbClient dbClient;
-
- public GlobalLockManager(DbClient dbClient) {
- this.dbClient = dbClient;
- }
-
- /**
- * Try to acquire a lock on the given name in the default namespace,
- * using the generic locking mechanism of {@see org.sonar.db.property.InternalPropertiesDao}.
- */
- public boolean tryLock(String name) {
- return tryLock(name, DEFAULT_LOCK_DURATION_SECONDS);
- }
-
- public boolean tryLock(String name, int durationSecond) {
- try (DbSession dbSession = dbClient.openSession(false)) {
- boolean success = dbClient.internalPropertiesDao().tryLock(dbSession, name, durationSecond);
- dbSession.commit();
- return success;
- }
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java
deleted file mode 100644
index d11c03152b8..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.server.exceptions.BadRequestException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class BooleanTypeValidationTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private BooleanTypeValidation underTest = new BooleanTypeValidation();
-
- @Test
- public void key() {
- assertThat(underTest.key()).isEqualTo("BOOLEAN");
- }
-
- @Test
- public void not_fail_on_valid_boolean() {
- underTest.validate("true", null);
- underTest.validate("True", null);
- underTest.validate("false", null);
- underTest.validate("FALSE", null);
- }
-
- @Test
- public void fail_on_invalid_boolean() {
- expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("Value 'abc' must be one of \"true\" or \"false\".");
-
- underTest.validate("abc", null);
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java
deleted file mode 100644
index b88c3fbb651..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.server.exceptions.BadRequestException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class FloatTypeValidationTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private FloatTypeValidation validation = new FloatTypeValidation();
-
- @Test
- public void key() {
- assertThat(validation.key()).isEqualTo("FLOAT");
- }
-
- @Test
- public void not_fail_on_valid_float() {
- validation.validate("10.2", null);
- validation.validate("10", null);
- validation.validate("-10.3", null);
- }
-
- @Test
- public void fail_on_invalid_float() {
- expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("Value 'abc' must be an floating point number.");
-
- validation.validate("abc", null);
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/GlobalLockManagerTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/GlobalLockManagerTest.java
deleted file mode 100644
index 8a069e1eae2..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/GlobalLockManagerTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.sonar.server.util.GlobalLockManager.DEFAULT_LOCK_DURATION_SECONDS;
-
-public class GlobalLockManagerTest {
-
- private final System2 system2 = mock(System2.class);
-
- @Rule
- public final DbTester dbTester = DbTester.create(system2);
-
- private final GlobalLockManager underTest = new GlobalLockManager(dbTester.getDbClient());
-
- @Test
- public void tryLock_succeeds_when_created_for_the_first_time() {
- assertThat(underTest.tryLock("newName")).isTrue();
- }
-
- @Test
- public void tryLock_fails_when_previous_lock_is_too_recent() {
- String name = "newName";
- assertThat(underTest.tryLock(name)).isTrue();
- assertThat(underTest.tryLock(name)).isFalse();
- }
-
- @Test
- public void tryLock_succeeds_when_previous_lock_is_old_enough() {
- String name = "newName";
- long firstLock = 0;
- long longEnoughAfterFirstLock = firstLock + DEFAULT_LOCK_DURATION_SECONDS * 1000;
- long notLongEnoughAfterFirstLock = longEnoughAfterFirstLock - 1;
-
- when(system2.now()).thenReturn(firstLock);
- assertThat(underTest.tryLock(name)).isTrue();
-
- when(system2.now()).thenReturn(notLongEnoughAfterFirstLock);
- assertThat(underTest.tryLock(name)).isFalse();
-
- when(system2.now()).thenReturn(longEnoughAfterFirstLock);
- assertThat(underTest.tryLock(name)).isTrue();
- }
-
- @Test
- public void locks_with_different_name_are_independent() {
- assertThat(underTest.tryLock("newName1")).isTrue();
- assertThat(underTest.tryLock("newName2")).isTrue();
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java
deleted file mode 100644
index e9b1953dd5a..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.server.exceptions.BadRequestException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class IntegerTypeValidationTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private IntegerTypeValidation validation = new IntegerTypeValidation();
-
- @Test
- public void key() {
- assertThat(validation.key()).isEqualTo("INTEGER");
- }
-
- @Test
- public void not_fail_on_valid_integer() {
- validation.validate("10", null);
- validation.validate("-10", null);
- }
-
- @Test
- public void fail_on_string() {
- expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("Value 'abc' must be an integer.");
-
- validation.validate("abc", null);
- }
-
- @Test
- public void fail_on_float() {
- expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("Value '10.1' must be an integer.");
-
- validation.validate("10.1", null);
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/LongTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/LongTypeValidationTest.java
deleted file mode 100644
index 2f7d7e0946e..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/LongTypeValidationTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.PropertyType;
-import org.sonar.server.exceptions.BadRequestException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LongTypeValidationTest {
-
- LongTypeValidation underTest = new LongTypeValidation();
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Test
- public void key_is_long_type_name() {
- assertThat(underTest.key()).isEqualTo(PropertyType.LONG.name());
- }
-
- @Test
- public void do_not_fail_with_long_values() {
- underTest.validate("1984", null);
- underTest.validate("-1984", null);
- }
-
- @Test
- public void fail_when_float() {
- expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("Value '3.14' must be a long.");
-
- underTest.validate("3.14", null);
- }
-
- @Test
- public void fail_when_string() {
- expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("Value 'original string' must be a long.");
-
- underTest.validate("original string", null);
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java
deleted file mode 100644
index 9f2630fd0de..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.server.exceptions.BadRequestException;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class StringListTypeValidationTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private StringListTypeValidation validation = new StringListTypeValidation();
-
- @Test
- public void key() {
- assertThat(validation.key()).isEqualTo("SINGLE_SELECT_LIST");
- }
-
- @Test
- public void not_fail_on_valid_option() {
- validation.validate("a", newArrayList("a", "b", "c"));
- validation.validate("a", null);
- }
-
- @Test
- public void fail_on_invalid_option() {
- expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("Value 'abc' must be one of : a, b, c.");
-
- validation.validate("abc", newArrayList("a", "b", "c"));
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java
deleted file mode 100644
index dde3afa3543..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class StringTypeValidationTest {
-
- StringTypeValidation validation;
-
- @Before
- public void setUp() {
- validation = new StringTypeValidation();
- }
-
- @Test
- public void key() {
- assertThat(validation.key()).isEqualTo("STRING");
- }
-
- @Test
- public void not_fail_on_valid_string() {
- validation.validate("10", null);
- validation.validate("abc", null);
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java
deleted file mode 100644
index 4261f95c580..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TextTypeValidationTest {
-
- TextTypeValidation validation;
-
- @Before
- public void setUp() {
- validation = new TextTypeValidation();
- }
-
- @Test
- public void key() {
- assertThat(validation.key()).isEqualTo("TEXT");
- }
-
- @Test
- public void not_fail_on_valid_text() {
- validation.validate("10", null);
- validation.validate("abc", null);
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationModuleTest.java
deleted file mode 100644
index 3ff709c8f0f..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationModuleTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TypeValidationModuleTest {
- @Test
- public void verify_count_of_added_components() {
- ComponentContainer container = new ComponentContainer();
- new TypeValidationModule().configure(container);
- assertThat(container.size()).isEqualTo(11);
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java
deleted file mode 100644
index 4dbae47cb37..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import org.junit.Test;
-import org.sonar.server.exceptions.BadRequestException;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class TypeValidationsTest {
-
- @Test
- public void validate() {
- TypeValidation fakeTypeValidation = mock(TypeValidation.class);
- when(fakeTypeValidation.key()).thenReturn("Fake");
-
- TypeValidations typeValidations = new TypeValidations(newArrayList(fakeTypeValidation));
- typeValidations.validate("10", "Fake", newArrayList("a"));
-
- verify(fakeTypeValidation).validate("10", newArrayList("a"));
- }
-
- @Test
- public void validate__multiple_values() {
- TypeValidation fakeTypeValidation = mock(TypeValidation.class);
- when(fakeTypeValidation.key()).thenReturn("Fake");
-
- TypeValidations typeValidations = new TypeValidations(newArrayList(fakeTypeValidation));
- typeValidations.validate(newArrayList("10", "11", "12"), "Fake", newArrayList("11"));
-
- verify(fakeTypeValidation).validate("10", newArrayList("11"));
- }
-
- @Test
- public void fail_on_unknown_type() {
- TypeValidation fakeTypeValidation = mock(TypeValidation.class);
- when(fakeTypeValidation.key()).thenReturn("Fake");
-
- try {
- TypeValidations typeValidations = new TypeValidations(newArrayList(fakeTypeValidation));
- typeValidations.validate("10", "Unknown", null);
- fail();
- } catch (Exception e) {
- assertThat(e).isInstanceOf(BadRequestException.class);
- BadRequestException badRequestException = (BadRequestException) e;
- assertThat(badRequestException.getMessage()).isEqualTo("Type 'Unknown' is not valid.");
- }
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTesting.java b/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTesting.java
deleted file mode 100644
index b237ba62aab..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTesting.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.server.util;
-
-import java.util.Arrays;
-
-public class TypeValidationsTesting {
- private TypeValidationsTesting() {
- // utility class
- }
-
- public static TypeValidations newFullTypeValidations() {
- return new TypeValidations(Arrays.asList(
- new BooleanTypeValidation(),
- new IntegerTypeValidation(),
- new LongTypeValidation(),
- new FloatTypeValidation(),
- new StringTypeValidation(),
- new StringListTypeValidation(),
- new MetricLevelTypeValidation()
- ));
- }
-}