initial import of project

This commit is contained in:
Juraj Michalek
2014-04-10 19:40:37 +02:00
parent e935e81271
commit 704f165b38
21 changed files with 436 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.+'
}
test {
useTestNG()
}

View File

@@ -0,0 +1,19 @@
public class Calculator {
/** Internal counter */
private int counter;
Calculator() {
counter = 0;
}
public int getCounter() {
return counter;
}
void add(int i) {
counter += i;
}
}

View File

@@ -0,0 +1,13 @@
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestCalculator {
@Test
public void testAdd() {
Calculator calc = new Calculator();
calc.add(1);
Assert.assertEquals(calc.getCounter(), 1);
}
}

20
02-pmd/build.gradle Normal file
View File

@@ -0,0 +1,20 @@
apply plugin: 'java'
apply plugin: 'pmd'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.+'
}
test {
useTestNG()
}
pmdMain {
ruleSets = [ "basic", "strings" ]
ignoreFailures = true
}

View File

@@ -0,0 +1,24 @@
public class Calculator {
/** Internal counter */
private int counter;
Calculator() {
counter = 0;
}
public int getCounter() {
return counter;
}
void add(int i) {
// Generate PMD warning
if (i==1) {
}
counter += i;
}
}

View File

@@ -0,0 +1,13 @@
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestCalculator {
@Test
public void testAdd() {
Calculator calc = new Calculator();
calc.add(1);
Assert.assertEquals(calc.getCounter(), 1);
}
}

View File

@@ -0,0 +1,24 @@
apply plugin: 'java'
apply plugin: 'pmd'
apply plugin: 'checkstyle'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.+'
}
test {
useTestNG()
}
pmdMain {
ruleSets = [ "basic", "strings" ]
ignoreFailures = true
}
tasks.withType(Checkstyle) {
ignoreFailures = true
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="UnusedImports"/>
</module>
</module>

View File

@@ -0,0 +1,29 @@
package com.ysoft.training;
// Generate Checkstyle warning - unused import
import java.util.Date;
public class Calculator {
/** Internal counter */
private int counter;
Calculator() {
counter = 0;
}
public int getCounter() {
return counter;
}
void add(int i) {
// Generate PMD warning
if (i==1) {
}
counter += i;
}
}

View File

@@ -0,0 +1,16 @@
package com.ysoft.training;
import com.ysoft.training.Calculator;
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestCalculator {
@Test
public void testAdd() {
Calculator calc = new Calculator();
calc.add(1);
Assert.assertEquals(calc.getCounter(), 1);
}
}

35
04-findbugs/build.gradle Normal file
View File

@@ -0,0 +1,35 @@
apply plugin: 'java'
apply plugin: 'pmd'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.+'
}
test {
useTestNG()
}
pmdMain {
ruleSets = [ "basic", "strings" ]
ignoreFailures = true
}
tasks.withType(Checkstyle) {
ignoreFailures = true
}
tasks.withType(FindBugs) {
reports {
xml.enabled false
html.enabled true
}
ignoreFailures = true
reportLevel = 'low'
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="UnusedImports"/>
</module>
</module>

View File

@@ -0,0 +1,29 @@
package com.ysoft.training;
// Generate Checkstyle warning - unused import
import java.util.Date;
public class Calculator {
/** Internal counter */
private int counter;
Calculator() {
counter = 0;
}
public int getCounter() {
return counter;
}
void add(int i) {
// Generate PMD warning
if (i==1) {
}
counter += i;
}
}

View File

@@ -0,0 +1,16 @@
package com.ysoft.training;
import com.ysoft.training.Calculator;
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestCalculator {
@Test
public void testAdd() {
Calculator calc = new Calculator();
calc.add(1);
Assert.assertEquals(calc.getCounter(), 1);
}
}

21
05-jdepend/build.gradle Normal file
View File

@@ -0,0 +1,21 @@
apply plugin: 'java'
apply plugin: 'jdepend'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.+'
}
test {
useTestNG()
}
tasks.withType(JDepend) {
reports {
xml.enabled false
text.enabled true
}
}

View File

@@ -0,0 +1,14 @@
package com.ysoft.circle;
// Create circular dependency for JDepend
import com.ysoft.training.Calculator;
public class Circulator {
public int compute() {
Calculator calc = new Calculator();
calc.add(1);
return calc.getCounter();
}
}

View File

@@ -0,0 +1,37 @@
package com.ysoft.training;
// Generate Checkstyle warning - unused import
import java.util.Date;
// Circular dependency for JDepend
import com.ysoft.circle.Circulator;
public class Calculator {
/** Internal counter */
private int counter;
public Calculator() {
counter = 0;
}
public int getCounter() {
return counter;
}
public int getCirculator() {
Circulator circ = new Circulator();
return circ.compute();
}
public void add(int i) {
// Generate PMD warning
if (i==1) {
}
counter += i;
}
}

View File

@@ -0,0 +1,16 @@
package com.ysoft.training;
import com.ysoft.training.Calculator;
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestCalculator {
@Test
public void testAdd() {
Calculator calc = new Calculator();
calc.add(1);
Assert.assertEquals(calc.getCounter(), 1);
}
}

View File

@@ -0,0 +1,28 @@
apply plugin: 'java'
apply plugin: 'maven'
version = '0.1-SNAPSHOT'
group = 'com.sinusgear.training'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.+'
}
test {
useTestNG()
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///idea/training/repo")
// use timestamp, e.g.: 06-maven-deployer-0.1-20140408.195954-2
uniqueVersion = true
}
}
}

View File

@@ -0,0 +1,29 @@
package com.ysoft.training;
// Generate Checkstyle warning - unused import
import java.util.Date;
public class Calculator {
/** Internal counter */
private int counter;
Calculator() {
counter = 0;
}
public int getCounter() {
return counter;
}
void add(int i) {
// Generate PMD warning
if (i==1) {
}
counter += i;
}
}

View File

@@ -0,0 +1,16 @@
package com.ysoft.training;
import com.ysoft.training.Calculator;
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestCalculator {
@Test
public void testAdd() {
Calculator calc = new Calculator();
calc.add(1);
Assert.assertEquals(calc.getCounter(), 1);
}
}