Skip to content

Commit

Permalink
Added no-warning assertions to some Maven and Gradle tests. (#1847)
Browse files Browse the repository at this point in the history
Bumped version numbers
  • Loading branch information
HSAR committed Jun 7, 2016
1 parent e4172e0 commit 597033c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 10 deletions.
3 changes: 0 additions & 3 deletions Tasks/Gradle/gradlesonar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import trm = require('vsts-task-lib/toolrunner');
import sqCommon = require('sonarqube-common/sonarqube-common');
import {SonarQubeEndpoint} from 'sonarqube-common/sonarqube-common';

// Set up localization resource file
tl.setResourcePath(path.join( __dirname, 'task.json'));

// Apply arguments to enable SonarQube analysis
export function applyEnabledSonarQubeArguments(gradleRun: trm.ToolRunner):trm.ToolRunner {
if (!isSonarQubeEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Gradle/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 41
"Patch": 42
},
"demands": [
"java"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Gradle/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 41
"Patch": 42
},
"demands": [
"java"
Expand Down
3 changes: 0 additions & 3 deletions Tasks/Maven/mavencodeanalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import pmd = require('./mavenpmd');
import {AnalysisResult} from './analysisresult';
import {ModuleAnalysis} from './moduleanalysis';

// Set up localization resource file
tl.setResourcePath(path.join( __dirname, 'task.json'));

// Cache build variables are cached globally as they cannot change during the same build.
var sourcesDir:string;
var stagingDir:string;
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Maven/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 51
"Patch": 52
},
"minimumAgentVersion": "1.89.0",
"instanceNameFormat": "Maven $(mavenPOMFile)",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Maven/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 51
"Patch": 52
},
"minimumAgentVersion": "1.89.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down
3 changes: 3 additions & 0 deletions Tests/L0/Gradle/_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ describe('gradle Suite', function() {
assert(tr.invokedToolCount == 1, 'should have only run gradle 1 time');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.stdout.indexOf('task.issue type=warning;') < 0, 'should not have produced any warnings');
assert(tr.ran('gradlew build'), 'it should have run only the default settings');
done();
})
Expand Down Expand Up @@ -683,6 +684,7 @@ describe('gradle Suite', function() {
assert(tr.invokedToolCount == 1, 'should have only run gradle 1 time');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.stdout.indexOf('task.issue type=warning;') < 0, 'should not have produced any warnings');
assert(tr.ran('gradlew build sonarqube -I /gradle/sonar.gradle -Dsonar.host.url=http://sonarqube/end/point -Dsonar.login=uname -Dsonar.password=pword -Dsonar.projectName=test_sqProjectName -Dsonar.projectKey=test_sqProjectKey -Dsonar.projectVersion=test_sqProjectVersion'),
'should have run the gradle wrapper with the appropriate SonarQube arguments');
done();
Expand Down Expand Up @@ -718,6 +720,7 @@ describe('gradle Suite', function() {
assert(tr.invokedToolCount == 1, 'should have only run gradle 1 time');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.stdout.indexOf('task.issue type=warning;') < 0, 'should not have produced any warnings');
assert(tr.ran('gradlew build sonarqube -I /gradle/sonar.gradle -Dsonar.host.url=http://sonarqube/end/point -Dsonar.login=uname -Dsonar.password=pword -Dsonar.jdbc.url=jdbc:test:tcp://localhost:8080/sonar -Dsonar.jdbc.username=testDbUsername -Dsonar.jdbc.password=testDbPassword -Dsonar.projectName=test_sqProjectName -Dsonar.projectKey=test_sqProjectKey -Dsonar.projectVersion=test_sqProjectVersion'),
'should have run the gradle wrapper with the appropriate SonarQube arguments');
done();
Expand Down
9 changes: 9 additions & 0 deletions Tests/L0/Maven/_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,8 @@ describe('Maven Suite', function() {
// Assert
assert(taskRunner.resultWasSet, 'should have set a result');
assert(taskRunner.stdout.length > 0, 'should have written to stdout');
assert(taskRunner.stderr.length == 0, 'should not have written to stderr');
assert(taskRunner.stdout.indexOf('task.issue type=warning;') < 0, 'should not have produced any warnings');
assert(taskRunner.succeeded, 'task should have succeeded');

assert(taskRunner.ran('/home/bin/maven/bin/mvn -f pom.xml package pmd:pmd'),
Expand Down Expand Up @@ -1072,6 +1074,8 @@ describe('Maven Suite', function() {
// Assert
assert(taskRunner.resultWasSet, 'should have set a result');
assert(taskRunner.stdout.length > 0, 'should have written to stdout');
assert(taskRunner.stderr.length == 0, 'should not have written to stderr');
assert(taskRunner.stdout.indexOf('task.issue type=warning;') < 0, 'should not have produced any warnings');
assert(taskRunner.succeeded, 'task should have succeeded');

assert(taskRunner.ran('/home/bin/maven/bin/mvn -f pom.xml package pmd:pmd'),
Expand Down Expand Up @@ -1129,6 +1133,8 @@ describe('Maven Suite', function() {
// Assert
assert(taskRunner.resultWasSet, 'should have set a result');
assert(taskRunner.stdout.length > 0, 'should have written to stdout');
assert(taskRunner.stderr.length == 0, 'should not have written to stderr');
assert(taskRunner.stdout.indexOf('task.issue type=warning;') < 0, 'should not have produced any warnings');
assert(taskRunner.succeeded, 'task should have succeeded');

assert(taskRunner.ran('/home/bin/maven/bin/mvn -f pom.xml package'),
Expand Down Expand Up @@ -1186,6 +1192,9 @@ describe('Maven Suite', function() {
assert(taskRunner.succeeded, 'task should not have failed');
assert(taskRunner.resultWasSet, 'should have set a result');
assert(taskRunner.stdout.length > 0, 'should have written to stdout');
assert(taskRunner.stderr.length == 0, 'should not have written to stderr');
assert(taskRunner.stdout.indexOf('task.issue type=warning;') < 0, 'should not have produced any warnings');
assert(taskRunner.succeeded, 'task should have succeeded');

assert(taskRunner.ran('/home/bin/maven/bin/mvn -f pom.xml package pmd:pmd'),
'should have run maven with the correct arguments');
Expand Down

0 comments on commit 597033c

Please sign in to comment.