Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
pipeline{

tools{
jdk 'myjava'
maven 'mymaven'
}
agent {label 'qa_server'}
stages{
stage('checkout'){
steps{
git branch:'qa' , url: 'https://github.com/sonal04devops/JavaWebCalculator.git'
}
}
stage('Compile'){

steps{
echo 'compiling..'
sh 'mvn compile'
}
}
stage('UnitTest'){

steps{
sh 'mvn test'
}
post {
success {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('Package'){

steps{
sh 'mvn package'
}
}

}
}
2 changes: 1 addition & 1 deletion src/main/java/mypackage/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public long subFucn(long first, long second){

public long mulFucn(long first, long second){

return first*second;
return first/second;
}


Expand Down
4 changes: 2 additions & 2 deletions src/test/java/mypackage/CalculatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public void threeMinusTwoIsOne() throws Exception {
assertThat(result, is(1L));
}

@Test

public void threeXThreeIsNine() throws Exception {
final long result = new Calculator().mulFucn(3, 3);
assertThat(result, is(9L));
}

}
}