diff options
Diffstat (limited to 'server/process/sonar-dummy-app')
3 files changed, 178 insertions, 0 deletions
diff --git a/server/process/sonar-dummy-app/pom.xml b/server/process/sonar-dummy-app/pom.xml new file mode 100644 index 00000000000..4829cd17693 --- /dev/null +++ b/server/process/sonar-dummy-app/pom.xml @@ -0,0 +1,96 @@ +<?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/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.codehaus.sonar</groupId> + <artifactId>process</artifactId> + <version>4.5-SNAPSHOT</version> + <relativePath>../</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>sonar-dummy-app</artifactId> + <packaging>jar</packaging> + <name>SonarQube :: Process :: DummyApp</name> + <description>Dummy Application to test sonar-process</description> + + <dependencies> + <dependency> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-process</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <scope>provided</scope> + </dependency> + + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <scope>runtime</scope> + </dependency> + + <!-- testing --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.easytesting</groupId> + <artifactId>fest-assert</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-all</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>false</addClasspath> + <mainClass>org.sonar.application.DummyOkApp</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>2.3</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <keepDependenciesWithProvidedScope>false</keepDependenciesWithProvidedScope> + <minimizeJar>true</minimizeJar> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/server/process/sonar-dummy-app/src/main/java/org/sonar/application/DummyOkApp.java b/server/process/sonar-dummy-app/src/main/java/org/sonar/application/DummyOkApp.java new file mode 100644 index 00000000000..99adbd03125 --- /dev/null +++ b/server/process/sonar-dummy-app/src/main/java/org/sonar/application/DummyOkApp.java @@ -0,0 +1,58 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube 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. + * + * SonarQube 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.application; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sonar.process.MonitoredProcess; +import org.sonar.process.Props; + +import java.util.Properties; + +public class DummyOkApp extends MonitoredProcess { + + private static final Logger LOGGER = LoggerFactory.getLogger(DummyOkApp.class); + + protected DummyOkApp(Props props) throws Exception { + super(props); + } + + @Override + protected void doStart() { + LOGGER.info("Starting Dummy OK Process"); + } + + @Override + protected void doTerminate() { + LOGGER.info("Terminating Dummy OK Process"); + } + + @Override + protected boolean doIsReady() { + return false; + } + + public static void main(String[] args) throws Exception { + Props props = new Props(new Properties()); + props.set(MonitoredProcess.NAME_PROPERTY, DummyOkApp.class.getSimpleName()); + new DummyOkApp(props).start(); + System.exit(1); + } +} diff --git a/server/process/sonar-dummy-app/src/main/resources/org/sonar/application/logback.xml b/server/process/sonar-dummy-app/src/main/resources/org/sonar/application/logback.xml new file mode 100644 index 00000000000..933930557b9 --- /dev/null +++ b/server/process/sonar-dummy-app/src/main/resources/org/sonar/application/logback.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + Configuration for default logger. Only used while embedded server is starting, + before proper logging configuration is loaded. + + See http://logback.qos.ch/manual/configuration.html +--> +<configuration debug="false"> + <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/> + + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <pattern> + %d{yyyy.MM.dd HH:mm:ss} %-5level %msg%n + </pattern> + </encoder> + </appender> + + <root> + <level value="DEBUG"/> + <appender-ref ref="CONSOLE"/> + </root> +</configuration> |