From commits-return-60673-archive-asf-public=cust-asf.ponee.io@commons.apache.org Sun Jan 7 19:21:54 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 2DE00180654 for ; Sun, 7 Jan 2018 19:21:54 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1E710160C40; Sun, 7 Jan 2018 18:21:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1DC6F160C3D for ; Sun, 7 Jan 2018 19:21:52 +0100 (CET) Received: (qmail 22088 invoked by uid 500); 7 Jan 2018 18:21:49 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 21427 invoked by uid 99); 7 Jan 2018 18:21:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Jan 2018 18:21:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EFBC9F2DCA; Sun, 7 Jan 2018 18:21:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chtompki@apache.org To: commits@commons.apache.org Date: Sun, 07 Jan 2018 18:22:09 -0000 Message-Id: <40103c339fb74b8587194fe140eb86e0@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [25/26] commons-release-plugin git commit: Heading towards a test for detatchment mojo Heading towards a test for detatchment mojo Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/5d4ab8c4 Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/5d4ab8c4 Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/5d4ab8c4 Branch: refs/heads/master Commit: 5d4ab8c4c3b024aae607d83f428be7cbb17568e5 Parents: bb99995 Author: Rob Tompkins Authored: Sat Jan 6 20:50:57 2018 -0500 Committer: Rob Tompkins Committed: Sat Jan 6 20:50:57 2018 -0500 ---------------------------------------------------------------------- .../CommonsDistributionDetatchmentMojoTest.java | 54 +++++++++++++++++++ .../mojos/CommonsSiteCompressionMojoTest.java | 16 +++--- .../release/plugin/stubs/MavenProjectStub.java | 20 ------- .../release/plugin/stubs/package-info.java | 17 ------ .../detatch-distributions.xml | 51 ++++++++++++++++++ .../target/mockAttachedFile.html | 24 +++++++++ .../target/mockAttachedTar.tar.gz | Bin 0 -> 327 bytes .../target/mockAttachedZip.zip | Bin 0 -> 1323 bytes 8 files changed, 137 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojoTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojoTest.java new file mode 100644 index 0000000..7e7867d --- /dev/null +++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojoTest.java @@ -0,0 +1,54 @@ +/* + * 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.commons.release.plugin.mojos; + +import org.apache.maven.plugin.testing.MojoRule; +import org.junit.Rule; +import org.junit.Test; + +import java.io.File; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertNotNull; + +/** + * Unit tests for {@link CommonsDistributionDetatchmentMojo}. + * + * @author chtompki + */ +public class CommonsDistributionDetatchmentMojoTest { + + @Rule + public MojoRule rule = new MojoRule() { + @Override + protected void before() throws Throwable { + } + + @Override + protected void after() { + } + }; + + private CommonsDistributionDetatchmentMojo mojo; + + @Test + public void testSuccess() throws Exception { + File testPom = new File("src/test/resources/mojos/detatch-distributions/detatch-distributions.xml"); + assertNotNull(testPom); + assertTrue(testPom.exists()); + } +} http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java index 50313b3..7d8efe6 100644 --- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java +++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java @@ -50,10 +50,10 @@ public class CommonsSiteCompressionMojoTest { @Test public void testCompressSiteSuccess() throws Exception { - File testFile = new File("src/test/resources/mojos/compress-site/compress-site.xml"); - assertNotNull(testFile); - assertTrue(testFile.exists()); - mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", testFile); + File testPom = new File("src/test/resources/mojos/compress-site/compress-site.xml"); + assertNotNull(testPom); + assertTrue(testPom.exists()); + mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", testPom); mojo.execute(); File siteZip = new File("target/commons-release-plugin/site.zip"); assertTrue(siteZip.exists()); @@ -61,10 +61,10 @@ public class CommonsSiteCompressionMojoTest { @Test public void testCompressSiteDirNonExistentFailure() throws Exception { - File testFile = new File("src/test/resources/mojos/compress-site/compress-site-failure.xml"); - assertNotNull(testFile); - assertTrue(testFile.exists()); - mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", testFile); + File testPom = new File("src/test/resources/mojos/compress-site/compress-site-failure.xml"); + assertNotNull(testPom); + assertTrue(testPom.exists()); + mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", testPom); try { mojo.execute(); } catch (MojoFailureException e) { http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/java/org/apache/commons/release/plugin/stubs/MavenProjectStub.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/stubs/MavenProjectStub.java b/src/test/java/org/apache/commons/release/plugin/stubs/MavenProjectStub.java deleted file mode 100644 index 3a7e104..0000000 --- a/src/test/java/org/apache/commons/release/plugin/stubs/MavenProjectStub.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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.commons.release.plugin.stubs; - -public class MavenProjectStub { -} http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java b/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java deleted file mode 100644 index 95d9137..0000000 --- a/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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.commons.release.plugin.stubs; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/resources/mojos/detatch-distributions/detatch-distributions.xml ---------------------------------------------------------------------- diff --git a/src/test/resources/mojos/detatch-distributions/detatch-distributions.xml b/src/test/resources/mojos/detatch-distributions/detatch-distributions.xml new file mode 100644 index 0000000..c7e399b --- /dev/null +++ b/src/test/resources/mojos/detatch-distributions/detatch-distributions.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + + org.apache.commons.plugin.my.unit + compress-site-test + 1.0-SNAPSHOT + jar + Test MyMojo + + + + junit + junit + 3.8.1 + test + + + + + + org.apache.commons + commons-release-plugin + + target/commons-release-plugin + ${basedir}/target/test-classes/mojos/compress-site/example-site + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/resources/mojos/detatch-distributions/target/mockAttachedFile.html ---------------------------------------------------------------------- diff --git a/src/test/resources/mojos/detatch-distributions/target/mockAttachedFile.html b/src/test/resources/mojos/detatch-distributions/target/mockAttachedFile.html new file mode 100644 index 0000000..c9a72dd --- /dev/null +++ b/src/test/resources/mojos/detatch-distributions/target/mockAttachedFile.html @@ -0,0 +1,24 @@ + + +
Mock maven site
+ +mock body + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/resources/mojos/detatch-distributions/target/mockAttachedTar.tar.gz ---------------------------------------------------------------------- diff --git a/src/test/resources/mojos/detatch-distributions/target/mockAttachedTar.tar.gz b/src/test/resources/mojos/detatch-distributions/target/mockAttachedTar.tar.gz new file mode 100644 index 0000000..dda7e6c Binary files /dev/null and b/src/test/resources/mojos/detatch-distributions/target/mockAttachedTar.tar.gz differ http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/5d4ab8c4/src/test/resources/mojos/detatch-distributions/target/mockAttachedZip.zip ---------------------------------------------------------------------- diff --git a/src/test/resources/mojos/detatch-distributions/target/mockAttachedZip.zip b/src/test/resources/mojos/detatch-distributions/target/mockAttachedZip.zip new file mode 100644 index 0000000..1f34188 Binary files /dev/null and b/src/test/resources/mojos/detatch-distributions/target/mockAttachedZip.zip differ