Skip to content

Commit

Permalink
[MNG-5862] Add an IT for xml entities and xinclude
Browse files Browse the repository at this point in the history
# Conflicts:
#	core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
  • Loading branch information
gnodet committed Jan 9, 2024
1 parent 6150ce0 commit db9582d
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core-it-suite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ under the License.
<exclude>src/test/resources/mng-2254/latin-1/pom.xml</exclude>
<exclude>src/test/resources/mng-2362/latin-1/pom.xml</exclude>
<exclude>src/test/resources/mng-3839/pom.xml</exclude>
<exclude>src/test/resources/mng-5862-entities-xinclude/pom.xml</exclude>
<exclude>src/test/resources/mng-5862-entities-xinclude/child/pom.xml</exclude>
</excludes>
</pom>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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.
*/
package org.apache.maven.it;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.stream.Collectors;

import org.apache.maven.shared.verifier.Verifier;
import org.apache.maven.shared.verifier.util.ResourceExtractor;
import org.junit.jupiter.api.Test;

public class MavenITmng5862EntitiesAndXInclude extends AbstractMavenIntegrationTestCase {

public MavenITmng5862EntitiesAndXInclude() {
super("(4.0.0-alpha-7,)");
}

@Test
public void testRelativePathPointsToWrongVersion() throws Exception {
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5862-entities-xinclude");

Verifier verifier = newVerifier(testDir.getPath());
verifier.addCliArgument("install");
verifier.execute();
verifier.verifyErrorFreeLog();

String path = verifier.getArtifactPath("org.apache.maven.it5862", "parent", "1.0-SNAPSHOT", "pom");
String content = Files.lines(Paths.get(path)).collect(Collectors.joining(System.lineSeparator()));
assertFalse(content.contains("&version;"));
assertFalse(content.contains("xi:include"));

path = verifier.getArtifactPath("org.apache.maven.it5862", "child", "1.0-SNAPSHOT", "pom");
content = Files.lines(Paths.get(path)).collect(Collectors.joining(System.lineSeparator()));
assertFalse(content.contains("&version;"));
assertFalse(content.contains("xi:include"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public TestSuiteOrdering() {
* the tests are to finishing. Newer tests are also more likely to fail, so this is
* a fail fast technique as well.
*/
suite.addTestSuite(MavenITmng5862EntitiesAndXInclude.class);
suite.addTestSuite(MavenITmng7967ArtifactHandlerLanguageTest.class);
suite.addTestSuite(MavenITmng7965PomDuplicateTagsTest.class);
suite.addTestSuite(MavenITmng7939PluginsValidationExcludesTest.class);
Expand Down
1 change: 1 addition & 0 deletions core-it-suite/src/test/resources-filtered/bootstrap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ org.apache.maven.plugins:maven-resources-plugin:3.2.0
org.apache.maven.plugins:maven-resources-plugin:3.3.0
org.apache.maven.plugins:maven-site-plugin:${stubPluginVersion}
org.apache.maven.plugins:maven-site-plugin:3.9.1
org.apache.maven.plugins:maven-site-plugin:3.12.0
org.apache.maven.plugins:maven-shade-plugin:3.5.0
org.apache.maven.plugins:maven-source-plugin:${stubPluginVersion}
org.apache.maven.plugins:maven-surefire-plugin:${stubPluginVersion}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2019-2023 the original author or authors.
Licensed 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.
-->
<!DOCTYPE foo SYSTEM "../foo.dtd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
http://www.w3.org/2001/XInclude https://www.w3.org/2001/XInclude/XInclude.xsd">


<modelVersion>4.0.0</modelVersion>

<xi:include href="../snippets.xml" xpointer="id-parent" />

<groupId>&groupId;</groupId>
<artifactId>child</artifactId>
&version;
<packaging>jar</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2019-2023 the original author or authors.
Licensed 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.
-->
<!ENTITY version SYSTEM "version.xml">
<!ENTITY groupId "org.apache.maven.it5862">
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2019-2023 the original author or authors.
Licensed 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.
-->
<!DOCTYPE foo SYSTEM "foo.dtd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
http://www.w3.org/2001/XInclude https://www.w3.org/2001/XInclude/XInclude.xsd">


<modelVersion>4.0.0</modelVersion>

<groupId>&groupId;</groupId>
<artifactId>parent</artifactId>
&version;

<packaging>pom</packaging>

<modules>
<module>child</module>
</modules>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2019-2023 the original author or authors.
Licensed 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.
-->
<!DOCTYPE foo [
<!ENTITY version SYSTEM "version.xml">
<!ENTITY groupId "org.apache.maven.it5862">
]>
<snippets>

<parent xml:id="id-parent">
<groupId>&groupId;</groupId>
<artifactId>parent</artifactId>
&version;
</parent>

</snippets>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2019-2023 the original author or authors.
Licensed 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.
-->
<version>1.0-SNAPSHOT</version>

0 comments on commit db9582d

Please sign in to comment.