Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.killbill.billing.osgi.api.OSGIKillbillRegistrar;
import org.killbill.billing.osgi.api.config.PluginConfig;
import org.killbill.billing.osgi.api.config.PluginConfigServiceApi;
import org.killbill.commons.health.api.HealthCheckRegistry;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
Expand Down Expand Up @@ -55,6 +56,8 @@ public abstract class KillbillActivatorBase implements BundleActivator {
protected OSGIConfigPropertiesService configProperties;
protected OSGIMetricRegistry metricRegistry;

protected HealthCheckRegistry healthCheckRegistry;

protected File tmpDir = null;

private ScheduledFuture<?> restartFuture = null;
Expand All @@ -73,6 +76,7 @@ public void start(final BundleContext context) throws Exception {
configProperties = new OSGIConfigPropertiesService(context);
clock = new OSGIKillbillClock(context);
metricRegistry = new OSGIMetricRegistry(context);
healthCheckRegistry = context.getServiceReference(HealthCheckRegistry.class) != null ? context.getService(context.getServiceReference(HealthCheckRegistry.class)) : null;

// Registrar for bundle
registrar = new OSGIKillbillRegistrar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.killbill.billing.platform.jndi.JNDIManager;
import org.killbill.billing.usage.plugin.api.UsagePluginApi;
import org.killbill.clock.Clock;
import org.killbill.commons.health.api.HealthCheckRegistry;
import org.killbill.commons.metrics.api.MetricRegistry;
import org.osgi.framework.AllServiceListener;
import org.osgi.framework.BundleActivator;
Expand Down Expand Up @@ -95,6 +96,8 @@ public class KillbillActivator implements BundleActivator, AllServiceListener {
private ServiceTracker<LogService, LogService> logTracker;
private OSGIAppender osgiAppender = null;

private HealthCheckRegistry healthCheckRegistry;

@Inject
public KillbillActivator(@Named(DefaultOSGIModule.OSGI_DATA_SOURCE_ID) final DataSource dataSource,
final OSGIKillbill osgiKillbill,
Expand All @@ -105,6 +108,7 @@ public KillbillActivator(@Named(DefaultOSGIModule.OSGI_DATA_SOURCE_ID) final Dat
final KillbillEventObservable observable,
final OSGIConfigProperties configProperties,
final MetricRegistry metricsRegistry,
final HealthCheckRegistry healthCheckRegistry,
final JNDIManager jndiManager) {
this.osgiKillbill = osgiKillbill;
this.bundleRegistry = bundleRegistry;
Expand All @@ -116,6 +120,7 @@ public KillbillActivator(@Named(DefaultOSGIModule.OSGI_DATA_SOURCE_ID) final Dat
this.configProperties = configProperties;
this.jndiManager = jndiManager;
this.metricsRegistry = metricsRegistry;
this.healthCheckRegistry = healthCheckRegistry;
this.registrar = new OSGIKillbillRegistrar();
this.allRegistrationHandlers = new LinkedList<OSGIServiceRegistrable>();
}
Expand Down Expand Up @@ -209,6 +214,7 @@ public void start(final BundleContext context) throws Exception {
registrar.registerService(context, OSGIConfigProperties.class, configProperties, props);
registrar.registerService(context, Clock.class, clock, props);
registrar.registerService(context, MetricRegistry.class, metricsRegistry, props);
registrar.registerService(context, HealthCheckRegistry.class, healthCheckRegistry, props);

context.addServiceListener(this);

Expand Down
2 changes: 1 addition & 1 deletion platform-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
<artifactId>killbill-platform-api</artifactId>
<packaging>jar</packaging>
<name>killbill-platform-api</name>
<dependencies />
<dependencies/>
</project>
4 changes: 2 additions & 2 deletions platform-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@
<phase>initialize</phase>
<configuration>
<tasks>
<copy file="${basedir}/../osgi-bundles/tests/beatrix/target/killbill-platform-osgi-bundles-test-beatrix-${project.version}.jar" tofile="${basedir}/src/test/resources/killbill-osgi-bundles-test-beatrix-jar-with-dependencies.jar" />
<copy file="${basedir}/../osgi-bundles/tests/payment/target/killbill-platform-osgi-bundles-test-payment-${project.version}.jar" tofile="${basedir}/src/test/resources/killbill-osgi-bundles-test-payment-jar-with-dependencies.jar" />
<copy file="${basedir}/../osgi-bundles/tests/beatrix/target/killbill-platform-osgi-bundles-test-beatrix-${project.version}.jar" tofile="${basedir}/src/test/resources/killbill-osgi-bundles-test-beatrix-jar-with-dependencies.jar"/>
<copy file="${basedir}/../osgi-bundles/tests/payment/target/killbill-platform-osgi-bundles-test-payment-${project.version}.jar" tofile="${basedir}/src/test/resources/killbill-osgi-bundles-test-payment-jar-with-dependencies.jar"/>
</tasks>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.killbill.billing.beatrix.integration.osgi.glue;

import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

Expand Down Expand Up @@ -60,7 +61,9 @@
import org.killbill.billing.util.api.TagUserApi;
import org.killbill.clock.Clock;
import org.killbill.clock.ClockMock;
import org.killbill.commons.health.api.HealthCheck;
import org.killbill.commons.health.api.HealthCheckRegistry;
import org.killbill.commons.health.api.Result;
import org.killbill.commons.metrics.api.MetricRegistry;
import org.killbill.commons.metrics.impl.NoOpMetricRegistry;

Expand All @@ -78,7 +81,7 @@ protected void configure() {
install(new TestPlatformModuleWithEmbeddedDB(configSource, true, (TestKillbillConfigSource) configSource));

bind(MetricRegistry.class).to(NoOpMetricRegistry.class);
bind(HealthCheckRegistry.class).toProvider(Providers.of(null));
bind(HealthCheckRegistry.class).to(TestHealthCheckRegistry.class);
bind(Clock.class).to(ClockMock.class);
// Make sure we have a unique clock if one requests ClockMock explicitly
bind(ClockMock.class).asEagerSingleton();
Expand Down Expand Up @@ -195,4 +198,22 @@ public T getService() {
return this.pluginsByName.values().stream().findFirst().orElse(null);
}
}

static final class TestHealthCheckRegistry implements HealthCheckRegistry {

@Override
public Set<String> getNames() {
return null;
}

@Override
public Result runHealthCheck(final String name) throws NoSuchElementException {
return null;
}

@Override
public void register(final String name, final HealthCheck healthCheck) {

}
}
}