[Osgi-messages] SF.net SVN: osgi:[262] papoose-cmpn/trunk
Status: Beta
Brought to you by:
maguro
|
From: <osg...@li...> - 2010-02-26 16:04:48
|
Revision: 262
http://osgi.svn.sourceforge.net/osgi/?rev=262&view=rev
Author: maguro
Date: 2010-02-26 16:04:16 +0000 (Fri, 26 Feb 2010)
Log Message:
-----------
POM update and more test
Modified Paths:
--------------
papoose-cmpn/trunk/event/pom.xml
papoose-cmpn/trunk/http/pom.xml
papoose-cmpn/trunk/http/src/main/java/org/papoose/http/HttpServiceImpl.java
papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ResourceNotFoundException.java
papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ServletDispatcher.java
papoose-cmpn/trunk/log/pom.xml
papoose-cmpn/trunk/pom.xml
papoose-cmpn/trunk/tck/tests/pom.xml
Added Paths:
-----------
papoose-cmpn/trunk/tck/tests/src/test/java/org/papoose/tck/http/
papoose-cmpn/trunk/tck/tests/src/test/java/org/papoose/tck/http/HttpServiceImplTest.java
Modified: papoose-cmpn/trunk/event/pom.xml
===================================================================
--- papoose-cmpn/trunk/event/pom.xml 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/event/pom.xml 2010-02-26 16:04:16 UTC (rev 262)
@@ -23,7 +23,7 @@
<instructions>
<Bundle-SymbolicName>org.papoose.cmpn.event</Bundle-SymbolicName>
<Export-Package>org.papoose.event</Export-Package>
- <Import-Package>org.papoose.core;resolution:=optional,org.osgi.framework;version="[1.0,1.6)",org.osgi.service.event;version="[1.1,1.3)",org.osgi.service.log;version="[1.1,1.4)",org.osgi.util.tracker;version="[1.3,1.5)"</Import-Package>
+ <Import-Package>org.papoose.core;resolution:=optional,org.osgi.framework;version="[1,2)",org.osgi.service.event;version="[1.1,2)",org.osgi.service.log;version="[1.1,2)",org.osgi.util.tracker;version="[1.3,2)"</Import-Package>
<Private-Package>org.papoose.event.util</Private-Package>
</instructions>
</configuration>
Modified: papoose-cmpn/trunk/http/pom.xml
===================================================================
--- papoose-cmpn/trunk/http/pom.xml 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/http/pom.xml 2010-02-26 16:04:16 UTC (rev 262)
@@ -23,7 +23,7 @@
<instructions>
<Bundle-SymbolicName>org.papoose.cmpn.event</Bundle-SymbolicName>
<Export-Package>org.papoose.http</Export-Package>
- <Import-Package>org.papoose.core;resolution:=optional,javax.servlet;version="2.4",javax.servlet.http;version="2.4",org.osgi.framework;version="1.4",org.osgi.service.http;version="1.2"</Import-Package>
+ <Import-Package>org.papoose.core;resolution:=optional,javax.servlet;version="[2.4,3)",javax.servlet.http;version="[2.4,3)",org.osgi.framework;version="[1,2)",org.osgi.service.http;version="[1.2,2)"</Import-Package>
<Private-Package>org.papoose.http.util</Private-Package>
</instructions>
</configuration>
@@ -35,8 +35,7 @@
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
+ <artifactId>com.springsource.javax.servlet</artifactId>
<scope>provided</scope>
</dependency>
Modified: papoose-cmpn/trunk/http/src/main/java/org/papoose/http/HttpServiceImpl.java
===================================================================
--- papoose-cmpn/trunk/http/src/main/java/org/papoose/http/HttpServiceImpl.java 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/http/src/main/java/org/papoose/http/HttpServiceImpl.java 2010-02-26 16:04:16 UTC (rev 262)
@@ -70,6 +70,15 @@
}
}
+ public void start() {}
+
+ public void stop()
+ {
+ dispatcher.clear();
+ contexts.clear();
+ registrations.clear();
+ }
+
/**
* {@inheritDoc}
*/
Modified: papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ResourceNotFoundException.java
===================================================================
--- papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ResourceNotFoundException.java 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ResourceNotFoundException.java 2010-02-26 16:04:16 UTC (rev 262)
@@ -19,6 +19,6 @@
/**
* @version $Revision: $ $Date: $
*/
-public class ResourceNotFoundException extends RuntimeException
+class ResourceNotFoundException extends RuntimeException
{
}
Modified: papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ServletDispatcher.java
===================================================================
--- papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ServletDispatcher.java 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/http/src/main/java/org/papoose/http/ServletDispatcher.java 2010-02-26 16:04:16 UTC (rev 262)
@@ -98,4 +98,9 @@
{
registrations.remove(registration);
}
+
+ void clear()
+ {
+ registrations.clear();
+ }
}
Modified: papoose-cmpn/trunk/log/pom.xml
===================================================================
--- papoose-cmpn/trunk/log/pom.xml 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/log/pom.xml 2010-02-26 16:04:16 UTC (rev 262)
@@ -23,7 +23,7 @@
<instructions>
<Bundle-SymbolicName>org.papoose.cmpn.log</Bundle-SymbolicName>
<Export-Package>org.papoose.log</Export-Package>
- <Import-Package>org.papoose.core;resolution:=optional,org.osgi.framework;version="[1.0,1.6)",org.osgi.service.event;version="[1.1,1.3)",org.osgi.service.log;version="[1.1,1.4)",org.osgi.util.tracker;version="[1.3,1.5)"</Import-Package>
+ <Import-Package>org.papoose.core;resolution:=optional,org.osgi.framework;version="[1,2)",org.osgi.service.event;version="[1.1,2)",org.osgi.service.log;version="[1.1,2)",org.osgi.util.tracker;version="[1.3,2)"</Import-Package>
<Private-Package>org.papoose.log.util</Private-Package>
<Private-Package>org.papoose.log.util</Private-Package>
</instructions>
Modified: papoose-cmpn/trunk/pom.xml
===================================================================
--- papoose-cmpn/trunk/pom.xml 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/pom.xml 2010-02-26 16:04:16 UTC (rev 262)
@@ -75,6 +75,12 @@
<dependencies>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>com.springsource.javax.servlet</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
@@ -153,6 +159,28 @@
<enabled>true</enabled>
</snapshots>
</repository>
+
+ <repository>
+ <id>com.springsource.repository.bundles.release</id>
+ <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
+ <url>http://repository.springsource.com/maven/bundles/release</url>
+ </repository>
+ <repository>
+ <id>com.springsource.repository.bundles.external</id>
+ <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
+ <url>http://repository.springsource.com/maven/bundles/external</url>
+ </repository>
+
+ <repository>
+ <id>com.springsource.repository.libraries.release</id>
+ <name>SpringSource Enterprise Bundle Repository - SpringSource Library Releases</name>
+ <url>http://repository.springsource.com/maven/libraries/release</url>
+ </repository>
+ <repository>
+ <id>com.springsource.repository.libraries.external</id>
+ <name>SpringSource Enterprise Bundle Repository - External Library Releases</name>
+ <url>http://repository.springsource.com/maven/libraries/external</url>
+ </repository>
</repositories>
<pluginRepositories>
Modified: papoose-cmpn/trunk/tck/tests/pom.xml
===================================================================
--- papoose-cmpn/trunk/tck/tests/pom.xml 2010-02-26 14:08:08 UTC (rev 261)
+++ papoose-cmpn/trunk/tck/tests/pom.xml 2010-02-26 16:04:16 UTC (rev 262)
@@ -31,20 +31,12 @@
<dependencies>
<dependency>
- <groupId>org.papoose.cmpn</groupId>
- <artifactId>papoose-cmpn-event</artifactId>
- <version>${project.version}</version>
+ <groupId>javax.servlet</groupId>
+ <artifactId>com.springsource.javax.servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.papoose.cmpn</groupId>
- <artifactId>papoose-cmpn-log</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -78,6 +70,27 @@
<artifactId>org.osgi.core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.papoose.cmpn</groupId>
+ <artifactId>papoose-cmpn-event</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.cmpn</groupId>
+ <artifactId>papoose-cmpn-http</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.papoose.cmpn</groupId>
+ <artifactId>papoose-cmpn-log</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
Copied: papoose-cmpn/trunk/tck/tests/src/test/java/org/papoose/tck/http/HttpServiceImplTest.java (from rev 260, papoose-cmpn/trunk/tck/tests/src/test/java/org/papoose/tck/log/LogServiceImplTest.java)
===================================================================
--- papoose-cmpn/trunk/tck/tests/src/test/java/org/papoose/tck/http/HttpServiceImplTest.java (rev 0)
+++ papoose-cmpn/trunk/tck/tests/src/test/java/org/papoose/tck/http/HttpServiceImplTest.java 2010-02-26 16:04:16 UTC (rev 262)
@@ -0,0 +1,113 @@
+/**
+ *
+ * Copyright 2010 (C) The original author or authors
+ *
+ * Licensed 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.
+ */
+package org.papoose.tck.http;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Assert;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import org.ops4j.pax.exam.Inject;
+import static org.ops4j.pax.exam.MavenUtils.asInProject;
+import org.ops4j.pax.exam.Option;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.compendiumProfile;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+
+import org.papoose.http.HttpServiceImpl;
+import org.papoose.http.ServletDispatcher;
+
+
+/**
+ * @version $Revision: $ $Date: $
+ */
+@RunWith(JUnit4TestRunner.class)
+public class HttpServiceImplTest
+{
+ @Inject
+ private BundleContext bundleContext = null;
+
+ @Configuration
+ public static Option[] configure()
+ {
+ return options(
+ equinox(),
+ // felix(),
+ // knopflerfish(),
+ // papoose(),
+ compendiumProfile(),
+ // vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+ // this is necessary to let junit runner not timout the remote process before attaching debugger
+ // setting timeout to 0 means wait as long as the remote service comes available.
+ // starting with version 0.5.0 of PAx Exam this is no longer required as by default the framework tests
+ // will not be triggered till the framework is not started
+ // waitForFrameworkStartup()
+ provision(
+ mavenBundle().groupId("javax.servlet").artifactId("com.springsource.javax.servlet").version(asInProject()),
+ mavenBundle().groupId("org.papoose.cmpn").artifactId("papoose-cmpn-http").version(asInProject())
+ )
+ );
+ }
+
+ @Test
+ public void test() throws Exception
+ {
+ Assert.assertNotNull(bundleContext);
+ ExecutorService executor = new ThreadPoolExecutor(1, 5, 100, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
+
+ ServletDispatcher dispatcher = new ServletDispatcher();
+ HttpServiceImpl httpService = new HttpServiceImpl(bundleContext, dispatcher);
+
+ httpService.start();
+ bundleContext.registerService(HttpService.class.getName(), httpService, null);
+
+ try
+ {
+ ServiceReference sr = bundleContext.getServiceReference(HttpService.class.getName());
+ HttpService service = (HttpService) bundleContext.getService(sr);
+
+ service.registerResources("/a/b", "/car", service.createDefaultHttpContext());
+ try
+ {
+ service.registerResources("/a/b", "/car", service.createDefaultHttpContext());
+ fail("Should not be able to register with same alias");
+ }
+ catch (NamespaceException ignore)
+ {
+ }
+
+ service.unregister("/a/b");
+ }
+ finally
+ {
+ httpService.stop();
+ executor.shutdown();
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|