You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by kg...@apache.org on 2011/12/10 10:23:42 UTC
svn commit: r1212753 - in
/felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test: ./ java/
java/org/ java/org/apache/ java/org/apache/felix/
java/org/apache/felix/httplite/ java/org/apache/felix/httplite/osgi/
java/org/apache/felix/httplite/osgi...
Author: kgilmer
Date: Sat Dec 10 09:23:41 2011
New Revision: 1212753
URL: http://svn.apache.org/viewvc?rev=1212753&view=rev
Log:
httplite: add some experimental test code based on pojosr
Added:
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/osgi/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/osgi/test/
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/osgi/test/AppTest.java
Added: felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/osgi/test/AppTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/osgi/test/AppTest.java?rev=1212753&view=auto
==============================================================================
--- felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/osgi/test/AppTest.java (added)
+++ felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/test/java/org/apache/felix/httplite/osgi/test/AppTest.java Sat Dec 10 09:23:41 2011
@@ -0,0 +1,51 @@
+package org.apache.felix.httplite.osgi.test;
+
+import java.util.HashMap;
+import java.util.ServiceLoader;
+
+import junit.framework.TestCase;
+
+import org.apache.felix.httplite.osgi.Activator;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+
+import de.kalpatec.pojosr.framework.launch.PojoServiceRegistry;
+import de.kalpatec.pojosr.framework.launch.PojoServiceRegistryFactory;
+
+public class AppTest extends TestCase {
+
+ protected PojoServiceRegistry registry;
+ protected Activator activator;
+
+ protected void setUp() throws Exception {
+
+ String fm = "org.osgi.framework";
+
+ System.out.println("Setting framework to " + fm);
+ System.setProperty("org.osgi.vendor.framework", fm);
+ Filter f = FrameworkUtil.createFilter("(a=b");
+
+
+ ServiceLoader loader = ServiceLoader.load(PojoServiceRegistryFactory.class);
+
+ registry = ((PojoServiceRegistryFactory) loader.iterator().next()).newPojoServiceRegistry(new HashMap());
+
+ assertNotNull(registry);
+
+ activator = new Activator();
+ activator.start(registry.getBundleContext());
+ }
+
+ public void testServiceAvailability() {
+ ServiceReference sr = registry.getServiceReference(HttpService.class.getName());
+
+ assertNotNull(sr);
+
+ Object svc = registry.getService(sr);
+
+ assertNotNull(svc);
+ assertTrue(svc instanceof HttpService);
+ }
+}