Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/karaf4.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dotasek committed Dec 7, 2017
2 parents 2b1e6c0 + 9054b6c commit fa04a4e
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 106 deletions.
37 changes: 12 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<bundle.namespace>org.cytoscape.rest</bundle.namespace>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-bundle-plugin.version>3.2.0</maven-bundle-plugin.version>
<osgi.api.version>4.2.0</osgi.api.version>
<osgi.api.version>6.0.0</osgi.api.version>
<osgi.compendium.version>5.0.0</osgi.compendium.version>
<junit.version>4.12</junit.version>
<jersey.version>2.23</jersey.version>

Expand Down Expand Up @@ -207,21 +208,12 @@
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.metatype</artifactId>
<version>1.0.10</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>1.8.2</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.karaf.scr</groupId>
<artifactId>org.apache.karaf.scr.command</artifactId>
<version>3.0.3</version>
<version>2.0.12</version>
</artifactItem>

</artifactItems>
<outputDirectory>src/main/resources/karaf-scr</outputDirectory>
<stripVersion>false</stripVersion>
Expand All @@ -238,12 +230,7 @@
<artifactItem>
<groupId>org.apache.karaf.http</groupId>
<artifactId>org.apache.karaf.http.core</artifactId>
<version>3.0.3</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.karaf.http</groupId>
<artifactId>org.apache.karaf.http.command</artifactId>
<version>3.0.3</version>
<version>4.2.0-SNAPSHOT</version>
</artifactItem>
</artifactItems>
<outputDirectory>src/main/resources/karaf-http</outputDirectory>
Expand All @@ -261,17 +248,17 @@
<artifactItem>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-api</artifactId>
<version>2.4.0-b34</version>
<version>2.4.0</version>
</artifactItem>
<artifactItem>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-locator</artifactId>
<version>2.4.0-b34</version>
<version>2.4.0</version>
</artifactItem>
<artifactItem>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-utils</artifactId>
<version>2.4.0-b34</version>
<version>2.4.0</version>
</artifactItem>
<artifactItem>
<groupId>org.glassfish.hk2</groupId>
Expand All @@ -281,12 +268,12 @@
<artifactItem>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
<version>2.4.0-b34</version>
<version>2.4.0</version>
</artifactItem>
<artifactItem>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>aopalliance-repackaged</artifactId>
<version>2.4.0-b34</version>
<version>2.4.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>src/main/resources/hk2</outputDirectory>
Expand Down Expand Up @@ -415,7 +402,7 @@
<artifactItem>
<groupId>com.eclipsesource.jaxrs</groupId>
<artifactId>provider-gson</artifactId>
<version>2.2</version>
<version>2.3</version>
</artifactItem>
</artifactItems>
<outputDirectory>src/main/resources/osgi-jax-rs-connector</outputDirectory>
Expand Down Expand Up @@ -674,7 +661,7 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>${osgi.api.version}</version>
<version>${osgi.compendium.version}</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,16 @@ public class OSGiJAXRSManager

private String port;

private static final String PAX_JETTY_PATH = "pax-jetty/";

//Bundles should stay in this order.
private static final String[] PAX_JETTY_BUNDLES = {
PAX_JETTY_PATH + "org.apache.servicemix.specs.activation-api-1.1-2.2.0.jar",
PAX_JETTY_PATH + "geronimo-servlet_3.0_spec-1.0.jar",
PAX_JETTY_PATH + "mail-1.4.4.jar",
PAX_JETTY_PATH + "geronimo-jta_1.1_spec-1.1.1.jar",
PAX_JETTY_PATH + "geronimo-annotation_1.1_spec-1.0.1.jar",
PAX_JETTY_PATH + "geronimo-jaspic_1.0_spec-1.1.jar",
PAX_JETTY_PATH + "asm-all-5.0.2.jar",
PAX_JETTY_PATH + "jetty-all-server-8.1.15.v20140411.jar"
};

private static final String PAX_HTTP_PATH = "pax-http/";

