diff --git a/pom.xml b/pom.xml
index e496f78d8..a854e943c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,11 +124,6 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
1.7.0
test
-
- commons-collections
- commons-collections
- 3.2.2
-
commons-io
commons-io
diff --git a/qulice-maven-plugin/pom.xml b/qulice-maven-plugin/pom.xml
index 2b5f9314b..0094019fe 100644
--- a/qulice-maven-plugin/pom.xml
+++ b/qulice-maven-plugin/pom.xml
@@ -133,11 +133,6 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
commons-io
-
- commons-collections
- commons-collections
-
-
com.jcabi
jcabi-log
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/DuplicateFinderValidator.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/DuplicateFinderValidator.java
index ee8f88926..72393f262 100644
--- a/qulice-maven-plugin/src/main/java/com/qulice/maven/DuplicateFinderValidator.java
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/DuplicateFinderValidator.java
@@ -30,13 +30,12 @@
*/
package com.qulice.maven;
+import com.qulice.maven.transformer.DuplicateFinderExclude;
+import com.qulice.maven.transformer.Exclude;
import com.qulice.spi.ValidationException;
-import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Properties;
-import java.util.stream.Collectors;
-import org.apache.commons.collections.CollectionUtils;
/**
* Validate with maven-duplicate-finder-plugin.
@@ -46,42 +45,34 @@
* Resource can be presented as a regular expression with that symbol, can cause some problem.
*/
public final class DuplicateFinderValidator implements MavenValidator {
+ /**
+ * Duplicatefinder constant.
+ */
+ private static final String DUPLICATEFINDER = "duplicatefinder";
@Override
public void validate(final MavenEnvironment env)
throws ValidationException {
- final String prefix = "duplicatefinder";
- if (!env.exclude(prefix, "")) {
+ if (!env.exclude(DuplicateFinderValidator.DUPLICATEFINDER, "")) {
final Properties props = new Properties();
props.put("failBuildInCaseOfConflict", "true");
props.put("checkTestClasspath", "false");
- props.put("useResultFile", "false");
- props.put(
- "ignoredResourcePatterns",
- CollectionUtils.union(
- env.excludes(prefix).stream()
- .filter(s -> !s.contains(":"))
- .collect(Collectors.toList()),
- Arrays.asList("META-INF/.*", "module-info.class")
- )
- );
+ final Collection ignres = new LinkedList<>();
final Collection deps = new LinkedList<>();
- for (final String sdep : env.excludes(prefix)) {
- final String[] parts = sdep.split(":");
- if (parts.length < 2) {
- continue;
+ for (final String sdep : env.excludes(DuplicateFinderValidator.DUPLICATEFINDER)) {
+ final Exclude exclude =
+ new DuplicateFinderExclude(DuplicateFinderValidator.DUPLICATEFINDER, sdep);
+ final Collection excl = exclude.dependencies();
+ if (!excl.isEmpty()) {
+ deps.addAll(excl);
}
- final Properties main = new Properties();
- final Properties prop = new Properties();
- prop.put("groupId", parts[0]);
- prop.put("artifactId", parts[1]);
- if (parts.length > 2) {
- prop.put("version", parts[2]);
+ final Collection res = exclude.resources();
+ if (!res.isEmpty()) {
+ ignres.addAll(excl);
}
- main.put("dependency", prop);
- deps.add(main);
}
props.put("ignoredDependencies", deps);
+ props.put("ignoredResourcePatterns", ignres);
env.executor().execute(
"org.basepom.maven:duplicate-finder-maven-plugin:2.0.1",
"check",
@@ -89,5 +80,4 @@ public void validate(final MavenEnvironment env)
);
}
}
-
}
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/MojoExecutor.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/MojoExecutor.java
index b780d4e8b..7f1c25757 100644
--- a/qulice-maven-plugin/src/main/java/com/qulice/maven/MojoExecutor.java
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/MojoExecutor.java
@@ -31,10 +31,10 @@
package com.qulice.maven;
import com.jcabi.log.Logger;
+import com.qulice.maven.transformer.PlexusConfigurationToXpp3Dom;
+import com.qulice.maven.transformer.PropertiesToXpp3Dom;
import com.qulice.spi.ValidationException;
-import java.util.Collection;
import java.util.LinkedList;
-import java.util.Map;
import java.util.Properties;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
@@ -50,8 +50,6 @@
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.reporting.exec.DefaultMavenPluginManagerHelper;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
@@ -101,6 +99,7 @@ public MojoExecutor(final MavenPluginManager mngr,
* @param config The configuration to set
* @throws ValidationException If something is wrong inside
*/
+ @SuppressWarnings("PMD.UseProperClassLoader")
public void execute(final String coords, final String goal,
final Properties config) throws ValidationException {
final Plugin plugin = new Plugin();
@@ -123,19 +122,22 @@ public void execute(final String coords, final String goal,
throw new IllegalStateException("Can't setup realm", ex);
}
final Xpp3Dom xpp = Xpp3Dom.mergeXpp3Dom(
- this.toXppDom(config, "configuration"),
- this.toXppDom(descriptor.getMojoConfiguration())
+ new PropertiesToXpp3Dom(config, "configuration").transform(),
+ new PlexusConfigurationToXpp3Dom(descriptor.getMojoConfiguration()).transform()
);
final MojoExecution execution = new MojoExecution(descriptor, xpp);
final Mojo mojo = this.mojo(execution);
+ final ClassLoader cloader = Thread.currentThread().getContextClassLoader();
try {
Logger.info(this, "Calling %s:%s...", coords, goal);
+ Thread.currentThread().setContextClassLoader(mojo.getClass().getClassLoader());
mojo.execute();
} catch (final MojoExecutionException ex) {
throw new IllegalArgumentException(ex);
} catch (final MojoFailureException ex) {
throw new ValidationException(ex);
} finally {
+ Thread.currentThread().setContextClassLoader(cloader);
this.manager.releaseMojo(mojo, execution);
}
}
@@ -179,87 +181,4 @@ private Mojo mojo(final MojoExecution execution) {
}
return mojo;
}
-
- /**
- * Recuresively convert Properties to Xpp3Dom.
- * @param config The config to convert
- * @param name High-level name of it
- * @return The Xpp3Dom document
- * @see #execute(String,String,Properties)
- * @checkstyle ExecutableStatementCountCheck (100 lines)
- */
- @SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", "PMD.CognitiveComplexity"})
- private Xpp3Dom toXppDom(final Properties config, final String name) {
- final Xpp3Dom xpp = new Xpp3Dom(name);
- for (final Map.Entry, ?> entry : config.entrySet()) {
- if (entry.getValue() instanceof String) {
- final Xpp3Dom child = new Xpp3Dom(entry.getKey().toString());
- child.setValue(config.getProperty(entry.getKey().toString()));
- xpp.addChild(child);
- } else if (entry.getValue() instanceof String[]) {
- final Xpp3Dom child = new Xpp3Dom(entry.getKey().toString());
- for (final String val : String[].class.cast(entry.getValue())) {
- final Xpp3Dom row = new Xpp3Dom(entry.getKey().toString());
- row.setValue(val);
- child.addChild(row);
- }
- xpp.addChild(child);
- } else if (entry.getValue() instanceof Collection) {
- final Xpp3Dom child = new Xpp3Dom(entry.getKey().toString());
- for (final Object val : Collection.class.cast(entry.getValue())) {
- if (val instanceof Properties) {
- child.addChild(
- this.toXppDom(
- Properties.class.cast(val),
- entry.getKey().toString()
- ).getChild(0)
- );
- } else if (val != null) {
- final Xpp3Dom row = new Xpp3Dom(entry.getKey().toString());
- row.setValue(val.toString());
- child.addChild(row);
- }
- }
- xpp.addChild(child);
- } else if (entry.getValue() instanceof Properties) {
- xpp.addChild(
- this.toXppDom(
- Properties.class.cast(entry.getValue()),
- entry.getKey().toString()
- )
- );
- } else {
- throw new IllegalArgumentException(
- String.format(
- "Invalid properties value at '%s'",
- entry.getKey().toString()
- )
- );
- }
- }
- return xpp;
- }
-
- /**
- * Recursively convert PLEXUS config to Xpp3Dom.
- * @param config The config to convert
- * @return The Xpp3Dom document
- * @see #execute(String,String,Properties)
- */
- private Xpp3Dom toXppDom(final PlexusConfiguration config) {
- final Xpp3Dom result = new Xpp3Dom(config.getName());
- result.setValue(config.getValue(null));
- for (final String name : config.getAttributeNames()) {
- try {
- result.setAttribute(name, config.getAttribute(name));
- } catch (final PlexusConfigurationException ex) {
- throw new IllegalArgumentException(ex);
- }
- }
- for (final PlexusConfiguration child : config.getChildren()) {
- result.addChild(this.toXppDom(child));
- }
- return result;
- }
-
}
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/DuplicateFinderExclude.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/DuplicateFinderExclude.java
new file mode 100644
index 000000000..aedc0421a
--- /dev/null
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/DuplicateFinderExclude.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Implementation of exclude model for DuplicateFinder plugin.
+ *
+ * @since 0.23.1
+ */
+public final class DuplicateFinderExclude implements Exclude {
+ /**
+ * Pattern for parsing ignore list.
+ */
+ private final Pattern pattern;
+
+ /**
+ * Configuration string.
+ * - duplicatefinder:about.html
+ * - duplicatefinder:org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5
+ * - duplicatefinder:org.codehaus.groovy.ast.expr.RegexExpression
+ * - duplicatefinder:org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5
+ * |xml-apis:xml-apis:1.0.0|about.html
+ * - duplicatefinder:org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5
+ * |xml-apis:xml-apis:1.0.0|org.w3c.dom.UserDataHandler
+ * See https://github.com/tpc2/qulice/issues/152#issuecomment-39028953
+ * and https://github.com/teamed/qulice/issues/250 for details
+ */
+ private final String excludes;
+
+ /**
+ * Ctor.
+ * @param predicate Predicate for plugin.
+ * @param excl String with exclude from config.
+ */
+ public DuplicateFinderExclude(final String predicate, final String excl) {
+ this.pattern = Pattern.compile(
+ String.format(
+ "(%s:)|(%s)|(?[\\w-\\.&&[^\\|]]+)",
+ predicate,
+ "(?[\\w\\.-]+):(?[\\w\\.-]+):(?[\\w\\.-]+)"
+ )
+ );
+ this.excludes = excl;
+ }
+
+ @Override
+ public List dependencies() {
+ final Matcher matcher = this.pattern.matcher(this.excludes);
+ final List deps = new LinkedList<>();
+ while (matcher.find()) {
+ final String group = matcher.group("gr");
+ final String artifact = matcher.group("art");
+ final String version = matcher.group("ver");
+ if (!empty(group) && !empty(artifact) && !empty(version)) {
+ final Properties main = new Properties();
+ final Properties prop = new Properties();
+ prop.put("groupId", group);
+ prop.put("artifactId", artifact);
+ prop.put("version", version);
+ main.put("dependency", prop);
+ deps.add(main);
+ }
+ }
+ return deps;
+ }
+
+ @Override
+ public List resources() {
+ final Matcher matcher = this.pattern.matcher(this.excludes);
+ final List res = new LinkedList<>();
+ while (matcher.find()) {
+ final String resource = matcher.group("res");
+ if (!empty(resource)) {
+ final Properties prop = new Properties();
+ prop.put("ignoredResourcePattern", resource);
+ res.add(prop);
+ }
+ }
+ return res;
+ }
+
+ /**
+ * Check string.
+ *
+ * @param value String for check.
+ * @return True for not empty string.
+ */
+ private static boolean empty(final String value) {
+ return value == null || value.isBlank();
+ }
+}
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/Exclude.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/Exclude.java
new file mode 100644
index 000000000..bca0a9717
--- /dev/null
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/Exclude.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import java.util.List;
+
+/**
+ * Model of exclude list from configuration plugins.
+ *
+ * @param Type of dependency implementation class.
+ * @param Type of resource implementation class.
+ *
+ * @since 0.23.1
+ */
+public interface Exclude {
+ /**
+ * Return list of dependency from configuration.
+ * @return Dependency list.
+ */
+ List dependencies();
+
+ /**
+ * Return list of resource from configuration.
+ * @return Resource list.
+ */
+ List resources();
+}
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/PlexusConfigurationToXpp3Dom.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/PlexusConfigurationToXpp3Dom.java
new file mode 100644
index 000000000..513650504
--- /dev/null
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/PlexusConfigurationToXpp3Dom.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Convert PLEXUS config to Xpp3Dom.
+ *
+ * @since 0.23.1
+ */
+public final class PlexusConfigurationToXpp3Dom implements TransformToXpp3Dom {
+ /**
+ * PLEXUS configuration.
+ */
+ private final PlexusConfiguration config;
+
+ /**
+ * Ctor.
+ * @param config The config to convert.
+ */
+ public PlexusConfigurationToXpp3Dom(final PlexusConfiguration config) {
+ this.config = config;
+ }
+
+ @Override
+ public Xpp3Dom transform() {
+ return this.toXppDom(this.config);
+ }
+
+ /**
+ * Recursively convert PLEXUS config to Xpp3Dom.
+ * @param conf The config to convert.
+ * @return The Xpp3Dom document.
+ */
+ private Xpp3Dom toXppDom(final PlexusConfiguration conf) {
+ final Xpp3Dom document = new Xpp3Dom(conf.getName());
+ document.setValue(conf.getValue(null));
+ for (final String name : conf.getAttributeNames()) {
+ try {
+ document.setAttribute(name, conf.getAttribute(name));
+ } catch (final PlexusConfigurationException ex) {
+ throw new IllegalArgumentException(ex);
+ }
+ }
+ for (final PlexusConfiguration child : conf.getChildren()) {
+ document.addChild(this.toXppDom(child));
+ }
+ return document;
+ }
+}
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/PropertiesToXpp3Dom.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/PropertiesToXpp3Dom.java
new file mode 100644
index 000000000..c60ab79ba
--- /dev/null
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/PropertiesToXpp3Dom.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Convert properties config to Xpp3Dom.
+ *
+ * @since 0.23.1
+ */
+public final class PropertiesToXpp3Dom implements TransformToXpp3Dom {
+ /**
+ * Configuration properties.
+ */
+ private final Properties config;
+
+ /**
+ * The name of the parent configuration element.
+ */
+ private final Xpp3Dom parent;
+
+ /**
+ * Ctor.
+ * @param conf Configuration properties.
+ * @param cfgname The name of the parent configuration element.
+ */
+ public PropertiesToXpp3Dom(final Properties conf, final String cfgname) {
+ this(conf, new Xpp3Dom(cfgname));
+ }
+
+ /**
+ * Ctor.
+ * @param conf Configuration properties.
+ * @param parnt Parent element.
+ */
+ public PropertiesToXpp3Dom(final Properties conf, final Xpp3Dom parnt) {
+ this.config = conf;
+ this.parent = parnt;
+ }
+
+ @Override
+ public Xpp3Dom transform() {
+ return PropertiesToXpp3Dom.toXppDom(this.config, this.parent);
+ }
+
+ /**
+ * Recuresively convert Properties to Xpp3Dom.
+ * @param config The config to convert
+ * @param parent Parent Xpp3Dom element.
+ * @return The Xpp3Dom document
+ */
+ @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
+ private static Xpp3Dom toXppDom(final Properties config, final Xpp3Dom parent) {
+ for (final Map.Entry, ?> entry : config.entrySet()) {
+ if (entry.getValue() instanceof String) {
+ final Xpp3Dom child = new Xpp3Dom(entry.getKey().toString());
+ child.setValue(config.getProperty(entry.getKey().toString()));
+ parent.addChild(child);
+ } else if (entry.getValue() instanceof String[]) {
+ stringArrayToXppDom(parent, entry);
+ } else if (entry.getValue() instanceof Collection) {
+ collectionToXppDom(parent, entry);
+ } else if (entry.getValue() instanceof Properties) {
+ parent.addChild(
+ PropertiesToXpp3Dom.toXppDom(
+ Properties.class.cast(entry.getValue()),
+ new Xpp3Dom(entry.getKey().toString())
+ )
+ );
+ } else {
+ throw new IllegalArgumentException(
+ String.format(
+ "Invalid properties value at '%s'",
+ entry.getKey().toString()
+ )
+ );
+ }
+ }
+ return parent;
+ }
+
+ /**
+ * Converts the array of strings to Xpp3Dom.
+ * @param parent Parent Xpp3Dom element.
+ * @param cfgitem Current configuration item.
+ */
+ private static void stringArrayToXppDom(final Xpp3Dom parent, final Map.Entry, ?> cfgitem) {
+ final Xpp3Dom child = new Xpp3Dom(cfgitem.getKey().toString());
+ for (final String val : String[].class.cast(cfgitem.getValue())) {
+ final Xpp3Dom row = new Xpp3Dom(cfgitem.getKey().toString());
+ row.setValue(val);
+ child.addChild(row);
+ }
+ parent.addChild(child);
+ }
+
+ /**
+ * Converts the collection to Xpp3Dom.
+ * @param parent Parent Xpp3Dom element.
+ * @param cfgitem Current configuration item.
+ */
+ private static void collectionToXppDom(final Xpp3Dom parent, final Map.Entry, ?> cfgitem) {
+ final Xpp3Dom child = new Xpp3Dom(cfgitem.getKey().toString());
+ for (final Object val : Collection.class.cast(cfgitem.getValue())) {
+ if (val instanceof Properties) {
+ PropertiesToXpp3Dom.toXppDom(Properties.class.cast(val), child);
+ } else {
+ if (val != null) {
+ final Xpp3Dom row = new Xpp3Dom(cfgitem.getKey().toString());
+ row.setValue(val.toString());
+ child.addChild(row);
+ }
+ }
+ }
+ parent.addChild(child);
+ }
+}
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/TransformToXpp3Dom.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/TransformToXpp3Dom.java
new file mode 100644
index 000000000..0369939b2
--- /dev/null
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/TransformToXpp3Dom.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Interface for transforming various data into the Xpp3Dom document.
+ *
+ * @since 0.23.1
+ */
+public interface TransformToXpp3Dom {
+ /**
+ * Transform input date to Xpp3Dom document.
+ * @return The Xpp3Dom document.
+ */
+ Xpp3Dom transform();
+}
diff --git a/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/package-info.java b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/package-info.java
new file mode 100644
index 000000000..3b2da5568
--- /dev/null
+++ b/qulice-maven-plugin/src/main/java/com/qulice/maven/transformer/package-info.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Data transformers.
+ *
+ * @since 0.23.1
+ */
+package com.qulice.maven.transformer;
diff --git a/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/DuplicateFinderExcludeTest.java b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/DuplicateFinderExcludeTest.java
new file mode 100644
index 000000000..2a5f0c797
--- /dev/null
+++ b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/DuplicateFinderExcludeTest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import java.util.List;
+import java.util.Properties;
+import org.hamcrest.MatcherAssert;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test case for DuplicateFinderExclude class.
+ *
+ * @since 0.23.1
+ */
+final class DuplicateFinderExcludeTest {
+ /**
+ * Dependency constant.
+ */
+ private static final String DEPENDENCY = "dependency";
+
+ /**
+ * GroupId constant.
+ */
+ private static final String GROUPID = "groupId";
+
+ /**
+ * ArtifactId constant.
+ */
+ private static final String ARTIFACTID = "artifactId";
+
+ /**
+ * Version constant.
+ */
+ private static final String VERSION = "version";
+
+ /**
+ * IgnoredResourcePattern constant.
+ */
+ private static final String IGNORED_RES = "ignoredResourcePattern";
+
+ /**
+ * Class under test.
+ */
+ private final Exclude exclude =
+ new DuplicateFinderExclude(
+ "duplicate",
+ String.format(
+ "%s%s",
+ "duplicate:org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5| about.html |",
+ "xml-apis:xml-apis:1.0.0| org.w3c.dom.UserDataHandler"
+ )
+ );
+
+ @Test
+ void findDependency() {
+ final List deps = this.exclude.dependencies();
+ MatcherAssert.assertThat(
+ "2 should be returned",
+ deps.size(),
+ Matchers.equalTo(2)
+ );
+ MatcherAssert.assertThat(
+ "'org.eclipse.sisu' should be returned",
+ ((Properties) (deps.get(0).get(DuplicateFinderExcludeTest.DEPENDENCY)))
+ .get(DuplicateFinderExcludeTest.GROUPID),
+ Matchers.equalTo("org.eclipse.sisu")
+ );
+ MatcherAssert.assertThat(
+ "'org.eclipse.sisu.plexus' should be returned",
+ ((Properties) (deps.get(0).get(DuplicateFinderExcludeTest.DEPENDENCY)))
+ .get(DuplicateFinderExcludeTest.ARTIFACTID),
+ Matchers.equalTo("org.eclipse.sisu.plexus")
+ );
+ MatcherAssert.assertThat(
+ "'0.0.0.M5' should be returned",
+ ((Properties) (deps.get(0).get(DuplicateFinderExcludeTest.DEPENDENCY)))
+ .get(DuplicateFinderExcludeTest.VERSION),
+ Matchers.equalTo("0.0.0.M5")
+ );
+ MatcherAssert.assertThat(
+ "'xml-apis' should be returned",
+ ((Properties) (deps.get(1).get(DuplicateFinderExcludeTest.DEPENDENCY)))
+ .get(DuplicateFinderExcludeTest.GROUPID),
+ Matchers.equalTo("xml-apis")
+ );
+ MatcherAssert.assertThat(
+ "'xml-apis' should be returned",
+ ((Properties) (deps.get(1).get(DuplicateFinderExcludeTest.DEPENDENCY)))
+ .get(DuplicateFinderExcludeTest.ARTIFACTID),
+ Matchers.equalTo("xml-apis")
+ );
+ MatcherAssert.assertThat(
+ "'1.0.0' should be returned",
+ ((Properties) (deps.get(1).get(DuplicateFinderExcludeTest.DEPENDENCY)))
+ .get(DuplicateFinderExcludeTest.VERSION),
+ Matchers.equalTo("1.0.0")
+ );
+ }
+
+ @Test
+ void findResources() {
+ final List res = this.exclude.resources();
+ MatcherAssert.assertThat(
+ "'about.html' should be returned",
+ res.get(0).get(DuplicateFinderExcludeTest.IGNORED_RES),
+ Matchers.equalTo("about.html")
+ );
+ MatcherAssert.assertThat(
+ "'org.w3c.dom.UserDataHandler' should be returned",
+ res.get(1).get(DuplicateFinderExcludeTest.IGNORED_RES),
+ Matchers.equalTo("org.w3c.dom.UserDataHandler")
+ );
+ }
+}
diff --git a/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/PlexusConfigurationToXpp3DomTest.java b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/PlexusConfigurationToXpp3DomTest.java
new file mode 100644
index 000000000..92948ba61
--- /dev/null
+++ b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/PlexusConfigurationToXpp3DomTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import org.codehaus.plexus.configuration.DefaultPlexusConfiguration;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.hamcrest.MatcherAssert;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test case for PlexusConfigurationToXpp3Dom class.
+ *
+ * @since 0.23.1
+ */
+final class PlexusConfigurationToXpp3DomTest {
+
+ @Test
+ void transform() {
+ final PlexusConfiguration config = new DefaultPlexusConfiguration("testName");
+ config.addChild("kchild1", "vchild1");
+ final PlexusConfiguration child = new DefaultPlexusConfiguration("kchild2");
+ child.addChild("kchild3", "vchild3");
+ config.addChild(child);
+ final TransformToXpp3Dom transformer = new PlexusConfigurationToXpp3Dom(config);
+ final Xpp3Dom doc = transformer.transform();
+ MatcherAssert.assertThat(
+ "'testName' should be returned",
+ doc.getName(),
+ Matchers.equalTo("testName")
+ );
+ MatcherAssert.assertThat(
+ "'kchild1' should be returned",
+ doc.getChild(0).getName(),
+ Matchers.equalTo("kchild1")
+ );
+ MatcherAssert.assertThat(
+ "'vchild1' should be returned",
+ doc.getChild("kchild1").getValue(),
+ Matchers.equalTo("vchild1")
+ );
+ MatcherAssert.assertThat(
+ "'kchild2' should be returned",
+ doc.getChild(1).getName(),
+ Matchers.equalTo("kchild2")
+ );
+ MatcherAssert.assertThat(
+ "'kchild3' should be returned",
+ doc.getChild("kchild2").getChild(0).getName(),
+ Matchers.equalTo("kchild3")
+ );
+ MatcherAssert.assertThat(
+ "'vchild3' should be returned",
+ doc.getChild("kchild2").getChild("kchild3").getValue(),
+ Matchers.equalTo("vchild3")
+ );
+ }
+}
diff --git a/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/PropertiesToXpp3DomTest.java b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/PropertiesToXpp3DomTest.java
new file mode 100644
index 000000000..bc8279b8a
--- /dev/null
+++ b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/PropertiesToXpp3DomTest.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.qulice.maven.transformer;
+
+import java.util.List;
+import java.util.Properties;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.hamcrest.MatcherAssert;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test case for PropertiesToXpp3Dom class.
+ *
+ * @since 0.23.1
+ */
+final class PropertiesToXpp3DomTest {
+
+ @Test
+ void transform() {
+ final String keychildtwo = "kchild2";
+ final String kcharr = "kcharr";
+ final Properties main = new Properties();
+ main.put("kchild1", "vchild1");
+ main.put(kcharr, new String[] {"arrv1", "arrv2"});
+ final Properties child = new Properties();
+ main.put(keychildtwo, child);
+ final List collection = List.of("col1", "col2");
+ child.put("collection", collection);
+ final Properties collprop = new Properties();
+ collprop.put("kchild3", "vchild3");
+ final List listprop = List.of(collprop);
+ child.put("collprop", listprop);
+ final TransformToXpp3Dom transformer = new PropertiesToXpp3Dom(main, "testName");
+ final Xpp3Dom doc = transformer.transform();
+ MatcherAssert.assertThat(
+ "'testName' should be returned",
+ doc.getName(),
+ Matchers.equalTo("testName")
+ );
+ MatcherAssert.assertThat(
+ "'vchild1' should be returned",
+ doc.getChild("kchild1").getValue(),
+ Matchers.equalTo("vchild1")
+ );
+ MatcherAssert.assertThat(
+ "'kcharr' should be returned",
+ doc.getChild(kcharr).getChild(0).getName(),
+ Matchers.equalTo(kcharr)
+ );
+ MatcherAssert.assertThat(
+ "'arrv1' should be returned",
+ doc.getChild(kcharr).getChild(0).getValue(),
+ Matchers.equalTo("arrv1")
+ );
+ MatcherAssert.assertThat(
+ "'kcharr' should be returned",
+ doc.getChild(kcharr).getChild(1).getName(),
+ Matchers.equalTo(kcharr)
+ );
+ MatcherAssert.assertThat(
+ "'arrv2' should be returned",
+ doc.getChild(kcharr).getChild(1).getValue(),
+ Matchers.equalTo("arrv2")
+ );
+ MatcherAssert.assertThat(
+ "'col1' should be returned",
+ doc.getChild(keychildtwo).getChild("collection").getChild(0).getValue(),
+ Matchers.equalTo("col1")
+ );
+ MatcherAssert.assertThat(
+ "'col2' should be returned",
+ doc.getChild(keychildtwo).getChild("collection").getChild(1).getValue(),
+ Matchers.equalTo("col2")
+ );
+ MatcherAssert.assertThat(
+ "'kchild3' should be returned",
+ doc.getChild(keychildtwo).getChild("collprop").getChild(0).getName(),
+ Matchers.equalTo("kchild3")
+ );
+ MatcherAssert.assertThat(
+ "'vchild3' should be returned",
+ doc.getChild(keychildtwo).getChild("collprop").getChild("kchild3").getValue(),
+ Matchers.equalTo("vchild3")
+ );
+ }
+}
diff --git a/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/package-info.java b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/package-info.java
new file mode 100644
index 000000000..1057a2ba9
--- /dev/null
+++ b/qulice-maven-plugin/src/test/java/com/qulice/maven/transformer/package-info.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011-2024 Qulice.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. 3) Neither the name of the Qulice.com nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Data transformers test cases.
+ *
+ * @since 0.23.1
+ */
+package com.qulice.maven.transformer;