Skip to content

Commit 2339c25

Browse files
#207: refactor test folder structure (#211)
1 parent 1bc5c6a commit 2339c25

File tree

45 files changed

+34
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+34
-19
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
.*
88
!.gitignore
99
!.ide.software.version
10+
!.devon.software.version
11+
!.ide
12+
!.anyedit.properties
13+
!.ide.properties
1014
target/
1115
eclipse-target/
1216
generated/

cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeContextTest.java

+16-15
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,47 @@ public abstract class AbstractIdeContextTest extends Assertions {
3232
private static final int CHUNK_SIZE = 1024;
3333

3434
/**
35-
* @param projectName the (folder)name of the test project in {@link #PATH_PROJECTS}. E.g. "basic".
35+
* @param projectTestCaseName the (folder)name of the project test case, in this folder a 'project' folder represents
36+
* the test project in {@link #PATH_PROJECTS}. E.g. "basic".
3637
* @return the {@link IdeTestContext} pointing to that project.
3738
*/
38-
protected IdeTestContext newContext(String projectName) {
39+
protected IdeTestContext newContext(String projectTestCaseName) {
3940

40-
return newContext(projectName, null, true);
41+
return newContext(projectTestCaseName, null, true);
4142
}
4243

4344
/**
44-
* @param projectName the (folder)name of the test project in {@link #PATH_PROJECTS}. E.g. "basic".
45+
* @param projectTestCaseName the (folder)name of the project test case, in this folder a 'project' folder represents
46+
* the test project in {@link #PATH_PROJECTS}. E.g. "basic".
4547
* @param projectPath the relative path inside the test project where to create the context.
4648
* @return the {@link IdeTestContext} pointing to that project.
4749
*/
48-
protected static IdeTestContext newContext(String projectName, String projectPath) {
50+
protected static IdeTestContext newContext(String projectTestCaseName, String projectPath) {
4951

50-
return newContext(projectName, projectPath, true);
52+
return newContext(projectTestCaseName, projectPath, true);
5153
}
5254

5355
/**
54-
* @param projectName the (folder)name of the test project in {@link #PATH_PROJECTS}. E.g. "basic".
56+
* @param projectTestCaseName the (folder)name of the project test case, in this folder a 'project' folder represents
57+
* the test project in {@link #PATH_PROJECTS}. E.g. "basic".
5558
* @param projectPath the relative path inside the test project where to create the context.
5659
* @param copyForMutation - {@code true} to create a copy of the project that can be modified by the test,
5760
* {@code false} otherwise (only to save resources if you are 100% sure that your test never modifies anything
58-
* in that project.
61+
* in that project.)
5962
* @return the {@link IdeTestContext} pointing to that project.
6063
*/
61-
protected static IdeTestContext newContext(String projectName, String projectPath, boolean copyForMutation) {
64+
protected static IdeTestContext newContext(String projectTestCaseName, String projectPath, boolean copyForMutation) {
6265

63-
Path sourceDir = PATH_PROJECTS.resolve(projectName);
64-
Path userDir = sourceDir;
66+
Path sourceDir = PATH_PROJECTS.resolve(projectTestCaseName);
67+
Path userDir = sourceDir.resolve("project");
6568
IdeTestContext context;
6669
if (copyForMutation) {
67-
Path projectDir = PATH_PROJECTS_COPY.resolve(projectName);
70+
Path projectDir = PATH_PROJECTS_COPY.resolve(projectTestCaseName);
6871
FileAccess fileAccess = new FileAccessImpl(IdeTestContextMock.get());
6972
fileAccess.delete(projectDir);
7073
fileAccess.mkdirs(PATH_PROJECTS_COPY);
7174
fileAccess.copy(sourceDir, projectDir, FileCopyMode.COPY_TREE_OVERRIDE_TREE);
72-
fileAccess.copy(PATH_PROJECTS.resolve(IdeContext.FOLDER_IDE), PATH_PROJECTS_COPY.resolve(IdeContext.FOLDER_IDE),
73-
FileCopyMode.COPY_TREE_OVERRIDE_TREE);
74-
userDir = projectDir;
75+
userDir = projectDir.resolve("project");
7576
}
7677
if (projectPath != null) {
7778
userDir = userDir.resolve(projectPath);

cli/src/test/java/com/devonfw/tools/ide/merge/DirectoryMergerTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
*/
1818
public class DirectoryMergerTest extends AbstractIdeContextTest {
1919

20-
private static final String IDE_HOME = PATH_PROJECTS.resolve(PROJECT_BASIC).toAbsolutePath().toString().replace('\\',
21-
'/');
20+
private static final String IDE_HOME = PATH_PROJECTS.resolve(PROJECT_BASIC).resolve("project").toAbsolutePath()
21+
.toString().replace('\\', '/');
2222

2323
private static final Prop JAVA_VERSION = new Prop("java.version", "1.11");
2424

cli/src/test/resources/ide-projects/_ide/urls/mvn/secondMvnEdition/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
"manual" : false,
3+
"urls" : {
4+
"-997329125" : {
5+
"success" : {
6+
"timestamp" : "2023-04-28T07:12:26.601818Z"
7+
}
8+
}
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is the IDE_HOME directory
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
this is the IDE_HOME directory
1+
this is the IDE_ROOT directory

cli/src/test/resources/ide-projects/readme

-1
This file was deleted.

0 commit comments

Comments
 (0)