This is an automated email from the ASF dual-hosted git repository. mthmulders pushed a commit to branch MNG-6389-introduce-seperate-toolchain-artifact in repository https://gitbox.apache.org/repos/asf/maven.git
commit 9502e1099eee0c7ab6ff36f4b4e82418b8c7137a Author: Maarten Mulders <mthmuld...@apache.org> AuthorDate: Wed Oct 13 11:53:37 2021 +0200 [MNG-6389] Remove files that were supposed to be moved --- .../toolchain/merge/MavenToolchainMergerTest.java | 135 --------------------- .../toolchain/model/toolchains-jdks-extend.xml | 45 ------- 2 files changed, 180 deletions(-) diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/merge/MavenToolchainMergerTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/merge/MavenToolchainMergerTest.java deleted file mode 100644 index 7bed9a9..0000000 --- a/maven-core/src/test/java/org/apache/maven/toolchain/merge/MavenToolchainMergerTest.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.apache.maven.toolchain.merge; - -/* - * 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 org.apache.maven.toolchain.model.PersistedToolchains; -import org.apache.maven.toolchain.model.ToolchainModel; -import org.apache.maven.toolchain.model.TrackableBase; -import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.junit.jupiter.api.Test; - -import java.io.InputStream; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MavenToolchainMergerTest -{ - private MavenToolchainMerger merger = new MavenToolchainMerger(); - - private MavenToolchainsXpp3Reader reader = new MavenToolchainsXpp3Reader(); - - @Test - public void testMergeNulls() - { - merger.merge( null, null, null ); - - PersistedToolchains pt = new PersistedToolchains(); - merger.merge( pt, null, null ); - merger.merge( null, pt, null ); - } - - @Test - public void testMergeJdk() - throws Exception - { - try ( InputStream isDominant = ToolchainModel.class.getResourceAsStream( "toolchains-jdks.xml" ); - InputStream isRecessive = ToolchainModel.class.getResourceAsStream( "toolchains-jdks.xml" ) ) - { - PersistedToolchains dominant = reader.read( isDominant ); - PersistedToolchains recessive = reader.read( isRecessive ); - assertEquals( 2, dominant.getToolchains().size() ); - - merger.merge( dominant, recessive, TrackableBase.USER_LEVEL ); - assertEquals( 2, dominant.getToolchains().size() ); - } - } - - @Test - public void testMergeJdkExtra() - throws Exception - { - try ( InputStream jdksIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks.xml" ); - InputStream jdksExtraIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks-extra.xml" ) ) - { - PersistedToolchains jdks = reader.read( jdksIS ); - PersistedToolchains jdksExtra = reader.read( jdksExtraIS ); - assertEquals( 2, jdks.getToolchains().size() ); - - merger.merge( jdks, jdksExtra, TrackableBase.USER_LEVEL ); - assertEquals( 4, jdks.getToolchains().size() ); - assertEquals( 2, jdksExtra.getToolchains().size() ); - } - try ( InputStream jdksIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks.xml" ); - InputStream jdksExtraIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks-extra.xml" ) ) - { - PersistedToolchains jdks = reader.read( jdksIS ); - PersistedToolchains jdksExtra = reader.read( jdksExtraIS ); - assertEquals( 2, jdks.getToolchains().size() ); - - // switch dominant with recessive - merger.merge( jdksExtra, jdks, TrackableBase.USER_LEVEL ); - assertEquals( 4, jdksExtra.getToolchains().size() ); - assertEquals( 2, jdks.getToolchains().size() ); - } - } - - @Test - public void testMergeJdkExtend() - throws Exception - { - try ( InputStream jdksIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks.xml" ); - InputStream jdksExtendIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks-extend.xml" ) ) - { - PersistedToolchains jdks = reader.read( jdksIS ); - PersistedToolchains jdksExtend = reader.read( jdksExtendIS ); - assertEquals( 2, jdks.getToolchains().size() ); - - merger.merge( jdks, jdksExtend, TrackableBase.USER_LEVEL ); - assertEquals( 2, jdks.getToolchains().size() ); - Xpp3Dom config0 = (Xpp3Dom) jdks.getToolchains().get( 0 ).getConfiguration(); - assertEquals( "lib/tools.jar", config0.getChild( "toolsJar" ).getValue() ); - assertEquals( 2, config0.getChildCount() ); - Xpp3Dom config1 = (Xpp3Dom) jdks.getToolchains().get( 1 ).getConfiguration(); - assertEquals( 2, config1.getChildCount() ); - assertEquals( "lib/classes.jar", config1.getChild( "toolsJar" ).getValue() ); - assertEquals( 2, jdksExtend.getToolchains().size() ); - } - try ( InputStream jdksIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks.xml" ); - InputStream jdksExtendIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks-extend.xml" ) ) - { - PersistedToolchains jdks = reader.read( jdksIS ); - PersistedToolchains jdksExtend = reader.read( jdksExtendIS ); - assertEquals( 2, jdks.getToolchains().size() ); - - // switch dominant with recessive - merger.merge( jdksExtend, jdks, TrackableBase.USER_LEVEL ); - assertEquals( 2, jdksExtend.getToolchains().size() ); - Xpp3Dom config0 = (Xpp3Dom) jdksExtend.getToolchains().get( 0 ).getConfiguration(); - assertEquals( "lib/tools.jar", config0.getChild( "toolsJar" ).getValue() ); - assertEquals( 2, config0.getChildCount() ); - Xpp3Dom config1 = (Xpp3Dom) jdksExtend.getToolchains().get( 1 ).getConfiguration(); - assertEquals( 2, config1.getChildCount() ); - assertEquals( "lib/classes.jar", config1.getChild( "toolsJar" ).getValue() ); - assertEquals( 2, jdks.getToolchains().size() ); - } - } - -} diff --git a/maven-core/src/test/resources/org/apache/maven/toolchain/model/toolchains-jdks-extend.xml b/maven-core/src/test/resources/org/apache/maven/toolchain/model/toolchains-jdks-extend.xml deleted file mode 100644 index 64de88a..0000000 --- a/maven-core/src/test/resources/org/apache/maven/toolchain/model/toolchains-jdks-extend.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF8"?> - -<!-- -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. ---> - -<toolchains> - <toolchain> - <type>jdk</type> - <provides> - <version>1.5</version> - <vendor>sun</vendor> - </provides> - <configuration> - <jdkHome>${env.JAVA_HOME}</jdkHome> - <toolsJar>lib/tools.jar</toolsJar> - </configuration> - </toolchain> - <toolchain> - <type>jdk</type> - <provides> - <version>1.6</version> - <vendor>sun</vendor> - </provides> - <configuration> - <jdkHome>${env.JAVA_HOME}</jdkHome> - <toolsJar>lib/classes.jar</toolsJar> - </configuration> - </toolchain> -</toolchains> \ No newline at end of file