You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cs...@apache.org on 2018/10/11 14:10:12 UTC

svn commit: r1843552 - in /felix/trunk: rootcause/ rootcause/docs/ rootcause/src/ rootcause/src/main/ rootcause/src/main/java/ rootcause/src/main/java/org/ rootcause/src/main/java/org/apache/ rootcause/src/main/java/org/apache/felix/ rootcause/src/main...

Author: cschneider
Date: Thu Oct 11 14:10:11 2018
New Revision: 1843552

URL: http://svn.apache.org/viewvc?rev=1843552&view=rev
Log:
FELIX-5961 - Move root cause analysis into its own project

Added:
    felix/trunk/rootcause/
    felix/trunk/rootcause/.travis.yml
    felix/trunk/rootcause/LICENSE
    felix/trunk/rootcause/README.md
    felix/trunk/rootcause/bnd.bnd
    felix/trunk/rootcause/docs/
    felix/trunk/rootcause/docs/README.md
    felix/trunk/rootcause/pom.xml
    felix/trunk/rootcause/src/
    felix/trunk/rootcause/src/main/
    felix/trunk/rootcause/src/main/java/
    felix/trunk/rootcause/src/main/java/org/
    felix/trunk/rootcause/src/main/java/org/apache/
    felix/trunk/rootcause/src/main/java/org/apache/felix/
    felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/
    felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSComp.java
    felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRef.java
    felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRootCause.java
    felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCauseCommand.java
    felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCausePrinter.java
    felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/package-info.java
    felix/trunk/rootcause/src/test/
    felix/trunk/rootcause/src/test/java/
    felix/trunk/rootcause/src/test/java/org/
    felix/trunk/rootcause/src/test/java/org/apache/
    felix/trunk/rootcause/src/test/java/org/apache/felix/
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/DSRootCauseTest.java
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithCyclicRef.java
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingConfig.java
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef.java
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef2.java
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithoutService.java
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BaseTest.java
    felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BndDSOptions.java
    felix/trunk/rootcause/src/test/resources/
    felix/trunk/rootcause/src/test/resources/exam.properties
    felix/trunk/rootcause/src/test/resources/logback.xml
    felix/trunk/systemready/.travis.yml
Removed:
    felix/trunk/systemready/src/main/java/org/apache/felix/systemready/rootcause/
    felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/DSRootCauseTest.java
    felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/examples/CompWithCyclicRef.java
    felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/examples/CompWithMissingConfig.java
    felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/examples/CompWithMissingRef.java
    felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/examples/CompWithMissingRef2.java
Modified:
    felix/trunk/systemready/docs/README.md
    felix/trunk/systemready/pom.xml
    felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ComponentsCheck.java
    felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ServicesCheck.java
    felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/util/BaseTest.java

Added: felix/trunk/rootcause/.travis.yml
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/.travis.yml?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/.travis.yml (added)
+++ felix/trunk/rootcause/.travis.yml Thu Oct 11 14:10:11 2018
@@ -0,0 +1 @@
+language: java

Added: felix/trunk/rootcause/LICENSE
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/LICENSE?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/LICENSE (added)
+++ felix/trunk/rootcause/LICENSE Thu Oct 11 14:10:11 2018
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.

