Repository navigation
Expand file tree
/
Copy pathspring_boot_cli_spec.rb
More file actions
112 lines (81 loc) · 3.54 KB
/
Copy pathspring_boot_cli_spec.rb
File metadata and controls
112 lines (81 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# frozen_string_literal: true
# Cloud Foundry Java Buildpack
# Copyright 2013-2019 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'spec_helper'
require 'component_helper'
require 'java_buildpack/container/spring_boot_cli'
describe JavaBuildpack::Container::SpringBootCLI do
include_context 'with component help'
it 'does not detect a non-Groovy project',
app_fixture: 'container_main' do
expect(component.detect).to be_nil
end
it 'does not detect a .groovy directory',
app_fixture: 'container_groovy_dot_groovy' do
expect(component.detect).to be_nil
end
it 'does not detect if the application has a WEB-INF directory',
app_fixture: 'container_spring_boot_cli_groovy_with_web_inf' do
expect(component.detect).to be_nil
end
it 'does not detect if one of the Groovy files is not a POGO',
app_fixture: 'container_spring_boot_cli_non_pogo' do
expect(component.detect).to be_nil
end
it 'does not detect if one of the Groovy files has a shebang',
app_fixture: 'container_groovy_shebang' do
expect(component.detect).to be_nil
end
it 'does not detect Logback Groovy files',
app_fixture: 'container_groovy_logback' do
expect(component.detect).to be_nil
end
it 'does not detect a Groovy file which has a shebang but which also contains a class',
app_fixture: 'container_groovy_shebang_containing_class' do
expect(component.detect).to be_nil
end
it 'does not detect if one of the Groovy files has a main() method',
app_fixture: 'container_spring_boot_cli_main_method' do
expect(component.detect).to be_nil
end
it 'detects if there are Groovy files and they are all POGOs plus a beans-style configuration',
app_fixture: 'container_spring_boot_cli_beans_configuration' do
expect(component.detect).to eq("spring-boot-cli=#{version}")
end
it 'detects if there are Groovy files and they are all POGOs with no main method and there is no WEB-INF directory',
app_fixture: 'container_spring_boot_cli_valid_app' do
expect(component.detect).to eq("spring-boot-cli=#{version}")
end
it 'extracts Spring Boot CLI from a ZIP',
app_fixture: 'container_spring_boot_cli_valid_app',
cache_fixture: 'stub-spring-boot-cli.tar.gz' do
component.compile
expect(sandbox + 'bin/spring').to exist
end
it 'returns command',
app_fixture: 'container_spring_boot_cli_valid_app' do
expect(component.release).to eq("#{env_vars_str} #{java_home.as_env_var} " \
'exec $PWD/.java-buildpack/spring_boot_cli/bin/spring run ' \
'-cp $PWD/.additional_libs/test-jar-1.jar:$PWD/.additional_libs/test-jar-2.jar:' \
'$PWD/.root_libs/test-jar-3.jar:$PWD/.root_libs/test-jar-4.jar ' \
'directory/pogo_4.groovy invalid.groovy pogo_1.groovy pogo_2.groovy pogo_3.groovy')
end
def env_vars_str
environment_variables.join(' ')
end
def java_opts_str
"\"#{java_opts.join(' ')}\""
end
end