private static final String[] PAX_HTTP_BUNDLES = {
PAX_HTTP_PATH + "ops4j-base-lang-1.4.0.jar",
PAX_HTTP_PATH + "pax-swissbox-core-1.7.0.jar",
// Already included in pax-jetty
// PAX_HTTP_PATH + "asm-all-5.0.2.jar",
PAX_HTTP_PATH + "xbean-bundleutils-3.18.jar",
PAX_HTTP_PATH + "xbean-reflect-3.18.jar",
PAX_HTTP_PATH + "xbean-finder-3.18.jar",
PAX_HTTP_PATH + "pax-web-api-3.1.4.jar",
PAX_HTTP_PATH + "pax-web-spi-3.1.4.jar",
PAX_HTTP_PATH + "pax-web-runtime-3.1.4.jar",
PAX_HTTP_PATH + "pax-web-jetty-3.1.4.jar"
};

private static final String KARAF_SCR_PATH = "karaf-scr/";

private static final String[] KARAF_SCR_BUNDLES = {
KARAF_SCR_PATH + "org.apache.felix.metatype-1.0.10.jar",
KARAF_SCR_PATH + "org.apache.felix.scr-1.8.2.jar",
KARAF_SCR_PATH + "org.apache.karaf.scr.command-3.0.3.jar"
};

private static final String KARAF_HTTP_PATH = "karaf-http/";

private static final String[] KARAF_HTTP_BUNDLES = {
KARAF_HTTP_PATH + "org.apache.karaf.http.core-3.0.3.jar",
KARAF_HTTP_PATH + "org.apache.karaf.http.command-3.0.3.jar"
};


private static final String HK2_PATH = "hk2/";

private static final String[] HK2_BUNDLES = {
HK2_PATH + "hk2-api-2.4.0-b34.jar",
HK2_PATH + "hk2-locator-2.4.0-b34.jar",
HK2_PATH + "hk2-utils-2.4.0-b34.jar",
HK2_PATH + "hk2-api-2.4.0.jar",
HK2_PATH + "hk2-locator-2.4.0.jar",
HK2_PATH + "hk2-utils-2.4.0.jar",
HK2_PATH + "osgi-resource-locator-1.0.1.jar",
HK2_PATH + "javax.inject-2.4.0-b34.jar",
HK2_PATH + "aopalliance-repackaged-2.4.0-b34.jar",
HK2_PATH + "javax.inject-2.4.0.jar",
HK2_PATH + "aopalliance-repackaged-2.4.0.jar",

};

Expand All @@ -98,7 +54,7 @@ public class OSGiJAXRSManager
private static final String JERSEY_MISC_PATH = "jersey-misc/";

