klogger 1.7.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0700da90894071658bc94f54991b6d7609edcf61
4
- data.tar.gz: f4413d2732673f71d5d72828490004a4a0cdd391
3
+ metadata.gz: 810f50cd7068a8ee2b806df06e61c4bbc00a8262
4
+ data.tar.gz: 8df861f3a791eb43fa3db096573caa16a47c6959
5
5
  SHA512:
6
- metadata.gz: e057e421d8fb3d843b967358b27282dcdaceab23c761bb76af5967fff3396f521185a9b2698449f814dc54e58a9decea0c65b4adbbe0617dddcfa3bb365c59bf
7
- data.tar.gz: 34eda518dc262b43f175a40869ddcb84ab22199a7db73158fc472abcc3b6582eba3972ebdd7db4060a544a8efa476362ea8778b4bcdddc113db91e2f59f96399
6
+ metadata.gz: 17d157ebb18ccb4eaf0dd9764a03f84df386cee00e8a4c82b9609924031a7f53d275f64375b730f794e2734ab75458c6d9baf50717246f46aabb9aa48582a05e
7
+ data.tar.gz: e1937dfaacaaa369fbcba8e3a48e5a193d244ccf166034f8eb3733826f60584e3b384bd0a2a7163ebbf02e821a98426116c4e108d8fc3f66479e81ec081119b1
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ *.swp
3
4
  .bundle
4
5
  .config
5
6
  coverage
@@ -18,16 +19,15 @@ _yardoc
18
19
  doc/
19
20
 
20
21
  .jbundler
21
- Jarfile.lock
22
- Gemfile.lock
23
-
24
- # Build directory
25
- /klogger/
26
22
 
27
23
  # Config file
28
24
  klogger.yml
29
25
 
30
26
  .DS_Store
31
27
 
32
- .idea
33
- *.asc
28
+ target
29
+ pom.xml.asc
30
+
31
+ .idea/
32
+
33
+ Gemfile.head.lock
@@ -1,19 +1,38 @@
1
1
  language: ruby
2
2
 
3
+ sudo: false
4
+ cache: bundler
5
+
6
+ script: 'bundle exec rake spec'
7
+
3
8
  notifications:
4
9
  email:
5
10
  - kill-bill-commits@googlegroups.com
6
11
 
12
+ env:
13
+ global:
14
+ - JRUBY_OPTS='-J-Xmx1024M'
15
+
7
16
  rvm:
8
- - jruby-19mode
9
- - jruby-20mode
17
+ - jruby-1.7.19
18
+ - jruby-20mode # latest 1.7.x
10
19
  - jruby-head
11
20
 
21
+ gemfile:
22
+ - Gemfile
23
+ - Gemfile.head
24
+
12
25
  jdk:
13
- - openjdk6
14
26
  - openjdk7
15
27
  - oraclejdk7
28
+ - oraclejdk8
16
29
 
17
30
  matrix:
18
31
  allow_failures:
19
32
  - rvm: jruby-head
