forked from apache/maven-mvnd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
560 additions
and
0 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleNativeIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* 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.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.StandardCopyOption; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import javax.inject.Inject; | ||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.mvndaemon.mvnd.assertj.TestClientOutput; | ||
import org.mvndaemon.mvnd.client.Client; | ||
import org.mvndaemon.mvnd.common.DaemonInfo; | ||
import org.mvndaemon.mvnd.junit.ClientFactory; | ||
import org.mvndaemon.mvnd.junit.MvndNativeTest; | ||
import org.mvndaemon.mvnd.junit.TestParameters; | ||
import org.mvndaemon.mvnd.junit.TestRegistry; | ||
|
||
@MvndNativeTest(projectDir = "src/test/projects/new-managed-module") | ||
public class NewManagedModuleNativeIT { | ||
|
||
@Inject | ||
TestParameters parameters; | ||
|
||
@Inject | ||
TestRegistry registry; | ||
|
||
@Inject | ||
ClientFactory clientFactory; | ||
|
||
@Test | ||
void upgrade() throws IOException, InterruptedException { | ||
Assertions.assertThat(registry.getAll().size()).isEqualTo(0); | ||
|
||
/* Build the initial state of the test project */ | ||
final Path parentDir = parameters.getTestDir().resolve("project/parent"); | ||
final Client cl = clientFactory.newClient(parameters.cd(parentDir)); | ||
{ | ||
final TestClientOutput output = new TestClientOutput(); | ||
cl.execute(output, "clean", "install", "-e").assertSuccess(); | ||
} | ||
Assertions.assertThat(registry.getAll().size()).isEqualTo(1); | ||
|
||
final DaemonInfo d = registry.getAll().get(0); | ||
/* Wait, till the instance becomes idle */ | ||
registry.awaitIdle(d.getUid()); | ||
|
||
/* Do the changes */ | ||
final Path srcDir = parentDir.resolve("../changes").normalize(); | ||
try (Stream<Path> files = Files.walk(srcDir)) { | ||
files.forEach(source -> { | ||
final Path relPath = srcDir.relativize(source); | ||
final Path dest = parentDir.resolve(relPath); | ||
try { | ||
if (Files.isDirectory(source)) { | ||
Files.createDirectories(dest); | ||
} else { | ||
Files.createDirectories(dest.getParent()); | ||
Files.copy(source, dest, StandardCopyOption.REPLACE_EXISTING); | ||
} | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
}); | ||
} | ||
|
||
/* Build again */ | ||
{ | ||
final TestClientOutput output = new TestClientOutput(); | ||
cl.execute(output, "clean", "install", "-e", "-B").assertSuccess(); | ||
|
||
final List<String> messagesToString = output.messagesToString(); | ||
Assertions.assertThat(messagesToString.stream().noneMatch(m -> m.contains("[ERROR]"))) | ||
.withFailMessage("Should contain no errors:\n %s", | ||
messagesToString.stream().collect(Collectors.joining("\n "))) | ||
.isTrue(); | ||
} | ||
Assertions.assertThat(registry.getAll().size()).isEqualTo(1); | ||
|
||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/new-managed-module") | ||
public class NewManagedModuleTest extends NewManagedModuleNativeIT { | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
integration-tests/src/test/projects/new-managed-module/changes/bom/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>new-managed-module-bom</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<new-managed-module.version>0.0.1-SNAPSHOT</new-managed-module.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-module</artifactId> | ||
<version>${new-managed-module.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-new-module</artifactId> | ||
<version>${new-managed-module.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
</project> |
49 changes: 49 additions & 0 deletions
49
integration-tests/src/test/projects/new-managed-module/changes/module/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>new-managed-module-module</artifactId> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-bom</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-new-module</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
26 changes: 26 additions & 0 deletions
26
...le/changes/module/src/main/java/org/mvndaemon/mvnd/test/upgrades/bom/module/UseHello.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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.upgrades.bom.module; | ||
|
||
import org.mvndaemon.mvnd.test.upgrades.nw.module.Hello; | ||
|
||
public class UseHello { | ||
|
||
public void use() { | ||
System.out.println(new Hello().hi()); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
integration-tests/src/test/projects/new-managed-module/changes/new-module/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>new-managed-module-new-module</artifactId> | ||
|
||
</project> |
24 changes: 24 additions & 0 deletions
24
...le/changes/new-module/src/main/java/org/mvndaemon/mvnd/test/upgrades/nw/module/Hello.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.upgrades.nw.module; | ||
|
||
public class Hello { | ||
|
||
public String hi() { | ||
return "Hi"; | ||
} | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
integration-tests/src/test/projects/new-managed-module/changes/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.mvndaemon.mvnd.test.new-managed-module</groupId> | ||
<artifactId>new-managed-module-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
|
||
<maven-clean-plugin.version>2.5</maven-clean-plugin.version> | ||
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> | ||
<maven-install-plugin.version>2.4</maven-install-plugin.version> | ||
<maven-resources-plugin.version>2.6</maven-resources-plugin.version> | ||
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version> | ||
</properties> | ||
|
||
<modules> | ||
<module>bom</module> | ||
<module>module</module> | ||
<module>new-module</module> | ||
</modules> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>${maven-clean-plugin.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven-compiler-plugin.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>${maven-install-plugin.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>${maven-resources-plugin.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${maven-surefire-plugin.version}</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
</project> |
Empty file.
Oops, something went wrong.