diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-27 12:25:42 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-27 13:48:01 +0200 |
commit | 60a09b339533429a7eebecc75c21f36a45ee06ee (patch) | |
tree | 32f32771858b51aea12c69f3d073d8aa1bb0b33a /it/it-plugins/property-relocation-plugin | |
parent | 5050ad482cc23da9593fabf5e57863665f39aabd (diff) | |
download | sonarqube-60a09b339533429a7eebecc75c21f36a45ee06ee.tar.gz sonarqube-60a09b339533429a7eebecc75c21f36a45ee06ee.zip |
Move server category test from it-sonar
Diffstat (limited to 'it/it-plugins/property-relocation-plugin')
3 files changed, 69 insertions, 0 deletions
diff --git a/it/it-plugins/property-relocation-plugin/pom.xml b/it/it-plugins/property-relocation-plugin/pom.xml new file mode 100644 index 00000000000..1f3e0d353a6 --- /dev/null +++ b/it/it-plugins/property-relocation-plugin/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.sonarsource.it</groupId> + <artifactId>it-plugins</artifactId> + <version>5.2-SNAPSHOT</version> + </parent> + + <artifactId>property-relocation-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <description>Plugins :: Property Relocation</description> + + <dependencies> + <dependency> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-plugin-api</artifactId> + <version>${apiVersion}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-packaging-maven-plugin</artifactId> + <version>1.12.1</version> + <extensions>true</extensions> + <configuration> + <pluginClass>PropertyRelocationPlugin</pluginClass> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/property-relocation-plugin/src/main/java/CheckProperties.java b/it/it-plugins/property-relocation-plugin/src/main/java/CheckProperties.java new file mode 100644 index 00000000000..ef0a850440b --- /dev/null +++ b/it/it-plugins/property-relocation-plugin/src/main/java/CheckProperties.java @@ -0,0 +1,16 @@ +import org.sonar.api.BatchExtension; +import org.sonar.api.config.Settings; + +public class CheckProperties implements BatchExtension { + private Settings settings; + + public CheckProperties(Settings settings) { + this.settings = settings; + } + + public void start() { + if (settings.getBoolean("sonar.newKey") != true) { + throw new IllegalStateException("Property not found: sonar.newKey"); + } + } +} diff --git a/it/it-plugins/property-relocation-plugin/src/main/java/PropertyRelocationPlugin.java b/it/it-plugins/property-relocation-plugin/src/main/java/PropertyRelocationPlugin.java new file mode 100644 index 00000000000..f2e1e654215 --- /dev/null +++ b/it/it-plugins/property-relocation-plugin/src/main/java/PropertyRelocationPlugin.java @@ -0,0 +1,14 @@ +import java.util.Arrays; +import java.util.List; +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.SonarPlugin; + +@Properties({ + @Property(key = "sonar.newKey", deprecatedKey = "sonar.deprecatedKey", name = "New Key", category = "general") +}) +public class PropertyRelocationPlugin extends SonarPlugin { + public List getExtensions() { + return Arrays.asList(CheckProperties.class); + } +} |