diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/DeleteRepoNativeIT.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/DeleteRepoNativeIT.java new file mode 100644 index 00000000..ccb289b1 --- /dev/null +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/DeleteRepoNativeIT.java @@ -0,0 +1,52 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed 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.mvndaemon.mvnd.it; + +import java.io.IOException; +import java.nio.file.Path; +import javax.inject.Inject; +import org.junit.jupiter.api.Test; +import org.mvndaemon.mvnd.assertj.TestClientOutput; +import org.mvndaemon.mvnd.client.Client; +import org.mvndaemon.mvnd.client.DaemonParameters; +import org.mvndaemon.mvnd.common.Os; +import org.mvndaemon.mvnd.junit.MvndNativeTest; +import org.mvndaemon.mvnd.junit.TestUtils; + +@MvndNativeTest(projectDir = "src/test/projects/delete-repo") +public class DeleteRepoNativeIT { + + @Inject + Client client; + + @Inject + DaemonParameters parameters; + + @Test + void buildDeleteRepoAndRebuild() throws IOException, InterruptedException { + final Path localMavenRepo = parameters.mavenRepoLocal(); + TestUtils.deleteDir(localMavenRepo); + + final TestClientOutput o1 = new TestClientOutput(); + client.execute(o1, "clean", "install", "-e", "-B").assertSuccess(); + + TestUtils.deleteDir(localMavenRepo, Os.current() != Os.WINDOWS); + + final TestClientOutput o2 = new TestClientOutput(); + client.execute(o2, "clean", "install", "-e", "-B").assertSuccess(); + } + +} diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/DeleteRepoTest.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/DeleteRepoTest.java new file mode 100644 index 00000000..3545def3 --- /dev/null +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/DeleteRepoTest.java @@ -0,0 +1,23 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed 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.mvndaemon.mvnd.it; + +import org.mvndaemon.mvnd.junit.MvndTest; + +@MvndTest(projectDir = "src/test/projects/delete-repo") +public class DeleteRepoTest extends DeleteRepoNativeIT { + +} diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java index e627e606..2b662f8b 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java @@ -29,9 +29,7 @@ import org.mvndaemon.mvnd.assertj.TestClientOutput; import org.mvndaemon.mvnd.client.Client; import org.mvndaemon.mvnd.client.DaemonParameters; import org.mvndaemon.mvnd.common.Message; -import org.mvndaemon.mvnd.common.Os; import org.mvndaemon.mvnd.junit.MvndNativeTest; -import org.mvndaemon.mvnd.junit.TestUtils; @MvndNativeTest(projectDir = "src/test/projects/single-module") public class SingleModuleNativeIT { @@ -83,20 +81,6 @@ public class SingleModuleNativeIT { } - @Test - void buildDeleteRepoAndRebuild() throws IOException, InterruptedException { - final Path localMavenRepo = parameters.mavenRepoLocal(); - TestUtils.deleteDir(localMavenRepo); - - final TestClientOutput o1 = new TestClientOutput(); - client.execute(o1, "clean", "install", "-e", "-B").assertSuccess(); - - TestUtils.deleteDir(localMavenRepo, Os.current() != Os.WINDOWS); - - final TestClientOutput o2 = new TestClientOutput(); - client.execute(o2, "clean", "install", "-e", "-B").assertSuccess(); - } - protected void assertJVM(TestClientOutput o, Properties props) { /* implemented in the subclass */ } diff --git a/integration-tests/src/test/projects/delete-repo/.mvn/maven.config b/integration-tests/src/test/projects/delete-repo/.mvn/maven.config new file mode 100644 index 00000000..4230c241 --- /dev/null +++ b/integration-tests/src/test/projects/delete-repo/.mvn/maven.config @@ -0,0 +1,3 @@ +-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 +-Dmaven.wagon.http.retryHandler.requestSentEnabled=true +-Dmaven.wagon.http.retryHandler.count=10 diff --git a/integration-tests/src/test/projects/delete-repo/pom.xml b/integration-tests/src/test/projects/delete-repo/pom.xml new file mode 100644 index 00000000..879cf5db --- /dev/null +++ b/integration-tests/src/test/projects/delete-repo/pom.xml @@ -0,0 +1,91 @@ + + + + 4.0.0 + org.mvndaemon.mvnd.test.delete-repo + delete-repo + 0.0.1-SNAPSHOT + jar + + + UTF-8 + 1.8 + 1.8 + + 2.5 + 3.8.0 + 2.4 + 2.6 + 2.22.2 + + + + + org.junit.jupiter + junit-jupiter-engine + 5.6.2 + test + + + + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven-clean-plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.apache.maven.plugins + maven-install-plugin + ${maven-install-plugin.version} + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + false + false + reuseCreated + + + + + + \ No newline at end of file diff --git a/integration-tests/src/test/projects/delete-repo/src/main/java/org/mvndaemon/mvnd/test/single/module/Hello.java b/integration-tests/src/test/projects/delete-repo/src/main/java/org/mvndaemon/mvnd/test/single/module/Hello.java new file mode 100644 index 00000000..29d4e585 --- /dev/null +++ b/integration-tests/src/test/projects/delete-repo/src/main/java/org/mvndaemon/mvnd/test/single/module/Hello.java @@ -0,0 +1,24 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed 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.mvndaemon.mvnd.test.single.module; + +public class Hello { + + public String sayHello() { + return "Hello"; + } + +} diff --git a/integration-tests/src/test/projects/delete-repo/src/test/java/org/mvndaemon/mvnd/test/single/module/HelloTest.java b/integration-tests/src/test/projects/delete-repo/src/test/java/org/mvndaemon/mvnd/test/single/module/HelloTest.java new file mode 100644 index 00000000..601274c6 --- /dev/null +++ b/integration-tests/src/test/projects/delete-repo/src/test/java/org/mvndaemon/mvnd/test/single/module/HelloTest.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed 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.mvndaemon.mvnd.test.single.module; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class HelloTest { + @Test + void hello() throws IOException { + final String actual = new Hello().sayHello(); + Files.write(Paths.get("target/hello.txt"), actual.getBytes(StandardCharsets.UTF_8)); + Assertions.assertEquals("Hello", actual); + } +}