Skip to content

Commit

Permalink
Merge branch 'Add-missing-logging-dependencies-for-GemFire'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Frost committed Jan 29, 2016
2 parents 35e7995 + 5ceccb1 commit 5194155
Show file tree
Hide file tree
Showing 18 changed files with 503 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AllCops:
- 'build/**/*'
- 'vendor/**/*'
Metrics/AbcSize:
Max: 18
Max: 22
Metrics/ClassLength:
Max: 200
Metrics/CyclomaticComplexity:
Expand Down
19 changes: 17 additions & 2 deletions config/tomcat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,23 @@ gemfire_store:
version: 8.+
repository_root: ! '{default.repository.root}/gem-fire-security'
gemfire_logging:
version: 1.5.8
version: 1.7.7
repository_root: ! '{default.repository.root}/slf4j-jdk14'
gemfire_logging_api:
version: 1.5.8
version: 1.7.7
repository_root: ! '{default.repository.root}/slf4j-api'
gemfire_log4j_api:
version: 2.1.0
repository_root: ! '{default.repository.root}/log4j-api'
gemfire_log4j_core:
version: 2.1.0
repository_root: ! '{default.repository.root}/log4j-core'
gemfire_log4j_jcl:
version: 2.1.0
repository_root: ! '{default.repository.root}/log4j-jcl'
gemfire_log4j_jul:
version: 2.1.0
repository_root: ! '{default.repository.root}/log4j-jul'
gemfire_log4j_slf4j_impl:
version: 2.1.0
repository_root: ! '{default.repository.root}/log4j-slf4j-impl'
53 changes: 53 additions & 0 deletions lib/java_buildpack/container/tomcat/gemfire/gemfire_log4j_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2015 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 'java_buildpack/component/versioned_dependency_component'
require 'java_buildpack/container'
require 'java_buildpack/container/tomcat/tomcat_utils'
require 'java_buildpack/logging/logger_factory'

module JavaBuildpack
module Container

# Encapsulates the detect, compile, and release functionality for Log4j API support.
class GemFireLog4jApi < JavaBuildpack::Component::VersionedDependencyComponent
include JavaBuildpack::Container

# (see JavaBuildpack::Component::BaseComponent#compile)
def compile
download_jar(jar_name, tomcat_lib, 'GemFire Log4j API')
end

# (see JavaBuildpack::Component::BaseComponent#release)
def release
end

protected

# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
def supports?
true
end

private

def jar_name
"log4j-api-#{@version}.jar"
end
end

end
end
53 changes: 53 additions & 0 deletions lib/java_buildpack/container/tomcat/gemfire/gemfire_log4j_core.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2015 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 'java_buildpack/component/versioned_dependency_component'
require 'java_buildpack/container'
require 'java_buildpack/container/tomcat/tomcat_utils'
require 'java_buildpack/logging/logger_factory'

module JavaBuildpack
module Container

# Encapsulates the detect, compile, and release functionality for Log4j Core support.
class GemFireLog4jCore < JavaBuildpack::Component::VersionedDependencyComponent
include JavaBuildpack::Container

# (see JavaBuildpack::Component::BaseComponent#compile)
def compile
download_jar(jar_name, tomcat_lib, 'GemFire Log4j Core')
end

# (see JavaBuildpack::Component::BaseComponent#release)
def release
end

protected

# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
def supports?
true
end

private

def jar_name
"log4j-core-#{@version}.jar"
end
end

end
end
53 changes: 53 additions & 0 deletions lib/java_buildpack/container/tomcat/gemfire/gemfire_log4j_jcl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2015 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 'java_buildpack/component/versioned_dependency_component'
require 'java_buildpack/container'
require 'java_buildpack/container/tomcat/tomcat_utils'
require 'java_buildpack/logging/logger_factory'

module JavaBuildpack
module Container

# Encapsulates the detect, compile, and release functionality for Log4j Jcl support.
class GemFireLog4jJcl < JavaBuildpack::Component::VersionedDependencyComponent
include JavaBuildpack::Container

# (see JavaBuildpack::Component::BaseComponent#compile)
def compile
download_jar(jar_name, tomcat_lib, 'GemFire Log4j Jcl')
end

# (see JavaBuildpack::Component::BaseComponent#release)
def release
end

protected

# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
def supports?
true
end

private

def jar_name
"log4j-jcl-#{@version}.jar"
end
end

end
end
53 changes: 53 additions & 0 deletions lib/java_buildpack/container/tomcat/gemfire/gemfire_log4j_jul.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2015 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 'java_buildpack/component/versioned_dependency_component'
require 'java_buildpack/container'
require 'java_buildpack/container/tomcat/tomcat_utils'
require 'java_buildpack/logging/logger_factory'

