-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MNG-5862] Add an IT for xml entities and xinclude
# Conflicts: # core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
- Loading branch information
Showing
9 changed files
with
204 additions
and
0 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
55 changes: 55 additions & 0 deletions
55
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5862EntitiesAndXInclude.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,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")); | ||
} | ||
} |
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
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
36 changes: 36 additions & 0 deletions
36
core-it-suite/src/test/resources/mng-5862-entities-xinclude/child/pom.xml
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,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> |
20 changes: 20 additions & 0 deletions
20
core-it-suite/src/test/resources/mng-5862-entities-xinclude/foo.dtd
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,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"> |
39 changes: 39 additions & 0 deletions
39
core-it-suite/src/test/resources/mng-5862-entities-xinclude/pom.xml
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,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> |
31 changes: 31 additions & 0 deletions
31
core-it-suite/src/test/resources/mng-5862-entities-xinclude/snippets.xml
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,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> |
19 changes: 19 additions & 0 deletions
19
core-it-suite/src/test/resources/mng-5862-entities-xinclude/version.xml
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,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> |