Added: felix/trunk/rootcause/README.md
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/README.md?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/README.md (added)
+++ felix/trunk/rootcause/README.md Thu Oct 11 14:10:11 2018
@@ -0,0 +1,28 @@
+# OSGi root cause analysis
+
+[![Build Status](https://builds.apache.org/buildStatus/icon?job=Felix%20Rootcause)](https://builds.apache.org/job/Felix%20Rootcause/)
+[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.felix/org.apache.felix.rootcause/badge.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.felix%22%20a%3A%22org.apache.felix.rootcause%22)
+
+
+Finding the root cause of problems with OSGi declarative services components.
+
+## Usage
+
+See [reference documentation](docs/README.md).
+
+## Build
+
+    mvn clean install
+
+Also check the [Jenkins build](https://builds.apache.org/job/Felix%20Rootcause/)
+
+## Issue reporting
+
+We currently have these [open issues](https://issues.apache.org/jira/issues/?jql=project%20%3D%20FELIX%20AND%20component%20%3D%20%22Root%20Cause%22%20AND%20resolution%20%3D%20Unresolved). Please report issues using project`Felix` and Component `Root Cause`.
+
+## Working with the code
+
+As contributor the easiest way is to fork the [Felix project on github](https://github.com/apache/felix/tree/trunk/rootcause) and do a pull request. We do not actively monitor pull requests so please also open an issue.
+
+When creating a PR it is a good practice to first create a branch named like the jira issue id. The commit message should also refer to the issue id. Like `FELIX-1234 My message`.
+

Added: felix/trunk/rootcause/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/bnd.bnd?rev=1843552&view=auto
==============================================================================
    (empty)

Added: felix/trunk/rootcause/docs/README.md
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/docs/README.md?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/docs/README.md (added)
+++ felix/trunk/rootcause/docs/README.md Thu Oct 11 14:10:11 2018
@@ -0,0 +1,50 @@
+# Reference Documentation Felix RootCause
+
+Finding the root cause of problems with OSGi declarative services components.
+
+## Requirements:
+
+* Configuration Admin Service
+* Service Component Runtime
+
+See below for a hands on example in Apache Karaf.
+
+## Root cause command
+
+For quickly checking for a root cause of a problem with a declarative services component there is also a handy command.
+
+`rootcause <ds-compoment-name>`
+
+It prints the top level status of a DS component as well as the tree of DS unsatisfied components it depends on together with their status.
+
+This is a sample output from the DSRootCause tests. It shows the cause of a component that depends on some other components. The root cause of CompWithMissingRef2 not being satisfied is that CompWithMissingConfig is missing its mandatory config.
+
+```
+Component CompWithMissingRef2 unsatisfied references
+  ref other interface CompWithMissingRef
+    Component CompWithMissingRef unsatisfied references
+      ref other interface CompWithMissingConfig
+        Component CompWithMissingConfig missing config on pid [CompWithMissingConfig]
+```
+
+## Example of using the system ready service framework in Apache Karaf
+
+Download, install and run Apache Karaf 4.1.x. Inside the karaf shell execute this:
+
+```
+feature:install scr http-whiteboard
+config:property-set --pid ServicesCheck services.list org.osgi.service.log.LogService
+config:property-set --pid SystemReadyServlet osgi.http.whiteboard.context.select "(osgi.http.whiteboard.context.name=default)"
+install -s mvn:org.apache.felix/org.apache.felix.systemready/0.1.0-SNAPSHOT
+```
+
+Point your browser to http://localhost:8181/system/console/ready .
+
+Check the status of a DS component:
+
+```
+rootcause SystemReadyMonitor
+ Component SystemReadyMonitor statisfied
+```
+
+Try this with some of your own components.

Added: felix/trunk/rootcause/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/pom.xml?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/pom.xml (added)
+++ felix/trunk/rootcause/pom.xml Thu Oct 11 14:10:11 2018
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+        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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>felix-parent</artifactId>
+        <version>5</version>
+        <relativePath />
+    </parent>
+
+    <artifactId>org.apache.felix.rootcause</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <name>Apache Felix - Root Cause Analysis</name>
+
+    <properties>
+        <felix.java.version>8</felix.java.version>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <exam.version>4.11.0</exam.version>
+    </properties>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/root-cause</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/root-cause</developerConnection>
+        <url>http://svn.apache.org/viewvc/felix/trunk/root-cause</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-maven-plugin</artifactId>
+                <version>4.0.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>bnd-process</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <attach>true</attach>
+                    <quiet>true</quiet>
+                    <encoding>UTF-8</encoding>
+                    <additionalparam>-Xdoclint:none</additionalparam>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.cmpn</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.annotation</artifactId>
+            <version>7.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.6</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- Test dependencies -->
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.9.5</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.hamcrest</artifactId>
+            <version>1.3_1</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-native</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-cm</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-mvn</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+            <version>5.6.10</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>1.0.13</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>1.0.13</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <version>1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.tinybundles</groupId>
+            <artifactId>tinybundles</artifactId>
+            <version>3.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <version>3.1.0</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Added: felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSComp.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSComp.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSComp.java (added)
+++ felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSComp.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,32 @@
+/*
+ * 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.felix.rootcause;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osgi.dto.DTO;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+
+public class DSComp extends DTO {
+    public ComponentDescriptionDTO desc;
+    public ComponentConfigurationDTO config;
+    public List<DSRef> unsatisfied = new ArrayList<>();
+}

Added: felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRef.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRef.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRef.java (added)
+++ felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRef.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,31 @@
+/*
+ * 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.felix.rootcause;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osgi.dto.DTO;
+
+public class DSRef extends DTO {
+    public String name;
+    public String iface;
+    public String filter;
+    public List<DSComp> candidates = new ArrayList<>();
+}

Added: felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRootCause.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRootCause.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRootCause.java (added)
+++ felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/DSRootCause.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,97 @@
+/*
+ * 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.felix.rootcause;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+import org.osgi.service.component.runtime.dto.ReferenceDTO;
+import org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO;
+
+public class DSRootCause {
+
+    private static final int MAX_RECURSION = 10;
+    
+    private ServiceComponentRuntime scr;
+    
+    public DSRootCause(ServiceComponentRuntime scr) {
+        this.scr = scr;
+    }
+    
+    public Optional<DSComp> getRootCause(String iface) {
+        return scr.getComponentDescriptionDTOs().stream()
+            .filter(desc -> offersInterface(desc, iface))
+            .map(this::getRootCause)
+            .findFirst();
+    }
+    
+    public DSComp getRootCause(ComponentDescriptionDTO desc) {
+        return getRootCause(desc, 0);
+    }
+
+    private DSComp getRootCause(ComponentDescriptionDTO desc, int level) {
+        if (level > MAX_RECURSION) {
+            throw new IllegalStateException("Aborting after because of cyclic references");
+        }
+        DSComp dsComp = new DSComp();
+        dsComp.desc = desc;
+        Collection<ComponentConfigurationDTO> instances = scr.getComponentConfigurationDTOs(desc);
+        if (instances.isEmpty()) {
+            return dsComp;
+        }
+        for (ComponentConfigurationDTO instance : instances) {
+            for (UnsatisfiedReferenceDTO ref : instance.unsatisfiedReferences) {
+                ReferenceDTO refdef = getReference(desc, ref.name);
+                DSRef unresolvedRef = createRef(ref, refdef);
+                unresolvedRef.candidates = getCandidates(ref, refdef, level + 1);
+                dsComp.unsatisfied.add(unresolvedRef);
+            }
+        }
+        return dsComp;
+    }
+
+    private DSRef createRef(UnsatisfiedReferenceDTO unsatifiedRef, ReferenceDTO refdef) {
+        DSRef ref = new DSRef();
+        ref.name = unsatifiedRef.name;
+        ref.filter = unsatifiedRef.target;
+        ref.iface = refdef.interfaceName;
+        return ref;
+    }
+
+    private List<DSComp> getCandidates(UnsatisfiedReferenceDTO ref, ReferenceDTO refdef, int level) {
+        return scr.getComponentDescriptionDTOs().stream()
+                .filter(desc -> offersInterface(desc, refdef.interfaceName))
+                .map(desc -> getRootCause(desc, level)).collect(Collectors.toList());
+    }
+
+    private boolean offersInterface(ComponentDescriptionDTO desc, String interfaceName) {
+        return Arrays.asList(desc.serviceInterfaces).contains(interfaceName);
+    }
+
+    private ReferenceDTO getReference(ComponentDescriptionDTO desc, String name) {
+        return Arrays.asList(desc.references).stream().filter(ref -> ref.name.equals(name)).findFirst().get();
+    }
+
+}

Added: felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCauseCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCauseCommand.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCauseCommand.java (added)
+++ felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCauseCommand.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,46 @@
+/*
+ * 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.felix.rootcause;
+
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+
+@Component(
+        service = RootCauseCommand.class,
+        property = {
+                "osgi.command.scope=ready", //
+                "osgi.command.function=rootcause"
+        }
+        )
+public class RootCauseCommand {
+    
+    @Reference
+    ServiceComponentRuntime scr;
+    
+    public DSComp rootcause(String componentName) {
+        ComponentDescriptionDTO cdesc = scr.getComponentDescriptionDTOs().stream()
+            .filter(desc -> desc.name.equals(componentName))
+            .findFirst().get();
+        DSComp rootCause = new DSRootCause(scr).getRootCause(cdesc);
+        new RootCausePrinter().print(rootCause);
+        return rootCause;
+    }
+}

Added: felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCausePrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCausePrinter.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCausePrinter.java (added)
+++ felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/RootCausePrinter.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,74 @@
+/*
+ * 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.felix.rootcause;
+
+import java.util.Arrays;
+import java.util.function.Consumer;
+
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+
+public class RootCausePrinter {
+    private Consumer<String> printCallback;
+    
+    public RootCausePrinter() {
+        this(System.out::println);
+    }
+    
+    public RootCausePrinter(Consumer<String> printCallback) {
+        this.printCallback = printCallback;
+    }
+    
+    public void print(DSComp desc) {
+        print(desc, 0);
+    }
+    
+    public void print(DSComp comp, int level) {
+        if (comp.config == null && "require".equals(comp.desc.configurationPolicy)) {
+            println(level, "Component %s missing config on pid %s", comp.desc.name, Arrays.asList(comp.desc.configurationPid));
+        } else if (comp.config != null && comp.config.state == ComponentConfigurationDTO.UNSATISFIED_CONFIGURATION){
+            println(level, "Component %s unsatisifed configuration on pid %s", comp.desc.name, Arrays.asList(comp.desc.configurationPid));
+        } else if (!comp.unsatisfied.isEmpty()) {
+            println(level, "Component %s unsatisfied references", comp.desc.name);
+        } else {
+            println(level, "Component %s satisfied", comp.desc.name);
+        }
+        int l2 = level + 2;
+        int l3 = l2 + 2;
+        for (DSRef ref : comp.unsatisfied) {
+            println(l2, "unsatisfied ref %s interface %s %s", ref.name, ref.iface, getFilterSt(ref.filter));
+            for (DSComp cand : ref.candidates) {
+                print(cand, l3);
+            }
+        }
+    }
+ 
+    private Object getFilterSt(String filter) {
+        return filter == null ? "" : ", filter " + filter;
+    }
+
+    private void println(int level, String format, Object... args) {
+        printCallback.accept(spaces(level) + String.format(format, args));
+    }
+    
+    private String spaces(int length) {
+        char[] bytes = new char[length];
+        Arrays.fill(bytes, ' ');
+        return new String(bytes);
+    }
+}

Added: felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/package-info.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/package-info.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/package-info.java (added)
+++ felix/trunk/rootcause/src/main/java/org/apache/felix/rootcause/package-info.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+@org.osgi.annotation.versioning.Version("0.1.0")
+@org.osgi.annotation.bundle.Export
+package org.apache.felix.rootcause;

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/DSRootCauseTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/DSRootCauseTest.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/DSRootCauseTest.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/DSRootCauseTest.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,129 @@
+/*
+ * 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.felix.rootcause;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle;
+
+import javax.inject.Inject;
+
+import org.apache.felix.rootcause.DSComp;
+import org.apache.felix.rootcause.DSRef;
+import org.apache.felix.rootcause.DSRootCause;
+import org.apache.felix.rootcause.RootCausePrinter;
+import org.apache.felix.rootcause.examples.CompWithCyclicRef;
+import org.apache.felix.rootcause.examples.CompWithMissingConfig;
+import org.apache.felix.rootcause.examples.CompWithMissingRef;
+import org.apache.felix.rootcause.examples.CompWithMissingRef2;
+import org.apache.felix.rootcause.examples.CompWithoutService;
+import org.apache.felix.rootcause.util.BaseTest;
+import org.apache.felix.rootcause.util.BndDSOptions;
+import org.junit.Before;
+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.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class DSRootCauseTest extends BaseTest {
+
+    @Inject
+    ServiceComponentRuntime scr;
+    
+    DSRootCause dsRootCause;
+    
+    @Configuration
+    public Option[] configuration() {
+        return new Option[] {
+                baseConfiguration(),
+                BndDSOptions.dsBundle("test", bundle()
+                        .add(CompWithMissingConfig.class)
+                        .add(CompWithMissingRef.class)
+                        .add(CompWithCyclicRef.class)
+                        .add(CompWithMissingRef2.class)
+                        .add(CompWithoutService.class)
+                        )
+        };
+    }
+    
+    @Before
+    public void before() {
+        dsRootCause = new DSRootCause(scr);
+    }
+
+    
+    @Test
+    public void testMissingConfig() throws InterruptedException {
+        ComponentDescriptionDTO desc = getComponentDesc(CompWithMissingConfig.class);
+        DSComp rootCause = dsRootCause.getRootCause(desc);
+        new RootCausePrinter().print(rootCause);
+        assertEquals("CompWithMissingConfig", rootCause.desc.name);
+        assertNull(rootCause.config);
+    }
+    
+    @Test
+    public void testMissingRef() throws InterruptedException {
+        ComponentDescriptionDTO desc = getComponentDesc(CompWithMissingRef.class);
+        DSComp rootCause = dsRootCause.getRootCause(desc);
+        new RootCausePrinter().print(rootCause);
+        assertEquals(1, rootCause.unsatisfied.size());
+        DSRef unsatisfied = rootCause.unsatisfied.iterator().next();
+        assertEquals(1, rootCause.unsatisfied.size());
+        DSComp candidate = unsatisfied.candidates.iterator().next();
+        assertEquals("CompWithMissingConfig", candidate.desc.name);
+        assertNull(candidate.config);
+    }
+    
+    @Test
+    public void testMissingRef2() throws InterruptedException {
+        ComponentDescriptionDTO desc = getComponentDesc(CompWithMissingRef2.class);
+        DSComp rootCause = dsRootCause.getRootCause(desc);
+        new RootCausePrinter().print(rootCause);
+        assertEquals(1, rootCause.unsatisfied.size());
+        DSRef unsatisfied = rootCause.unsatisfied.iterator().next();
+        assertEquals(1, rootCause.unsatisfied.size());
+        DSComp candidate = unsatisfied.candidates.iterator().next();
+        assertEquals("CompWithMissingRef", candidate.desc.name);
+        assertNull(candidate.config);
+    }
+    
+    @Test
+    public void testNoService() throws InterruptedException {
+        ComponentDescriptionDTO desc = getComponentDesc(CompWithoutService.class);
+        DSComp rootCause = dsRootCause.getRootCause(desc);
+        assertThat(rootCause.desc.serviceInterfaces.length, equalTo(0)); 
+        new RootCausePrinter().print(rootCause);
+    }
+    
+    @Test(expected = IllegalStateException.class)
+    public void testCyclic() throws InterruptedException {
+        ComponentDescriptionDTO desc = getComponentDesc(CompWithCyclicRef.class);
+        dsRootCause.getRootCause(desc);
+    }
+
+}

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithCyclicRef.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithCyclicRef.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithCyclicRef.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithCyclicRef.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,28 @@
+/*
+ * 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.felix.rootcause.examples;
+
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+@Component(service=CompWithCyclicRef.class)
+public class CompWithCyclicRef {
+    @Reference
+    CompWithCyclicRef ref;
+}

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingConfig.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingConfig.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingConfig.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingConfig.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,31 @@
+/*
+ * 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.felix.rootcause.examples;
+
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+
+@Component(
+        service = CompWithMissingConfig.class,
+        name="CompWithMissingConfig",
+        configurationPolicy=ConfigurationPolicy.REQUIRE
+        )
+public class CompWithMissingConfig {
+
+}

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,32 @@
+/*
+ * 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.felix.rootcause.examples;
+
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+@Component(
+        name = "CompWithMissingRef",
+        service = CompWithMissingRef.class
+        )
+public class CompWithMissingRef {
+    @Reference
+    CompWithMissingConfig other;
+
+}

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef2.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef2.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef2.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithMissingRef2.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,31 @@
+/*
+ * 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.felix.rootcause.examples;
+
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+@Component(
+        name = "CompWithMissingRef2",
+        service = CompWithMissingRef2.class
+        )
+public class CompWithMissingRef2 {
+    @Reference
+    CompWithMissingRef other;
+}

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithoutService.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithoutService.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithoutService.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/examples/CompWithoutService.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,31 @@
+/*
+ * 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.felix.rootcause.examples;
+
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+@Component(
+        name = "CompWithoutService"
+        )
+public class CompWithoutService {
+
+    @Reference
+    Runnable dummy;
+}

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BaseTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BaseTest.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BaseTest.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BaseTest.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,86 @@
+/*
+ * 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.felix.rootcause.util;
+
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.util.Optional;
+import java.util.function.Predicate;
+
+import javax.inject.Inject;
+
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+
+
+public class BaseTest {
+    @Inject
+    public BundleContext context;
+
+    @Inject
+    public ServiceComponentRuntime scr;
+
+
+    public Option baseConfiguration() {
+        return CoreOptions.composite(
+                systemProperty("pax.exam.invoker").value("junit"),
+                systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
+                systemProperty("logback.configurationFile")
+                    .value("src/test/resources/logback.xml"),
+                mavenBundle().groupId("org.slf4j").artifactId("slf4j-api").version("1.7.6"),
+                mavenBundle().groupId("ch.qos.logback").artifactId("logback-core").version("1.0.13"),
+                mavenBundle().groupId("ch.qos.logback").artifactId("logback-classic").version("1.0.13"),
+                
+                bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.junit.link"),
+                bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link"),
+                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").version("1.3_1"),
+                mavenBundle().groupId("org.awaitility").artifactId("awaitility").version("3.1.0"),
+
+                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.scr").version("2.0.14"),
+                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.8.16"),
+                bundle("reference:file:target/classes/")
+
+        );
+    }
+    
+    public ComponentDescriptionDTO getComponentDesc(String compName) {
+        return getComponentDesc(desc -> desc.name.equals(compName), compName);
+    }
+
+    public ComponentDescriptionDTO getComponentDesc(Class<?> compClass) {
+        return getComponentDesc(desc -> desc.implementationClass.equals(compClass.getName()), compClass.getName());
+    }
+
+    public ComponentDescriptionDTO getComponentDesc(Predicate<ComponentDescriptionDTO> predicate, String label) {
+        Optional<ComponentDescriptionDTO> result = scr.getComponentDescriptionDTOs().stream()
+                .filter(predicate)
+                .findFirst();
+        if (result.isPresent()) {
+            return result.get();
+        } else {
+            throw new RuntimeException("Component " + label + " not found");
+        }
+    }
+
+}

Added: felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BndDSOptions.java
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BndDSOptions.java?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BndDSOptions.java (added)
+++ felix/trunk/rootcause/src/test/java/org/apache/felix/rootcause/util/BndDSOptions.java Thu Oct 11 14:10:11 2018
@@ -0,0 +1,43 @@
+/*
+ * 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.felix.rootcause.util;
+
+import static org.ops4j.pax.exam.CoreOptions.streamBundle;
+import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd;
+
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.tinybundles.core.TinyBundle;
+
+/**
+ * This must be in its own bundle and static to avoid that TinyBundles has to be deployed in OSGi
+ */
+public class BndDSOptions {
+
+    private BndDSOptions() {
+    }
+
+    /**
+     * Create a bundle with DS support and automatically generated exports and imports
+     */
+    public static Option dsBundle(String symbolicName, TinyBundle bundleDef) {
+        return streamBundle(bundleDef
+                .symbolicName(symbolicName)
+                .build(withBnd()));
+    }
+}

Added: felix/trunk/rootcause/src/test/resources/exam.properties
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/resources/exam.properties?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/resources/exam.properties (added)
+++ felix/trunk/rootcause/src/test/resources/exam.properties Thu Oct 11 14:10:11 2018
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+pax.exam.logging = none

Added: felix/trunk/rootcause/src/test/resources/logback.xml
URL: http://svn.apache.org/viewvc/felix/trunk/rootcause/src/test/resources/logback.xml?rev=1843552&view=auto
==============================================================================
--- felix/trunk/rootcause/src/test/resources/logback.xml (added)
+++ felix/trunk/rootcause/src/test/resources/logback.xml Thu Oct 11 14:10:11 2018
@@ -0,0 +1,30 @@
+<?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.
+-->
+<configuration>
+  <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%date %level [%thread] %logger{20} [%file : %line] %msg - %mdc %n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="console"/>
+  </root>
+</configuration>

Added: felix/trunk/systemready/.travis.yml
URL: http://svn.apache.org/viewvc/felix/trunk/systemready/.travis.yml?rev=1843552&view=auto
==============================================================================
--- felix/trunk/systemready/.travis.yml (added)
+++ felix/trunk/systemready/.travis.yml Thu Oct 11 14:10:11 2018
@@ -0,0 +1 @@
+language: java

Modified: felix/trunk/systemready/docs/README.md
URL: http://svn.apache.org/viewvc/felix/trunk/systemready/docs/README.md?rev=1843552&r1=1843551&r2=1843552&view=diff
==============================================================================
--- felix/trunk/systemready/docs/README.md (original)
+++ felix/trunk/systemready/docs/README.md Thu Oct 11 14:10:11 2018
@@ -101,24 +101,6 @@ When using the servlet in Apache Felix H
 
     osgi.http.whiteboard.context.select =(osgi.http.whiteboard.context.name=org.osgi.service.http)
 
-## Root cause command
-
-For quickly checking for a root cause of a problem with a declarative services component there is also a handy command.
-
-`rootcause <ds-compoment-name>`
-
-It prints the top level status of a DS component as well as the tree of DS unsatisfied components it depends on together with their status.
-
-This is a sample output from the DSRootCause tests. It shows the cause of a component that depends on some other components. The root cause of CompWithMissingRef2 not being satisfied is that CompWithMissingConfig is missing its mandatory config.
-
-```
-Component CompWithMissingRef2 unsatisfied references
-  ref other interface CompWithMissingRef
-    Component CompWithMissingRef unsatisfied references
-      ref other interface CompWithMissingConfig
-        Component CompWithMissingConfig missing config on pid [CompWithMissingConfig]
-```
-
 ## Example of using the system ready service framework in Apache Karaf
 
 Download, install and run Apache Karaf 4.1.x. Inside the karaf shell execute this:
@@ -127,7 +109,8 @@ Download, install and run Apache Karaf 4
 feature:install scr http-whiteboard
 config:property-set --pid ServicesCheck services.list org.osgi.service.log.LogService
 config:property-set --pid SystemReadyServlet osgi.http.whiteboard.context.select "(osgi.http.whiteboard.context.name=default)"
-install -s mvn:org.apache.felix/org.apache.felix.systemready/0.1.0-SNAPSHOT
+install -s mvn:org.apache.felix/org.apache.felix.rootcause/0.1.0-SNAPSHOT
+install -s mvn:org.apache.felix/org.apache.felix.systemready/0.5.0-SNAPSHOT
 ```
 
 Point your browser to http://localhost:8181/system/console/ready .

Modified: felix/trunk/systemready/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/systemready/pom.xml?rev=1843552&r1=1843551&r2=1843552&view=diff
==============================================================================
--- felix/trunk/systemready/pom.xml (original)
+++ felix/trunk/systemready/pom.xml Thu Oct 11 14:10:11 2018
@@ -73,6 +73,11 @@
 
 
     <dependencies>
+    	<dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.rootcause</artifactId>
+            <version>0.1.0-SNAPSHOT</version>
+        </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>

Modified: felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ComponentsCheck.java
URL: http://svn.apache.org/viewvc/felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ComponentsCheck.java?rev=1843552&r1=1843551&r2=1843552&view=diff
==============================================================================
--- felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ComponentsCheck.java (original)
+++ felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ComponentsCheck.java Thu Oct 11 14:10:11 2018
@@ -22,12 +22,12 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import org.apache.felix.rootcause.DSComp;
+import org.apache.felix.rootcause.DSRootCause;
+import org.apache.felix.rootcause.RootCausePrinter;
 import org.apache.felix.systemready.CheckStatus;
 import org.apache.felix.systemready.StateType;
 import org.apache.felix.systemready.SystemReadyCheck;
-import org.apache.felix.systemready.rootcause.DSComp;
-import org.apache.felix.systemready.rootcause.DSRootCause;
-import org.apache.felix.systemready.rootcause.RootCausePrinter;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;

Modified: felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ServicesCheck.java
URL: http://svn.apache.org/viewvc/felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ServicesCheck.java?rev=1843552&r1=1843551&r2=1843552&view=diff
==============================================================================
--- felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ServicesCheck.java (original)
+++ felix/trunk/systemready/src/main/java/org/apache/felix/systemready/impl/ServicesCheck.java Thu Oct 11 14:10:11 2018
@@ -27,13 +27,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 
+import org.apache.felix.rootcause.DSComp;
+import org.apache.felix.rootcause.DSRootCause;
+import org.apache.felix.rootcause.RootCausePrinter;
 import org.apache.felix.systemready.CheckStatus;
 import org.apache.felix.systemready.CheckStatus.State;
 import org.apache.felix.systemready.StateType;
 import org.apache.felix.systemready.SystemReadyCheck;
-import org.apache.felix.systemready.rootcause.DSComp;
-import org.apache.felix.systemready.rootcause.DSRootCause;
-import org.apache.felix.systemready.rootcause.RootCausePrinter;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;

Modified: felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/util/BaseTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/util/BaseTest.java?rev=1843552&r1=1843551&r2=1843552&view=diff
==============================================================================
--- felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/util/BaseTest.java (original)
+++ felix/trunk/systemready/src/test/java/org/apache/felix/systemready/osgi/util/BaseTest.java Thu Oct 11 14:10:11 2018
@@ -73,6 +73,7 @@ public class BaseTest {
 
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.scr").version("2.0.14"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.8.16"),
+                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.rootcause").version("0.1.0-SNAPSHOT"),
                 bundle("reference:file:target/classes/")
 
         );