mirror of
https://github.com/ysoftdevs/gradle-training.git
synced 2026-01-11 22:41:09 +01:00
initial import of project
This commit is contained in:
15
01-build-and-test/build.gradle
Normal file
15
01-build-and-test/build.gradle
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apply plugin: 'java'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testCompile group: 'org.testng', name: 'testng', version: '6.+'
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useTestNG()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
19
01-build-and-test/src/main/java/Calculator.java
Normal file
19
01-build-and-test/src/main/java/Calculator.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
13
01-build-and-test/src/test/java/TestCalculator.java
Normal file
13
01-build-and-test/src/test/java/TestCalculator.java
Normal 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
20
02-pmd/build.gradle
Normal 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
|
||||||
|
}
|
||||||
|
|
||||||
24
02-pmd/src/main/java/Calculator.java
Normal file
24
02-pmd/src/main/java/Calculator.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
13
02-pmd/src/test/java/TestCalculator.java
Normal file
13
02-pmd/src/test/java/TestCalculator.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
03-checkstyle/build.gradle
Normal file
24
03-checkstyle/build.gradle
Normal 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
|
||||||
|
}
|
||||||
11
03-checkstyle/config/checkstyle/checkstyle.xml
Normal file
11
03-checkstyle/config/checkstyle/checkstyle.xml
Normal 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>
|
||||||
|
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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
35
04-findbugs/build.gradle
Normal 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'
|
||||||
|
}
|
||||||
|
|
||||||
11
04-findbugs/config/checkstyle/checkstyle.xml
Normal file
11
04-findbugs/config/checkstyle/checkstyle.xml
Normal 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>
|
||||||
|
|
||||||
29
04-findbugs/src/main/java/com/ysoft/training/Calculator.java
Normal file
29
04-findbugs/src/main/java/com/ysoft/training/Calculator.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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
21
05-jdepend/build.gradle
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
14
05-jdepend/src/main/java/com/ysoft/circle/Circulator.java
Normal file
14
05-jdepend/src/main/java/com/ysoft/circle/Circulator.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
37
05-jdepend/src/main/java/com/ysoft/training/Calculator.java
Normal file
37
05-jdepend/src/main/java/com/ysoft/training/Calculator.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
06-maven-deployer/build.gradle
Normal file
28
06-maven-deployer/build.gradle
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user