1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.uruma.rcp.unit; |
17 | |
|
18 | |
import java.io.File; |
19 | |
import java.io.InputStream; |
20 | |
import java.util.Dictionary; |
21 | |
|
22 | |
import org.osgi.framework.Bundle; |
23 | |
import org.osgi.framework.BundleContext; |
24 | |
import org.osgi.framework.BundleException; |
25 | |
import org.osgi.framework.BundleListener; |
26 | |
import org.osgi.framework.Filter; |
27 | |
import org.osgi.framework.FrameworkListener; |
28 | |
import org.osgi.framework.InvalidSyntaxException; |
29 | |
import org.osgi.framework.ServiceListener; |
30 | |
import org.osgi.framework.ServiceReference; |
31 | |
import org.osgi.framework.ServiceRegistration; |
32 | |
import org.seasar.uruma.util.AssertionUtil; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
public class MockBundleContext implements BundleContext { |
40 | |
protected Bundle bundle; |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | 0 | public MockBundleContext(final MockBundle bundle) { |
46 | 0 | AssertionUtil.assertNotNull("bundle", bundle); |
47 | 0 | this.bundle = bundle; |
48 | 0 | } |
49 | |
|
50 | |
public void addBundleListener(final BundleListener listener) { |
51 | |
|
52 | 0 | } |
53 | |
|
54 | |
public void addFrameworkListener(final FrameworkListener listener) { |
55 | |
|
56 | 0 | } |
57 | |
|
58 | |
public void addServiceListener(final ServiceListener listener) { |
59 | |
|
60 | 0 | } |
61 | |
|
62 | |
public void addServiceListener(final ServiceListener listener, |
63 | |
final String filter) throws InvalidSyntaxException { |
64 | |
|
65 | 0 | } |
66 | |
|
67 | |
public Filter createFilter(final String filter) |
68 | |
throws InvalidSyntaxException { |
69 | 0 | return null; |
70 | |
} |
71 | |
|
72 | |
public ServiceReference[] getAllServiceReferences(final String clazz, |
73 | |
final String filter) throws InvalidSyntaxException { |
74 | 0 | return null; |
75 | |
} |
76 | |
|
77 | |
public Bundle getBundle() { |
78 | 0 | return bundle; |
79 | |
} |
80 | |
|
81 | |
public Bundle getBundle(final long id) { |
82 | 0 | return bundle; |
83 | |
} |
84 | |
|
85 | |
public Bundle[] getBundles() { |
86 | 0 | return new Bundle[] { bundle }; |
87 | |
} |
88 | |
|
89 | |
public File getDataFile(final String filename) { |
90 | 0 | return null; |
91 | |
} |
92 | |
|
93 | |
public String getProperty(final String key) { |
94 | 0 | return null; |
95 | |
} |
96 | |
|
97 | |
public Object getService(final ServiceReference reference) { |
98 | 0 | return null; |
99 | |
} |
100 | |
|
101 | |
public ServiceReference getServiceReference(final String clazz) { |
102 | 0 | return null; |
103 | |
} |
104 | |
|
105 | |
public ServiceReference[] getServiceReferences(final String clazz, |
106 | |
final String filter) throws InvalidSyntaxException { |
107 | 0 | return null; |
108 | |
} |
109 | |
|
110 | |
public Bundle installBundle(final String location) throws BundleException { |
111 | 0 | return null; |
112 | |
} |
113 | |
|
114 | |
public Bundle installBundle(final String location, final InputStream input) |
115 | |
throws BundleException { |
116 | |
|
117 | 0 | return null; |
118 | |
} |
119 | |
|
120 | |
@SuppressWarnings("unchecked") |
121 | |
public ServiceRegistration registerService(final String[] clazzes, |
122 | |
final Object service, final Dictionary properties) { |
123 | 0 | return null; |
124 | |
} |
125 | |
|
126 | |
@SuppressWarnings("unchecked") |
127 | |
public ServiceRegistration registerService(final String clazz, |
128 | |
final Object service, final Dictionary properties) { |
129 | 0 | return null; |
130 | |
} |
131 | |
|
132 | |
public void removeBundleListener(final BundleListener listener) { |
133 | |
|
134 | 0 | } |
135 | |
|
136 | |
public void removeFrameworkListener(final FrameworkListener listener) { |
137 | |
|
138 | 0 | } |
139 | |
|
140 | |
public void removeServiceListener(final ServiceListener listener) { |
141 | |
|
142 | 0 | } |
143 | |
|
144 | |
public boolean ungetService(final ServiceReference reference) { |
145 | 0 | return false; |
146 | |
} |
147 | |
|
148 | |
} |