Skip to content

Commit

Permalink
Fix ITs for BOM packaging / build pom
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jun 29, 2023
1 parent eaaf6d5 commit 96c6509
Show file tree
Hide file tree
Showing 17 changed files with 253 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void testitMNG1021() throws Exception {
verifier.setAutoclean(false);
verifier.deleteDirectory("repo");
verifier.deleteArtifacts("org.apache.maven.its.mng1021");
verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false");
verifier.addCliArgument("initialize");
verifier.execute();
verifier.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void testitMNG3396() throws Exception {
verifier.deleteArtifact(GROUP_ID, "A", "1.0", "jar");
verifier.deleteArtifact(GROUP_ID, "B", "1.0", "pom");
verifier.deleteArtifact(GROUP_ID, "B", "1.0", "jar");
verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false");
verifier.addCliArgument("install");
verifier.execute();
verifier.verifyErrorFreeLog();
Expand All @@ -59,6 +60,7 @@ public void testitMNG3396() throws Exception {
verifier.deleteArtifact(GROUP_ID, "A", "3.0", "jar");
verifier.deleteArtifact(GROUP_ID, "plugin", "1.0", "pom");
verifier.deleteArtifact(GROUP_ID, "plugin", "1.0", "jar");
verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false");
verifier.addCliArgument("install");
verifier.execute();
verifier.verifyErrorFreeLog();
Expand All @@ -68,6 +70,7 @@ public void testitMNG3396() throws Exception {
verifier = newVerifier(testDir.getAbsolutePath(), "remote");
verifier.deleteArtifact(GROUP_ID, "pluginuser", "1.0", "pom");
verifier.deleteArtifact(GROUP_ID, "pluginuser", "1.0", "jar");
verifier.addCliArgument("-Dmaven.experimental.buildconsumer=false");
verifier.addCliArgument("install");
verifier.execute();
verifier.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,23 @@ public void testPublishedPoms() throws Exception {
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6656-SNAPSHOT", "pom")));

assertTextEquals(
new File(testDir, "expected/simple-weather-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6656-SNAPSHOT", "pom", "build")));

assertTextEquals(
new File(testDir, "expected/simple-webapp.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6656-SNAPSHOT", "pom")));

assertTextEquals(
new File(testDir, "expected/simple-webapp-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6656-SNAPSHOT", "pom", "build")));
}

static void assertTextEquals(File file1, File file2) throws IOException {
assertEquals(FileUtils.loadFile(file1), FileUtils.loadFile(file2));
assertEquals(FileUtils.fileRead(file1), FileUtils.fileRead(file2));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,31 @@ public void testPublishedPoms() throws Exception {
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6957-SNAPSHOT", "pom")));

assertTextEquals(
new File(testDir, "expected/simple-weather-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6957-SNAPSHOT", "pom", "build")));

assertTextEquals(
new File(testDir, "expected/simple-webapp.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6957-SNAPSHOT", "pom")));

assertTextEquals(
new File(testDir, "expected/simple-webapp-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6957-SNAPSHOT", "pom", "build")));

assertTextEquals(
new File(testDir, "expected/simple-testutils.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-testutils", "0.9-MNG6957-SNAPSHOT", "pom")));

assertTextEquals(
new File(testDir, "expected/simple-testutils-build.pom"),
new File(verifier.getArtifactPath(
"org.sonatype.mavenbook.multi", "simple-testutils", "0.9-MNG6957-SNAPSHOT", "pom", "build")));

assertTextEquals(
new File(testDir, "expected/utils-parent.pom"),
new File(verifier.getArtifactPath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ void testLeakyModel() throws Exception {

verifier.verifyErrorFreeLog();

String pom = FileUtils.readFileToString(
new File(verifier.getArtifactPath("org.apache.maven.its.mng7228", "test", "1.0.0-SNAPSHOT", "pom")));
String pom = FileUtils.readFileToString(new File(
verifier.getArtifactPath("org.apache.maven.its.mng7228", "test", "1.0.0-SNAPSHOT", "pom", "build")));

assertThat(pom, containsString("projectProperty"));
assertThat(pom, not(containsString("activeProperty")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ under the License.
<artifactId>simple-parent</artifactId>
<packaging>pom</packaging>
<name>Multi Chapter Simple Parent Project</name>



<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-parent</artifactId>
<version>0.9-MNG6656-SNAPSHOT</version>
</parent>
<artifactId>simple-weather</artifactId>
<packaging>jar</packaging>

<name>Multi Chapter Simple Weather API</name>

</project>
Original file line number Diff line number Diff line change
@@ -1,32 +1,8 @@
<?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/maven-v4_0_0.xsd">
<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>
<parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-parent</artifactId>
<version>0.9-MNG6656-SNAPSHOT</version>
</parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-weather</artifactId>
<packaging>jar</packaging>

<version>0.9-MNG6656-SNAPSHOT</version>
<name>Multi Chapter Simple Weather API</name>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-parent</artifactId>
<version>0.9-MNG6656-SNAPSHOT</version>
</parent>

<artifactId>simple-webapp</artifactId>
<name>Multi Chapter Simple Web Application Project</name>
<dependencies>
<dependency>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-weather</artifactId>
<version>0.9-MNG6656-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>simple-webapp</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,49 +1,16 @@
<?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/maven-v4_0_0.xsd">
<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>
<parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-parent</artifactId>
<version>0.9-MNG6656-SNAPSHOT</version>
</parent>

<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-webapp</artifactId>
<version>0.9-MNG6656-SNAPSHOT</version>
<name>Multi Chapter Simple Web Application Project</name>
<dependencies>
<dependency>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-weather</artifactId>
<version>0.9-MNG6656-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>simple-webapp</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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>
<parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>utils-parent</artifactId>
<version>0.9-MNG6957-SNAPSHOT</version>
</parent>
<artifactId>simple-testutils</artifactId>
</project>
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
<?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>
<parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>utils-parent</artifactId>
<version>0.9-MNG6957-SNAPSHOT</version>
</parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-testutils</artifactId>
</project>
<version>0.9-MNG6957-SNAPSHOT</version>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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>
<parent>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-parent</artifactId>
<version>0.9-MNG6957-SNAPSHOT</version>
</parent>
<artifactId>simple-weather</artifactId>
<packaging>jar</packaging>

<name>Multi Chapter Simple Weather API</name>

<dependencies>
<dependency>
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-testutils</artifactId>
<scope>test</scope>
<version>0.9-MNG6957-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit 96c6509

Please sign in to comment.