Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Commit

Permalink
Fix dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasPohl committed Mar 14, 2018
1 parent 4118deb commit 4deef5d
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 18 deletions.
41 changes: 40 additions & 1 deletion pom.xml
Expand Up @@ -16,6 +16,8 @@

<sonar.buildVersion>6.7</sonar.buildVersion>
<jdk.min.version>1.7</jdk.min.version>
<sslr.version>1.22</sslr.version>
<version.shade.plugin>2.4.3</version.shade.plugin>
</properties>

<dependencies>
Expand All @@ -29,6 +31,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand All @@ -48,7 +51,7 @@
<dependency>
<groupId>org.sonarsource.sslr</groupId>
<artifactId>sslr-core</artifactId>
<version>1.22</version>
<version>${sslr.version}</version>
</dependency>
<!-- unit tests -->
<dependency>
Expand All @@ -73,6 +76,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.codehaus.sonar.sslr-squid-bridge</groupId> -->
Expand Down Expand Up @@ -101,6 +105,10 @@
<extensions>true</extensions>
<configuration>
<pluginClass>com.exxeta.iss.sonar.msgflow.MessageFlowPlugin</pluginClass>
<pluginName>Msgflow</pluginName>
<skipDependenciesPackaging>true</skipDependenciesPackaging>
<sonarLintSupported>false</sonarLintSupported>
<sonarQubeMinVersion>${sonar.buildVersion}</sonarQubeMinVersion>
</configuration>
</plugin>
<plugin>
Expand All @@ -122,6 +130,32 @@
<!--<execution> <goals> <goal>native2ascii</goal> </goals> </execution> -->
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${version.shade.plugin}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>cglib:cglib-nodep</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -160,5 +194,10 @@
<id>hesc</id>
<name>Hendrik Scholz</name>
</developer>
<developer>
<id>thpo</id>
<name>Thomas Pohl</name>
<email>thomas.pohl@exxeta.com</email>
</developer>
</developers>
</project>
Expand Up @@ -19,6 +19,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.config.Configuration;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.resources.AbstractLanguage;

Expand Down Expand Up @@ -48,16 +49,16 @@ public class MessageFlowLanguage extends AbstractLanguage {
/**
* Variable to hold the configuration settings.
*/
private MapSettings settings;
private Configuration configuration;

/**
* Construtor
*
* @param configuration The configuration settings set by IoC.
*/
public MessageFlowLanguage(MapSettings configuration) {
public MessageFlowLanguage(Configuration configuration) {
super(KEY, NAME);
this.settings = configuration;
this.configuration = configuration;
}

/* (non-Javadoc)
Expand All @@ -70,7 +71,7 @@ public MessageFlowLanguage(MapSettings configuration) {
*/
@Override
public String[] getFileSuffixes() {
String[] suffixes = settings.getStringArray(MessageFlowPlugin.FILE_SUFFIXES_KEY);
String[] suffixes = configuration.getStringArray(MessageFlowPlugin.FILE_SUFFIXES_KEY);
if (suffixes == null || suffixes.length == 0) {
suffixes = MessageFlowPlugin.FILE_SUFFIXES_DEFAULTVALUE;
}
Expand Down
Expand Up @@ -20,7 +20,7 @@
import java.util.Arrays;
import java.util.List;

import org.sonar.api.SonarPlugin;
import org.sonar.api.Plugin;

import com.exxeta.iss.sonar.msgflow.batch.AggregateControlSensor;
import com.exxeta.iss.sonar.msgflow.batch.CollectorNodeSensor;
Expand Down Expand Up @@ -60,7 +60,7 @@
*
* @author Hendrik Scholz (EXXETA AG)
*/
public class MessageFlowPlugin extends SonarPlugin {
public class MessageFlowPlugin implements Plugin {

/**
* The logger for the class.
Expand All @@ -81,17 +81,18 @@ public class MessageFlowPlugin extends SonarPlugin {
public static final String [] MAP_PATH_PATTERNS = {"**/*.map"};
public static final String [] ESQL_PATH_PATTERNS = {"**/*.esql"};
public static final String [] POM_PATH_PATTERNS = {"**/*pom.xml"};

@Override
public void define(Context context) {
context.addExtensions(getExtensions());
}

/* (non-Javadoc)
* @see org.sonar.api.Plugin#getExtensions()
*/
/**
* The method contains all classes necessary for the plug-in.
*
* @return a list of classes necessary for the plug-in
*/
@Override
public List getExtensions() {
public List<Class<? extends Object>> getExtensions() {
return Arrays.asList(
// Definitions
MessageFlowLanguage.class, // class extends AbstractLanguage
Expand Down
Expand Up @@ -19,6 +19,7 @@

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.internal.MapSettings;

Expand All @@ -28,17 +29,26 @@
* @author Hendrik Scholz (EXXETA AG)
*/
public class MessageFlowLanguageTest {


private MapSettings settings;
private MessageFlowLanguage msgflowLanguage;

@Before
public void setUp() {
settings = new MapSettings();
msgflowLanguage = new MessageFlowLanguage(settings.asConfig());
}

/**
* Test method for {@link com.exxeta.iss.sonar.msgflow.MessageFlowLanguage#getFileSuffixes()}.
*/
@Test
public final void testGetFileSuffixes() {
MessageFlowLanguage mfl = new MessageFlowLanguage(new MapSettings());
assertEquals(3, mfl.getFileSuffixes().length);
assertEquals(".msgflow", mfl.getFileSuffixes()[0]);
assertEquals(".subflow", mfl.getFileSuffixes()[1]);
assertEquals(".map", mfl.getFileSuffixes()[2]);
settings = new MapSettings();
assertEquals(3, msgflowLanguage.getFileSuffixes().length);
assertEquals(".msgflow", msgflowLanguage.getFileSuffixes()[0]);
assertEquals(".subflow", msgflowLanguage.getFileSuffixes()[1]);
assertEquals(".map", msgflowLanguage.getFileSuffixes()[2]);
// assertEquals(".esql", mfl.getFileSuffixes()[3]);
}

Expand Down

0 comments on commit 4deef5d

Please sign in to comment.