FELIX-4813 : Metatype information might contain wrong default values
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1663103 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index 8457f14..8a4ea81 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -70,9 +70,13 @@
org.ietf.jgss;resolution:=optional,
org.mortbay.log;resolution:=optional;version="[6.1,7)",
org.mortbay.util.ajax;resolution:=optional;version="[6.1,7)",
+ org.osgi.service.metatype;version="[1.1,2)";resolution:=optional,
org.osgi.service.useradmin;resolution:=optional,
*
</Import-Package>
+ <DynamicImport-Package>
+ org.osgi.service.metatype;version="[1.1,2)"
+ </DynamicImport-Package>
</instructions>
<!-- Skip Baselining due to Jetty API -->
<skip>true</skip>
@@ -85,7 +89,7 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>6.0.0</version>
+ <version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -146,12 +150,12 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.api</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.base</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>2.4.0</version>
</dependency>
</dependencies>
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java
index 2bb8f96..5e8bb90 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyActivator.java
@@ -16,22 +16,59 @@
*/
package org.apache.felix.http.jetty.internal;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
import org.apache.felix.http.base.internal.AbstractHttpActivator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
public final class JettyActivator extends AbstractHttpActivator
{
private JettyService jetty;
+ private ServiceRegistration<?> metatypeReg;
+
+ @Override
protected void doStart() throws Exception
{
super.doStart();
+ final Dictionary<String, Object> properties = new Hashtable<String, Object>();
+ properties.put(Constants.SERVICE_DESCRIPTION, "Metatype provider for Jetty Http Service");
+ properties.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+ properties.put("metatype.pid", JettyService.PID);
+
+ metatypeReg = this.getBundleContext().registerService("org.osgi.service.metatype.MetaTypeProvider",
+ new ServiceFactory()
+ {
+
+ @Override
+ public Object getService(final Bundle bundle, final ServiceRegistration registration)
+ {
+ return new ConfigMetaTypeProvider(getBundleContext().getBundle());
+ }
+
+ @Override
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+ {
+ // nothing to do
+ }
+ }, properties);
this.jetty = new JettyService(getBundleContext(), getDispatcherServlet(), getEventDispatcher(), getHttpServiceController());
this.jetty.start();
}
+ @Override
protected void doStop() throws Exception
{
this.jetty.stop();
+ if ( metatypeReg != null )
+ {
+ metatypeReg.unregister();
+ metatypeReg = null;
+ }
super.doStop();
}
}
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
index 4b056bc..daafbef 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
@@ -33,54 +33,54 @@
public final class JettyConfig
{
/** Felix specific property to set the interface to listen on. Applies to both HTTP and HTTP */
- private static final String FELIX_HOST = "org.apache.felix.http.host";
+ public static final String FELIX_HOST = "org.apache.felix.http.host";
/** Standard OSGi port property for HTTP service */
- private static final String HTTP_PORT = "org.osgi.service.http.port";
+ public static final String HTTP_PORT = "org.osgi.service.http.port";
/** Standard OSGi port property for HTTPS service */
- private static final String HTTPS_PORT = "org.osgi.service.http.port.secure";
+ public static final String HTTPS_PORT = "org.osgi.service.http.port.secure";
/** Felix specific property to set http reaching timeout limit */
public static final String HTTP_TIMEOUT = "org.apache.felix.http.timeout";
/** Felix specific property to enable debug messages */
- private static final String FELIX_HTTP_DEBUG = "org.apache.felix.http.debug";
- private static final String HTTP_DEBUG = "org.apache.felix.http.jetty.debug";
+ public static final String FELIX_HTTP_DEBUG = "org.apache.felix.http.debug";
+ public static final String HTTP_DEBUG = "org.apache.felix.http.jetty.debug";
/** Felix specific property to override the keystore file location. */
- private static final String FELIX_KEYSTORE = "org.apache.felix.https.keystore";
+ public static final String FELIX_KEYSTORE = "org.apache.felix.https.keystore";
private static final String OSCAR_KEYSTORE = "org.ungoverned.osgi.bundle.https.keystore";
/** Felix specific property to override the keystore password. */
- private static final String FELIX_KEYSTORE_PASSWORD = "org.apache.felix.https.keystore.password";
+ public static final String FELIX_KEYSTORE_PASSWORD = "org.apache.felix.https.keystore.password";
private static final String OSCAR_KEYSTORE_PASSWORD = "org.ungoverned.osgi.bundle.https.password";
/** Felix specific property to override the keystore key password. */
- private static final String FELIX_KEYSTORE_KEY_PASSWORD = "org.apache.felix.https.keystore.key.password";
+ public static final String FELIX_KEYSTORE_KEY_PASSWORD = "org.apache.felix.https.keystore.key.password";
private static final String OSCAR_KEYSTORE_KEY_PASSWORD = "org.ungoverned.osgi.bundle.https.key.password";
/** Felix specific property to override the type of keystore (JKS). */
- private static final String FELIX_KEYSTORE_TYPE = "org.apache.felix.https.keystore.type";
+ public static final String FELIX_KEYSTORE_TYPE = "org.apache.felix.https.keystore.type";
/** Felix specific property to control whether to enable HTTPS. */
- private static final String FELIX_HTTPS_ENABLE = "org.apache.felix.https.enable";
+ public static final String FELIX_HTTPS_ENABLE = "org.apache.felix.https.enable";
private static final String OSCAR_HTTPS_ENABLE = "org.ungoverned.osgi.bundle.https.enable";
/** Felix specific property to control whether to enable HTTP. */
- private static final String FELIX_HTTP_ENABLE = "org.apache.felix.http.enable";
+ public static final String FELIX_HTTP_ENABLE = "org.apache.felix.http.enable";
/** Felix specific property to override the truststore file location. */
- private static final String FELIX_TRUSTSTORE = "org.apache.felix.https.truststore";
+ public static final String FELIX_TRUSTSTORE = "org.apache.felix.https.truststore";
/** Felix specific property to override the truststore password. */
- private static final String FELIX_TRUSTSTORE_PASSWORD = "org.apache.felix.https.truststore.password";
+ public static final String FELIX_TRUSTSTORE_PASSWORD = "org.apache.felix.https.truststore.password";
/** Felix specific property to override the type of truststore (JKS). */
- private static final String FELIX_TRUSTSTORE_TYPE = "org.apache.felix.https.truststore.type";
+ public static final String FELIX_TRUSTSTORE_TYPE = "org.apache.felix.https.truststore.type";
/** Felix specific property to control whether to want or require HTTPS client certificates. Valid values are "none", "wants", "needs". Default is "none". */
- private static final String FELIX_HTTPS_CLIENT_CERT = "org.apache.felix.https.clientcertificate";
+ public static final String FELIX_HTTPS_CLIENT_CERT = "org.apache.felix.https.clientcertificate";
/** Felix specific property to configure the session timeout in minutes (same session-timout in web.xml). Default is servlet container specific */
public static final String FELIX_SESSION_TIMEOUT = "org.apache.felix.http.session.timeout";
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index fa6a1bd..f0b7bca 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -70,7 +70,6 @@
import org.osgi.service.cm.ManagedService;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;
-import org.osgi.service.http.runtime.HttpServiceRuntimeConstants;
import org.osgi.util.tracker.BundleTracker;
import org.osgi.util.tracker.BundleTrackerCustomizer;
import org.osgi.util.tracker.ServiceTracker;
@@ -79,7 +78,9 @@
public final class JettyService extends AbstractLifeCycle.AbstractLifeCycleListener implements BundleTrackerCustomizer, ServiceTrackerCustomizer
{
/** PID for configuration of the HTTP service. */
- private static final String PID = "org.apache.felix.http";
+ public static final String PID = "org.apache.felix.http";
+ /** Endpoint service registration property from RFC 189 */
+ private static final String REG_PROPERTY_ENDPOINTS = "osgi.http.service.endpoints";
private static final String HEADER_WEB_CONTEXT_PATH = "Web-ContextPath";
private static final String HEADER_ACTIVATION_POLICY = "Bundle-ActivationPolicy";
@@ -598,7 +599,7 @@
}
}
}
- props.put(HttpServiceRuntimeConstants.HTTP_SERVICE_ENDPOINT_ATTRIBUTE,
+ props.put(REG_PROPERTY_ENDPOINTS,
endpoints.toArray(new String[endpoints.size()]));
}
diff --git a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
deleted file mode 100644
index e0d7ebe..0000000
--- a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ /dev/null
@@ -1,152 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-
-
-#
-# This file contains localization strings for configuration labels and
-# descriptions as used in the metatype.xml descriptor generated by the
-# the Felix SCR plugin
-
-org.apache.felix.http.jetty.internal.JettyConfig.name = Apache Felix Jetty Based Http Service
-org.apache.felix.http.jetty.internal.JettyConfig.description = Configuration for \
- the embedded Jetty Servlet Container.
-
-org.apache.felix.http.host.name = Host Name
-org.apache.felix.http.host.description = IP Address or Host Name of the \
- interface to which HTTP and HTTPS bind. The default is "0.0.0.0" \
- indicating all interfaces.
-
-org.osgi.service.http.port.name = HTTP Port
-org.osgi.service.http.port.description = Port to listen on for HTTP requests. \
- Defaults to 8080.
-
-org.osgi.service.http.port.secure.name = HTTPS Port
-org.osgi.service.http.port.secure.description = Port to listen on for HTTPS \
- requests. Defaults to 433.
-
-org.apache.felix.http.timeout.name = Connection Timeout
-org.apache.felix.http.timeout.description = Time limit for reaching an \
- timeout specified in milliseconds. This property applies to both HTTP \
- and HTTP connections. Defaults to 60 seconds.
-
-org.apache.felix.http.session.timeout.name = Session Timeout
-org.apache.felix.http.session.timeout.description = Default lifetime of \
- an HTTP session specified in a whole number of minutes. If the timeout \
- is 0 or less, sessions will by default never timeout. The default is 0.
-
-org.apache.felix.http.debug.name = Debug Logging
-org.apache.felix.http.debug.description = Whether to write DEBUG level \
- messages or not. Defaults to false.
-
-org.apache.felix.https.keystore.name = Keystore
-org.apache.felix.https.keystore.description = Absolute Path to the Keystore to \
- use for HTTPS. Only used if HTTPS is enabled in which case this property is \
- required.
-
-org.apache.felix.https.keystore.password.name = Keystore Password
-org.apache.felix.https.keystore.password.description = Password to access the \
- Keystore. Only used if HTTPS is enabled.
-
-org.apache.felix.https.keystore.key.password.name = Key Password
-org.apache.felix.https.keystore.key.password.description = Password to unlock \
- the secret key from the Keystore. Only used if HTTPS is enabled.
-
-org.apache.felix.http.enable.name = Enable HTTP
-org.apache.felix.http.enable.description = Whether or not HTTP is enabled. \
- Defaults to true thus HTTP enabled.
-
-org.apache.felix.https.enable.name = Enable HTTPS
-org.apache.felix.https.enable.description = Whether or not HTTPS is enabled. \
- Defaults to false thus HTTPS disabled.
-
-org.apache.felix.https.truststore.name = Truststore
-org.apache.felix.https.truststore.description = Absolute Path to the Truststore \
- to use for HTTPS. Only used if HTTPS is enabled.
-
- org.apache.felix.https.truststore.password.name = Truststore Password
- org.apache.felix.https.truststore.password.description = Password to access the \
- Truststore. Only used if HTTPS is enabled.
-
-org.apache.felix.https.clientcertificate.name = Client Certificate
-org.apache.felix.https.clientcertificate.description = Requirement for the \
- Client to provide a valid certifcate. Defaults to none.
-
-clientcertificate.none = No Client Certificate
-clientcertificate.wants = Client Certficate Wanted
-clientcertificate.needs = Client Certificate Needed
-
-org.apache.felix.http.mbeans.name = Register MBeans
-org.apache.felix.http.mbeans.description = Whether or not to use register \
- JMX MBeans from the servlet container (Jetty). If this is enabled \
- Jetty Request and Connector statistics are also enabled. The default is \
- to not enable JMX.
-
-org.apache.felix.http.jetty.headerBufferSize.name = Header Buffer Size
-org.apache.felix.http.jetty.headerBufferSize.description = Size of the \
- buffer for request and response headers. Default is 16KB.
-
-org.apache.felix.http.jetty.requestBufferSize.name = Request Buffer Size
-org.apache.felix.http.jetty.requestBufferSize.description = Size of the \
- buffer for requests not fitting the header buffer. Default is 8KB.
-
-org.apache.felix.http.jetty.responseBufferSize.name = Response Buffer Size
-org.apache.felix.http.jetty.responseBufferSize.description = Size of the \
- buffer for responses. Default is 24KB.
-
-org.apache.felix.http.jetty.maxFormSize.name = Maxmimum Form Size
-org.apache.felix.http.jetty.maxFormSize.description = Size of Body for \
- submitted form content. Default is 200KB.
-
-org.apache.felix.http.context_path.name = Context Path
-org.apache.felix.http.context_path.description = The Servlet Context Path \
- to use for the Http Service. If this property is not configured it \
- defaults to "/". This must be a valid path starting with a slash and not \
- ending with a slash (unless it is the root context).
-
-org.apache.felix.http.path_exclusions.name = Path Exclusions
-org.apache.felix.http.path_exclusions.description = Contains a list of \
- context path prefixes. If a Web Application Bundle is started with a \
- context path matching any of these prefixes, it will not be deployed \
- in the servlet container.
-
-org.apache.felix.https.jetty.cipersuites.excluded.name = Excluded cipher suites
-org.apache.felix.https.jetty.cipersuites.excluded.description = List of cipher \
- suites that should be excluded. Default is none.
-
-org.apache.felix.https.jetty.cipersuites.included.name = Included cipher suites
-org.apache.felix.https.jetty.cipersuites.included.description = List of cipher \
- suites that should be included. Default is none.
-
-org.apache.felix.https.jetty.protocols.included.name = Included protocols
-org.apache.felix.https.jetty.protocols.included.description = List of SSL protocols \
- to include by default. Protocols may be any supported by the Java \
- platform such as SSLv2Hello, SSLv3, TLSv1, TLSv1.1, or TLSv1.2. Any \
- listed protocl not supported is silently ignored. Default \
- is none assuming to use any protocol enabled and supported on the platform.
-
-org.apache.felix.https.jetty.protocols.excluded.name = Excluded protocols
-org.apache.felix.https.jetty.protocols.excluded.description = List of SSL protocols \
- to exclude. This property further restricts the enabled protocols by \
- explicitly disabling. Any protocol listed in both this property and the \
- Included protocols property is excluded. Default is none such as to \
- accept all protocols enabled on platform or explicitly listed by the \
- Included protocols property.
-
-org.apache.felix.http.jetty.sendServerHeader.name = Send Server Header
-org.apache.felix.http.jetty.sendServerHeader.description = If enabled, the server header is sent.
\ No newline at end of file
diff --git a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml b/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
deleted file mode 100644
index ae4f4c7..0000000
--- a/http/jetty/src/main/resources/OSGI-INF/metatype/metatype.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
--->
-<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" localization="OSGI-INF/metatype/metatype">
- <OCD id="org.apache.felix.http" name="%org.apache.felix.http.jetty.internal.JettyConfig.name" description="%org.apache.felix.http.jetty.internal.JettyConfig.description">
- <AD id="org.apache.felix.http.host" type="String" default="0.0.0.0" name="%org.apache.felix.http.host.name" description="%org.apache.felix.http.host.description"/>
- <AD id="org.apache.felix.http.enable" type="Boolean" default="true" name="%org.apache.felix.http.enable.name" description="%org.apache.felix.http.enable.description"/>
- <AD id="org.osgi.service.http.port" type="Integer" default="8080" name="%org.osgi.service.http.port.name" description="%org.osgi.service.http.port.description"/>
- <AD id="org.apache.felix.http.timeout" type="Integer" default="60000" name="%org.apache.felix.http.timeout.name" description="%org.apache.felix.http.timeout.description"/>
- <AD id="org.apache.felix.https.enable" type="Boolean" default="false" name="%org.apache.felix.https.enable.name" description="%org.apache.felix.https.enable.description"/>
- <AD id="org.osgi.service.http.port.secure" type="Integer" default="433" name="%org.osgi.service.http.port.secure.name" description="%org.osgi.service.http.port.secure.description"/>
- <AD id="org.apache.felix.https.keystore" type="String" name="%org.apache.felix.https.keystore.name" description="%org.apache.felix.https.keystore.description"/>
- <AD id="org.apache.felix.https.keystore.password" type="String" name="%org.apache.felix.https.keystore.password.name" description="%org.apache.felix.https.keystore.password.description"/>
- <AD id="org.apache.felix.https.keystore.key.password" type="String" name="%org.apache.felix.https.keystore.key.password.name" description="%org.apache.felix.https.keystore.key.password.description"/>
- <AD id="org.apache.felix.https.truststore" type="String" name="%org.apache.felix.https.truststore.name" description="%org.apache.felix.https.truststore.description"/>
- <AD id="org.apache.felix.https.truststore.password" type="String" name="%org.apache.felix.https.truststore.password.name" description="%org.apache.felix.https.truststore.password.description"/>
- <AD id="org.apache.felix.https.clientcertificate" type="String" default="none" name="%org.apache.felix.https.clientcertificate.name" description="%org.apache.felix.https.clientcertificate.description">
- <Option value="none" label="%clientcertificate.none"/>
- <Option value="wants" label="%clientcertificate.wants"/>
- <Option value="needs" label="%clientcertificate.needs"/>
- </AD>
- <AD id="org.apache.felix.http.context_path" type="String" default="/" name="%org.apache.felix.http.context_path.name" description="%org.apache.felix.http.context_path.description"/>
- <AD id="org.apache.felix.http.mbeans" type="Boolean" default="false" name="%org.apache.felix.http.mbeans.name" description="%org.apache.felix.http.mbeans.description"/>
- <AD id="org.apache.felix.http.session.timeout" type="Integer" default="0" name="%org.apache.felix.http.session.timeout.name" description="%org.apache.felix.http.session.timeout.description"/>
- <AD id="org.apache.felix.http.jetty.headerBufferSize" type="Integer" default="16384" name="%org.apache.felix.http.jetty.headerBufferSize.name" description="%org.apache.felix.http.jetty.headerBufferSize.description"/>
- <AD id="org.apache.felix.http.jetty.requestBufferSize" type="Integer" default="8192" name="%org.apache.felix.http.jetty.requestBufferSize.name" description="%org.apache.felix.http.jetty.requestBufferSize.description"/>
- <AD id="org.apache.felix.http.jetty.responseBufferSize" type="Integer" default="24576" name="%org.apache.felix.http.jetty.responseBufferSize.name" description="%org.apache.felix.http.jetty.responseBufferSize.description"/>
- <AD id="org.apache.felix.http.jetty.maxFormSize" type="Integer" default="204800" name="%org.apache.felix.http.jetty.maxFormSize.name" description="%org.apache.felix.http.jetty.maxFormSize.description"/>
- <AD id="org.apache.felix.http.debug" type="Boolean" default="false" name="%org.apache.felix.http.debug.name" description="%org.apache.felix.http.debug.description"/>
- <AD id="org.apache.felix.http.path_exclusions" type="String" default="/system" cardinality="2147483647" name="%org.apache.felix.http.path_exclusions.name" description="%org.apache.felix.http.path_exclusions.description"/>
- <AD id="org.apache.felix.https.jetty.cipersuites.excluded" type="String" cardinality="2147483647" name="%org.apache.felix.https.jetty.cipersuites.excluded.name" description="%org.apache.felix.https.jetty.cipersuites.excluded.description"/>
- <AD id="org.apache.felix.https.jetty.cipersuites.included" type="String" cardinality="2147483647" name="%org.apache.felix.https.jetty.cipersuites.included.name" description="%org.apache.felix.https.jetty.cipersuites.included.description"/>
- <AD id="org.apache.felix.http.jetty.sendServerHeader" type="Boolean" default="true" name="%org.apache.felix.http.jetty.sendServerHeader.name" description="%org.apache.felix.http.jetty.sendServerHeader.description"/>
- <AD id="org.apache.felix.https.jetty.protocols.included" type="String" cardinality="2147483647" name="%org.apache.felix.https.jetty.protocols.included.name" description="%org.apache.felix.https.jetty.protocols.included.description"/>
- <AD id="org.apache.felix.https.jetty.protocols.excluded" type="String" cardinality="2147483647" name="%org.apache.felix.https.jetty.protocols.excluded.name" description="%org.apache.felix.https.jetty.protocols.excluded.description"/>
- </OCD>
- <Designate pid="org.apache.felix.http">
- <Object ocdref="org.apache.felix.http"/>
- </Designate>
-</metatype:MetaData>
diff --git a/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java b/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
index b1f2c41..f8ab1ee 100644
--- a/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
+++ b/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
@@ -48,16 +48,9 @@
import org.apache.felix.http.jetty.internal.JettyService.Deployment;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletHolder;
-import org.mockito.Matchers;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;
-import org.osgi.service.http.context.ServletContextHelper;
-import org.osgi.service.http.runtime.HttpServiceRuntime;
public class JettyServiceTest extends TestCase
{
@@ -92,19 +85,6 @@
when(mockBundle.getSymbolicName()).thenReturn("main");
when(mockBundle.getVersion()).thenReturn(new Version("1.0.0"));
when(mockBundle.getHeaders()).thenReturn(new Hashtable<String, String>());
- final ServiceReference ref = mock(ServiceReference.class);
- when(ref.getProperty(Constants.SERVICE_ID)).thenReturn(1L);
- final ServiceRegistration reg = mock(ServiceRegistration.class);
- when(reg.getReference()).thenReturn(ref);
- when(mockBundleContext.registerService((Class<ServletContextHelper>)Matchers.isNotNull(),
- (ServiceFactory<ServletContextHelper>)Matchers.any(ServiceFactory.class),
- Matchers.any(Dictionary.class))).thenReturn(reg);
- when(mockBundleContext.registerService(Matchers.<String[]>any(),
- Matchers.any(ServiceFactory.class),
- Matchers.any(Dictionary.class))).thenReturn(reg);
- when(mockBundleContext.registerService((Class<HttpServiceRuntime>)Matchers.isNotNull(),
- Matchers.any(HttpServiceRuntime.class),
- Matchers.any(Dictionary.class))).thenReturn(reg);
httpServiceController = new HttpServiceController(mockBundleContext);
dispatcherServlet = new DispatcherServlet(httpServiceController);
@@ -158,13 +138,11 @@
//Add a Filter to test whether the osgi-bundlecontext is available at init
webAppBundleContext.addServlet(new ServletHolder(new Servlet()
{
- @Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
// Do Nothing
}
- @Override
public void init(ServletConfig config) throws ServletException
{
ServletContext context = config.getServletContext();
@@ -174,19 +152,16 @@
testLatch.countDown();
}
- @Override
public String getServletInfo()
{
return null;
}
- @Override
public ServletConfig getServletConfig()
{
return null;
}
- @Override
public void destroy()
{
// Do Nothing
@@ -195,7 +170,6 @@
webAppBundleContext.addFilter(new FilterHolder(new Filter()
{
- @Override
public void init(FilterConfig filterConfig) throws ServletException
{
ServletContext context = filterConfig.getServletContext();
@@ -205,13 +179,11 @@
testLatch.countDown();
}
- @Override
public void doFilter(ServletRequest arg0, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
// Do Nothing
}
- @Override
public void destroy()
{
// Do Nothing
@@ -228,4 +200,4 @@
fail("Test Was not asserted");
}
}
-}
\ No newline at end of file
+}