[FELIX-4517] Fix service properties when using collections in blueprint
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1603091 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl b/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl
index aa2578b..b722a11 100644
--- a/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl
+++ b/bundleplugin/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl
@@ -88,7 +88,21 @@
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="bp:service-properties/bp:entry">
- <xsl:value-of select="concat(';', @key, '="', @value, '"')" />
+ <xsl:choose>
+ <xsl:when test="@value">
+ <xsl:value-of select="concat(';', @key, '="', @value, '"')" />
+ </xsl:when>
+ <xsl:when test="(bp:list|bp:array|bp:set)/bp:value/text()">
+ <xsl:value-of select="concat(';', @key, ':List<String>="')" />
+ <xsl:for-each select="(bp:list|bp:array|bp:set)/bp:value/text()">
+ <xsl:value-of select="."/>
+ <xsl:if test="position() != last()">
+ <xsl:value-of select="','" />
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:value-of select="'"'" />
+ </xsl:when>
+ </xsl:choose>
</xsl:for-each>
<xsl:text>
</xsl:text>
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
index 6015e90..c92ed66 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
@@ -48,7 +48,7 @@
public void testBlueprintServices() throws Exception
{
- test( "services" );
+ test( "service" );
}
public void testBlueprintGeneric() throws Exception
diff --git a/bundleplugin/src/test/resources/OSGI-INF/blueprint/bp.xml b/bundleplugin/src/test/resources/OSGI-INF/blueprint/bp.xml
index 281df68..7c6a049 100644
--- a/bundleplugin/src/test/resources/OSGI-INF/blueprint/bp.xml
+++ b/bundleplugin/src/test/resources/OSGI-INF/blueprint/bp.xml
@@ -47,7 +47,12 @@
<service interface="p6.Foo">
<service-properties>
- <entry key="k" value="v2" />
+ <entry key="k">
+ <array>
+ <value>v1</value>
+ <value>v2</value>
+ </array>
+ </entry>
</service-properties>
</service>