-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from mirkosertic/master
Implementation of #113 Plugin Facility for Sputnik Processors
- Loading branch information
Showing
23 changed files
with
450 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/pl/touk/sputnik/processor/ReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package pl.touk.sputnik.processor; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.review.ReviewProcessor; | ||
|
||
public interface ReviewProcessorFactory<T extends ReviewProcessor> { | ||
|
||
boolean isEnabled(Configuration configuration); | ||
|
||
T create(Configuration configuration); | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/checkstyle/CheckstyleReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.checkstyle; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class CheckstyleReviewProcessorFactory implements ReviewProcessorFactory<CheckstyleProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.CHECKSTYLE_ENABLED)); | ||
} | ||
|
||
@Override | ||
public CheckstyleProcessor create(Configuration configuration) { | ||
return new CheckstyleProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/codenarc/NodeCardReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.codenarc; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class NodeCardReviewProcessorFactory implements ReviewProcessorFactory<CodeNarcProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.CODE_NARC_ENABLED)); | ||
} | ||
|
||
@Override | ||
public CodeNarcProcessor create(Configuration configuration) { | ||
return new CodeNarcProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/findbugs/FindbugsReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.findbugs; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class FindbugsReviewProcessorFactory implements ReviewProcessorFactory<FindBugsProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.FINDBUGS_ENABLED)); | ||
} | ||
|
||
@Override | ||
public FindBugsProcessor create(Configuration configuration) { | ||
return new FindBugsProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/jshint/JsHintReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.jshint; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class JsHintReviewProcessorFactory implements ReviewProcessorFactory<JsHintProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.JSHINT_ENABLED)); | ||
} | ||
|
||
@Override | ||
public JsHintProcessor create(Configuration configuration) { | ||
return new JsHintProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/jslint/JsLintReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.jslint; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class JsLintReviewProcessorFactory implements ReviewProcessorFactory<JsLintProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.JSLINT_ENABLED)); | ||
} | ||
|
||
@Override | ||
public JsLintProcessor create(Configuration configuration) { | ||
return new JsLintProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/pmd/PmdReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.pmd; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class PmdReviewProcessorFactory implements ReviewProcessorFactory<PmdProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.PMD_ENABLED)); | ||
} | ||
|
||
@Override | ||
public PmdProcessor create(Configuration configuration) { | ||
return new PmdProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/scalastyle/ScalastyleReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.scalastyle; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class ScalastyleReviewProcessorFactory implements ReviewProcessorFactory<ScalastyleProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.SCALASTYLE_ENABLED)); | ||
} | ||
|
||
@Override | ||
public ScalastyleProcessor create(Configuration configuration) { | ||
return new ScalastyleProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/sonar/SonarReviewProcessorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package pl.touk.sputnik.processor.sonar; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class SonarReviewProcessorFactory implements ReviewProcessorFactory<SonarProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.SONAR_ENABLED)); | ||
} | ||
|
||
@Override | ||
public SonarProcessor create(Configuration configuration) { | ||
return new SonarProcessor(configuration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/resources/META-INF/services/pl.touk.sputnik.processor.ReviewProcessorFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pl.touk.sputnik.processor.checkstyle.CheckstyleReviewProcessorFactory | ||
pl.touk.sputnik.processor.pmd.PmdReviewProcessorFactory | ||
pl.touk.sputnik.processor.findbugs.FindbugsReviewProcessorFactory | ||
pl.touk.sputnik.processor.scalastyle.ScalastyleReviewProcessorFactory | ||
pl.touk.sputnik.processor.codenarc.NodeCardReviewProcessorFactory | ||
pl.touk.sputnik.processor.jslint.JsLintReviewProcessorFactory | ||
pl.touk.sputnik.processor.jshint.JsHintReviewProcessorFactory | ||
pl.touk.sputnik.processor.sonar.SonarReviewProcessorFactory |
34 changes: 34 additions & 0 deletions
34
src/test/java/pl/touk/sputnik/processor/checkstyle/CheckstyleReviewProcessorFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package pl.touk.sputnik.processor.checkstyle; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class CheckstyleReviewProcessorFactoryTest { | ||
|
||
@Test | ||
public void testIsEnabled() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CHECKSTYLE_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new CheckstyleReviewProcessorFactory(); | ||
assertTrue(factory.isEnabled(configuration)); | ||
} | ||
|
||
@Test | ||
public void testCreate() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CHECKSTYLE_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new CheckstyleReviewProcessorFactory(); | ||
assertNotNull(factory.create(configuration)); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/test/java/pl/touk/sputnik/processor/codenarc/NodeCardReviewProcessorFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package pl.touk.sputnik.processor.codenarc; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class NodeCardReviewProcessorFactoryTest { | ||
|
||
@Test | ||
public void testIsEnabled() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CODE_NARC_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new NodeCardReviewProcessorFactory(); | ||
assertTrue(factory.isEnabled(configuration)); | ||
} | ||
|
||
@Test | ||
public void testCreate() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CODE_NARC_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new NodeCardReviewProcessorFactory(); | ||
assertNotNull(factory.create(configuration)); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/test/java/pl/touk/sputnik/processor/findbugs/FindbugsReviewProcessorFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package pl.touk.sputnik.processor.findbugs; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class FindbugsReviewProcessorFactoryTest { | ||
|
||
@Test | ||
public void testIsEnabled() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.FINDBUGS_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new FindbugsReviewProcessorFactory(); | ||
assertTrue(factory.isEnabled(configuration)); | ||
} | ||
|
||
@Test | ||
public void testCreate() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.FINDBUGS_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new FindbugsReviewProcessorFactory(); | ||
assertNotNull(factory.create(configuration)); | ||
} | ||
} |
Oops, something went wrong.