forked from apache/maven
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MNG-6999] Chained (consumer) XMLFilters can result in "floating" com…
…ments
- Loading branch information
Showing
25 changed files
with
647 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...re/src/test/java/org/apache/maven/internal/aether/ConsumerModelSourceTransformerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.apache.maven.internal.aether; | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import java.io.InputStream; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.apache.maven.model.Model; | ||
import org.apache.maven.model.building.TransformerContext; | ||
import org.junit.Test; | ||
import org.xmlunit.assertj.XmlAssert; | ||
|
||
public class ConsumerModelSourceTransformerTest | ||
{ | ||
private ConsumerModelSourceTransformer transformer = new ConsumerModelSourceTransformer(); | ||
|
||
@Test | ||
public void transform() throws Exception | ||
{ | ||
Path beforePomFile = Paths.get( "src/test/resources/projects/transform/before.pom").toAbsolutePath(); | ||
Path afterPomFile = Paths.get( "src/test/resources/projects/transform/after.pom").toAbsolutePath(); | ||
|
||
try( InputStream expected = Files.newInputStream( afterPomFile ); | ||
InputStream result = transformer.transform( beforePomFile, new NoTransformerContext() ) ) | ||
{ | ||
XmlAssert.assertThat( result ).and( expected ).areIdentical(); | ||
} | ||
} | ||
|
||
private static class NoTransformerContext implements TransformerContext | ||
{ | ||
@Override | ||
public String getUserProperty( String key ) | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public Model getRawModel( String groupId, String artifactId ) | ||
throws IllegalStateException | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public Model getRawModel( Path p ) | ||
{ | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
maven-core/src/test/resources/projects/transform/after.pom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>test</groupId> | ||
<artifactId>test</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
|
||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.1</version> | ||
<configuration> | ||
<source> 1.5 </source> | ||
<target xml:space="preserve"> 1.5 </target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>test</id> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>default</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>file</id> | ||
<activation> | ||
<file> | ||
<exists>simple.xml</exists> | ||
</file> | ||
</activation> | ||
<properties> | ||
<profile.file>activated</profile.file> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</project> |
Oops, something went wrong.