|
22 | 22 | describe JavaBuildpack::Framework::ContainerSecurityProvider do
|
23 | 23 | include_context 'with component help'
|
24 | 24 |
|
25 |
| - let(:java_home) do |
26 |
| - java_home = JavaBuildpack::Component::MutableJavaHome.new |
27 |
| - java_home.version = version_8 |
28 |
| - return java_home |
| 25 | + it 'always detects' do |
| 26 | + expect(component.detect).to eq("container-security-provider=#{version}") |
29 | 27 | end
|
30 | 28 |
|
31 |
| - let(:version_8) { JavaBuildpack::Util::TokenizedVersion.new('1.8.0_162') } |
| 29 | + it 'adds extension directory' do |
| 30 | + component.release |
32 | 31 |
|
33 |
| - let(:version_9) { JavaBuildpack::Util::TokenizedVersion.new('9.0.4_11') } |
34 |
| - |
35 |
| - it 'does not detect if not enabled' do |
36 |
| - expect(component.detect).to be_nil |
| 32 | + expect(extension_directories).to include(droplet.sandbox) |
37 | 33 | end
|
38 | 34 |
|
39 |
| - context 'when enabled' do |
| 35 | + it 'adds security provider', |
| 36 | + cache_fixture: 'stub-container-security-provider.jar' do |
40 | 37 |
|
41 |
| - let(:configuration) { { 'enabled' => true } } |
| 38 | + component.compile |
| 39 | + expect(security_providers[1]).to eq('org.cloudfoundry.security.CloudFoundryContainerProvider') |
| 40 | + end |
42 | 41 |
|
43 |
| - it 'detects if enabled' do |
44 |
| - expect(component.detect).to eq("container-security-provider=#{version}") |
45 |
| - end |
| 42 | + context do |
46 | 43 |
|
47 |
| - it 'adds extension directory' do |
48 |
| - component.release |
| 44 | + let(:java_home_delegate) do |
| 45 | + delegate = JavaBuildpack::Component::MutableJavaHome.new |
| 46 | + delegate.root = app_dir + '.test-java-home' |
| 47 | + delegate.version = JavaBuildpack::Util::TokenizedVersion.new('9.0.0') |
49 | 48 |
|
50 |
| - expect(extension_directories).to include(droplet.sandbox) |
| 49 | + delegate |
51 | 50 | end
|
52 | 51 |
|
53 |
| - it 'adds security provider', |
| 52 | + it 'adds JAR to classpath during compile in Java 9', |
54 | 53 | cache_fixture: 'stub-container-security-provider.jar' do
|
55 | 54 |
|
56 | 55 | component.compile
|
57 | 56 |
|
58 |
| - expect(security_providers[1]).to eq('org.cloudfoundry.security.CloudFoundryContainerProvider') |
| 57 | + expect(additional_libraries).to include(droplet.sandbox + "container_security_provider-#{version}.jar") |
59 | 58 | end
|
60 | 59 |
|
61 |
| - context 'when java 9' do |
62 |
| - |
63 |
| - it 'adds JAR to classpath during compile in Java 9', |
64 |
| - cache_fixture: 'stub-container-security-provider.jar' do |
65 |
| - |
66 |
| - java_home.version = version_9 |
67 |
| - |
68 |
| - component.compile |
69 |
| - |
70 |
| - expect(additional_libraries).to include(droplet.sandbox + "container_security_provider-#{version}.jar") |
71 |
| - end |
72 |
| - |
73 |
| - it 'adds JAR to classpath during release in Java 9' do |
74 |
| - java_home.version = version_9 |
75 |
| - |
76 |
| - component.release |
77 |
| - |
78 |
| - expect(additional_libraries).to include(droplet.sandbox + "container_security_provider-#{version}.jar") |
79 |
| - end |
80 |
| - |
81 |
| - it 'adds does not add extension directory in Java 9' do |
82 |
| - java_home.version = version_9 |
| 60 | + it 'adds JAR to classpath during release in Java 9' do |
| 61 | + component.release |
83 | 62 |
|
84 |
| - component.release |
| 63 | + expect(additional_libraries).to include(droplet.sandbox + "container_security_provider-#{version}.jar") |
| 64 | + end |
85 | 65 |
|
86 |
| - expect(extension_directories).not_to include(droplet.sandbox) |
87 |
| - end |
| 66 | + it 'adds does not add extension directory in Java 9' do |
| 67 | + component.release |
88 | 68 |
|
| 69 | + expect(extension_directories).not_to include(droplet.sandbox) |
89 | 70 | end
|
90 | 71 |
|
91 | 72 | end
|
|
0 commit comments