2 * Copyright (c) 2014, 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package test.mock.util;
10 import org.osgi.framework.Bundle;
11 import org.osgi.framework.BundleContext;
12 import org.osgi.framework.BundleException;
13 import org.osgi.framework.BundleListener;
14 import org.osgi.framework.Filter;
15 import org.osgi.framework.FrameworkListener;
16 import org.osgi.framework.InvalidSyntaxException;
17 import org.osgi.framework.ServiceListener;
18 import org.osgi.framework.ServiceReference;
19 import org.osgi.framework.ServiceRegistration;
22 import java.io.InputStream;
23 import java.util.Collection;
24 import java.util.Dictionary;
26 public class BundleContextMock implements BundleContext {
28 public String getProperty(String s) {
33 public Bundle getBundle() {
38 public Bundle installBundle(String s, InputStream inputStream) throws BundleException {
43 public Bundle installBundle(String s) throws BundleException {
48 public Bundle getBundle(long l) {
53 public Bundle[] getBundles() {
58 public void addServiceListener(ServiceListener serviceListener, String s) throws InvalidSyntaxException {
63 public void addServiceListener(ServiceListener serviceListener) {
68 public void removeServiceListener(ServiceListener serviceListener) {
73 public void addBundleListener(BundleListener bundleListener) {
78 public void removeBundleListener(BundleListener bundleListener) {
83 public void addFrameworkListener(FrameworkListener frameworkListener) {
88 public void removeFrameworkListener(FrameworkListener frameworkListener) {
93 public ServiceRegistration<?> registerService(String[] strings, Object o, Dictionary<String, ?> stringDictionary) {
98 public ServiceRegistration<?> registerService(String s, Object o, Dictionary<String, ?> stringDictionary) {
103 public <S> ServiceRegistration<S> registerService(Class<S> sClass, S s, Dictionary<String, ?> stringDictionary) {
108 public ServiceReference<?>[] getServiceReferences(String s, String s2) throws InvalidSyntaxException {
109 return new ServiceReference<?>[0];
113 public ServiceReference<?>[] getAllServiceReferences(String s, String s2) throws InvalidSyntaxException {
114 return new ServiceReference<?>[0];
118 public ServiceReference<?> getServiceReference(String s) {
123 public <S> ServiceReference<S> getServiceReference(Class<S> sClass) {
128 public <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> sClass, String s) throws InvalidSyntaxException {
133 public <S> S getService(ServiceReference<S> sServiceReference) {
138 public boolean ungetService(ServiceReference<?> serviceReference) {
143 public File getDataFile(String s) {
148 public Filter createFilter(String s) throws InvalidSyntaxException {
153 public Bundle getBundle(String s) {