Skip to content

Commit 5503772

Browse files
ContentPackageOsgiConfigPostProcessor: Write OSGi configurations as .cfg.json files instead of .config files (#85)
1 parent 514e1ae commit 5503772

12 files changed

Lines changed: 33 additions & 42 deletions

File tree

changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
2424
<body>
2525

26+
<release version="2.20.0" date="not released">
27+
<action type="update" dev="sseifert" issue="85">
28+
ContentPackageOsgiConfigPostProcessor: Write OSGi configurations as .cfg.json files instead of .config files.
29+
</action>
30+
</release>
31+
2632
<release version="2.19.10" date="2023-12-18">
2733
<action type="fix" dev="sseifert">
2834
Update to latest io.wcm.tooling.commons.content-package-builder to fix potential problem with element ordering content packages generated from JSON files.

conga-aem-plugin/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.19.11-SNAPSHOT</version>
28+
<version>2.20.0-SNAPSHOT</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
34-
<version>2.19.11-SNAPSHOT</version>
34+
<version>2.20.0-SNAPSHOT</version>
3535
<packaging>jar</packaging>
3636

3737
<name>CONGA AEM Plugin</name>

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackageOsgiConfigPostProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public Void accept(String path, Dictionary<String, Object> properties) throws IO
151151
context.getLogger().info(" Include " + contentPath);
152152

153153
// write configuration to temporary file
154-
File tempFile = File.createTempFile(NAME, ".config");
154+
File tempFile = File.createTempFile(NAME, ".cfg.json");
155155
try (OutputStream os = new FileOutputStream(tempFile)) {
156156
OsgiConfigUtil.write(os, properties);
157157
}

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackageOsgiConfigPostProcessorTest.java

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434

3535
import java.io.ByteArrayInputStream;
3636
import java.io.File;
37-
import java.io.IOException;
3837
import java.io.InputStream;
38+
import java.io.InputStreamReader;
3939
import java.nio.charset.StandardCharsets;
4040
import java.util.Dictionary;
4141
import java.util.Map;
4242

4343
import org.apache.commons.io.FileUtils;
44-
import org.apache.felix.cm.file.ConfigurationHandler;
44+
import org.apache.felix.cm.json.io.Configurations;
4545
import org.junit.jupiter.api.BeforeEach;
4646
import org.junit.jupiter.api.Test;
4747
import org.slf4j.LoggerFactory;
@@ -103,24 +103,9 @@ void testPostProcess() throws Exception {
103103
File zipFile = new File(target, "test.zip");
104104
assertTrue(zipFile.exists());
105105

106-
try (InputStream is = new ByteArrayInputStream(getDataFromZip(zipFile, "jcr_root/apps/test/config/my.pid.config"))) {
107-
108-
// check for initial comment line
109-
is.mark(256);
110-
final int firstChar = is.read();
111-
if (firstChar == '#') {
112-
int b;
113-
while ((b = is.read()) != '\n') {
114-
if (b == -1) {
115-
throw new IOException("Unable to read configuration.");
116-
}
117-
}
118-
}
119-
else {
120-
is.reset();
121-
}
122-
123-
Dictionary<?, ?> config = ConfigurationHandler.read(is);
106+
try (InputStream is = new ByteArrayInputStream(getDataFromZip(zipFile, "jcr_root/apps/test/config/my.pid.cfg.json"));
107+
InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
108+
Dictionary<?, ?> config = Configurations.buildReader().build(reader).readConfiguration();
124109
assertEquals("value1", config.get("stringProperty"));
125110
assertArrayEquals(new String[] {
126111
"v1", "v2", "v3"
@@ -129,9 +114,9 @@ void testPostProcess() throws Exception {
129114
assertEquals(999999999999L, config.get("longProperty"));
130115
}
131116

132-
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config/my.factory-my.pid.config"));
133-
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode1/my.factory-my.pid2.config"));
134-
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode2/my.pid2.config"));
117+
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config/my.factory-my.pid.cfg.json"));
118+
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode1/my.factory-my.pid2.cfg.json"));
119+
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode2/my.pid2.cfg.json"));
135120

136121
Document filterXml = getXmlFromZip(zipFile, "META-INF/vault/filter.xml");
137122
assertXpathEvaluatesTo("/apps/test/config", "/workspaceFilter/filter[1]/@root", filterXml);

parent/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
34-
<version>2.19.11-SNAPSHOT</version>
34+
<version>2.20.0-SNAPSHOT</version>
3535
<packaging>pom</packaging>
3636

3737
<name>CONGA AEM Plugin</name>
@@ -57,18 +57,18 @@
5757
<dependency>
5858
<groupId>io.wcm.devops.conga</groupId>
5959
<artifactId>io.wcm.devops.conga.generator</artifactId>
60-
<version>1.16.4</version>
60+
<version>1.16.5-SNAPSHOT</version>
6161
</dependency>
6262
<dependency>
6363
<groupId>io.wcm.devops.conga</groupId>
6464
<artifactId>conga-maven-plugin</artifactId>
65-
<version>1.16.4</version>
65+
<version>1.16.5-SNAPSHOT</version>
6666
</dependency>
6767

6868
<dependency>
6969
<groupId>io.wcm.devops.conga.plugins</groupId>
7070
<artifactId>io.wcm.devops.conga.plugins.sling</artifactId>
71-
<version>1.3.4</version>
71+
<version>1.4.0-SNAPSHOT</version>
7272
</dependency>
7373

7474
<dependency>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
<parent>
2424
<groupId>io.wcm.devops.conga.plugins</groupId>
2525
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
26-
<version>2.19.11-SNAPSHOT</version>
26+
<version>2.20.0-SNAPSHOT</version>
2727
<relativePath>parent/pom.xml</relativePath>
2828
</parent>
2929

3030
<groupId>io.wcm.devops.conga.plugins</groupId>
3131
<artifactId>io.wcm.devops.conga.plugins.aem.root</artifactId>
32-
<version>2.19.11-SNAPSHOT</version>
32+
<version>2.20.0-SNAPSHOT</version>
3333
<packaging>pom</packaging>
3434

3535
<name>CONGA AEM Plugin</name>

tooling/conga-aem-crypto-cli/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.19.11-SNAPSHOT</version>
28+
<version>2.20.0-SNAPSHOT</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-crypto-cli</artifactId>
3434
<packaging>jar</packaging>
35-
<version>2.19.11-SNAPSHOT</version>
35+
<version>2.20.0-SNAPSHOT</version>
3636

3737
<name>CONGA AEM Crypto Command Line Interface</name>
3838
<description>Command line tool to generate Crypto keys for AEM.</description>
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>io.wcm.devops.conga.plugins</groupId>
4444
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
45-
<version>2.19.11-SNAPSHOT</version>
45+
<version>2.20.0-SNAPSHOT</version>
4646
<scope>compile</scope>
4747
<exclusions>
4848
<!-- Exclude all deps - only crypto util classes are used -->

tooling/conga-aem-maven-plugin/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.19.11-SNAPSHOT</version>
28+
<version>2.20.0-SNAPSHOT</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-maven-plugin</artifactId>
3434
<packaging>maven-plugin</packaging>
35-
<version>2.19.11-SNAPSHOT</version>
35+
<version>2.20.0-SNAPSHOT</version>
3636

3737
<name>CONGA AEM Maven Plugin</name>
3838
<description>wcm.io DevOps CONGA - CONfiguration GenerAtor Maven Plugin for AEM</description>
@@ -62,7 +62,7 @@
6262
<dependency>
6363
<groupId>io.wcm.devops.conga.plugins</groupId>
6464
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
65-
<version>2.19.11-SNAPSHOT</version>
65+
<version>2.20.0-SNAPSHOT</version>
6666
<scope>compile</scope>
6767
</dependency>
6868
<dependency>

tooling/conga-aem-maven-plugin/src/it/example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<plugin>
7575
<groupId>io.wcm.devops.conga</groupId>
7676
<artifactId>conga-maven-plugin</artifactId>
77-
<version>1.16.4</version>
77+
<version>1.16.5-SNAPSHOT</version>
7878
<extensions>true</extensions>
7979
<dependencies>
8080

tooling/conga-aem-maven-plugin/src/it/mixed-no-package-type/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<plugin>
6868
<groupId>io.wcm.devops.conga</groupId>
6969
<artifactId>conga-maven-plugin</artifactId>
70-
<version>1.16.4</version>
70+
<version>1.16.5-SNAPSHOT</version>
7171
<extensions>true</extensions>
7272
<dependencies>
7373

0 commit comments

Comments
 (0)