summaryrefslogtreecommitdiff
path: root/spec/integration/java/gradle_spec.rb
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-07-20 15:55:59 -0600
committermo khan <mo.khan@gmail.com>2020-07-21 16:46:02 -0600
commitb3faccb3e3007ddfd41ef251ad8a925542fe2500 (patch)
treec2389439b9d41193079daf29a7bb82b6127e1e88 /spec/integration/java/gradle_spec.rb
parente1bb260b43763a36536b7d3fa4d73108ffb604d4 (diff)
Update maven/gradle offline tests
* Let maven figure out the version of the license plugin that it is compatible with * Print the error when the setup fails * Add tests for multiple versions of maven and java * Install packages into a project specific directory to prevent cross test pollution * Specify the list of supported Maven versions * Update CHANGELOG and bump the version
Diffstat (limited to 'spec/integration/java/gradle_spec.rb')
-rw-r--r--spec/integration/java/gradle_spec.rb28
1 files changed, 16 insertions, 12 deletions
diff --git a/spec/integration/java/gradle_spec.rb b/spec/integration/java/gradle_spec.rb
index 0e71038..c2137b3 100644
--- a/spec/integration/java/gradle_spec.rb
+++ b/spec/integration/java/gradle_spec.rb
@@ -49,16 +49,20 @@ plugins {
end
end
- context 'when scanning a project that needs to connect to multiple TLS endpoints with different custom certificate chains', environment: 'offline' do
+ context 'when scanning a project that needs to connect to multiple TLS endpoints with different custom certificate chains' do
subject do
runner.scan(env: {
- 'ADDITIONAL_CA_CERT_BUNDLE' => fixture_file_content('java/gradle/offline-environment/bundle.crt'),
+ 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate('wildcard.test').read,
'PRIVATE_MAVEN_HOST' => private_maven_host
})
end
+ let(:private_maven_host) { 'maven.test' }
+
before do
- runner.mount(dir: fixture_file('java/gradle/offline-environment/'))
+ add_host('maven.test', '127.0.0.1')
+ start_proxy_server
+ runner.mount(dir: fixture_file('java/gradle/offline-environment'))
end
specify { expect(subject).to match_schema }
@@ -96,22 +100,22 @@ plugins {
end
context "when scanning a gradle project with a custom option to generate a profiler report" do
- let(:report) { runner.scan(env: { 'GRADLE_CLI_OPTS' => '--profile' }) }
+ subject { runner.scan(env: { 'GRADLE_CLI_OPTS' => '--profile' }) }
before do
- runner.add_file('build.gradle', fixture_file_content("java/11/build.gradle"))
+ runner.mount(dir: fixture_file("java/gradle/java-11"))
end
- specify { expect(report).to match_schema }
- specify { expect { report }.to change { Dir.glob("#{runner.project_path}/build/reports/profile/profile-*.html").count }.from(0).to(1) }
- specify { expect(report.dependency_names).to match_array(['postgresql']) }
- specify { expect(report.licenses_for('postgresql')).to match_array(['BSD-2-Clause']) }
+ specify { expect(subject).to match_schema }
+ specify { expect { subject }.to change { Dir.glob("#{runner.project_path}/build/reports/profile/profile-*.html").count }.from(0).to(1) }
+ specify { expect(subject.dependency_names).to match_array(['postgresql']) }
+ specify { expect(subject.licenses_for('postgresql')).to match_array(['BSD-2-Clause']) }
end
context 'when using Java 8 with version 1.* of gradle' do
before do
+ runner.mount(dir: fixture_file("java/gradle/java-8"))
runner.add_file('.tool-versions', "gradle 1.9")
- runner.add_file('build.gradle', fixture_file_content("java/8/build.gradle"))
end
it 'returns an empty report because the plugin we use does not work in this version of the gradle API' do
@@ -129,7 +133,7 @@ plugins {
before do
runner.add_file('.tool-versions', "gradle #{gradle_version}")
- runner.add_file('build.gradle.kts', fixture_file_content("java/build.gradle.kts"))
+ runner.add_file('build.gradle.kts', fixture_file_content("java/gradle/build.gradle.kts"))
runner.add_file('settings.gradle.kts', 'rootProject.name = "example"')
end
@@ -149,7 +153,7 @@ plugins {
before do
runner.add_file('.tool-versions', "gradle #{gradle_version}")
- runner.add_file('build.gradle', fixture_file_content("java/#{item[:java]}/build.gradle"))
+ runner.add_file('build.gradle', fixture_file_content("java/gradle/java-#{item[:java]}/build.gradle"))
runner.add_file('settings.gradle', 'rootProject.name = "example"')
end