[OLINGO-691] Refactored karaf module structure

Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/e59b5082
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/e59b5082
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/e59b5082

Branch: refs/heads/OLINGO-642_OSGi-Sample
Commit: e59b5082ffdca5948536e1a8988239a1559fdf8a
Parents: 7ab54a2
Author: Michael Bolz <[email protected]>
Authored: Wed Jun 10 06:26:45 2015 +0200
Committer: Michael Bolz <[email protected]>
Committed: Wed Jun 10 10:50:08 2015 +0200

----------------------------------------------------------------------
 ext/karaf/features/pom.xml                      |  81 ----------
 .../features/src/main/resources/features.xml    |  59 -------
 ext/karaf/itests/pom.xml                        | 152 -------------------
 .../apache/olingo/osgi/itests/BundlesTest.java  |  56 -------
 .../osgi/itests/OlingoOSGiTestSupport.java      | 137 -----------------
 .../osgi/itests/server/CarServiceTest.java      | 105 -------------
 ext/karaf/karaf-features/pom.xml                |  81 ++++++++++
 .../src/main/resources/features.xml             |  59 +++++++
 ext/karaf/karaf-fit/pom.xml                     | 152 +++++++++++++++++++
 .../apache/olingo/osgi/itests/BundlesTest.java  |  55 +++++++
 .../osgi/itests/OlingoOSGiTestSupport.java      | 134 ++++++++++++++++
 .../osgi/itests/server/CarServiceTest.java      | 105 +++++++++++++
 ext/karaf/pom.xml                               |  41 +++++
 ext/pom.xml                                     |  10 +-
 pom.xml                                         |   2 +-
 samples/pom.xml                                 |  11 +-
 16 files changed, 646 insertions(+), 594 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/features/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/features/pom.xml b/ext/karaf/features/pom.xml
