forked from devonfw/IDEasy
-
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.
devonfw#991: Introduce dependencies.json for gradle
Fixes devonfw#991 Removed method "installDependencies Added test-json dependencies.json Added GradleTest and necessary resources Changed permissions to git execute in files
- Loading branch information
Showing
10 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
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
72 changes: 72 additions & 0 deletions
72
cli/src/test/java/com/devonfw/tools/ide/tool/gradle/GradleTest.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,72 @@ | ||
package com.devonfw.tools.ide.tool.gradle; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.devonfw.tools.ide.commandlet.InstallCommandlet; | ||
import com.devonfw.tools.ide.context.AbstractIdeContextTest; | ||
import com.devonfw.tools.ide.context.IdeTestContext; | ||
|
||
/** | ||
* Integration test of {@link Gradle}. | ||
*/ | ||
public class GradleTest extends AbstractIdeContextTest { | ||
|
||
//*insert | ||
|
||
private static final String PROJECT_GRADLE = "gradle"; | ||
private static final String GRADLE_VERSION = "8.7"; | ||
|
||
/** | ||
* Tests the installation of {@link Gradle} | ||
* | ||
* @throws IOException if an I/O error occurs during the installation process | ||
*/ | ||
@Test | ||
public void testgradleInstall() throws IOException { | ||
|
||
// arrange | ||
IdeTestContext context = newContext(PROJECT_GRADLE); | ||
InstallCommandlet install = context.getCommandletManager().getCommandlet(InstallCommandlet.class); | ||
install.tool.setValueAsString("gradle", context); | ||
|
||
// act | ||
install.run(); | ||
|
||
// assert | ||
checkInstallation(context); | ||
} | ||
|
||
/** | ||
* Tests the execution of {@link Gradle} | ||
* | ||
* @throws IOException if an I/O error occurs during the installation process | ||
*/ | ||
@Test | ||
public void testGradleRun() throws IOException { | ||
// arrange | ||
IdeTestContext context = newContext(PROJECT_GRADLE); | ||
InstallCommandlet install = context.getCommandletManager().getCommandlet(InstallCommandlet.class); | ||
install.tool.setValueAsString("gradle", context); | ||
Gradle commandLet = (Gradle) install.tool.getValue(); | ||
commandLet.arguments.addValue("foo"); | ||
commandLet.arguments.addValue("bar"); | ||
|
||
// act | ||
commandLet.run(); | ||
|
||
// assert | ||
assertThat(context).logAtInfo().hasMessage("gradle " + "foo bar"); | ||
checkInstallation(context); | ||
} | ||
|
||
private void checkInstallation(IdeTestContext context) throws IOException { | ||
|
||
assertThat(context.getSoftwarePath().resolve("java/bin/java")).exists(); | ||
|
||
assertThat(context.getSoftwarePath().resolve("gradle/.ide.software.version")).exists().hasContent(GRADLE_VERSION); | ||
assertThat(context).logAtSuccess().hasMessage("Successfully installed gradle in version " + GRADLE_VERSION); | ||
|
||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
cli/src/test/resources/ide-projects/build/_ide/urls/gradle/gradle/dependencies.json
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,8 @@ | ||
{ | ||
"[8.5,8.8)": [ | ||
{ | ||
"tool": "java", | ||
"versionRange": "[17,)" | ||
} | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
cli/src/test/resources/ide-projects/gradle/_ide/urls/gradle/dependencies.json
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,8 @@ | ||
{ | ||
"[8.5,8.8)": [ | ||
{ | ||
"tool": "java", | ||
"versionRange": "[17,)" | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
cli/src/test/resources/ide-projects/gradle/_ide/urls/gradle/gradle/8.7/urls
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 @@ | ||
${testbaseurl}/download/gradle/gradle/8.7/gradle-8.7.tgz |
1 change: 1 addition & 0 deletions
1
cli/src/test/resources/ide-projects/gradle/_ide/urls/java/java/17.0.10_7/urls
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 @@ | ||
${testbaseurl}/download/java/java/17.0.10_7/java-17.0.10_7.tgz |
2 changes: 2 additions & 0 deletions
2
cli/src/test/resources/ide-projects/gradle/project/settings/ide.properties
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,2 @@ | ||
JAVA_VERSION=17.0.10_7 | ||
GRADLE_VERSION=8.7 |
Empty file.
2 changes: 2 additions & 0 deletions
2
cli/src/test/resources/ide-projects/gradle/repository/gradle/gradle/default/bin/gradle
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,2 @@ | ||
#!/bin/bash | ||
echo "gradle $*" |
2 changes: 2 additions & 0 deletions
2
cli/src/test/resources/ide-projects/gradle/repository/java/java/default/bin/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,2 @@ | ||
#!/bin/bash | ||
echo java $* |