mirror of https://github.com/apache/maven.git
[MNG-6656] move to o.a.m.model.transform + .sax
This commit is contained in:
parent
aa6b88c78f
commit
e25cf17d3b
|
@ -38,8 +38,8 @@ import javax.xml.transform.sax.TransformerHandler;
|
|||
import org.apache.maven.model.building.AbstractModelSourceTransformer;
|
||||
import org.apache.maven.model.building.DefaultBuildPomXMLFilterFactory;
|
||||
import org.apache.maven.model.building.TransformerContext;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.apache.maven.xml.internal.DefaultConsumerPomXMLFilterFactory;
|
||||
import org.apache.maven.xml.sax.filter.AbstractSAXFilter;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.maven.xml.internal;
|
|||
*/
|
||||
|
||||
import org.apache.maven.model.building.DefaultBuildPomXMLFilterFactory;
|
||||
import org.apache.maven.xml.sax.filter.ConsumerPomXMLFilterFactory;
|
||||
import org.apache.maven.model.transform.ConsumerPomXMLFilterFactory;
|
||||
|
||||
/**
|
||||
* The default implementation of the {@link ConsumerPomXMLFilterFactory}
|
||||
|
|
|
@ -40,9 +40,9 @@ import javax.xml.transform.sax.SAXTransformerFactory;
|
|||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.maven.xml.Factories;
|
||||
import org.apache.maven.xml.sax.ext.CommentRenormalizer;
|
||||
import org.apache.maven.xml.sax.filter.AbstractSAXFilter;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.apache.maven.model.transform.sax.CommentRenormalizer;
|
||||
import org.apache.maven.model.transform.sax.Factories;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
|
|
@ -31,9 +31,9 @@ import javax.inject.Singleton;
|
|||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
|
||||
import org.apache.maven.xml.sax.filter.AbstractSAXFilter;
|
||||
import org.apache.maven.xml.sax.filter.BuildPomXMLFilterFactory;
|
||||
import org.apache.maven.xml.sax.filter.BuildPomXMLFilterListener;
|
||||
import org.apache.maven.model.transform.BuildPomXMLFilterFactory;
|
||||
import org.apache.maven.model.transform.BuildPomXMLFilterListener;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.eclipse.sisu.Nullable;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
|
|
@ -27,8 +27,8 @@ import java.util.function.Consumer;
|
|||
import java.util.function.Function;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.xml.sax.filter.BuildPomXMLFilterFactory;
|
||||
import org.apache.maven.xml.sax.filter.RelativeProject;
|
||||
import org.apache.maven.model.transform.BuildPomXMLFilterFactory;
|
||||
import org.apache.maven.model.transform.RelativeProject;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.maven.model.building.TransformerContext;
|
|||
import org.apache.maven.model.io.DefaultModelReader;
|
||||
import org.apache.maven.model.io.DefaultModelWriter;
|
||||
import org.apache.maven.model.io.ModelWriter;
|
||||
import org.apache.maven.xml.sax.filter.AbstractSAXFilter;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xmlunit.matchers.CompareMatcher;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -24,8 +24,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.apache.maven.xml.sax.SAXEvent;
|
||||
import org.apache.maven.xml.sax.SAXEventFactory;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.apache.maven.model.transform.sax.SAXEvent;
|
||||
import org.apache.maven.model.transform.sax.SAXEventFactory;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
|
@ -1,4 +1,6 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -28,7 +28,8 @@ import java.util.function.Function;
|
|||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
|
||||
import org.apache.maven.xml.Factories;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.apache.maven.model.transform.sax.Factories;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -21,6 +21,7 @@ package org.apache.maven.xml.sax.filter;
|
|||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -24,6 +24,7 @@ import java.nio.file.Path;
|
|||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -22,6 +22,7 @@ package org.apache.maven.xml.sax.filter;
|
|||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.SAXException;
|
|
@ -1,4 +1,6 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -27,7 +27,7 @@ import java.util.Objects;
|
|||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.maven.xml.sax.SAXEventUtils;
|
||||
import org.apache.maven.model.transform.sax.SAXEventUtils;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -21,7 +21,7 @@ package org.apache.maven.xml.sax.filter;
|
|||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import org.apache.maven.xml.sax.SAXEventUtils;
|
||||
import org.apache.maven.model.transform.sax.SAXEventUtils;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.ext;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -41,8 +41,8 @@ Maven Model XML Transformer
|
|||
|
||||
Transformation is implemented as two filters:
|
||||
|
||||
* <<build to raw>> in <<<BuildPomXMLFilter>>> ({{{./apidocs/org/apache/maven/xml/sax/filter/BuildPomXMLFilter.html}javadoc}}),
|
||||
with its <<<BuildPomXMLFilterFactory>>> ({{{./xref/org/apache/maven/xml/sax/filter/BuildPomXMLFilterFactory.html}source}}) assembling transformation steps,
|
||||
* <<build to raw>> in <<<BuildPomXMLFilter>>> ({{{./apidocs/org/apache/maven/model/transform/BuildPomXMLFilter.html}javadoc}}),
|
||||
with its <<<BuildPomXMLFilterFactory>>> ({{{./xref/org/apache/maven/model/transform/BuildPomXMLFilterFactory.html}source}}) assembling transformation steps,
|
||||
|
||||
* in a multi-module build, <<<parent>>>'s <<<version>>> is automatically added,
|
||||
|
||||
|
@ -52,8 +52,8 @@ Maven Model XML Transformer
|
|||
|
||||
[]
|
||||
|
||||
* <<raw to consumer>> in <<<ConsumerPomXMLFilter>>> ({{{./apidocs/org/apache/maven/xml/sax/filter/ConsumerPomXMLFilter.html}javadoc}}),
|
||||
with its <<<ConsumerPomXMLFilterFactory>>> ({{{./xref/org/apache/maven/xml/sax/filter/ConsumerPomXMLFilterFactory.html}source}}) assembling transformation steps.
|
||||
* <<raw to consumer>> in <<<ConsumerPomXMLFilter>>> ({{{./apidocs/org/apache/maven/model/transform/ConsumerPomXMLFilter.html}javadoc}}),
|
||||
with its <<<ConsumerPomXMLFilterFactory>>> ({{{./xref/org/apache/maven/model/transform/ConsumerPomXMLFilterFactory.html}source}}) assembling transformation steps.
|
||||
|
||||
* <<<modules>>> is stripped because it only has a meaning at build time on disk, but not once mapped to repository format,
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -36,7 +36,8 @@ import javax.xml.transform.sax.SAXTransformerFactory;
|
|||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.maven.xml.Factories;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.apache.maven.model.transform.sax.Factories;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
@ -54,11 +55,13 @@ public abstract class AbstractXMLFilterTests
|
|||
return getFilter();
|
||||
}
|
||||
|
||||
protected String omitXmlDeclaration() {
|
||||
protected String omitXmlDeclaration()
|
||||
{
|
||||
return "yes";
|
||||
}
|
||||
|
||||
protected String indentAmount() {
|
||||
protected String indentAmount()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -146,9 +149,10 @@ public abstract class AbstractXMLFilterTests
|
|||
return writer.toString();
|
||||
}
|
||||
|
||||
private void setParent( AbstractSAXFilter filter ) throws SAXException, ParserConfigurationException
|
||||
private void setParent( AbstractSAXFilter filter )
|
||||
throws SAXException, ParserConfigurationException
|
||||
{
|
||||
if( filter.getParent() == null )
|
||||
if ( filter.getParent() == null )
|
||||
{
|
||||
XMLReader r = Factories.newXMLReader();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -25,6 +25,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import org.xml.sax.SAXException;
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -31,6 +31,7 @@ import java.util.function.Function;
|
|||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
|
||||
import org.apache.maven.model.transform.sax.AbstractSAXFilter;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
@ -88,7 +89,9 @@ public class ConsumerPomXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void aggregatorWithParent() throws Exception {
|
||||
public void aggregatorWithParent()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project>\n"
|
||||
+ " <parent>\n"
|
||||
+ " <groupId>GROUPID</groupId>\n"
|
||||
|
@ -115,7 +118,9 @@ public class ConsumerPomXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void aggregatorWithCliFriendlyVersion() throws Exception {
|
||||
public void aggregatorWithCliFriendlyVersion()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||
"<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" +
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
|
||||
|
@ -162,7 +167,9 @@ public class ConsumerPomXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void licenseHeader() throws Exception {
|
||||
public void licenseHeader()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||
"\n" +
|
||||
"<!--\n" +
|
||||
|
@ -237,7 +244,8 @@ public class ConsumerPomXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void lexicalHandler() throws Exception
|
||||
public void lexicalHandler()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project><!--before--><modules>"
|
||||
+ "<!--pre-in-->"
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -26,7 +26,9 @@ import java.util.function.Consumer;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public class ModulesXMLFilterTest extends AbstractXMLFilterTests {
|
||||
public class ModulesXMLFilterTest
|
||||
extends AbstractXMLFilterTests
|
||||
{
|
||||
|
||||
@Override
|
||||
protected ModulesXMLFilter getFilter( Consumer<LexicalHandler> lexicalHandlerConsumer )
|
||||
|
@ -37,7 +39,9 @@ public class ModulesXMLFilterTest extends AbstractXMLFilterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void emptyModules() throws Exception {
|
||||
public void emptyModules()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project><modules/></project>";
|
||||
String expected = "<project/>";
|
||||
String actual = transform( input );
|
||||
|
@ -45,7 +49,9 @@ public class ModulesXMLFilterTest extends AbstractXMLFilterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void setOfModules() throws Exception {
|
||||
public void setOfModules()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project><modules>"
|
||||
+ "<module>ab</module>"
|
||||
+ "<module>../cd</module>"
|
||||
|
@ -56,7 +62,9 @@ public class ModulesXMLFilterTest extends AbstractXMLFilterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void noModules() throws Exception {
|
||||
public void noModules()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project><name>NAME</name></project>";
|
||||
String expected = input;
|
||||
String actual = transform( input );
|
||||
|
@ -64,7 +72,9 @@ public class ModulesXMLFilterTest extends AbstractXMLFilterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void comment() throws Exception {
|
||||
public void comment()
|
||||
throws Exception
|
||||
{
|
||||
|
||||
String input = "<project><!--before--><modules>"
|
||||
+ "<!--pre-in-->"
|
||||
|
@ -79,7 +89,9 @@ public class ModulesXMLFilterTest extends AbstractXMLFilterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void setOfModulesLF() throws Exception {
|
||||
public void setOfModulesLF()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project>\n"
|
||||
+ "\n"
|
||||
+ " <modules>\n"
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -32,7 +32,8 @@ import org.junit.jupiter.api.Test;
|
|||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
||||
public class ParentXMLFilterTest
|
||||
extends AbstractXMLFilterTests
|
||||
{
|
||||
@Override
|
||||
protected ParentXMLFilter getFilter( Consumer<LexicalHandler> lexicalHandlerConsumer )
|
||||
|
@ -48,7 +49,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMinimum() throws Exception
|
||||
public void testMinimum()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<parent/>";
|
||||
String expected = input;
|
||||
|
@ -57,7 +59,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNoRelativePath() throws Exception
|
||||
public void testNoRelativePath()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<parent>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -72,7 +75,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultRelativePath() throws Exception
|
||||
public void testDefaultRelativePath()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<parent>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -96,7 +100,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testEmptyRelativePathNoVersion() throws Exception
|
||||
public void testEmptyRelativePathNoVersion()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<parent>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -115,7 +120,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNoVersion() throws Exception
|
||||
public void testNoVersion()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<parent>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -135,7 +141,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidRelativePath() throws Exception
|
||||
public void testInvalidRelativePath()
|
||||
throws Exception
|
||||
{
|
||||
ParentXMLFilter filter = new ParentXMLFilter( x -> Optional.ofNullable( null ) );
|
||||
filter.setProjectPath( Paths.get( "pom.xml").toAbsolutePath() );
|
||||
|
@ -153,7 +160,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRelativePathAndVersion() throws Exception
|
||||
public void testRelativePathAndVersion()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<parent>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -174,7 +182,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWithWeirdNamespace() throws Exception
|
||||
public void testWithWeirdNamespace()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<relativePath:parent xmlns:relativePath=\"relativePath\">"
|
||||
+ "<relativePath:groupId>GROUPID</relativePath:groupId>"
|
||||
|
@ -194,7 +203,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void comment() throws Exception
|
||||
public void comment()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project><!--before--><parent>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -216,7 +226,8 @@ public class ParentXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIndent() throws Exception
|
||||
public void testIndent()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project>\n"
|
||||
+ " <parent>\n"
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -29,7 +29,8 @@ import org.junit.jupiter.api.Test;
|
|||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public class ReactorDependencyXMLFilterTest extends AbstractXMLFilterTests
|
||||
public class ReactorDependencyXMLFilterTest
|
||||
extends AbstractXMLFilterTests
|
||||
{
|
||||
@Override
|
||||
protected ReactorDependencyXMLFilter getFilter( Consumer<LexicalHandler> lexicalHandlerConsumer )
|
||||
|
@ -41,7 +42,8 @@ public class ReactorDependencyXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultDependency() throws Exception
|
||||
public void testDefaultDependency()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<dependency>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -56,7 +58,8 @@ public class ReactorDependencyXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testManagedDependency() throws Exception
|
||||
public void testManagedDependency()
|
||||
throws Exception
|
||||
{
|
||||
ReactorDependencyXMLFilter filter = new ReactorDependencyXMLFilter( (g, a) -> null );
|
||||
|
||||
|
@ -72,7 +75,8 @@ public class ReactorDependencyXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReactorDependency() throws Exception
|
||||
public void testReactorDependency()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<dependency>"
|
||||
+ "<groupId>GROUPID</groupId>"
|
||||
|
@ -90,7 +94,8 @@ public class ReactorDependencyXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReactorDependencyLF() throws Exception
|
||||
public void testReactorDependencyLF()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<dependency>\n"
|
||||
+ " <groupId>GROUPID</groupId>\n"
|
||||
|
@ -110,7 +115,9 @@ public class ReactorDependencyXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void multipleDependencies() throws Exception {
|
||||
public void multipleDependencies()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project>\n" +
|
||||
" <modelVersion>4.0.0</modelVersion>\n" +
|
||||
" <groupId>tests.project</groupId>\n" +
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.filter;
|
||||
package org.apache.maven.model.transform;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -23,7 +23,8 @@ import static org.xmlunit.assertj.XmlAssert.assertThat;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RelativePathXMLFilterTest extends AbstractXMLFilterTests
|
||||
public class RelativePathXMLFilterTest
|
||||
extends AbstractXMLFilterTests
|
||||
{
|
||||
@Override
|
||||
protected RelativePathXMLFilter getFilter()
|
||||
|
@ -32,7 +33,8 @@ public class RelativePathXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRelativePath() throws Exception
|
||||
public void testRelativePath()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project>\n"
|
||||
+ " <parent>\n"
|
||||
|
@ -56,7 +58,8 @@ public class RelativePathXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRelativePathNS() throws Exception
|
||||
public void testRelativePathNS()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" +
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
|
||||
|
@ -84,7 +87,8 @@ public class RelativePathXMLFilterTest extends AbstractXMLFilterTests
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRelativePathPasNS() throws Exception
|
||||
public void testRelativePathPasNS()
|
||||
throws Exception
|
||||
{
|
||||
String input = "<p:project xmlns:p=\"http://maven.apache.org/POM/4.0.0\"\n" +
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -32,8 +32,6 @@ import javax.xml.transform.sax.SAXTransformerFactory;
|
|||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.maven.xml.Factories;
|
||||
import org.apache.maven.xml.sax.filter.AbstractSAXFilter;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax.ext;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -32,8 +32,8 @@ public class CommentRenormalizerTest
|
|||
private LexicalHandler lexicalHandler = mock( LexicalHandler.class );
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"\n", "\r\n", "\r" })
|
||||
public void singleLine(String lineSeparator)
|
||||
@ValueSource( strings = { "\n", "\r\n", "\r" } )
|
||||
public void singleLine( String lineSeparator )
|
||||
throws Exception
|
||||
{
|
||||
CommentRenormalizer commentRenormalizer = new CommentRenormalizer( lexicalHandler, lineSeparator );
|
||||
|
@ -46,8 +46,8 @@ public class CommentRenormalizerTest
|
|||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"\n", "\r\n", "\r" })
|
||||
public void multiLine(String lineSeparator)
|
||||
@ValueSource( strings = { "\n", "\r\n", "\r" } )
|
||||
public void multiLine( String lineSeparator )
|
||||
throws Exception
|
||||
{
|
||||
CommentRenormalizer commentRenormalizer = new CommentRenormalizer( lexicalHandler, lineSeparator );
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.xml.sax;
|
||||
package org.apache.maven.model.transform.sax;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -20,6 +20,7 @@ package org.apache.maven.xml.sax;
|
|||
*/
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
Loading…
Reference in New Issue