private static final String[] JERSEY_MISC_BUNDLES = {
JERSEY_MISC_PATH + "javax.annotation-api-1.2.jar",
//JERSEY_MISC_PATH + "javax.annotation-api-1.2.jar",
JERSEY_MISC_PATH + "validation-api-1.1.0.Final.jar",
JERSEY_MISC_PATH + "javassist-3.18.1-GA.jar",
JERSEY_MISC_PATH + "mimepull-1.9.6.jar",
Expand All @@ -109,10 +65,10 @@ public class OSGiJAXRSManager
private static final String[] OSGI_JAX_RS_CONNECTOR_BUNDLES = {
//OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "javax.servlet-api-3.1.0.jar",
//OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "jersey-min-2.22.1.jar",
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "consumer-5.3.jar",
//OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "consumer-5.3.jar",
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "publisher-5.3.jar",
//OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "gson-2.3.jar",
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "provider-gson-2.2.jar",
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "provider-gson-2.3.jar",
};

public void installOSGiJAXRSBundles(BundleContext bundleContext, String port) throws Exception
Expand All @@ -123,10 +79,10 @@ public void installOSGiJAXRSBundles(BundleContext bundleContext, String port) th
this.port = port;
setPortConfig(context);

installBundlesFromResources(bundleContext, PAX_JETTY_BUNDLES);
installBundlesFromResources(bundleContext, PAX_HTTP_BUNDLES);
installBundlesFromResources(bundleContext, KARAF_SCR_BUNDLES);
installBundlesFromResources(bundleContext, KARAF_HTTP_BUNDLES);
//installBundlesFromResources(bundleContext, PAX_JETTY_BUNDLES);
//installBundlesFromResources(bundleContext, PAX_HTTP_BUNDLES);
//installBundlesFromResources(bundleContext, KARAF_SCR_BUNDLES);
//installBundlesFromResources(bundleContext, KARAF_HTTP_BUNDLES);

setRootResourceConfig(context);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.cytoscape.rest.internal.task;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -68,7 +69,7 @@ public void registerResourceServices() throws Exception

for (Class<?> clazz : coreResourceClasses){
Object instance = injector.getInstance(clazz);
serviceRegistrations.add(bundleContext.registerService(clazz.getName(), instance, new Properties()));
serviceRegistrations.add(bundleContext.registerService(clazz.getName(), instance, new Hashtable<String, Object>()));
}

for (Map.Entry<Class<?>, Module> entry : shimResources.entrySet()){
Expand All @@ -80,7 +81,7 @@ public void registerResourceServices() throws Exception
Injector appInjector = Guice.createInjector(entry.getValue());
appInjector.injectMembers(instance);
}
serviceRegistrations.add(bundleContext.registerService(entry.getKey().getName(), instance, new Properties()));
serviceRegistrations.add(bundleContext.registerService(entry.getKey().getName(), instance, new Hashtable<String, Object>()));
}
else
{
Expand All @@ -97,7 +98,7 @@ public void registerResourceServices() throws Exception
swaggerResourceTracker = new SwaggerResourceTracker(bundleContext,bundleContext.createFilter(ANY_SERVICE_FILTER), swagger);
swaggerResourceTracker.open();

serviceRegistrations.add(bundleContext.registerService(CyRESTSwagger.class.getName(), swagger, new Properties()));
serviceRegistrations.add(bundleContext.registerService(CyRESTSwagger.class.getName(), swagger, new Hashtable<String, Object>()));

loadTime = System.currentTimeMillis() - loadTime;

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/cytoscape/rest/CyActivatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public URL answer(InvocationOnMock invocation) throws MalformedURLException {
when(configAdmin.getConfiguration("org.ops4j.pax.logging")).thenReturn(configuration);
when(configAdmin.getConfiguration("org.ops4j.pax.web", null)).thenReturn(configuration);
when(configAdmin.getConfiguration("com.eclipsesource.jaxrs.connector", null)).thenReturn(configuration);
Dictionary<String,String> dictionary = new Hashtable<String, String>();
Dictionary<String,Object> dictionary = new Hashtable<String, Object>();
dictionary.put("log4j.appender.file.File", "dummyLogLocation");
when(configuration.getProperties()).thenReturn(dictionary);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,24 @@ public class OSGiJAXRSConnectorIntegrationTest
private static final String KARAF_SCR_PATH = "karaf-scr/";

private static final String[] KARAF_SCR_BUNDLES = {
KARAF_SCR_PATH + "org.apache.felix.metatype-1.0.10.jar",
KARAF_SCR_PATH + "org.apache.felix.scr-1.8.2.jar",
KARAF_SCR_PATH + "org.apache.karaf.scr.command-3.0.3.jar"
KARAF_SCR_PATH + "org.apache.felix.scr-2.0.12.jar"
};

private static final String KARAF_HTTP_PATH = "karaf-http/";

private static final String[] KARAF_HTTP_BUNDLES = {
KARAF_HTTP_PATH + "org.apache.karaf.http.core-3.0.3.jar",
KARAF_HTTP_PATH + "org.apache.karaf.http.command-3.0.3.jar"
KARAF_HTTP_PATH + "org.apache.karaf.http.core-4.2.0-SNAPSHOT.jar"
};

private static final String HK2_PATH = "hk2/";

private static final String[] HK2_BUNDLES = {
HK2_PATH + "hk2-api-2.4.0-b34.jar",
HK2_PATH + "hk2-locator-2.4.0-b34.jar",
HK2_PATH + "hk2-utils-2.4.0-b34.jar",
HK2_PATH + "hk2-api-2.4.0.jar",
HK2_PATH + "hk2-locator-2.4.0.jar",
HK2_PATH + "hk2-utils-2.4.0.jar",
HK2_PATH + "osgi-resource-locator-1.0.1.jar",
HK2_PATH + "javax.inject-2.4.0-b34.jar",
HK2_PATH + "aopalliance-repackaged-2.4.0-b34.jar",
HK2_PATH + "javax.inject-2.4.0.jar",
HK2_PATH + "aopalliance-repackaged-2.4.0.jar",

};

Expand All @@ -107,7 +104,7 @@ public class OSGiJAXRSConnectorIntegrationTest
private static final String JERSEY_MISC_PATH = "jersey-misc/";

private static final String[] JERSEY_MISC_BUNDLES = {
JERSEY_MISC_PATH + "javax.annotation-api-1.2.jar",
//JERSEY_MISC_PATH + "javax.annotation-api-1.2.jar",
JERSEY_MISC_PATH + "validation-api-1.1.0.Final.jar",
JERSEY_MISC_PATH + "javassist-3.18.1-GA.jar",
JERSEY_MISC_PATH + "mimepull-1.9.6.jar",
Expand All @@ -116,16 +113,18 @@ public class OSGiJAXRSConnectorIntegrationTest
private static final String OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH = "osgi-jax-rs-connector/";

private static final String[] OSGI_JAX_RS_CONNECTOR_BUNDLES = {
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "consumer-5.3.jar",
//OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "javax.servlet-api-3.1.0.jar",

//OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "consumer-5.3.jar",
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "publisher-5.3.jar",
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "provider-gson-2.2.jar",
OSGI_JAX_RS_CONNECTOR_BUNDLES_PATH + "provider-gson-2.3.jar",
};

private static final String[][] allBundles = {
PAX_JETTY_BUNDLES,
PAX_HTTP_BUNDLES,
KARAF_SCR_BUNDLES,
KARAF_HTTP_BUNDLES,
//PAX_JETTY_BUNDLES,
//PAX_HTTP_BUNDLES,
//KARAF_SCR_BUNDLES,
//KARAF_HTTP_BUNDLES,
JERSEY_MISC_BUNDLES,
HK2_BUNDLES,
GLASSFISH_JERSEY_BUNDLES,
Expand Down Expand Up @@ -198,7 +197,7 @@ public void testResourcesExist()
for (String[] resourceGroup : allBundles) {
for (String resource : resourceGroup) {
File f = new File("./src/main/resources/" + resource);
assertTrue(f.exists());
assertTrue("File does not exist: " + f.getAbsolutePath(), f.exists());
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/org/cytoscape/rest/ResourceManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.net.URI;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -175,7 +176,7 @@ public void testRegisterResourceServices() throws Exception
assertEquals(TestClass.class, instances.get(0).getClass());
TestClass testClassInstance = (TestClass) instances.get(0);
assertEquals("1234", testClassInstance.cyRestPort);
verify(context).registerService(TestClass.class.getName(), new TestClass(), new Properties());
verify(context).registerService(TestClass.class.getName(), new TestClass(), new Hashtable<String, Object>());
}

@Test
Expand All @@ -186,7 +187,7 @@ public void testRegisterShimResourceServices() throws Exception
assertEquals(TestShimClass.class, instances.get(1).getClass());
TestShimClass testShimClassInstance = (TestShimClass) instances.get(1);
assertEquals(new Float(0.13f), testShimClassInstance.injected);
verify(context).registerService(TestShimClass.class.getName(), new TestShimClass(), new Properties());
verify(context).registerService(TestShimClass.class.getName(), new TestShimClass(), new Hashtable<String, Object>());
}

@Test
Expand Down

0 comments on commit fa04a4e

Please sign in to comment.