deleted file mode 100644
index 921eac2..0000000
--- a/ext/karaf/features/pom.xml
+++ /dev/null
@@ -1,81 +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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>odata-karaf-features</artifactId>
-  <packaging>pom</packaging>
-  <name>${project.artifactId}</name>
-
-  <parent>
-    <groupId>org.apache.olingo</groupId>
-    <artifactId>odata-ext</artifactId>
-    <version>4.0.0-SNAPSHOT</version>
-    <relativePath>../..</relativePath>
-  </parent>
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-resources-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>filter</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>resources</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-artifacts</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>attach-artifact</goal>
-                        </goals>
-                        <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>target/classes/features.xml</file>
-                                    <type>xml</type>
-                                    <classifier>features</classifier>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/features/src/main/resources/features.xml 
b/ext/karaf/features/src/main/resources/features.xml
deleted file mode 100644
index 0a433c5..0000000
--- a/ext/karaf/features/src/main/resources/features.xml
+++ /dev/null
@@ -1,59 +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.
--->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"; 
name="olingo-${project.version}">
-
-    <feature name="olingo-server" version="${project.version}" 
resolver="(obr)" start-level="50">
-      <feature>war</feature>
-         
<bundle>mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
-         
<bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
-         
<bundle>mvn:org.codehaus.woodstox/stax2-api/${woodstox.stax2-api.version}</bundle>
-         <bundle>mvn:com.fasterxml/aalto-xml/${aalto-xml.version}</bundle>
-         
<bundle>wrap:mvn:org.antlr/antlr4-runtime/${antlr.version}/$Bundle-SymbolicName=antlr4-runtime&amp;Bundle-Version=${antlr.version}&amp;Export-Package=org.antlr.v4.runtime*</bundle>
-
-         
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
-         
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
-         
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
-
-         
<bundle>mvn:org.apache.olingo/odata-commons-api/${project.version}</bundle>
-         
<bundle>mvn:org.apache.olingo/odata-commons-core/${project.version}</bundle>
-         
<bundle>mvn:org.apache.olingo/odata-server-api/${project.version}</bundle>
-         
<bundle>mvn:org.apache.olingo/odata-server-core/${project.version}</bundle>
-    </feature>
-
-    <feature name="olingo-client" version="${project.version}" 
resolver="(obr)" start-level="50">
-         
<bundle>mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
-         <bundle>mvn:commons-io/commons-io/${commons.io.version}</bundle>
-         
<bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
-         
<bundle>mvn:org.codehaus.woodstox/stax2-api/${woodstox.stax2-api.version}</bundle>
-         <bundle>mvn:com.fasterxml/aalto-xml/${aalto-xml.version}</bundle>
-         
<bundle>mvn:org.apache.httpcomponents/httpcore-osgi/${hc.core.version}</bundle>
-         
<bundle>mvn:org.apache.httpcomponents/httpclient-osgi/${hc.client.version}</bundle>
-
-         
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
-         
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
-         
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
-         
<bundle>mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version}</bundle>
-         
<bundle>mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-xml/${jackson.version}</bundle>
-
-         
<bundle>mvn:org.apache.olingo/odata-commons-api/${project.version}</bundle>
-         
<bundle>mvn:org.apache.olingo/odata-commons-core/${project.version}</bundle>
-         
<bundle>mvn:org.apache.olingo/odata-client-api/${project.version}</bundle>
-         
<bundle>mvn:org.apache.olingo/odata-client-core/${project.version}</bundle>
-    </feature>
-</features>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/itests/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/itests/pom.xml b/ext/karaf/itests/pom.xml
deleted file mode 100644
index 989a7bd..0000000
--- a/ext/karaf/itests/pom.xml
+++ /dev/null
@@ -1,152 +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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>odata-karaf-itests</artifactId>
-  <packaging>jar</packaging>
-  <name>${project.artifactId}</name>
-
-  <parent>
-    <groupId>org.apache.olingo</groupId>
-    <artifactId>odata-ext</artifactId>
-    <version>4.0.0-SNAPSHOT</version>
-    <relativePath>../..</relativePath>
-  </parent>
-  <dependencies>
-    <!-- Karaf features -->
-    <dependency>
-      <groupId>org.apache.olingo</groupId>
-      <artifactId>odata-karaf-features</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>features</classifier>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>org.apache.karaf.features.core</artifactId>
-      <version>${karaf.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.shell</groupId>
-      <artifactId>org.apache.karaf.shell.console</artifactId>
-      <version>${karaf.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>${osgi.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
-      <version>${osgi.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-atinject_1.0_spec</artifactId>
-      <version>1.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <!-- pax-exam -->
-    <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</artifactId>
-      <version>${pax.exam.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-container-karaf</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.apache.karaf</groupId>
-      <artifactId>apache-karaf</artifactId>
-      <version>${karaf.version}</version>
-      <type>tar.gz</type>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.karaf.shell</groupId>
-          <artifactId>org.apache.karaf.shell.dev</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.eclipse</groupId>
-          <artifactId>osgi</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.eclipse</groupId>
-          <artifactId>org.eclipse.osgi</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.apache.karaf</groupId>
-          <artifactId>org.apache.karaf.client</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>org.apache.felix.framework</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <!-- generate dependencies versions that are needed -->
-      <plugin>
-        <groupId>org.apache.servicemix.tooling</groupId>
-        <artifactId>depends-maven-plugin</artifactId>
-        <version>1.2</version>
-        <executions>
-          <execution>
-            <id>generate-depends-file</id>
-            <goals>
-              <goal>generate-depends-file</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
----------------------------------------------------------------------
diff --git 
a/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java 
b/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
deleted file mode 100644
index 4b542a1..0000000
--- 
a/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
+++ /dev/null
@@ -1,56 +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.
- 
******************************************************************************/
-
-package org.apache.olingo.osgi.itests;
-
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
-import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
-
-
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class BundlesTest extends OlingoOSGiTestSupport {
-    @Test
-    public void test() throws Exception {
-        // check the server-api and server-core
-        assertBundleStarted("org.apache.olingo.odata-server-api");
-        assertBundleStarted("org.apache.olingo.odata-server-core");
-
-        // check the client-api and client-core
-        assertBundleStarted("org.apache.olingo.odata-client-api");
-        assertBundleStarted("org.apache.olingo.odata-client-core");
-    }
-
-    @Configuration
-    public Option[] config() {
-        return new Option[]{
-            olingoBaseConfig(),
-            features(olingoUrl, "olingo-server", "olingo-client"),
-            logLevel(LogLevel.INFO)};
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
----------------------------------------------------------------------
diff --git 
a/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
 
b/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
deleted file mode 100644
index e882736..0000000
--- 
a/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
+++ /dev/null
@@ -1,137 +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.
- 
******************************************************************************/
-
-package org.apache.olingo.osgi.itests;
-
-
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import javax.inject.Inject;
-
-import org.apache.karaf.features.FeaturesService;
-import org.junit.Assert;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.ProbeBuilder;
-import org.ops4j.pax.exam.TestProbeBuilder;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import static org.ops4j.pax.exam.CoreOptions.composite;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.when;
-import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-
-/**
- * 
- */
-public class OlingoOSGiTestSupport {
-    private static final String MAVEN_DEPENDENCIES_PROPERTIES = 
"/META-INF/maven/dependencies.properties";
-
-    @Inject
-    protected BundleContext bundleContext;
-
-    @Inject
-    protected FeaturesService featureService;
-
-    protected ExecutorService executor = Executors.newCachedThreadPool();
-
-    protected MavenUrlReference olingoUrl;
-    protected MavenUrlReference karafUrl;
-
-    /**
-     * @param probe
-     * @return
-     */
-    @ProbeBuilder
-    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
-        probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, 
"*,org.apache.felix.service.*;status=provisional");
-        return probe;
-    }
-
-    private static String getKarafVersion() {
-        String karafVersion = 
getVersionFromPom("org.apache.karaf/apache-karaf/version");
-        if (karafVersion == null) {
-            karafVersion = System.getProperty("karaf.version");
-        }
-        if (karafVersion == null) {
-            // setup the default version of it
-            karafVersion = "3.0.3";
-        }
-        return karafVersion;
-    }
-
-    private static String getVersionFromPom(String key) {
-        try {
-            InputStream ins = 
OlingoOSGiTestSupport.class.getResourceAsStream(MAVEN_DEPENDENCIES_PROPERTIES);
-            Properties p = new Properties();
-            p.load(ins);
-            return p.getProperty(key);
-        } catch (Exception t) {
-            throw new IllegalStateException(MAVEN_DEPENDENCIES_PROPERTIES + " 
can not be found", t);
-        }
-    }    
-    /**
-     * Create an {@link org.ops4j.pax.exam.Option} for using a .
-     * 
-     * @return
-     */
-    protected Option olingoBaseConfig() {
-        karafUrl = 
maven().groupId("org.apache.karaf").artifactId("apache-karaf").version(getKarafVersion())
-            .type("tar.gz");
-        olingoUrl = 
maven().groupId("org.apache.olingo").artifactId("odata-karaf-features").versionAsInProject()
-            .type("xml").classifier("features");
-        String localRepo = System.getProperty("localRepository");
-        return composite(karafDistributionConfiguration()
-                             .frameworkUrl(karafUrl)
-                             .karafVersion(getKarafVersion())
-                             .name("Apache Karaf")
-                             .useDeployFolder(false)
-                             .unpackDirectory(new File("target/paxexam/")),
-                         //DO NOT COMMIT WITH THIS LINE ENABLED!!!    
-                         //KarafDistributionOption.keepRuntimeFolder(),        
                 
-                         systemProperty("java.awt.headless").value("true"),
-                         when(localRepo != null)
-                             
.useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
-                                                                  
"org.ops4j.pax.url.mvn.localRepository",
-                                                                  localRepo)));
-    }
-
-    protected void assertBundleStarted(String name) {
-        Bundle bundle = findBundleByName(name);
-        Assert.assertNotNull("Bundle " + name + " should be installed", 
bundle);
-        Assert.assertEquals("Bundle " + name + " should be started", 
Bundle.ACTIVE, bundle.getState());
-    }
-
-    protected Bundle findBundleByName(String symbolicName) {
-        for (Bundle bundle : bundleContext.getBundles()) {
-            if (bundle.getSymbolicName().equals(symbolicName)) {
-                return bundle;
-            }
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
----------------------------------------------------------------------
diff --git 
a/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
 
b/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
deleted file mode 100644
index d727253..0000000
--- 
a/ext/karaf/itests/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
+++ /dev/null
@@ -1,105 +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.
- 
******************************************************************************/
-package org.apache.olingo.osgi.itests.server;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.apache.olingo.osgi.itests.OlingoOSGiTestSupport;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
-import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
-
-/**
- *
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
-public class CarServiceTest extends OlingoOSGiTestSupport {
-    private static final String SERVICE_URL = 
"http://localhost:8181/olingo-cars/cars.svc/";;
-
-    @Test
-    public void testServiceStarted() throws Exception {
-        // check if the bundle is started
-        assertBundleStarted("org.apache.olingo.odata-server-osgi-sample");
-        
-        // use the jdk http client to verify the server side
-        verifyContent(getContent(SERVICE_URL));
-        
-        verifyContent(getContent(SERVICE_URL + "$metadata"));
-        
-        verifyContent(getContent(SERVICE_URL + "Cars"));
-        
-        verifyContent(getContent(SERVICE_URL + "Cars(1)"));
-        
-        verifyContent(getContent(SERVICE_URL + "Cars(1)/Price"));
-    }    
-
-    private static void verifyContent(String content) {
-        // this is currently a simple test to check if there is no error
-        Assert.assertNotNull(content);
-        Assert.assertTrue(content.indexOf("error") < 0);
-    }
-
-    private static String getContent(String target) throws Exception {
-        InputStream in = null;
-        try {
-            URL url = new URL(target);
-            URLConnection urlConnection = url.openConnection();
-            urlConnection.setRequestProperty("Accept", "*/*");
-            in = urlConnection.getInputStream();
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            byte[] buf = new byte[4096];
-            int n = 0;
-            while ((n = in.read(buf, 0, buf.length)) != -1) {
-                baos.write(buf, 0, n);
-            }
-            return new String(baos.toByteArray(), "utf-8");
-        } finally {
-            if (in != null) {
-                in.close();
-            }
-        }
-        
-    }
-
-    @Configuration
-    public Option[] config() {
-        return new Option[] {
-            olingoBaseConfig(),
-            features(olingoUrl, "olingo-server", "olingo-client"),
-            mavenBundle("org.apache.olingo", "odata-server-osgi-sample", 
"4.0.0-SNAPSHOT"),
-            logLevel(LogLevel.INFO)
-        };
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/karaf-features/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/karaf-features/pom.xml b/ext/karaf/karaf-features/pom.xml
new file mode 100644
index 0000000..2ae3f2c
--- /dev/null
+++ b/ext/karaf/karaf-features/pom.xml
@@ -0,0 +1,81 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>odata-karaf-features</artifactId>
+  <packaging>pom</packaging>
+  <name>${project.artifactId}</name>
+
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>odata-karaf</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>filter</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>resources</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-artifacts</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>target/classes/features.xml</file>
+                                    <type>xml</type>
+                                    <classifier>features</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/karaf-features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/karaf-features/src/main/resources/features.xml 
b/ext/karaf/karaf-features/src/main/resources/features.xml
new file mode 100644
index 0000000..0f2b5f4
--- /dev/null
+++ b/ext/karaf/karaf-features/src/main/resources/features.xml
@@ -0,0 +1,59 @@
+<?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.
+-->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"; 
name="olingo-${project.version}">
+
+  <feature name="olingo-server" version="${project.version}" resolver="(obr)" 
start-level="50">
+    <feature>war</feature>
+    <bundle>mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
+    
<bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
+    
<bundle>mvn:org.codehaus.woodstox/stax2-api/${woodstox.stax2-api.version}</bundle>
+    <bundle>mvn:com.fasterxml/aalto-xml/${aalto-xml.version}</bundle>
+    
<bundle>wrap:mvn:org.antlr/antlr4-runtime/${antlr.version}/$Bundle-SymbolicName=antlr4-runtime&amp;Bundle-Version=${antlr.version}&amp;Export-Package=org.antlr.v4.runtime*</bundle>
+
+    
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+    
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+    
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+
+    <bundle>mvn:org.apache.olingo/odata-commons-api/${project.version}</bundle>
+    
<bundle>mvn:org.apache.olingo/odata-commons-core/${project.version}</bundle>
+    <bundle>mvn:org.apache.olingo/odata-server-api/${project.version}</bundle>
+    <bundle>mvn:org.apache.olingo/odata-server-core/${project.version}</bundle>
+  </feature>
+
+  <feature name="olingo-client" version="${project.version}" resolver="(obr)" 
start-level="50">
+    <bundle>mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
+    <bundle>mvn:commons-io/commons-io/${commons.io.version}</bundle>
+    
<bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
+    
<bundle>mvn:org.codehaus.woodstox/stax2-api/${woodstox.stax2-api.version}</bundle>
+    <bundle>mvn:com.fasterxml/aalto-xml/${aalto-xml.version}</bundle>
+    
<bundle>mvn:org.apache.httpcomponents/httpcore-osgi/${hc.core.version}</bundle>
+    
<bundle>mvn:org.apache.httpcomponents/httpclient-osgi/${hc.client.version}</bundle>
+
+    
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+    
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+    
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+    
<bundle>mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version}</bundle>
+    
<bundle>mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-xml/${jackson.version}</bundle>
+
+    <bundle>mvn:org.apache.olingo/odata-commons-api/${project.version}</bundle>
+    
<bundle>mvn:org.apache.olingo/odata-commons-core/${project.version}</bundle>
+    <bundle>mvn:org.apache.olingo/odata-client-api/${project.version}</bundle>
+    <bundle>mvn:org.apache.olingo/odata-client-core/${project.version}</bundle>
+  </feature>
+</features>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/karaf-fit/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/karaf-fit/pom.xml b/ext/karaf/karaf-fit/pom.xml
new file mode 100644
index 0000000..14a7238
--- /dev/null
+++ b/ext/karaf/karaf-fit/pom.xml
@@ -0,0 +1,152 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>odata-karaf-fit</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>odata-karaf</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+  <dependencies>
+    <!-- Karaf features -->
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>odata-karaf-feature</artifactId>
+      <version>${project.version}</version>
+      <type>xml</type>
+      <classifier>features</classifier>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>org.apache.karaf.features.core</artifactId>
+      <version>${karaf.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.console</artifactId>
+      <version>${karaf.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>${osgi.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <version>${osgi.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-atinject_1.0_spec</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- pax-exam -->
+    <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</artifactId>
+      <version>${pax.exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-karaf</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.apache.karaf</groupId>
+      <artifactId>apache-karaf</artifactId>
+      <version>${karaf.version}</version>
+      <type>tar.gz</type>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.karaf.shell</groupId>
+          <artifactId>org.apache.karaf.shell.dev</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse</groupId>
+          <artifactId>osgi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse</groupId>
+          <artifactId>org.eclipse.osgi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.karaf</groupId>
+          <artifactId>org.apache.karaf.client</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.apache.felix.framework</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <!-- generate dependencies versions that are needed -->
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>generate-depends-file</id>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
----------------------------------------------------------------------
diff --git 
a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
 
b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
new file mode 100644
index 0000000..85d0f42
--- /dev/null
+++ 
b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.
+ 
******************************************************************************/
+
+package org.apache.olingo.osgi.itests;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class BundlesTest extends OlingoOSGiTestSupport {
+    @Test
+    public void test() throws Exception {
+        // check the server-api and server-core
+        assertBundleStarted("org.apache.olingo.odata-server-api");
+        assertBundleStarted("org.apache.olingo.odata-server-core");
+
+        // check the client-api and client-core
+        assertBundleStarted("org.apache.olingo.odata-client-api");
+        assertBundleStarted("org.apache.olingo.odata-client-core");
+    }
+
+    @Configuration
+    public Option[] config() {
+        return new Option[]{
+            olingoBaseConfig(),
+            features(olingoUrl, "olingo-server", "olingo-client"),
+            logLevel(LogLevel.INFO)};
+    }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
----------------------------------------------------------------------
diff --git 
a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
 
b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
new file mode 100644
index 0000000..b055071
--- /dev/null
+++ 
b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * 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.
+ 
******************************************************************************/
+package org.apache.olingo.osgi.itests;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.inject.Inject;
+
+import org.apache.karaf.features.FeaturesService;
+import org.junit.Assert;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.when;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+
+/**
+ * 
+ */
+public class OlingoOSGiTestSupport {
+    private static final String MAVEN_DEPENDENCIES_PROPERTIES = 
"/META-INF/maven/dependencies.properties";
+
+    @Inject
+    protected BundleContext bundleContext;
+
+    @Inject
+    protected FeaturesService featureService;
+
+    protected ExecutorService executor = Executors.newCachedThreadPool();
+
+    protected MavenUrlReference olingoUrl;
+    protected MavenUrlReference karafUrl;
+
+    /**
+     * @param probe
+     * @return
+     */
+    @ProbeBuilder
+    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+        probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, 
"*,org.apache.felix.service.*;status=provisional");
+        return probe;
+    }
+
+    private static String getKarafVersion() {
+        String karafVersion = 
getVersionFromPom("org.apache.karaf/apache-karaf/version");
+        if (karafVersion == null) {
+            karafVersion = System.getProperty("karaf.version");
+        }
+        if (karafVersion == null) {
+            // setup the default version of it
+            karafVersion = "3.0.3";
+        }
+        return karafVersion;
+    }
+
+    private static String getVersionFromPom(String key) {
+        try {
+            InputStream ins = 
OlingoOSGiTestSupport.class.getResourceAsStream(MAVEN_DEPENDENCIES_PROPERTIES);
+            Properties p = new Properties();
+            p.load(ins);
+            return p.getProperty(key);
+        } catch (Exception t) {
+            throw new IllegalStateException(MAVEN_DEPENDENCIES_PROPERTIES + " 
can not be found", t);
+        }
+    }    
+    /**
+     * Create an {@link org.ops4j.pax.exam.Option} for using a .
+     * 
+     * @return
+     */
+    protected Option olingoBaseConfig() {
+        karafUrl = 
maven().groupId("org.apache.karaf").artifactId("apache-karaf").version(getKarafVersion())
+            .type("tar.gz");
+        olingoUrl = 
maven().groupId("org.apache.olingo").artifactId("odata-karaf-feature").versionAsInProject()
+            .type("xml").classifier("features");
+        String localRepo = System.getProperty("localRepository");
+        return composite(karafDistributionConfiguration()
+                             .frameworkUrl(karafUrl)
+                             .karafVersion(getKarafVersion())
+                             .name("Apache Karaf")
+                             .useDeployFolder(false)
+                             .unpackDirectory(new File("target/paxexam/")),
+                         //DO NOT COMMIT WITH THIS LINE ENABLED!!!    
+                         //KarafDistributionOption.keepRuntimeFolder(),        
                 
+                         systemProperty("java.awt.headless").value("true"),
+                         when(localRepo != null)
+                             
.useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
+                                                                  
"org.ops4j.pax.url.mvn.localRepository",
+                                                                  localRepo)));
+    }
+
+    protected void assertBundleStarted(String name) {
+        Bundle bundle = findBundleByName(name);
+        Assert.assertNotNull("Bundle " + name + " should be installed", 
bundle);
+        Assert.assertEquals("Bundle " + name + " should be started", 
Bundle.ACTIVE, bundle.getState());
+    }
+
+    protected Bundle findBundleByName(String symbolicName) {
+        for (Bundle bundle : bundleContext.getBundles()) {
+            if (bundle.getSymbolicName().equals(symbolicName)) {
+                return bundle;
+            }
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
----------------------------------------------------------------------
diff --git 
a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
 
b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
new file mode 100644
index 0000000..d727253
--- /dev/null
+++ 
b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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.
+ 
******************************************************************************/
+package org.apache.olingo.osgi.itests.server;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.olingo.osgi.itests.OlingoOSGiTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+/**
+ *
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class CarServiceTest extends OlingoOSGiTestSupport {
+    private static final String SERVICE_URL = 
"http://localhost:8181/olingo-cars/cars.svc/";;
+
+    @Test
+    public void testServiceStarted() throws Exception {
+        // check if the bundle is started
+        assertBundleStarted("org.apache.olingo.odata-server-osgi-sample");
+        
+        // use the jdk http client to verify the server side
+        verifyContent(getContent(SERVICE_URL));
+        
+        verifyContent(getContent(SERVICE_URL + "$metadata"));
+        
+        verifyContent(getContent(SERVICE_URL + "Cars"));
+        
+        verifyContent(getContent(SERVICE_URL + "Cars(1)"));
+        
+        verifyContent(getContent(SERVICE_URL + "Cars(1)/Price"));
+    }    
+
+    private static void verifyContent(String content) {
+        // this is currently a simple test to check if there is no error
+        Assert.assertNotNull(content);
+        Assert.assertTrue(content.indexOf("error") < 0);
+    }
+
+    private static String getContent(String target) throws Exception {
+        InputStream in = null;
+        try {
+            URL url = new URL(target);
+            URLConnection urlConnection = url.openConnection();
+            urlConnection.setRequestProperty("Accept", "*/*");
+            in = urlConnection.getInputStream();
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            byte[] buf = new byte[4096];
+            int n = 0;
+            while ((n = in.read(buf, 0, buf.length)) != -1) {
+                baos.write(buf, 0, n);
+            }
+            return new String(baos.toByteArray(), "utf-8");
+        } finally {
+            if (in != null) {
+                in.close();
+            }
+        }
+        
+    }
+
+    @Configuration
+    public Option[] config() {
+        return new Option[] {
+            olingoBaseConfig(),
+            features(olingoUrl, "olingo-server", "olingo-client"),
+            mavenBundle("org.apache.olingo", "odata-server-osgi-sample", 
"4.0.0-SNAPSHOT"),
+            logLevel(LogLevel.INFO)
+        };
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/pom.xml b/ext/karaf/pom.xml
new file mode 100644
index 0000000..14e3645
--- /dev/null
+++ b/ext/karaf/pom.xml
@@ -0,0 +1,41 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>odata-karaf</artifactId>
+  <packaging>pom</packaging>
+  <name>${project.artifactId}</name>
+
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>odata-ext</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <modules>
+    <module>karaf-features</module>
+    <module>karaf-fit</module>
+  </modules>
+</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/ext/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pom.xml b/ext/pom.xml
index 93a78e3..92a4bc2 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -39,6 +39,14 @@
     <module>pojogen-maven-plugin</module>
     <module>client-proxy</module>
     <module>client-android</module>
-    <module>karaf/features</module>
   </modules>
+
+  <profiles>
+    <profile>
+      <id>karaf</id>
+      <modules>
+        <module>karaf</module>
+      </modules>
+    </profile>
+  </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1544783..0ae3c97 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,7 +100,7 @@
     <!-- for osgi integration testing -->
     <osgi.version>4.2.0</osgi.version>
     <karaf.version>3.0.3</karaf.version>
-    <pax.exam.version>4.5.0</pax.exam.version>
+    <pax.exam.version>3.4.0</pax.exam.version>
 
     <!-- Project build settings -->
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e59b5082/samples/pom.xml
----------------------------------------------------------------------
diff --git a/samples/pom.xml b/samples/pom.xml
index 0efc961..2d6b235 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -23,7 +23,6 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.olingo</groupId>
   <artifactId>odata-samples</artifactId>
   <packaging>pom</packaging>
   <name>${project.artifactId}</name>
@@ -37,6 +36,14 @@
 
   <modules>
     <module>server</module>
-    <module>osgi/server</module>
   </modules>
+
+  <profiles>
+    <profile>
+      <id>samples</id>
+      <modules>
+        <module>osgi/server</module>
+      </modules>
+    </profile>
+  </profiles>
 </project>

Reply via email to