|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | +package org.apache.maven.it; |
| 20 | + |
| 21 | +import java.io.File; |
| 22 | + |
| 23 | +import org.junit.jupiter.api.Test; |
| 24 | + |
| 25 | +/** |
| 26 | + * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-8245">MNG-8245</a> |
| 27 | + * and <a href="https://issues.apache.org/jira/browse/MNG-8246">MNG-8246</a>. |
| 28 | + */ |
| 29 | +class MavenITmng8245BeforePhaseCliTest extends AbstractMavenIntegrationTestCase { |
| 30 | + |
| 31 | + MavenITmng8245BeforePhaseCliTest() { |
| 32 | + super("[4.0.0-rc-2,)"); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Verify phase before:clean spits a warning and calls clean |
| 37 | + */ |
| 38 | + @Test |
| 39 | + void testPhaseBeforeCleanAllWihConcurrentBuilder() throws Exception { |
| 40 | + File testDir = extractResources("/mng-8245-phase-all"); |
| 41 | + |
| 42 | + Verifier verifier = newVerifier(testDir.getAbsolutePath()); |
| 43 | + verifier.setLogFileName("build-concurrent.txt"); |
| 44 | + verifier.addCliArguments("-b", "concurrent", "before:clean"); |
| 45 | + verifier.execute(); |
| 46 | + |
| 47 | + verifier.verifyTextInLog("Illegal call to phase 'before:clean'. The main phase 'clean' will be used instead."); |
| 48 | + verifier.verifyTextInLog("Hallo 'before:all' phase."); |
| 49 | + verifier.verifyTextInLog("Hallo 'after:all' phase."); |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Verify phase before:clean spits a warning and calls clean |
| 54 | + */ |
| 55 | + @Test |
| 56 | + void testPhaseBeforeCleanAllWithLegacyBuilder() throws Exception { |
| 57 | + File testDir = extractResources("/mng-8244-phase-all"); |
| 58 | + |
| 59 | + Verifier verifier = newVerifier(testDir.getAbsolutePath()); |
| 60 | + verifier.setLogFileName("build-legacy.txt"); |
| 61 | + verifier.addCliArguments("before:clean"); |
| 62 | + verifier.execute(); |
| 63 | + |
| 64 | + verifier.verifyTextInLog("Illegal call to phase 'before:clean'. The main phase 'clean' will be used instead."); |
| 65 | + verifier.verifyTextInLog("Hallo 'before:all' phase."); |
| 66 | + verifier.verifyTextInLog("Hallo 'after:all' phase."); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * Verify phase after:clean spits a warning and calls clean |
| 71 | + */ |
| 72 | + @Test |
| 73 | + void testPhaseAFterCleanAllWihConcurrentBuilder() throws Exception { |
| 74 | + File testDir = extractResources("/mng-8245-phase-all"); |
| 75 | + |
| 76 | + Verifier verifier = newVerifier(testDir.getAbsolutePath()); |
| 77 | + verifier.setLogFileName("build-concurrent.txt"); |
| 78 | + verifier.addCliArguments("-b", "concurrent", "after:clean"); |
| 79 | + verifier.execute(); |
| 80 | + |
| 81 | + verifier.verifyTextInLog("Illegal call to phase 'after:clean'. The main phase 'clean' will be used instead."); |
| 82 | + verifier.verifyTextInLog("Hallo 'before:clean' phase."); |
| 83 | + verifier.verifyTextInLog("Hallo 'after:clean' phase."); |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * Verify phase after:clean spits a warning and calls clean |
| 88 | + */ |
| 89 | + @Test |
| 90 | + void testPhaseAfterCleanAllWithLegacyBuilder() throws Exception { |
| 91 | + File testDir = extractResources("/mng-8244-phase-all"); |
| 92 | + |
| 93 | + Verifier verifier = newVerifier(testDir.getAbsolutePath()); |
| 94 | + verifier.setLogFileName("build-legacy.txt"); |
| 95 | + verifier.addCliArguments("after:clean"); |
| 96 | + verifier.execute(); |
| 97 | + |
| 98 | + verifier.verifyTextInLog("Illegal call to phase 'after:clean'. The main phase 'clean' will be used instead."); |
| 99 | + verifier.verifyTextInLog("Hallo 'before:clean' phase."); |
| 100 | + verifier.verifyTextInLog("Hallo 'after:clean' phase."); |
| 101 | + } |
| 102 | +} |
0 commit comments