diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-02-04 17:54:57 +0300 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-02-04 19:48:41 +0300 |
commit | 547e8323146ec2f0f602ce6f4c325c9ed0ecbb18 (patch) | |
tree | 55e330b2b9959bdcf46ebde624f96766d6bb4d76 /sonar-plugin-api | |
parent | ea8d694355aac5dc93de2650e11d802c6bb3e3d5 (diff) | |
download | sonarqube-547e8323146ec2f0f602ce6f4c325c9ed0ecbb18.tar.gz sonarqube-547e8323146ec2f0f602ce6f4c325c9ed0ecbb18.zip |
Replace enum Environment by class EnvironmentInformation
* Each environment should provide key and version
* Plugins for Maven 2.x and Maven 3.x have same key "Maven"
and provide a real version of Maven
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java | 50 | ||||
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/platform/EnvironmentTest.java | 52 |
2 files changed, 0 insertions, 102 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java deleted file mode 100644 index 57d36283fe9..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.api.platform; - -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; - -/** - * @since 2.2 - */ -public enum Environment implements BatchComponent, ServerComponent { - - /* - * When will GRADLE, ANT, ECLIPSE, INTELLIJ_IDEA be added to this list ? :-) - */ - SERVER, MAVEN3, MAVEN2, ANT; - - public boolean isServer() { - return this==SERVER; - } - - public boolean isMaven2Batch() { - return this==MAVEN2; - } - - public boolean isMaven3Batch() { - return this==MAVEN3; - } - - public boolean isBatch() { - return isMaven2Batch() || isMaven3Batch(); - } -} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/platform/EnvironmentTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/platform/EnvironmentTest.java deleted file mode 100644 index 81ecf2389c4..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/platform/EnvironmentTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.api.platform; - -import org.junit.Test; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - -public class EnvironmentTest { - - @Test - public void testMaven2() { - assertThat(Environment.MAVEN2.isBatch(), is(true)); - assertThat(Environment.MAVEN2.isMaven2Batch(), is(true)); - assertThat(Environment.MAVEN2.isMaven3Batch(), is(false)); - assertThat(Environment.MAVEN2.isServer(), is(false)); - } - - @Test - public void testMaven3() { - assertThat(Environment.MAVEN3.isBatch(), is(true)); - assertThat(Environment.MAVEN3.isMaven2Batch(), is(false)); - assertThat(Environment.MAVEN3.isMaven3Batch(), is(true)); - assertThat(Environment.MAVEN3.isServer(), is(false)); - } - - @Test - public void testServer() { - assertThat(Environment.SERVER.isBatch(), is(false)); - assertThat(Environment.SERVER.isMaven2Batch(), is(false)); - assertThat(Environment.SERVER.isMaven3Batch(), is(false)); - assertThat(Environment.SERVER.isServer(), is(true)); - } -} |