From 5f8e27bbc052763174f8080154f33d1727960966 Mon Sep 17 00:00:00 2001 From: Preeti Sawant Date: Wed, 22 Jul 2020 12:52:02 -0400 Subject: [PATCH] compression feature added --- lib/liberty_buildpack/container/liberty.rb | 1 + .../liberty_buildpack/container/liberty_spec.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/liberty_buildpack/container/liberty.rb b/lib/liberty_buildpack/container/liberty.rb index 229615aa0..c1db784b8 100644 --- a/lib/liberty_buildpack/container/liberty.rb +++ b/lib/liberty_buildpack/container/liberty.rb @@ -473,6 +473,7 @@ def update_http_endpoint(server_xml_doc) endpoint.add_attribute('host', '*') end endpoint.add_attribute('httpPort', "${#{KEY_HTTP_PORT}}") + endpoint.add_element('compression') endpoint.delete_attribute('httpsPort') end diff --git a/spec/liberty_buildpack/container/liberty_spec.rb b/spec/liberty_buildpack/container/liberty_spec.rb index 170ba2d54..8e891e26c 100644 --- a/spec/liberty_buildpack/container/liberty_spec.rb +++ b/spec/liberty_buildpack/container/liberty_spec.rb @@ -1298,6 +1298,23 @@ def check_appstate(app_xml, app_name, configuration = default_configuration) end end + def check_compression_feature(app_xml, app_name, configuration = default_configuration) + Dir.mktmpdir do |root| + root = File.join(root, 'app') + generate(root, app_xml, configuration) + liberty_directory = File.join root, '.liberty' + expect(Dir.exist?(liberty_directory)).to eq(true) + server_xml_file = File.join(root, 'wlp', 'usr', 'servers', 'myServer', 'server.xml') + server_xml_contents = File.read(server_xml_file) + expect(server_xml_contents).to include("") + expect(server_xml_contents).to include("") + expect(server_xml_contents).to include("") + expect(server_xml_contents).to include("") + expect(server_xml_contents).to include('') + expect(server_xml_contents).to match(/httpEndpoint id="defaultHttpEndpoint" host="127.0.0.1"/) + end + end + def check_no_appstate(app_xml, configuration = default_configuration) Dir.mktmpdir do |root| root = File.join(root, 'app')