You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2015/06/24 22:07:42 UTC
svn commit: r1687355 - in /felix/trunk/http:
base/src/main/java/org/apache/felix/http/base/internal/registry/ bundle/
itest/ itest/src/test/java/org/apache/felix/http/itest/ jetty/
jetty/src/main/java/org/apache/felix/http/jetty/internal/ parent/
Author: cziegeler
Date: Wed Jun 24 20:07:42 2015
New Revision: 1687355
URL: http://svn.apache.org/r1687355
Log:
Update to new parent pom 3, cleanup pax exam configuration
Modified:
felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/HandlerRegistry.java
felix/trunk/http/bundle/pom.xml
felix/trunk/http/itest/pom.xml
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ErrorPageTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpServiceRuntimeTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpWhiteboardTargetTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ServletPatternTest.java
felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java
felix/trunk/http/jetty/pom.xml
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyManagedService.java
felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
felix/trunk/http/parent/pom.xml
Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/HandlerRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/HandlerRegistry.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/HandlerRegistry.java (original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/HandlerRegistry.java Wed Jun 24 20:07:42 2015
@@ -200,13 +200,13 @@ public final class HandlerRegistry
/**
* Get the servlet handler for a servlet by name
- * @param contextId The context id or {@code null}
+ * @param contextId The context id
* @param name The servlet name
* @return The servlet handler or {@code null}
*/
- public ServletResolution resolveServletByName(final Long contextId, @Nonnull final String name)
+ public ServletResolution resolveServletByName(final long contextId, @Nonnull final String name)
{
- final PerContextHandlerRegistry reg = (contextId == null ? null : this.getRegistry(contextId));
+ final PerContextHandlerRegistry reg = this.getRegistry(contextId);
if ( reg != null )
{
final ServletHandler handler = reg.resolveServletByName(name);
Modified: felix/trunk/http/bundle/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/bundle/pom.xml?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/bundle/pom.xml (original)
+++ felix/trunk/http/bundle/pom.xml Wed Jun 24 20:07:42 2015
@@ -38,7 +38,7 @@
</scm>
<properties>
- <http.java.version>7</http.java.version>
+ <felix.java.version>7</felix.java.version>
</properties>
<build>
Modified: felix/trunk/http/itest/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/pom.xml?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/pom.xml (original)
+++ felix/trunk/http/itest/pom.xml Wed Jun 24 20:07:42 2015
@@ -31,11 +31,9 @@
</scm>
<properties>
- <pax.exam.version>2.6.0</pax.exam.version>
- <pax.exam.plugin.version>1.2.4</pax.exam.plugin.version>
- <pax.url.aether.version>2.1.0</pax.url.aether.version>
- <pax.swissbox.version>1.7.0</pax.swissbox.version>
- <pax.runner.version>1.7.6</pax.runner.version>
+ <felix.java.version>7</felix.java.version>
+ <pax.exam.version>4.4.0</pax.exam.version>
+ <pax.url.aether.version>2.4.1</pax.url.aether.version>
</properties>
<dependencies>
@@ -46,28 +44,28 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- <scope>provided</scope>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-osgi</artifactId>
<version>4.3.2</version>
<scope>provided</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-osgi</artifactId>
<version>4.3.4</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
<scope>provided</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>org.apache.felix.http.api</artifactId>
@@ -83,72 +81,37 @@
<artifactId>org.apache.felix.http.jetty</artifactId>
<version>3.0.3-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <version>1.8.0</version>
- </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-forked</artifactId>
+ <version>${pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.objenesis</groupId>
- <artifactId>objenesis</artifactId>
- <version>2.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit4</artifactId>
- <version>${pax.exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-forked</artifactId>
- <version>${pax.exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.runner</groupId>
- <artifactId>pax-runner-no-jcl</artifactId>
- <version>${pax.runner.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-link-assembly</artifactId>
- <version>${pax.exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-link-mvn</artifactId>
- <version>${pax.exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-aether</artifactId>
- <version>${pax.url.aether.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-wrap</artifactId>
- <version>${pax.url.aether.version}</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${pax.url.aether.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
@@ -158,38 +121,8 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
- <version>5.0.0</version>
+ <version>5.0.1</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.6.0</version>
- <scope>compile</scope>
- </dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <version>1.2.4</version>
- <executions>
- <execution>
- <id>generate-config</id>
- <goals>
- <goal>generate-depends-file</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
</project>
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java Wed Jun 24 20:07:42 2015
@@ -35,12 +35,15 @@ import javax.servlet.http.HttpServletRes
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class AsyncTest extends BaseIntegrationTest
{
@@ -64,6 +67,7 @@ public class AsyncTest extends BaseInteg
asyncContext.setTimeout(2000);
asyncContext.start(new Runnable()
{
+ @Override
public void run()
{
try
@@ -125,6 +129,7 @@ public class AsyncTest extends BaseInteg
final AsyncContext asyncContext = req.startAsync(req, resp);
asyncContext.start(new Runnable()
{
+ @Override
public void run()
{
try
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java Wed Jun 24 20:07:42 2015
@@ -19,18 +19,17 @@
package org.apache.felix.http.itest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import static org.ops4j.pax.exam.Constants.START_LEVEL_SYSTEM_BUNDLES;
import static org.ops4j.pax.exam.Constants.START_LEVEL_TEST_BUNDLE;
-import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackage;
-import static org.ops4j.pax.exam.CoreOptions.cleanCaches;
-import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.url;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.when;
import java.io.Closeable;
import java.io.IOException;
@@ -61,9 +60,8 @@ import javax.servlet.http.HttpServletRes
import org.apache.felix.http.api.ExtHttpService;
import org.junit.After;
import org.junit.Before;
-import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -175,7 +173,7 @@ public abstract class BaseIntegrationTes
protected static final int DEFAULT_TIMEOUT = 10000;
- protected static final String ORG_APACHE_FELIX_HTTP_JETTY = "org.apache.felix.http.jetty";
+ private static final String ORG_APACHE_FELIX_HTTP_JETTY = "org.apache.felix.http.jetty";
protected static void assertContent(int expectedRC, String expected, URL url) throws IOException
{
@@ -309,38 +307,34 @@ public abstract class BaseIntegrationTes
@Configuration
public Option[] config()
{
+ final String localRepo = System.getProperty("maven.repo.local", "");
+
return options(
- bootDelegationPackage("sun.*"),
- cleanCaches(),
- CoreOptions.systemProperty("logback.configurationFile").value("file:src/test/resources/logback.xml"), //
+ when( localRepo.length() > 0 ).useOptions(
+ systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
+ ),
// CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"),
- mavenBundle("org.slf4j", "slf4j-api").version("1.6.5").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("ch.qos.logback", "logback-core").version("1.0.6").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("ch.qos.logback", "logback-classic").version("1.0.6").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-
- url("link:classpath:META-INF/links/org.ops4j.pax.exam.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.ops4j.pax.exam.inject.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.ops4j.pax.extender.service.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.ops4j.base.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.core.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.extender.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.lifecycle.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.framework.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- url("link:classpath:META-INF/links/org.apache.geronimo.specs.atinject.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-
- mavenBundle("org.apache.felix", "org.apache.felix.http.api").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY).versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
-
- mavenBundle("org.mockito", "mockito-core").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("org.objenesis", "objenesis").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("com.googlecode.json-simple", "json-simple").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("org.apache.httpcomponents", "httpcore-osgi").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
- mavenBundle("org.apache.httpcomponents", "httpclient-osgi").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "4.0.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice", "1.0.2"),
+
+ mavenBundle("org.slf4j", "slf4j-api", "1.6.4"),
+ mavenBundle("org.slf4j", "jcl-over-slf4j", "1.6.4"),
+ mavenBundle("org.slf4j", "log4j-over-slf4j", "1.6.4"),
+
+ mavenBundle("org.apache.felix", "org.apache.felix.http.api").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY).startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin").version("1.8.6"),
+
+ mavenBundle("org.apache.httpcomponents", "httpcore-osgi").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("org.apache.httpcomponents", "httpclient-osgi").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("org.mockito", "mockito-all").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("org.objenesis", "objenesis").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+ mavenBundle("com.googlecode.json-simple", "json-simple").startLevel(START_LEVEL_SYSTEM_BUNDLES),
- junitBundles(), frameworkStartLevel(START_LEVEL_TEST_BUNDLE), felix());
+ junitBundles(),
+ frameworkStartLevel(START_LEVEL_TEST_BUNDLE));
}
private final Map<String, ServiceTracker<?, ?>> trackers = new HashMap<String, ServiceTracker<?, ?>>();
@@ -416,10 +410,11 @@ public abstract class BaseIntegrationTes
{
final String pid = "org.apache.felix.http";
- Collection<ServiceReference<ManagedService>> serviceRefs = m_context.getServiceReferences(ManagedService.class, String.format("(%s=%s)", Constants.SERVICE_PID, pid));
+ final Collection<ServiceReference<ManagedService>> serviceRefs = m_context.getServiceReferences(ManagedService.class, String.format("(%s=%s)", Constants.SERVICE_PID, pid));
assertNotNull("Unable to obtain managed configuration for " + pid, serviceRefs);
+ assertFalse("Unable to obtain managed configuration for " + pid, serviceRefs.isEmpty());
- for (ServiceReference<ManagedService> serviceRef : serviceRefs)
+ for (final ServiceReference<ManagedService> serviceRef : serviceRefs)
{
ManagedService service = m_context.getService(serviceRef);
try
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ErrorPageTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ErrorPageTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ErrorPageTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ErrorPageTest.java Wed Jun 24 20:07:42 2015
@@ -43,11 +43,14 @@ import javax.servlet.http.HttpServletRes
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.http.context.ServletContextHelper;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class ErrorPageTest extends BaseIntegrationTest
{
private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java Wed Jun 24 20:07:42 2015
@@ -38,15 +38,18 @@ import javax.servlet.http.HttpSessionLis
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.ServiceRegistration;
/**
* Test cases for all supported event listeners.
- *
+ *
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class EventListenerTest extends BaseIntegrationTest
{
/**
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java Wed Jun 24 20:07:42 2015
@@ -29,13 +29,16 @@ import org.eclipse.jetty.server.LocalCon
import org.eclipse.jetty.server.Server;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.ServiceRegistration;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class HttpJettyConnectorTest extends BaseIntegrationTest
{
@Test
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java Wed Jun 24 20:07:42 2015
@@ -50,14 +50,17 @@ import javax.servlet.http.HttpServletRes
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.Bundle;
import org.osgi.service.http.HttpContext;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class HttpJettyTest extends BaseIntegrationTest
{
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpServiceRuntimeTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpServiceRuntimeTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpServiceRuntimeTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpServiceRuntimeTest.java Wed Jun 24 20:07:42 2015
@@ -19,12 +19,12 @@
package org.apache.felix.http.itest;
import static java.util.Arrays.asList;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.fail;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.osgi.framework.Constants.SERVICE_RANKING;
import static org.osgi.service.http.runtime.HttpServiceRuntimeConstants.HTTP_SERVICE_ENDPOINT;
@@ -75,9 +75,9 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.ExamReactorStrategy;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactorFactory;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -92,8 +92,8 @@ import org.osgi.service.http.runtime.dto
import org.osgi.service.http.runtime.dto.ServletContextDTO;
import org.osgi.service.http.runtime.dto.ServletDTO;
-@RunWith(JUnit4TestRunner.class)
-@ExamReactorStrategy( EagerSingleStagedReactorFactory.class )
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class HttpServiceRuntimeTest extends BaseIntegrationTest
{
private static final String HTTP_CONTEXT_NAME = "org.osgi.service.http";
@@ -385,9 +385,13 @@ public class HttpServiceRuntimeTest exte
contextDTO = assertDefaultContext(runtimeDTOWithBothResources);
assertEquals(2, contextDTO.resourceDTOs.length);
assertEquals("/resources", contextDTO.resourceDTOs[0].prefix);
- assertArrayEquals(new String[] { "/resource_1/*" }, contextDTO.resourceDTOs[0].patterns);
- assertEquals("/resources", contextDTO.resourceDTOs[1].prefix);
- assertArrayEquals(new String[] { "/resource_2/*" }, contextDTO.resourceDTOs[1].patterns);
+ assertEquals(1, contextDTO.resourceDTOs[0].patterns.length);
+ assertEquals(1, contextDTO.resourceDTOs[1].patterns.length);
+ final Set<String> patterns = new HashSet<String>();
+ patterns.add(contextDTO.resourceDTOs[0].patterns[0]);
+ patterns.add(contextDTO.resourceDTOs[1].patterns[0]);
+ assertTrue(patterns.contains("/resource_1/*"));
+ assertTrue(patterns.contains("/resource_2/*"));
}
@Test
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpWhiteboardTargetTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpWhiteboardTargetTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpWhiteboardTargetTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/HttpWhiteboardTargetTest.java Wed Jun 24 20:07:42 2015
@@ -19,12 +19,10 @@
package org.apache.felix.http.itest;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
-import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
-import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
import static javax.servlet.http.HttpServletResponse.SC_OK;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.net.URL;
@@ -34,24 +32,27 @@ import java.util.concurrent.CountDownLat
import java.util.concurrent.TimeUnit;
import javax.servlet.Filter;
-import javax.servlet.Servlet;
import javax.servlet.FilterChain;
+import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class HttpWhiteboardTargetTest extends BaseIntegrationTest
{
-
- private static final String SERVICE_HTTP_PORT = "org.osgi.service.http.port";
-
+
+ private static final String SERVICE_HTTP_PORT = "org.osgi.service.http.port";
+
/**]
* Test that a servlet with the org.osgi.http.whiteboard.target property not set
* is registered with the whiteboard
@@ -61,109 +62,109 @@ public class HttpWhiteboardTargetTest ex
{
CountDownLatch initLatch = new CountDownLatch(1);
CountDownLatch destroyLatch = new CountDownLatch(1);
-
- TestServlet servlet = new TestServlet(initLatch, destroyLatch)
+
+ TestServlet servlet = new TestServlet(initLatch, destroyLatch)
{
private static final long serialVersionUID = 1L;
@Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
resp.getWriter().print("It works!");
resp.flushBuffer();
}
};
-
+
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servletAlias");
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + ".myname", "servletName");
-
+
ServiceRegistration<?> reg = m_context.registerService(Servlet.class.getName(), servlet, props);
try {
assertTrue(initLatch.await(5, TimeUnit.SECONDS));
URL testURL = createURL("/servletAlias");
- assertContent("It works!", testURL);
+ assertContent("It works!", testURL);
} finally {
- reg.unregister();
+ reg.unregister();
}
assertTrue(destroyLatch.await(5, TimeUnit.SECONDS));
}
-
+
/**
- * Test that a servlet with the org.osgi.http.whiteboard.target property matching the
- * HttpServiceRuntime properties is registered with the whiteboard.
- *
+ * Test that a servlet with the org.osgi.http.whiteboard.target property matching the
+ * HttpServiceRuntime properties is registered with the whiteboard.
+ *
* In the current implementation the HttpServiceRuntime properties are the same as the
- * HttpService properties.
- *
+ * HttpService properties.
+ *
*/
@Test
- public void testServletTargetMatchPort() throws Exception
+ public void testServletTargetMatchPort() throws Exception
{
CountDownLatch initLatch = new CountDownLatch(1);
CountDownLatch destroyLatch = new CountDownLatch(1);
-
+
TestServlet servlet = new TestServlet(initLatch, destroyLatch)
{
private static final long serialVersionUID = 1L;
@Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
resp.getWriter().print("matchingServlet");
resp.flushBuffer();
}
};
-
+
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servletAlias");
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + ".myname", "servletName");
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_TARGET, "(" + SERVICE_HTTP_PORT + "=8080" + ")");
-
+
ServiceRegistration<?> reg = m_context.registerService(Servlet.class.getName(), servlet, props);
-
+
try {
assertTrue(initLatch.await(5, TimeUnit.SECONDS));
URL testURL = createURL("/servletAlias");
- assertContent("matchingServlet", testURL);
+ assertContent("matchingServlet", testURL);
} finally {
reg.unregister();
}
-
- assertTrue(destroyLatch.await(5, TimeUnit.SECONDS));
+
+ assertTrue(destroyLatch.await(5, TimeUnit.SECONDS));
}
-
+
/**
* Test that a servlet with the org.osgi.http.whiteboard.target property not matching
* the properties of the HttpServiceRuntime is not registered with the whiteboard.
- *
+ *
*/
@Test
- public void testServletTargetNotMatchPort() throws Exception
+ public void testServletTargetNotMatchPort() throws Exception
{
CountDownLatch initLatch = new CountDownLatch(1);
CountDownLatch destroyLatch = new CountDownLatch(1);
- TestServlet nonMatchingServlet = new TestServlet(initLatch, destroyLatch)
+ TestServlet nonMatchingServlet = new TestServlet(initLatch, destroyLatch)
{
private static final long serialVersionUID = 1L;
@Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
resp.getWriter().print("nonMatchingServlet");
resp.flushBuffer();
}
};
-
+
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servletAlias");
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + ".myname", "servletName");
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_TARGET, "(" + SERVICE_HTTP_PORT + "=8282" + ")");
-
+
ServiceRegistration<?> reg = m_context.registerService(Servlet.class.getName(), nonMatchingServlet, props);
-
+
try {
// the servlet will not be registered, its init method will not be called, await must return false due to timeout
assertFalse(initLatch.await(5, TimeUnit.SECONDS));
@@ -172,22 +173,22 @@ public class HttpWhiteboardTargetTest ex
} finally {
reg.unregister();
}
- }
-
+ }
+
/**
* Test that a filter with no target property set is correctly registered with the whiteboard
- *
+ *
*/
@Test
public void testFilterNoTargetProperty() throws Exception
{
CountDownLatch initLatch = new CountDownLatch(3);
CountDownLatch destroyLatch = new CountDownLatch(3);
-
+
TestServlet servlet1 = new TestServlet(initLatch, destroyLatch)
{
private static final long serialVersionUID = 1L;
-
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
@@ -199,11 +200,11 @@ public class HttpWhiteboardTargetTest ex
props1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servlet/1");
props1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + ".myname", "servlet1");
props1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_TARGET, "(" + SERVICE_HTTP_PORT + "=8080" + ")");
-
+
TestServlet servlet2 = new TestServlet(initLatch, destroyLatch)
{
private static final long serialVersionUID = 1L;
-
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
@@ -215,8 +216,8 @@ public class HttpWhiteboardTargetTest ex
props2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servlet/2");
props2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + ".myname", "servle2");
props2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_TARGET, "(" + SERVICE_HTTP_PORT + "=8080" + ")");
-
- TestFilter filter = new TestFilter(initLatch, destroyLatch)
+
+ TestFilter filter = new TestFilter(initLatch, destroyLatch)
{
@Override
protected void filter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException
@@ -227,8 +228,8 @@ public class HttpWhiteboardTargetTest ex
resp.reset();
resp.sendError(SC_FORBIDDEN);
resp.flushBuffer();
- }
- else
+ }
+ else
{
chain.doFilter(req, resp);
}
@@ -242,33 +243,33 @@ public class HttpWhiteboardTargetTest ex
ServiceRegistration<?> reg1 = m_context.registerService(Servlet.class.getName(), servlet1, props1);
ServiceRegistration<?> reg2 = m_context.registerService(Servlet.class.getName(), servlet2, props2);
ServiceRegistration<?> reg = m_context.registerService(Filter.class.getName(), filter, props);
-
+
assertTrue(initLatch.await(5, TimeUnit.SECONDS));
-
+
assertResponseCode(SC_FORBIDDEN, createURL("/servlet/1?param=forbidden"));
assertContent("servlet1", createURL("/servlet/1?param=any"));
assertContent("servlet1", createURL("/servlet/1"));
-
+
assertResponseCode(SC_OK, createURL("/servlet/2?param=forbidden"));
assertContent("servlet2", createURL("/servlet/2?param=forbidden"));
-
+
reg1.unregister();
reg2.unregister();
reg.unregister();
-
+
assertTrue(destroyLatch.await(5, TimeUnit.SECONDS));
- }
-
+ }
+
@Test
public void testFilterTargetMatchPort() throws Exception
{
CountDownLatch initLatch = new CountDownLatch(2);
CountDownLatch destroyLatch = new CountDownLatch(2);
-
+
TestServlet servlet = new TestServlet(initLatch, destroyLatch)
{
private static final long serialVersionUID = 1L;
-
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
@@ -280,8 +281,8 @@ public class HttpWhiteboardTargetTest ex
sprops.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servlet");
sprops.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + ".myname", "servlet1");
sprops.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_TARGET, "(" + SERVICE_HTTP_PORT + "=8080" + ")");
-
- TestFilter filter = new TestFilter(initLatch, destroyLatch)
+
+ TestFilter filter = new TestFilter(initLatch, destroyLatch)
{
@Override
protected void filter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException
@@ -292,8 +293,8 @@ public class HttpWhiteboardTargetTest ex
resp.reset();
resp.sendError(SC_FORBIDDEN);
resp.flushBuffer();
- }
- else
+ }
+ else
{
chain.doFilter(req, resp);
}
@@ -307,32 +308,32 @@ public class HttpWhiteboardTargetTest ex
ServiceRegistration<?> sreg = m_context.registerService(Servlet.class.getName(), servlet, sprops);
ServiceRegistration<?> freg = m_context.registerService(Filter.class.getName(), filter, fprops);
-
+
assertTrue(initLatch.await(5, TimeUnit.SECONDS));
-
+
assertResponseCode(SC_FORBIDDEN, createURL("/servlet?param=forbidden"));
assertContent("servlet", createURL("/servlet?param=any"));
assertContent("servlet", createURL("/servlet"));
-
+
sreg.unregister();
freg.unregister();
-
+
assertTrue(destroyLatch.await(5, TimeUnit.SECONDS));
- }
+ }
@Test
public void testFilterTargetNotMatchPort() throws Exception
{
CountDownLatch servletInitLatch = new CountDownLatch(1);
CountDownLatch servletDestroyLatch = new CountDownLatch(1);
-
+
CountDownLatch filterInitLatch = new CountDownLatch(1);
CountDownLatch filterDestroyLatch = new CountDownLatch(1);
-
+
TestServlet servlet = new TestServlet(servletInitLatch, servletDestroyLatch)
{
private static final long serialVersionUID = 1L;
-
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
@@ -344,8 +345,8 @@ public class HttpWhiteboardTargetTest ex
sprops.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servlet");
sprops.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + ".myname", "servlet1");
sprops.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_TARGET, "(" + SERVICE_HTTP_PORT + "=8080" + ")");
-
- TestFilter filter = new TestFilter(filterInitLatch, filterDestroyLatch)
+
+ TestFilter filter = new TestFilter(filterInitLatch, filterDestroyLatch)
{
@Override
protected void filter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException
@@ -356,8 +357,8 @@ public class HttpWhiteboardTargetTest ex
resp.reset();
resp.sendError(SC_FORBIDDEN);
resp.flushBuffer();
- }
- else
+ }
+ else
{
chain.doFilter(req, resp);
}
@@ -371,21 +372,21 @@ public class HttpWhiteboardTargetTest ex
ServiceRegistration<?> sreg = m_context.registerService(Servlet.class.getName(), servlet, sprops);
ServiceRegistration<?> freg = m_context.registerService(Filter.class.getName(), filter, fprops);
-
+
// servlet is registered
assertTrue(servletInitLatch.await(5, TimeUnit.SECONDS));
// fitler is not registered, timeout occurs
assertFalse(filterInitLatch.await(5, TimeUnit.SECONDS));
-
+
assertResponseCode(SC_OK, createURL("/servlet?param=forbidden"));
assertContent("servlet", createURL("/servlet?param=forbidden"));
assertContent("servlet", createURL("/servlet?param=any"));
assertContent("servlet", createURL("/servlet"));
-
+
sreg.unregister();
freg.unregister();
-
+
assertTrue(servletDestroyLatch.await(5, TimeUnit.SECONDS));
assertFalse(filterDestroyLatch.await(5, TimeUnit.SECONDS));
- }
+ }
}
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java Wed Jun 24 20:07:42 2015
@@ -44,13 +44,16 @@ import javax.servlet.http.HttpServletRes
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.service.http.NamespaceException;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class RequestDispatchTest extends BaseIntegrationTest
{
/**
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java Wed Jun 24 20:07:42 2015
@@ -35,13 +35,16 @@ import javax.servlet.http.HttpServletRes
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.service.http.HttpContext;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class ResourceTest extends BaseIntegrationTest
{
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ServletPatternTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ServletPatternTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ServletPatternTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/ServletPatternTest.java Wed Jun 24 20:07:42 2015
@@ -47,14 +47,14 @@ import org.apache.felix.http.itest.HttpS
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.ExamReactorStrategy;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactorFactory;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.http.context.ServletContextHelper;
-@RunWith(JUnit4TestRunner.class)
-@ExamReactorStrategy( EagerSingleStagedReactorFactory.class )
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class ServletPatternTest extends BaseIntegrationTest
{
private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java (original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/SessionHandlingTest.java Wed Jun 24 20:07:42 2015
@@ -59,14 +59,14 @@ import org.json.simple.parser.ParseExcep
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.ExamReactorStrategy;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactorFactory;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.http.context.ServletContextHelper;
-@RunWith(JUnit4TestRunner.class)
-@ExamReactorStrategy( EagerSingleStagedReactorFactory.class )
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
public class SessionHandlingTest extends BaseIntegrationTest
{
private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
Modified: felix/trunk/http/jetty/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/pom.xml?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/jetty/pom.xml (original)
+++ felix/trunk/http/jetty/pom.xml Wed Jun 24 20:07:42 2015
@@ -38,7 +38,7 @@
</scm>
<properties>
- <http.java.version>7</http.java.version>
+ <felix.java.version>7</felix.java.version>
<!-- jetty.version is moved to http-parent POM -->
</properties>
Modified: felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java (original)
+++ felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java Wed Jun 24 20:07:42 2015
@@ -129,7 +129,7 @@ public final class JettyConfig
/** Felix specific property to control whether to enable Proxy/Load Balancer Connection */
public static final String FELIX_PROXY_LOAD_BALANCER_CONNECTION_ENABLE = "org.apache.felix.proxy.load.balancer.connection.enable";
-
+
private static String validateContextPath(String ctxPath)
{
// undefined, empty, or root context path
@@ -362,7 +362,7 @@ public final class JettyConfig
boolean useHttps = getBooleanProperty(FELIX_HTTPS_ENABLE, getBooleanProperty(OSCAR_HTTPS_ENABLE, false));
return useHttps && getHttpsPort() > 0;
}
-
+
public boolean isProxyLoadBalancerConnection()
{
return getBooleanProperty(FELIX_PROXY_LOAD_BALANCER_CONNECTION_ENABLE, false);
Modified: felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyManagedService.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyManagedService.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyManagedService.java (original)
+++ felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyManagedService.java Wed Jun 24 20:07:42 2015
@@ -25,7 +25,7 @@ import org.osgi.framework.ServiceFactory
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.ManagedService;
-public class JettyManagedService implements ServiceFactory
+public class JettyManagedService implements ServiceFactory<ManagedService>
{
private final JettyService jettyService;
@@ -35,10 +35,12 @@ public class JettyManagedService impleme
this.jettyService = jettyService;
}
- public Object getService(Bundle bundle, ServiceRegistration registration)
+ @Override
+ public ManagedService getService(Bundle bundle, ServiceRegistration registration)
{
return new ManagedService()
{
+ @Override
public void updated(Dictionary properties)
{
jettyService.updated(properties);
@@ -46,7 +48,8 @@ public class JettyManagedService impleme
};
}
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+ @Override
+ public void ungetService(Bundle bundle, ServiceRegistration registration, ManagedService service)
{
// just have the reference dropped, nothing to cleanup
}
Modified: felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java (original)
+++ felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java Wed Jun 24 20:07:42 2015
@@ -68,7 +68,6 @@ import org.osgi.framework.BundleEvent;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
-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;
@@ -96,7 +95,7 @@ public final class JettyService extends
private final Map<String, Deployment> deployments;
private final ExecutorService executor;
- private ServiceRegistration configServiceReg;
+ private ServiceRegistration<?> configServiceReg;
private Server server;
private ContextHandlerCollection parent;
private EventDispatcher eventDispatcher;
@@ -133,7 +132,7 @@ public final class JettyService extends
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(Constants.SERVICE_PID, PID);
- this.configServiceReg = this.context.registerService(ManagedService.class.getName(), new JettyManagedService(this), props);
+ this.configServiceReg = this.context.registerService("org.osgi.service.cm.ManagedService", new JettyManagedService(this), props);
this.eventAdmintTracker = new ServiceTracker(this.context, EventAdmin.class.getName(), this);
this.eventAdmintTracker.open();
@@ -217,6 +216,7 @@ public final class JettyService extends
{
this.server.stop();
this.server = null;
+ SystemLogger.info("Stopped Jetty.");
}
catch (Exception e)
{
@@ -263,7 +263,7 @@ public final class JettyService extends
this.server.setHandler(this.parent);
this.server.start();
- StringBuffer message = new StringBuffer("Started Jetty ").append(version).append(" at port(s)");
+ final StringBuilder message = new StringBuilder("Started Jetty ").append(version).append(" at port(s)");
if (this.config.isUseHttp() && initializeHttp())
{
@@ -318,12 +318,12 @@ public final class JettyService extends
configureHttpConnectionFactory(connFactory);
ServerConnector connector = new ServerConnector(server, connFactory);
configureConnector(connector, this.config.getHttpPort());
-
+
if (this.config.isProxyLoadBalancerConnection())
{
connFactory.getHttpConfiguration().addCustomizer(new ForwardedRequestCustomizer());
}
-
+
return startConnector(connector);
}
@@ -338,12 +338,12 @@ public final class JettyService extends
ServerConnector connector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.toString()), connFactory);
HttpConfiguration httpConfiguration = connFactory.getHttpConfiguration();
httpConfiguration.addCustomizer(new SecureRequestCustomizer());
-
+
if (this.config.isProxyLoadBalancerConnection())
{
httpConfiguration.addCustomizer(new ForwardedRequestCustomizer());
}
-
+
configureConnector(connector, this.config.getHttpsPort());
return startConnector(connector);
}
Modified: felix/trunk/http/parent/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/parent/pom.xml?rev=1687355&r1=1687354&r2=1687355&view=diff
==============================================================================
--- felix/trunk/http/parent/pom.xml (original)
+++ felix/trunk/http/parent/pom.xml Wed Jun 24 20:07:42 2015
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.felix</groupId>
<artifactId>felix-parent</artifactId>
- <version>2.1</version>
+ <version>3</version>
<relativePath>../../pom/pom.xml</relativePath>
</parent>
@@ -34,7 +34,7 @@
<packaging>pom</packaging>
<prerequisites>
- <maven>2.2.1</maven>
+ <maven>3.0.5</maven>
</prerequisites>
<properties>
@@ -50,7 +50,7 @@
Using anything else causes the set-bundle-required-execution-environment
to fail the build with an exception
-->
- <http.java.version>6</http.java.version>
+ <felix.java.version>6</felix.java.version>
</properties>
<scm>
@@ -60,69 +60,6 @@
</scm>
<build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>set-bundle-required-execution-environment</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>initialize</phase>
- <configuration>
- <exportAntProperties>true</exportAntProperties>
- <target>
- <script language="javascript"> <![CDATA[
- var System = java.lang.System;
- var bree = "J2SE-1.6";
- var httpJavaVersion = System.getProperty("http.java.version");
- if (!httpJavaVersion) {
- httpJavaVersion = project.getProperty("http.java.version");
- }
- if (httpJavaVersion == "7") {
- bree = "JavaSE-1.7";
- System.out.println("Setting Bundle-RequiredExecutionEnvironment=" + bree + " from http.java.version=" + httpJavaVersion);
- } else if (httpJavaVersion != "6") {
- System.out.println("Unsupported http.java.version=" + httpJavaVersion + "; must be 6 or 7.");
- throw "http.java.version must be 6 or 7";
- }
- project.setProperty("http.bree", bree);
- ]]></script>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.${http.java.version}</source>
- <target>1.${http.java.version}</target>
- <compilerVersion>1.${http.java.version}</compilerVersion>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <configuration>
- <signature>
- <groupId>org.codehaus.mojo.signature</groupId>
- <artifactId>java1${http.java.version}</artifactId>
- <version>1.0</version>
- </signature>
- </configuration>
- <executions>
- <execution>
- <phase>test</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
<pluginManagement>
<plugins>
<plugin>
@@ -148,15 +85,10 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Bundle-RequiredExecutionEnvironment>${http.bree}</Bundle-RequiredExecutionEnvironment>
+ <Bundle-RequiredExecutionEnvironment>${felix.bree}</Bundle-RequiredExecutionEnvironment>
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.14</version>
- </plugin>
</plugins>
</pluginManagement>
</build>
@@ -168,18 +100,6 @@
<version>1.50.0</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.8.2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<dependencyManagement>