Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentPackageOsgiConfigPostProcessor: Write OSGi configurations as .cfg.json files instead of .config files #85

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="2.20.0" date="not released">
<action type="update" dev="sseifert" issue="85">
ContentPackageOsgiConfigPostProcessor: Write OSGi configurations as .cfg.json files instead of .config files.
</action>
</release>

<release version="2.19.10" date="2023-12-18">
<action type="fix" dev="sseifert">
Update to latest io.wcm.tooling.commons.content-package-builder to fix potential problem with element ordering content packages generated from JSON files.
Expand Down
4 changes: 2 additions & 2 deletions conga-aem-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>CONGA AEM Plugin</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public Void accept(String path, Dictionary<String, Object> properties) throws IO
context.getLogger().info(" Include " + contentPath);

// write configuration to temporary file
File tempFile = File.createTempFile(NAME, ".config");
File tempFile = File.createTempFile(NAME, ".cfg.json");
try (OutputStream os = new FileOutputStream(tempFile)) {
OsgiConfigUtil.write(os, properties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Dictionary;
import java.util.Map;

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

try (InputStream is = new ByteArrayInputStream(getDataFromZip(zipFile, "jcr_root/apps/test/config/my.pid.config"))) {

// check for initial comment line
is.mark(256);
final int firstChar = is.read();
if (firstChar == '#') {
int b;
while ((b = is.read()) != '\n') {
if (b == -1) {
throw new IOException("Unable to read configuration.");
}
}
}
else {
is.reset();
}

Dictionary<?, ?> config = ConfigurationHandler.read(is);
try (InputStream is = new ByteArrayInputStream(getDataFromZip(zipFile, "jcr_root/apps/test/config/my.pid.cfg.json"));
InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
Dictionary<?, ?> config = Configurations.buildReader().build(reader).readConfiguration();
assertEquals("value1", config.get("stringProperty"));
assertArrayEquals(new String[] {
"v1", "v2", "v3"
Expand All @@ -129,9 +114,9 @@ void testPostProcess() throws Exception {
assertEquals(999999999999L, config.get("longProperty"));
}

assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config/my.factory-my.pid.config"));
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode1/my.factory-my.pid2.config"));
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode2/my.pid2.config"));
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config/my.factory-my.pid.cfg.json"));
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode1/my.factory-my.pid2.cfg.json"));
assertTrue(ZipUtil.containsEntry(zipFile, "jcr_root/apps/test/config.mode2/my.pid2.cfg.json"));

Document filterXml = getXmlFromZip(zipFile, "META-INF/vault/filter.xml");
assertXpathEvaluatesTo("/apps/test/config", "/workspaceFilter/filter[1]/@root", filterXml);
Expand Down
8 changes: 4 additions & 4 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>CONGA AEM Plugin</name>
Expand All @@ -57,18 +57,18 @@
<dependency>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>io.wcm.devops.conga.generator</artifactId>
<version>1.16.4</version>
<version>1.16.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>conga-maven-plugin</artifactId>
<version>1.16.4</version>
<version>1.16.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.sling</artifactId>
<version>1.3.4</version>
<version>1.4.0-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<parent>
<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<relativePath>parent/pom.xml</relativePath>
</parent>

<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem.root</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>CONGA AEM Plugin</name>
Expand Down
6 changes: 3 additions & 3 deletions tooling/conga-aem-crypto-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
<parent>
<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>conga-aem-crypto-cli</artifactId>
<packaging>jar</packaging>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>

<name>CONGA AEM Crypto Command Line Interface</name>
<description>Command line tool to generate Crypto keys for AEM.</description>
Expand All @@ -42,7 +42,7 @@
<dependency>
<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<!-- Exclude all deps - only crypto util classes are used -->
Expand Down
6 changes: 3 additions & 3 deletions tooling/conga-aem-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
<parent>
<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>conga-aem-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>

<name>CONGA AEM Maven Plugin</name>
<description>wcm.io DevOps CONGA - CONfiguration GenerAtor Maven Plugin for AEM</description>
Expand Down Expand Up @@ -62,7 +62,7 @@
<dependency>
<groupId>io.wcm.devops.conga.plugins</groupId>
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
<version>2.19.11-SNAPSHOT</version>
<version>2.20.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion tooling/conga-aem-maven-plugin/src/it/example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<plugin>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>conga-maven-plugin</artifactId>
<version>1.16.4</version>
<version>1.16.5-SNAPSHOT</version>
<extensions>true</extensions>
<dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<plugin>
<groupId>io.wcm.devops.conga</groupId>
<artifactId>conga-maven-plugin</artifactId>
<version>1.16.4</version>
<version>1.16.5-SNAPSHOT</version>
<extensions>true</extensions>
<dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.wcm.maven</groupId>
<artifactId>io.wcm.maven.aem-global-parent</artifactId>
<version>2.1.12</version>
<version>2.1.15-SNAPSHOT</version>
<relativePath/>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.wcm.maven</groupId>
<artifactId>io.wcm.maven.aem-global-parent</artifactId>
<version>2.1.12</version>
<version>2.1.15-SNAPSHOT</version>
<relativePath/>
</parent>

Expand Down