From d774bf03c29b6b50aa402780aee259da96e2d753 Mon Sep 17 00:00:00 2001 From: lruiz Date: Sat, 9 Nov 2024 13:45:59 -0600 Subject: [PATCH] fix polyglot-groovy tests --- polyglot-groovy/pom.xml | 31 +++++++++++++++++-- .../groovy/GroovyModelTestSupport.groovy | 28 ++++++++++------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/polyglot-groovy/pom.xml b/polyglot-groovy/pom.xml index 3e088517..d640efb4 100644 --- a/polyglot-groovy/pom.xml +++ b/polyglot-groovy/pom.xml @@ -26,6 +26,12 @@ io.takari.polyglot polyglot-common + + + org.codehaus.plexus + plexus-utils + + org.codehaus.groovy @@ -50,10 +56,29 @@ + + + + io.takari.polyglot + polyglot-maven-plugin + test + + + + org.codehaus.plexus + plexus-component-annotations + test + + + org.assertj + assertj-core + 3.25.3 + test + - commons-logging - commons-logging - 1.1.1 + ch.qos.logback + logback-classic + test diff --git a/polyglot-groovy/src/test/groovy/org/sonatype/maven/polyglot/groovy/GroovyModelTestSupport.groovy b/polyglot-groovy/src/test/groovy/org/sonatype/maven/polyglot/groovy/GroovyModelTestSupport.groovy index 075d11f5..a61112f5 100644 --- a/polyglot-groovy/src/test/groovy/org/sonatype/maven/polyglot/groovy/GroovyModelTestSupport.groovy +++ b/polyglot-groovy/src/test/groovy/org/sonatype/maven/polyglot/groovy/GroovyModelTestSupport.groovy @@ -7,25 +7,29 @@ */ package org.sonatype.maven.polyglot.groovy -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory import org.apache.maven.model.Model import org.apache.maven.model.io.DefaultModelWriter -import org.sonatype.maven.polyglot.groovy.Dom2Groovy +import org.codehaus.plexus.ContainerConfiguration +import org.codehaus.plexus.PlexusConstants +import org.codehaus.plexus.PlexusTestCase import org.w3c.dom.Document import org.xml.sax.InputSource -import static org.junit.Assert.* -import org.sonatype.maven.polyglot.groovy.Dom2Groovy -import org.codehaus.plexus.PlexusTestCase + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory /** * Support for model tests. * * @author Jason Dillon */ -public class GroovyModelTestSupport - extends PlexusTestCase -{ +public class GroovyModelTestSupport extends PlexusTestCase { + @Override + protected void customizeContainerConfiguration(ContainerConfiguration configuration) { + configuration.autoWiring = true; + configuration.classPathScanning = PlexusConstants.SCANNING_CACHE + } + protected String load(final String name) { assertNotNull(name) def url = getClass().getResource(name) @@ -46,15 +50,15 @@ public class GroovyModelTestSupport Dom2Groovy converter = new Dom2Groovy(new IndentPrinter(new PrintWriter(buff), " ")) DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder() Document doc = builder.parse(new InputSource(new StringReader(chew(model)))) - + def root = doc.documentElement def attrs = root.attributes - for (int i=0; i