33
+ - jdk: oraclejdk8
34
+ - gemfile: Gemfile.head
35
+ fast_finish: true
36
+
37
+ after_success:
38
+ - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "<settings><servers><server><id>sonatype-nexus-snapshots</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml && MVN="mvn --settings $HOME/settings.xml" NO_RELEASE=1 travis_retry travis_wait bash release.sh | egrep -v "Download|Install|Upload" ; rm -f ~/settings.xml'
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'killbill', :github => 'killbill/killbill-plugin-framework-ruby', :ref => 'HEAD'
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ klogger (2.0.0)
5
+ cinch (~> 2.0.3)
6
+ jruby-openssl (~> 0.9.6)
7
+ killbill (~> 4.0.0)
8
+ mail (~> 2.5.3)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ cinch (2.0.12)
14
+ diff-lcs (1.1.3)
15
+ ethon (0.7.3)
16
+ ffi (>= 1.3.0)
17
+ ffi (1.9.8-java)
18
+ jbundler (0.4.3)
19
+ maven-tools (~> 0.32.1)
20
+ ruby-maven (~> 3.0.4)
21
+ jruby-openssl (0.9.7-java)
22
+ killbill (4.0.0)
23
+ rack (>= 1.5.2)
24
+ sinatra (~> 1.3.4)
25
+ typhoeus (~> 0.6.9)
26
+ tzinfo (~> 1.2.0)
27
+ mail (2.5.4)
28
+ mime-types (~> 1.16)
29
+ treetop (~> 1.4.8)
30
+ maven-tools (0.32.5)
31
+ mime-types (1.25.1)
32
+ polyglot (0.3.5)
33
+ rack (1.6.1)
34
+ rack-protection (1.5.3)
35
+ rack
36
+ rake (10.4.2)
37
+ rspec (2.12.0)
38
+ rspec-core (~> 2.12.0)
39
+ rspec-expectations (~> 2.12.0)
40
+ rspec-mocks (~> 2.12.0)
41
+ rspec-core (2.12.2)
42
+ rspec-expectations (2.12.1)
43
+ diff-lcs (~> 1.1.3)
44
+ rspec-mocks (2.12.2)
45
+ ruby-maven (3.0.4.1.4)
46
+ maven-tools (~> 0.32.3)
47
+ thor (>= 0.14.6, < 2.0)
48
+ sinatra (1.3.6)
49
+ rack (~> 1.4)
50
+ rack-protection (~> 1.3)
51
+ tilt (~> 1.3, >= 1.3.3)
52
+ thor (0.19.1)
53
+ thread_safe (0.3.5-java)
54
+ tilt (1.4.1)
55
+ treetop (1.4.15)
56
+ polyglot
57
+ polyglot (>= 0.3.1)
58
+ typhoeus (0.6.9)
59
+ ethon (>= 0.7.1)
60
+ tzinfo (1.2.2)
61
+ thread_safe (~> 0.1)
62
+
63
+ PLATFORMS
64
+ java
65
+
66
+ DEPENDENCIES
67
+ jbundler (~> 0.4.3)
68
+ klogger!
69
+ rack (>= 1.5.2)
70
+ rake (>= 10.0.0)
71
+ rspec (~> 2.12.0)
data/Jarfile CHANGED
@@ -1,6 +1,9 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.8.2'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.6.4'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.6.4'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.6.4'
5
- jar 'org.kill-bill.billing:killbill-util:tests', '0.9.1'
6
- jar 'javax.servlet:javax.servlet-api', '3.0.1'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.14'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.9'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.9'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.9'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.9'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.9'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.13.7'
8
+ jar 'org.mockito:mockito-all', '1.10.19'
9
+ jar 'javax.servlet:javax.servlet-api', '3.1.0'
@@ -0,0 +1,58 @@
1
+ org.kill-bill.billing:killbill-api:jar:0.14
2
+ com.fasterxml.jackson.core:jackson-annotations:jar:2.4.3
3
+ joda-time:joda-time:jar:2.3
4
+ org.kill-bill.billing.plugin:killbill-plugin-api-currency:jar:0.9
5
+ org.kill-bill.billing.plugin:killbill-plugin-api-invoice:jar:0.9
6
+ org.kill-bill.billing.plugin:killbill-plugin-api-notification:jar:0.9
7
+ org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.9
8
+ org.kill-bill.billing.plugin:killbill-plugin-api-routing:jar:0.9
9
+ org.kill-bill.billing:killbill-util:jar:tests:0.13.7
10
+ com.fasterxml.jackson.core:jackson-databind:jar:2.4.3
11
+ com.fasterxml.jackson.core:jackson-core:jar:2.4.3
12
+ com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.4.3
13
+ com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.4.3
14
+ com.samskivert:jmustache:jar:1.5
15
+ io.dropwizard.metrics:metrics-core:jar:3.1.1
16
+ io.dropwizard.metrics:metrics-ehcache:jar:3.1.1
17
+ net.sf.ehcache:ehcache:jar:2.9.1
18
+ org.antlr:stringtemplate:jar:3.2.1
19
+ antlr:antlr:jar:2.7.7
20
+ org.apache.commons:commons-email:jar:1.2
21
+ javax.mail:mail:jar:1.4.1
22
+ javax.activation:activation:jar:1.1
23
+ org.apache.shiro:shiro-core:jar:1.2.3
24
+ commons-beanutils:commons-beanutils:jar:1.8.3
25
+ commons-logging:commons-logging:jar:1.1.1
26
+ org.apache.shiro:shiro-ehcache:jar:1.2.3
27
+ net.sf.ehcache:ehcache-core:jar:2.5.0
28
+ org.apache.shiro:shiro-guice:jar:1.2.3
29
+ com.google.guava:guava:jar:r09
30
+ com.google.inject:guice:jar:3.0
31
+ aopalliance:aopalliance:jar:1.0
32
+ com.google.inject.extensions:guice-multibindings:jar:3.0
33
+ org.jdbi:jdbi:jar:2.62
34
+ org.joda:joda-money:jar:0.9
35
+ org.kill-bill.billing:killbill-internal-api:jar:0.13.7
36
+ org.kill-bill.billing:killbill-platform-api:jar:0.2
37
+ org.kill-bill.billing:killbill-platform-base:jar:0.2
38
+ com.google.code.findbugs:annotations:jar:3.0.0
39
+ org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:jar:1.16
40
+ org.kill-bill.billing:killbill-platform-osgi-api:jar:0.2
41
+ org.osgi:org.osgi.core:jar:5.0.0
42
+ org.kill-bill.commons:killbill-clock:jar:0.3
43
+ org.kill-bill.commons:killbill-concurrent:jar:0.3
44
+ org.kill-bill.commons:killbill-embeddeddb-common:jar:0.3
45
+ org.kill-bill.commons:killbill-jdbi:jar:0.3
46
+ com.h2database:h2:jar:1.4.186
47
+ javax.inject:javax.inject:jar:1
48
+ org.kill-bill.commons:killbill-locker:jar:0.3
49
+ org.kill-bill.commons:killbill-queue:jar:0.3
50
+ org.kill-bill.commons:killbill-xmlloader:jar:0.3
51
+ org.skife.config:config-magic:jar:0.14
52
+ org.slf4j:jcl-over-slf4j:jar:1.7.12
53
+ org.slf4j:slf4j-api:jar:1.7.12
54
+ org.weakref:jmxutils:jar:1.12
55
+ org.mockito:mockito-all:jar:1.10.19
56
+ javax.servlet:javax.servlet-api:jar:3.1.0
57
+ org.bouncycastle:bcpkix-jdk15on:jar:1.50
58
+ org.bouncycastle:bcprov-jdk15on:jar:1.50
data/README.md CHANGED
@@ -1,6 +1,3 @@
1
- [![Build Status](https://travis-ci.org/killbill/killbill-logging-plugin.png)](https://travis-ci.org/killbill/killbill-logging-plugin)
2
- [![Code Climate](https://codeclimate.com/github/killbill/killbill-logging-plugin.png)](https://codeclimate.com/github/killbill/killbill-logging-plugin)
3
-
4
1
  killbill-logging-plugin
5
2
  =======================
6
3
 
@@ -8,12 +5,25 @@ Plugin to log Kill Bill events to Syslog, IRC, emails, ...
8
5
 
9
6
  Release builds are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.plugin.ruby%22%20AND%20a%3A%22logging-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:logging-plugin`.
10
7
 
8
+ Kill Bill compatibility
9
+ -----------------------
10
+
11
+ | Plugin version | Kill Bill version |
12
+ | -------------: | ----------------: |
13
+ | 2.x.y | 0.14.z |
14
+
11
15
  Configuration
12
16
  -------------
13
17
 
14
- The plugin expects a `klogger.yml` configuration file containing the following:
15
-
16
18
  ```
19
+ curl -v \
20
+ -X POST \
21
+ -u admin:password \
22
+ -H 'X-Killbill-ApiKey: bob' \
23
+ -H 'X-Killbill-ApiSecret: lazar' \
24
+ -H 'X-Killbill-CreatedBy: admin' \
25
+ -H 'Content-Type: text/plain' \
26
+ -d '
17
27
  syslog:
18
28
  :enabled: true
19
29
  :ident: 'klogger'
@@ -22,7 +32,7 @@ syslog:
22
32
 
23
33
  irc:
24
34
  :enabled: true
25
- :channels: ['#killbilling']
35
+ :channels: ['#killbillio']
26
36
  :nick: 'klogger'
27
37
  :server: 'irc.freenode.org'
28
38
  :port: 6667
@@ -39,7 +49,6 @@ email:
39
49
  :password: 'password'
40
50
  :authentication: 'plain'
41
51
  :enable_starttls_auto: true
52
+ ' \
53
+ http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-logger
42
54
  ```
43
-
44
- By default, the plugin will look at the plugin directory root (where `killbill.properties` is located) to find this file.
45
- Alternatively, set the Kill Bill system property `-Dorg.killbill.billing.osgi.bundles.jruby.conf.dir=/my/directory` to specify another location.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 2.0.0
@@ -12,25 +12,26 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.author = 'Kill Bill core team'
14
14
  s.email = 'killbilling-users@googlegroups.com'
15
- s.homepage = 'http://kill-bill.org'
15
+ s.homepage = 'http://killbill.io'
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.bindir = 'bin'
20
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
- s.require_paths = ["lib"]
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ s.require_paths = ['lib']
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 3.0.0'
25
+ s.add_dependency 'killbill', '~> 4.0.0'
26
+
26
27
  s.add_dependency 'cinch', '~> 2.0.3'
27
28
  s.add_dependency 'mail', '~> 2.5.3'
28
29
  if defined?(JRUBY_VERSION)
29
30
  # Required to avoid errors like java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DERBoolean
30
- s.add_dependency 'jruby-openssl', '~> 0.9.4'
31
+ s.add_dependency 'jruby-openssl', '~> 0.9.6'
31
32
  end
32
33
 
33
- s.add_development_dependency 'jbundler', '~> 0.4.1'
34
+ s.add_development_dependency 'jbundler', '~> 0.4.3'
34
35
  s.add_development_dependency 'rake', '>= 10.0.0'
35
36
  s.add_development_dependency 'rack', '>= 1.5.2'
36
37
  s.add_development_dependency 'rspec', '~> 2.12.0'
@@ -1,4 +1,5 @@
1
1
  require 'logger'
2
+ require 'pathname'
2
3
  require 'psych'
3
4
 
4
5
  require 'killbill'
@@ -20,69 +21,112 @@ module Klogger
20
21
 
21
22
  def initialize(*args)
22
23
  super(*args)
23
- @enabled_modules = []
24
+
25
+ @config_key_name = "PLUGIN_CONFIG_killbill-logger".to_sym
26
+ @enabled_modules = {}
24
27
  end
25
28
 
26
29
  def start_plugin
27
- configure_modules
28
- @enabled_modules.each do |m|
29
- begin
30
- m.start_plugin
31
- rescue => e
32
- @logger.warn "Unable to start module #{m.class}: #{e.message}"
33
- end
34
- end
35
-
36
30
  super
37
31
 
32
+ @global_config = global_configuration
38
33
  @logger.info "Klogger::KloggerPlugin started"
39
34
  end
40
35
 
41
36
  def on_event(event)
42
- @enabled_modules.each do |m|
43
- begin
44
- m.on_event(event)
45
- rescue => e
46
- @logger.warn "Unable to send event to module #{m.class}: #{e.message}"
47
- end
37
+ tenant_id = tenant(event)
38
+
39
+ if (event.event_type == :TENANT_CONFIG_CHANGE || event.event_type == :TENANT_CONFIG_DELETION) &&
40
+ event.meta_data.to_sym == @config_key_name
41
+ @enabled_modules[tenant_id] = nil
48
42
  end
43
+ configure_modules(tenant_id) if @enabled_modules[tenant_id].nil?
44
+
45
+ dispatch_event(event, tenant_id)
49
46
  end
50
47
 
51
48
  def stop_plugin
52
49
  super
53
50
 
54
- @enabled_modules.each do |m|
55
- begin
56
- m.stop_plugin
57
- rescue => e
58
- @logger.warn "Unable to stop module #{m.class}: #{e.message}"
59
- end
60
- end
61
-
51
+ @enabled_modules.keys.each { |kb_tenant_id| stop_modules(kb_tenant_id) }
62
52
  @logger.info "Klogger::KloggerPlugin stopped"
63
53
  end
64
54
 
65
55
  private
66
56
 
67
- def configure_modules
68
- # Parse the config file
69
- begin
70
- @config = Psych.load_file("#{@conf_dir}/klogger.yml")
71
- rescue Errno::ENOENT
72
- @logger.warn "Unable to find the config file #{@conf_dir}/klogger.yml"
73
- return
74
- end
57
+ def configure_modules(kb_tenant_id)
58
+ @enabled_modules[kb_tenant_id] ||= []
59
+
60
+ stop_modules(kb_tenant_id)
61
+
62
+ tenant_config = @global_config.merge(tenant_configuration(kb_tenant_id))
75
63
 
76
64
  # Instantiate each module
77
- @config.each do |kmodule, config|
65
+ tenant_config.each do |kmodule, config|
78
66
  next unless config[:enabled]
79
67
 
80
68
  module_klass = MODULES[kmodule.to_sym]
81
69
  next unless module_klass
82
70
 
83
- @logger.info "Module #{module_klass} enabled"
84
- @enabled_modules << module_klass.send('new', config, @logger)
71
+ @logger.info "Module #{module_klass} enabled for tenant #{kb_tenant_id}"
72
+ @enabled_modules[kb_tenant_id] << module_klass.send('new', config, @logger)
73
+ end
74
+
75
+ start_modules(kb_tenant_id)
76
+ end
77
+
78
+ def tenant_configuration(kb_tenant_id)
79
+ return {} if kb_tenant_id.nil? || kb_tenant_id == :monotenant
80
+ context = @kb_apis.create_context(kb_tenant_id)
81
+ values = @kb_apis.tenant_user_api.get_tenant_values_for_key(@config_key_name, context)
82
+ values && values[0] ? Psych.load(values[0]) : {}
83
+ end
84
+
85
+ def global_configuration
86
+ config_file = "#{@conf_dir}/klogger.yml"
87
+ return {} unless Pathname.new(config_file).file?
88
+
89
+ begin
90
+ Psych.load_file(config_file)
91
+ rescue
92
+ @logger.warn "Unable to parse the config file #{config_file}"
93
+ {}
94
+ end
95
+ end
96
+
97
+ def dispatch_event(event, kb_tenant_id)
98
+ @enabled_modules[kb_tenant_id].each do |m|
99
+ begin
100
+ m.on_event(event)
101
+ rescue => e
102
+ @logger.warn "Unable to send event to module #{m.class}: #{e.message}"
103
+ end
104
+ end
105
+ end
106
+
107
+ def start_modules(kb_tenant_id)
108
+ @enabled_modules[kb_tenant_id].each do |m|
109
+ begin
110
+ m.start_plugin
111
+ rescue => e
112
+ @logger.warn "Unable to start module #{m.class}: #{e.message}"
113
+ end
85
114
  end
86
115
  end
116
+
117
+ def stop_modules(kb_tenant_id)
118
+ @enabled_modules[kb_tenant_id].each do |m|
119
+ begin
120
+ m.stop_plugin
121
+ rescue => e
122
+ @logger.warn "Unable to stop module #{m.class}: #{e.message}"
123
+ end
124
+ end
125
+ @enabled_modules[kb_tenant_id] = []
126
+ end
127
+
128
+ def tenant(event)
129
+ event.tenant_id.nil? ? :monotenant : event.tenant_id
130
+ end
87
131
  end
88
132
  end
data/pom.xml CHANGED
@@ -1,8 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
3
  ~ Copyright 2010-2013 Ning, Inc.
4
+ ~ Copyright 2014-2015 The Billing Project, LLC
4
5
  ~
5
- ~ Ning licenses this file to you under the Apache License, version 2.0
6
+ ~ The Billing Project licenses this file to you under the Apache License, version 2.0
6
7
  ~ (the "License"); you may not use this file except in compliance with the
7
8
  ~ License. You may obtain a copy of the License at:
8
9
  ~
@@ -25,7 +26,7 @@
25
26
  <groupId>org.kill-bill.billing.plugin.ruby</groupId>
26
27
  <artifactId>logging-plugin</artifactId>
27
28
  <packaging>pom</packaging>
28
- <version>1.7.0</version>
29
+ <version>2.0.0</version>
29
30
  <name>logging-plugin</name>
30
31
  <url>http://github.com/killbill/killbill-logging-plugin</url>
31
32
  <description>Plugin to log Kill Bill events</description>
data/release.sh CHANGED
@@ -1,41 +1,61 @@
1
1
  set -e
2
2
 
3
- if [ "GNU" != "$(tar --help | grep GNU | head -1 | awk '{print $1}')" ]; then
4
- echo "Unable to release: make sure to use GNU tar"
3
+ BUNDLE=${BUNDLE-"bundle exec"}
4
+ MVN=${MVN-"mvn"}
5
+
6
+ if [ 'GNU' != "$(tar --help | grep GNU | head -1 | awk '{print $1}')" ]; then
7
+ echo 'Unable to release: make sure to use GNU tar'
5
8
  exit 1
6
9
  fi
7
10
 
8
11
  if $(ruby -e'require "java"'); then
9
12
  # Good
10
- echo "Detected JRuby"
13
+ echo 'Detected JRuby'
11
14
  else
12
- echo "Unable to release: make sure to use JRuby"
15
+ echo 'Unable to release: make sure to use JRuby'
13
16
  exit 1
14
17
  fi
15
18
 
16
19
  VERSION=`grep -E '<version>([0-9]+\.[0-9]+\.[0-9]+)</version>' pom.xml | sed 's/[\t \n]*<version>\(.*\)<\/version>[\t \n]*/\1/'`
17
- if [ "$VERSION" != "$(cat $PWD/VERSION)" ]; then
18
- echo "Unable to release: make sure the versions in pom.xml and VERSION match"
20
+ if [[ -z "$NO_RELEASE" && "$VERSION" != "$(cat $PWD/VERSION)" ]]; then
21
+ echo 'Unable to release: make sure the versions in pom.xml and VERSION match'
19
22
  exit 1
20
23
  fi
21
24
 
22
- echo "Cleaning up"
23
- rake killbill:clean ; rake build
25
+ echo 'Cleaning up'
26
+ $BUNDLE rake killbill:clean
27
+
28
+ echo 'Building gem'
29
+ $BUNDLE rake build
24
30
 
25
- echo "Pushing the gem to Rubygems"
26
- rake release
31
+ if [[ -z "$NO_RELEASE" ]]; then
32
+ echo 'Pushing the gem to Rubygems'
33
+ $BUNDLE rake release
34
+ fi
27
35
 
28
- echo "Building artifact"
29
- rake killbill:package
36
+ echo 'Building artifact'
37
+ $BUNDLE rake killbill:package
30
38
 
31
39
  ARTIFACT="$PWD/pkg/klogger-$VERSION.tar.gz"
32
40
  echo "Pushing $ARTIFACT to Maven Central"
33
- mvn gpg:sign-and-deploy-file \
34
- -DgroupId=org.kill-bill.billing.plugin.ruby \
35
- -DartifactId=logging-plugin \
36
- -Dversion=$VERSION \
37
- -Dpackaging=tar.gz \
38
- -DrepositoryId=ossrh-releases \
39
- -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
40
- -Dfile=$ARTIFACT \
41
- -DpomFile=pom.xml
41
+
42
+ if [[ -z "$NO_RELEASE" ]]; then
43
+ GOAL=gpg:sign-and-deploy-file
44
+ REPOSITORY_ID=ossrh-releases
45
+ URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
46
+ else
47
+ GOAL=deploy:deploy-file
48
+ REPOSITORY_ID=sonatype-nexus-snapshots
49
+ URL=https://oss.sonatype.org/content/repositories/snapshots/
50
+ VERSION="$VERSION-SNAPSHOT"
51
+ fi
52
+
53
+ $MVN $GOAL \
54
+ -DgroupId=org.kill-bill.billing.plugin.ruby \
55
+ -DartifactId=logging-plugin \
56
+ -Dversion=$VERSION \
57
+ -Dpackaging=tar.gz \
58
+ -DrepositoryId=$REPOSITORY_ID \
59
+ -Durl=$URL \
60
+ -Dfile=$ARTIFACT \
61
+ -DpomFile=pom.xml
@@ -6,25 +6,39 @@ class String
6
6
  end
7
7
  end
8
8
 
9
+ class FakeJavaTenantUserApi
10
+
11
+ attr_accessor :per_tenant_config
12
+
13
+ def initialize(per_tenant_config = {})
14
+ @per_tenant_config = per_tenant_config
15
+ end
16
+
17
+ def get_tenant_values_for_key(key, context)
18
+ result = @per_tenant_config[context.tenant_id.to_s]
19
+ result ? [result] : nil
20
+ end
21
+ end
22
+
9
23
  class MockEvent
10
- def get_event_type
24
+ def event_type
11
25
  'InvoiceCreationEvent'
12
26
  end
13
27
 
14
- def get_object_type
28
+ def object_type
15
29
  'INVOICE'
16
30
  end
17
31
 
18
- def get_object_id
19
- '1234'
32
+ def object_id
33
+ SecureRandom.uuid
20
34
  end
21
35
 
22
- def get_account_id
23
- '11-22-33'
36
+ def account_id
37
+ SecureRandom.uuid
24
38
  end
25
39
 
26
- def get_tenant_id
27
- '1100-998'
40
+ def tenant_id
41
+ SecureRandom.uuid
28
42
  end
29
43
  end
30
44
 
@@ -47,6 +61,10 @@ email:
47
61
  @plugin.logger = Logger.new(STDOUT)
48
62
  @plugin.conf_dir = File.dirname(file)
49
63
 
64
+ @tenant_api = FakeJavaTenantUserApi.new
65
+ svcs = {:tenant_user_api => @tenant_api}
66
+ @plugin.kb_apis = Killbill::Plugin::KillbillApi.new('klogger', svcs)
67
+
50
68
  # Start the plugin here - since the config file will be deleted
51
69
  @plugin.start_plugin
52
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill
@@ -16,12 +16,12 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
19
+ version: 4.0.0
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 3.0.0
24
+ version: 4.0.0
25
25
  prerelease: false
26
26
  type: :runtime
27
27
  - !ruby/object:Gem::Dependency
@@ -58,12 +58,12 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.4
61
+ version: 0.9.6
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - ~>
65
65
  - !ruby/object:Gem::Version
66
- version: 0.9.4
66
+ version: 0.9.6
67
67
  prerelease: false
68
68
  type: :runtime
69
69
  - !ruby/object:Gem::Dependency
@@ -72,12 +72,12 @@ dependencies:
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 0.4.1
75
+ version: 0.4.3
76
76
  requirement: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ~>
79
79
  - !ruby/object:Gem::Version
80
- version: 0.4.1
80
+ version: 0.4.3
81
81
  prerelease: false
82
82
  type: :development
83
83
  - !ruby/object:Gem::Dependency
@@ -131,7 +131,10 @@ files:
131
131
  - .gitignore
132
132
  - .travis.yml
133
133
  - Gemfile
134
+ - Gemfile.head
135
+ - Gemfile.lock
134
136
  - Jarfile
137
+ - Jarfile.lock
135
138
  - NEWS
136
139
  - README.md
137
140
  - Rakefile
@@ -147,7 +150,7 @@ files:
147
150
  - release.sh
148
151
  - spec/klogger/integration_spec.rb
149
152
  - spec/spec_helper.rb
150
- homepage: http://kill-bill.org
153
+ homepage: http://killbill.io
151
154
  licenses:
152
155
  - Apache License (2.0)
153
156
  metadata: {}
@@ -173,6 +176,4 @@ rubygems_version: 2.1.9
173
176
  signing_key:
174
177
  specification_version: 4
175
178
  summary: Plugin to log Kill Bill events.
176
- test_files:
177
- - spec/klogger/integration_spec.rb
178
- - spec/spec_helper.rb
179
+ test_files: []