Skip to content

Commit 0d79de1

Browse files
Jaime Salas ZancadaJaime Salas Zancada
authored andcommitted
added gradle code CI-CD exercise
1 parent f1e319a commit 0d79de1

File tree

14 files changed

+374
-1
lines changed

14 files changed

+374
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# calculator
2+
Java + Gradle repository to learn Jenkins
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
plugins {
2+
id 'org.springframework.boot' version '2.3.4.RELEASE'
3+
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
4+
id 'java'
5+
}
6+
7+
group = 'com.lemoncode'
8+
version = '0.0.1-SNAPSHOT'
9+
sourceCompatibility = '1.8'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
// implementation 'org.springframework.boot:spring-boot-starter'
17+
implementation 'org.springframework.boot:spring-boot-starter-web'
18+
19+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
20+
// testImplementation('org.springframework.boot:spring-boot-starter-test') {
21+
// exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
22+
// }
23+
}
24+
25+
test {
26+
// useJUnitPlatform()
27+
}
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

03-cd/exercises/jenkins-resources/calculator/gradlew

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

03-cd/exercises/jenkins-resources/calculator/gradlew.bat

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'calculator'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.lemoncode.calculator;
2+
import org.springframework.stereotype.Service;
3+
4+
@Service
5+
public class Calculator {
6+
int sum(int a, int b) {
7+
return a + b;
8+
}
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.lemoncode.calculator;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class CalculatorApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(CalculatorApplication.class, args);
11+
}
12+
13+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.lemoncode.calculator;
2+
import org.springframework.beans.factory.annotation.Autowired;
3+
import org.springframework.web.bind.annotation.RequestMapping;
4+
import org.springframework.web.bind.annotation.RequestParam;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
@RestController
8+
class CalculatorController {
9+
@Autowired
10+
private Calculator calculator;
11+
12+
@RequestMapping("/sum")
13+
String sum(@RequestParam("a") Integer a,
14+
@RequestParam("b") Integer b) {
15+
return String.valueOf(calculator.sum(a, b));
16+
}
17+
}

0 commit comments

Comments
 (0)