From 9bc0fb592b5ef5c4e8540ca6c3c6676d43ab4eec Mon Sep 17 00:00:00 2001 From: Nico Korthout Date: Tue, 28 Nov 2023 09:49:50 +0100 Subject: [PATCH] Test skip flags This adds 3 ITs for the skip flags: - to verify `skip` -> should not create/remove flattened pom - to verify `skipFlatten` -> should not create flattened pom - to verify `skipClean` -> should not remove flattened pom --- src/it/projects/clean-skip/.flattened-pom.xml | 16 ++++++++++ src/it/projects/clean-skip/pom.xml | 29 +++++++++++++++++++ src/it/projects/clean-skip/verify.groovy | 24 +++++++++++++++ src/it/projects/flatten-skip/pom.xml | 29 +++++++++++++++++++ src/it/projects/flatten-skip/verify.groovy | 24 +++++++++++++++ src/it/projects/skip/.flattened-pom.xml | 16 ++++++++++ src/it/projects/skip/pom.xml | 29 +++++++++++++++++++ src/it/projects/skip/verify.groovy | 28 ++++++++++++++++++ 8 files changed, 195 insertions(+) create mode 100644 src/it/projects/clean-skip/.flattened-pom.xml create mode 100644 src/it/projects/clean-skip/pom.xml create mode 100644 src/it/projects/clean-skip/verify.groovy create mode 100644 src/it/projects/flatten-skip/pom.xml create mode 100644 src/it/projects/flatten-skip/verify.groovy create mode 100644 src/it/projects/skip/.flattened-pom.xml create mode 100644 src/it/projects/skip/pom.xml create mode 100644 src/it/projects/skip/verify.groovy diff --git a/src/it/projects/clean-skip/.flattened-pom.xml b/src/it/projects/clean-skip/.flattened-pom.xml new file mode 100644 index 00000000..c7c5b961 --- /dev/null +++ b/src/it/projects/clean-skip/.flattened-pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.codehaus.mojo.flatten.its + resolve-properties + 0.0.1-SNAPSHOT + + + org.codehaus.mojo.flatten.its + dep + 1.1 + compile + + + diff --git a/src/it/projects/clean-skip/pom.xml b/src/it/projects/clean-skip/pom.xml new file mode 100644 index 00000000..d7c0aa94 --- /dev/null +++ b/src/it/projects/clean-skip/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + org.codehaus.mojo.flatten.its + flatten-skip + 0.0.1-SNAPSHOT + + + + org.codehaus.mojo.flatten.its + dep + 1.1 + + + + + verify + + + org.codehaus.mojo + flatten-maven-plugin + @project.version@ + + true + + + + + diff --git a/src/it/projects/clean-skip/verify.groovy b/src/it/projects/clean-skip/verify.groovy new file mode 100644 index 00000000..9e828c4e --- /dev/null +++ b/src/it/projects/clean-skip/verify.groovy @@ -0,0 +1,24 @@ +/* + * 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. + */ + +// Clean mojo is skipped so we should expect flattened pom to still exist +File flattendPom = new File( basedir, '.flattened-pom.xml' ) +assert flattendPom.exists() + + diff --git a/src/it/projects/flatten-skip/pom.xml b/src/it/projects/flatten-skip/pom.xml new file mode 100644 index 00000000..50f6313e --- /dev/null +++ b/src/it/projects/flatten-skip/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + org.codehaus.mojo.flatten.its + flatten-skip + 0.0.1-SNAPSHOT + + + + org.codehaus.mojo.flatten.its + dep + 1.1 + + + + + verify + + + org.codehaus.mojo + flatten-maven-plugin + @project.version@ + + true + + + + + diff --git a/src/it/projects/flatten-skip/verify.groovy b/src/it/projects/flatten-skip/verify.groovy new file mode 100644 index 00000000..9f5e8190 --- /dev/null +++ b/src/it/projects/flatten-skip/verify.groovy @@ -0,0 +1,24 @@ +/* + * 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. + */ + +// Flatten mojo is skipped so we should expect no flattened pom +File flattendPom = new File( basedir, '.flattened-pom.xml' ) +assert !flattendPom.exists() + + diff --git a/src/it/projects/skip/.flattened-pom.xml b/src/it/projects/skip/.flattened-pom.xml new file mode 100644 index 00000000..c7c5b961 --- /dev/null +++ b/src/it/projects/skip/.flattened-pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.codehaus.mojo.flatten.its + resolve-properties + 0.0.1-SNAPSHOT + + + org.codehaus.mojo.flatten.its + dep + 1.1 + compile + + + diff --git a/src/it/projects/skip/pom.xml b/src/it/projects/skip/pom.xml new file mode 100644 index 00000000..50f6313e --- /dev/null +++ b/src/it/projects/skip/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + org.codehaus.mojo.flatten.its + flatten-skip + 0.0.1-SNAPSHOT + + + + org.codehaus.mojo.flatten.its + dep + 1.1 + + + + + verify + + + org.codehaus.mojo + flatten-maven-plugin + @project.version@ + + true + + + + + diff --git a/src/it/projects/skip/verify.groovy b/src/it/projects/skip/verify.groovy new file mode 100644 index 00000000..2d445d72 --- /dev/null +++ b/src/it/projects/skip/verify.groovy @@ -0,0 +1,28 @@ +/* + * 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. + */ + +// Flatten plugin is skipped so we should expect that the flattened +// pom is not removed by the clean mojo, and not newly created by the +// flatten mojo, i.e. it is left unchanged. We can check this by +// asserting it was last modified before starting to run this test +File flattendPom = new File( basedir, '.flattened-pom.xml' ) +assert flattendPom.exists() +long now = System.currentTimeMillis() +assert now - flattendPom.lastModified() > 20*1000 +