module JavaBuildpack
module Container

# Encapsulates the detect, compile, and release functionality for Log4j Jul support.
class GemFireLog4jJul < JavaBuildpack::Component::VersionedDependencyComponent
include JavaBuildpack::Container

# (see JavaBuildpack::Component::BaseComponent#compile)
def compile
download_jar(jar_name, tomcat_lib, 'GemFire Log4j Jul')
end

# (see JavaBuildpack::Component::BaseComponent#release)
def release
end

protected

# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
def supports?
true
end

private

def jar_name
"log4j-jul-#{@version}.jar"
end
end

end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2015 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 'java_buildpack/component/versioned_dependency_component'
require 'java_buildpack/container'
require 'java_buildpack/container/tomcat/tomcat_utils'
require 'java_buildpack/logging/logger_factory'

module JavaBuildpack
module Container

# Encapsulates the detect, compile, and release functionality for Log4j Slf4j Impl support.
class GemFireLog4jSlf4jImpl < JavaBuildpack::Component::VersionedDependencyComponent
include JavaBuildpack::Container

# (see JavaBuildpack::Component::BaseComponent#compile)
def compile
download_jar(jar_name, tomcat_lib, 'GemFire Log4j Slf4j Impl')
end

# (see JavaBuildpack::Component::BaseComponent#release)
def release
end

protected

# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
def supports?
true
end

private

def jar_name
"log4j-slf4j-impl-#{@version}.jar"
end
end

end
end
10 changes: 10 additions & 0 deletions lib/java_buildpack/container/tomcat/tomcat_gemfire_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
require 'java_buildpack/container'
require 'java_buildpack/container/tomcat/tomcat_utils'
require 'java_buildpack/container/tomcat/gemfire/gemfire'
require 'java_buildpack/container/tomcat/gemfire/gemfire_log4j_api'
require 'java_buildpack/container/tomcat/gemfire/gemfire_log4j_core'
require 'java_buildpack/container/tomcat/gemfire/gemfire_log4j_jcl'
require 'java_buildpack/container/tomcat/gemfire/gemfire_log4j_jul'
require 'java_buildpack/container/tomcat/gemfire/gemfire_log4j_slf4j_impl'
require 'java_buildpack/container/tomcat/gemfire/gemfire_logging_api'
require 'java_buildpack/container/tomcat/gemfire/gemfire_logging'
require 'java_buildpack/container/tomcat/gemfire/gemfire_modules'
Expand Down Expand Up @@ -48,6 +53,11 @@ def compile
def sub_components(context)
[
GemFire.new(sub_configuration_context(context, 'gemfire')),
GemFireLog4jApi.new(sub_configuration_context(context, 'gemfire_log4j_api')),
GemFireLog4jCore.new(sub_configuration_context(context, 'gemfire_log4j_core')),
GemFireLog4jJcl.new(sub_configuration_context(context, 'gemfire_log4j_jcl')),
GemFireLog4jJul.new(sub_configuration_context(context, 'gemfire_log4j_jul')),
GemFireLog4jSlf4jImpl.new(sub_configuration_context(context, 'gemfire_log4j_slf4j_impl')),
GemFireLoggingApi.new(sub_configuration_context(context, 'gemfire_logging_api')),
GemFireLogging.new(sub_configuration_context(context, 'gemfire_logging')),
GemFireModules.new(sub_configuration_context(context, 'gemfire_modules')),
Expand Down
Binary file added spec/fixtures/stub-gemfire-log4j-api.jar
Binary file not shown.
Binary file added spec/fixtures/stub-gemfire-log4j-core.jar
Binary file not shown.
Binary file added spec/fixtures/stub-gemfire-log4j-jcl.jar
Binary file not shown.
Binary file added spec/fixtures/stub-gemfire-log4j-jul.jar
Binary file not shown.
Binary file added spec/fixtures/stub-gemfire-log4j-slf4j-impl.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2015 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/tomcat/gemfire/gemfire_log4j_api'

describe JavaBuildpack::Container::GemFireLog4jApi do
include_context 'component_helper'

let(:component_id) { 'tomcat' }

it 'always detects' do
expect(component.detect).to eq("gem-fire-log4j-api=#{version}")
end

it 'copies resources',
cache_fixture: 'stub-gemfire-log4j-api.jar' do

component.compile

expect(sandbox + "lib/log4j-api-#{version}.jar").to exist
end

it 'does nothing during release' do
component.release
end

end
Loading

0 comments on commit 5194155

Please sign in to comment.