File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
lib/java_buildpack/framework
spec/java_buildpack/framework Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,8 @@ def copy_appd_default_configuration(default_conf_dir)
145145 def check_if_resource_exists ( resource_uri , conf_file )
146146 # check if resource exists on remote server
147147 begin
148- response = Net ::HTTP . start ( resource_uri . host , resource_uri . port ) do |http |
148+ opts = { use_ssl : true } if resource_uri . scheme == 'https'
149+ response = Net ::HTTP . start ( resource_uri . host , resource_uri . port , opts ) do |http |
149150 http . request_head ( resource_uri )
150151 end
151152 rescue StandardError => e
Original file line number Diff line number Diff line change 164164 end
165165 component . compile
166166 end
167+
168+ end
169+
170+ context do
171+ let ( :environment ) { { 'APPD_CONF_HTTP_URL' => 'https://foo.com' } }
172+
173+ it 'sets APPD_CONF_HTTP_URL env var to download config files over HTTPS' ,
174+ cache_fixture : 'stub-app-dynamics-agent.zip' do
175+
176+ config_files = %w[ logging/log4j2.xml logging/log4j.xml app-agent-config.xml controller-info.xml
177+ service-endpoint.xml transactions.xml custom-interceptors.xml
178+ custom-activity-correlation.xml ]
179+
180+ config_files . each do |file |
181+ uri = "https://foo.com/java/#{ file } "
182+ allow ( application_cache ) . to receive ( :get )
183+ . with ( uri )
184+ allow ( Net ::HTTP ) . to receive ( :start ) . with ( 'foo.com' , 443 , use_ssl : true ) . and_call_original
185+ stub_request ( :head , uri )
186+ . with ( headers : { 'Accept' => '*/*' , 'Host' => 'foo.com' , 'User-Agent' => 'Ruby' } )
187+ . to_return ( status : 200 , body : '' , headers : { } )
188+ end
189+ component . compile
190+ end
167191 end
168192 end
169193 end
You can’t perform that action at this time.
0 commit comments