Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
92a51d2
#146 added jacoco
moritzLanger Nov 29, 2023
de35d63
Update build-pr.yml
moritzLanger Nov 29, 2023
3839f77
#146 added coverall action
moritzLanger Nov 29, 2023
241e3cb
#146 added Coverall
moritzLanger Nov 29, 2023
a1b1eea
#146 update build-pr
moritzLanger Nov 30, 2023
3bcc87e
Merge branch 'main' into feature/#146ImplemetAutomatedCoverageTool
moritzLanger Nov 30, 2023
f340e56
#146 Update build-pr.yml
moritzLanger Nov 30, 2023
58a4313
#146 Update build-pr.yml
moritzLanger Nov 30, 2023
cb897e3
Merge pull request #3 from moritzLanger/feature/#146ImplemetAutomated…
moritzLanger Nov 30, 2023
390b87d
Update HelpCommandlet.java
moritzLanger Nov 30, 2023
c31a9f6
Update HelpCommandlet.java
moritzLanger Nov 30, 2023
4e2d012
Update build.yml
moritzLanger Nov 30, 2023
7b01f93
Update build-pr.yml
moritzLanger Nov 30, 2023
4f4b79d
Update build.yml
moritzLanger Nov 30, 2023
9b154ba
Merge pull request #4 from moritzLanger/PRTestwithoutCovrage
moritzLanger Nov 30, 2023
89b6a1f
Update EnvironmentCommandletTest.java
moritzLanger Nov 30, 2023
a716225
Update HelpCommandletTest.java
moritzLanger Nov 30, 2023
ad1c68d
Update build-pr.yml
moritzLanger Nov 30, 2023
717bd17
Update build-pr.yml
moritzLanger Dec 4, 2023
feafcda
Create coverall.yml
moritzLanger Dec 4, 2023
1bd94f1
Update coverall.yml
moritzLanger Dec 4, 2023
f3e31fe
Update VersionSetCommandletTest.java
moritzLanger Dec 4, 2023
c6e7dc8
Create Testfile.asciidoc
moritzLanger Dec 5, 2023
2705527
Update build-pr.yml
moritzLanger Dec 5, 2023
ac289b1
Update coverall.yml
moritzLanger Dec 5, 2023
9748170
Merge pull request #6 from moritzLanger/PRTestwithoutCovrage
moritzLanger Dec 5, 2023
93a5346
Update build.yml
moritzLanger Dec 5, 2023
cbbad5f
Update build.yml
moritzLanger Dec 5, 2023
d1b79de
Update pom.xml
moritzLanger Dec 5, 2023
b13774d
Merge branch 'main' into testPRBranch
moritzLanger Dec 5, 2023
c764b81
Update PipUrlUpdaterTest.java
moritzLanger Dec 11, 2023
f64b5b9
Update PythonUrlUpdaterTest.java
moritzLanger Dec 11, 2023
f1df154
Update README.adoc
moritzLanger Dec 11, 2023
02eb663
Update README.adoc
moritzLanger Dec 11, 2023
469c535
Update README.adoc
moritzLanger Dec 11, 2023
883e759
Update README.adoc
moritzLanger Dec 11, 2023
90743ef
Update README.adoc
moritzLanger Dec 11, 2023
540a50d
Update README.adoc
moritzLanger Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ jobs:
java-version: '17'
- name: Build project with Maven
run: mvn -B -ntp -Dstyle.color=always install
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.2.3



7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ jobs:
java-version: '17'
- name: Build project with Maven
run: mvn -B -ntp -Dstyle.color=always install
- name: Deploy to OSSRH nexus
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dstyle.color=always -B -ntp deploy
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.2.3
1 change: 1 addition & 0 deletions .github/workflows/coverall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ image:https://img.shields.io/github/license/devonfw/IDEasy.svg?label=License["Ap
image:https://img.shields.io/maven-central/v/com.devonfw.tools.ide/ide-cli.svg?label=Maven%20Central["Maven Central",link=https://search.maven.org/search?q=g:com.devonfw.tools.ide]
image:https://github.com/devonfw/IDEasy/actions/workflows/build.yml/badge.svg["Build Status",link="https://github.com/devonfw/IDEasy/actions/workflows/build.yml"]
image:https://github.com/devonfw/IDEasy/actions/workflows/update-urls.yml/badge.svg["Update URLS Status",link="https://github.com/devonfw/IDEasy/actions/workflows/update-urls.yml"]
[![Coverage Status](https://coveralls.io/repos/github/moritzLanger/IDEasy/badge.svg?branch=main)](https://coveralls.io/github/moritzLanger/IDEasy?branch=main)


toc::[]

Expand Down
1 change: 1 addition & 0 deletions Testfile.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
T
19 changes: 19 additions & 0 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public String getName() {

return "help";
}

public String getNonCoverageName() {

return "notcovered";
}

@Override
public boolean isIdeHomeRequired() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class CommandletManagerResetter {
/**
* Make {@link CommandletManagerImpl#reset()} visible for testing.
*/

public static void reset() {

CommandletManagerImpl.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,6 @@
*/
public class EnvironmentCommandletTest extends AbstractIdeContextTest {

/**
* Test of {@link EnvironmentCommandlet#normalizeWindowsValue(String)} for Windows.
*/
@Test
public void testNormalizeWindowsValue2Windows() {

EnvironmentCommandlet env = new EnvironmentCommandlet(IdeTestContextMock.get());
assertThat(env.normalizeWindowsValue("")).isEqualTo("");
assertThat(env.normalizeWindowsValue("*")).isEqualTo("*");
assertThat(env.normalizeWindowsValue("$:\\\\{garbage}§")).isEqualTo("$:\\\\{garbage}§");
assertThat(env.normalizeWindowsValue("/c/Windows/system32/drivers/etc/hosts"))
.isEqualTo("C:\\Windows\\system32\\drivers\\etc\\hosts");
assertThat(env.normalizeWindowsValue("C:\\Windows\\system32\\drivers\\etc\\hosts"))
.isEqualTo("C:\\Windows\\system32\\drivers\\etc\\hosts");
assertThat(env.normalizeWindowsValue("C:\\Users\\login/.ide/scripts/ide"))
.isEqualTo("C:\\Users\\login\\.ide\\scripts\\ide");
assertThat(env.normalizeWindowsValue("\\login/.ide/scripts/ide")).isEqualTo("\\login/.ide/scripts/ide");
}

/**
* Test of {@link EnvironmentCommandlet#normalizeWindowsValue(String)} for (Git-)Bash.
*/
@Test
public void testNormalizeWindowsValue2Bash() {

EnvironmentCommandlet env = new EnvironmentCommandlet(IdeTestContextMock.get());
env.bash.setValue(true);
assertThat(env.normalizeWindowsValue("")).isEqualTo("");
assertThat(env.normalizeWindowsValue("*")).isEqualTo("*");
assertThat(env.normalizeWindowsValue("$:\\\\{garbage}§")).isEqualTo("$:\\\\{garbage}§");
assertThat(env.normalizeWindowsValue("C:\\Windows\\system32\\drivers\\etc\\hosts"))
.isEqualTo("/c/Windows/system32/drivers/etc/hosts");
assertThat(env.normalizeWindowsValue("/c/Windows/system32/drivers/etc/hosts"))
.isEqualTo("/c/Windows/system32/drivers/etc/hosts");
}

/**
* Test of {@link EnvironmentCommandlet#normalizeWindowsValue(VariableLine)} for Windows.
*/
@Test
public void testNormalizeWindowsLine() {

// arrange
VariableLine line = VariableLine.of(true, "MAGIC_PATH", "/c/Windows/system32/drivers/etc/hosts");
EnvironmentCommandlet env = new EnvironmentCommandlet(IdeTestContextMock.get());
// act
VariableLine normalized = env.normalizeWindowsValue(line);
// assert
assertThat(normalized.getValue()).isEqualTo("C:\\Windows\\system32\\drivers\\etc\\hosts");
assertThat(normalized.isExport()).isTrue();
assertThat(normalized.getName()).isEqualTo("MAGIC_PATH");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,80 +12,4 @@
* Integration test of {@link HelpCommandlet}.
*/
public class HelpCommandletTest extends AbstractIdeContextTest {

/**
* Test of {@link HelpCommandlet} does not require home.
*/
@Test
public void testThatHomeIsNotReqired() {

// arrange
IdeContext context = IdeTestContextMock.get();
// act
HelpCommandlet help = new HelpCommandlet(context);
// assert
assertThat(help.isIdeHomeRequired()).isEqualTo(false);
}

/**
* Test of {@link HelpCommandlet} run.
*/
@Test
public void testRun() {

// arrange
IdeTestContext context = IdeTestContext.of();
HelpCommandlet help = new HelpCommandlet(context);
// act
help.run();
// assert
assertLogoMessage(context);
assertLogMessage(context, IdeLogLevel.INFO, "Usage: ide [option]* [[commandlet] [arg]*]");
assertOptionLogMessages(context);
}

/**
* Test of {@link HelpCommandlet} run with a Commandlet.
*/
@Test
public void testRunWithCommandlet() {

// arrange
String path = "workspaces/foo-test/my-git-repo";
IdeTestContext context = newContext("basic", path, true);
HelpCommandlet help = context.getCommandletManager().getCommandlet(HelpCommandlet.class);
help.commandlet.setValueAsString("mvn");
// act
help.run();
// assert
assertLogoMessage(context);
assertLogMessage(context, IdeLogLevel.INFO, "Usage: ide [option]* mvn [<args>*]");
assertLogMessage(context, IdeLogLevel.INFO, "Tool commandlet for Maven (Build-Tool)");
assertOptionLogMessages(context);
}

/**
* Assertion for the options that should be displayed.
*/
private void assertOptionLogMessages(IdeTestContext context) {

assertLogMessage(context, IdeLogLevel.INFO, "--locale the locale (e.g. 'de' for German language)");
assertLogMessage(context, IdeLogLevel.INFO, "-b | --batch enable batch mode (non-interactive)");
assertLogMessage(context, IdeLogLevel.INFO, "-d | --debug enable debug logging");
assertLogMessage(context, IdeLogLevel.INFO, "-f | --force enable force mode");
assertLogMessage(context, IdeLogLevel.INFO,
"-o | --offline enable offline mode (skip updates or git pull, fail downloads or git clone)");
assertLogMessage(context, IdeLogLevel.INFO,
"-q | --quiet disable info logging (only log success, warning or error)");
assertLogMessage(context, IdeLogLevel.INFO, "-t | --trace enable trace logging");
assertLogMessage(context, IdeLogLevel.INFO, "-v | --version Print the IDE version and exit.");
}

/**
* Assertion for the IDE-Logo that should be displayed.
*/
private void assertLogoMessage(IdeTestContext context) {

assertLogMessage(context, IdeLogLevel.INFO, HelpCommandlet.LOGO);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,5 @@
*/
public class VersionSetCommandletTest extends AbstractIdeContextTest {

/**
* Test of {@link VersionSetCommandlet} run.
*
* @throws IOException on error.
*/
@Test
public void testVersionSetCommandletRun() throws IOException {

// arrange
String path = "workspaces/foo-test/my-git-repo";
IdeContext context = newContext("basic", path, true);
VersionSetCommandlet versionSet = context.getCommandletManager().getCommandlet(VersionSetCommandlet.class);
versionSet.tool.setValueAsString("mvn");
versionSet.version.setValueAsString("3.1.0");
// act
versionSet.run();
// assert
Path settingsIdeProperties = context.getSettingsPath().resolve("ide.properties");
assertThat(settingsIdeProperties).hasContent("""
#********************************************************************************
# This file contains project specific environment variables
#********************************************************************************

JAVA_VERSION=17*
MVN_VERSION=3.1.0
ECLIPSE_VERSION=2023-03
INTELLIJ_EDITION=ultimate

IDE_TOOLS=mvn,eclipse

BAR=bar-${SOME}
""");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,6 @@ public class PipUrlUpdaterTest extends AbstractUrlUpdaterTest {
@Test
public void testPipUrlUpdaterWithTextContentTypeWillSucceed(@TempDir Path tempDir) {

// given
stubFor(any(urlMatching("/pip/.*"))
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/plain").withBody("aBody")));

UrlRepository urlRepository = UrlRepository.load(tempDir);
PipUrlUpdaterMock updater = new PipUrlUpdaterMock();

String statusUrl = "http://localhost:8080/pip/1.0/get-pip.py";
String toolName = "pip";
String editionName = "pip";
String versionName = "1.0";

// when
updater.update(urlRepository);

Path versionsPath = tempDir.resolve(toolName).resolve(editionName).resolve(versionName);

// then
assertThat(versionsPath.resolve("status.json")).exists();

StatusJson statusJson = retrieveStatusJson(urlRepository, toolName, editionName, versionName);
UrlStatus urlStatus = statusJson.getOrCreateUrlStatus(statusUrl);
Instant successTimestamp = urlStatus.getSuccess().getTimestamp();

assertThat(successTimestamp).isNotNull();


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,6 @@ public class PythonUrlUpdaterTest extends Assertions {
@Test
public void testPythonURl(@TempDir Path tempPath) throws IOException {

// given
stubFor(get(urlMatching("/actions/python-versions/main/.*")).willReturn(aResponse().withStatus(200)
.withBody(Files.readAllBytes(Paths.get(testdataRoot).resolve("python-version.json")))));

stubFor(any(urlMatching("/actions/python-versions/releases/download.*"))
.willReturn(aResponse().withStatus(200).withBody("aBody")));

UrlRepository urlRepository = UrlRepository.load(tempPath);
PythonUrlUpdaterMock pythonUpdaterMock = new PythonUrlUpdaterMock();
pythonUpdaterMock.update(urlRepository);
Path pythonPath = tempPath.resolve("python").resolve("python").resolve("3.12.0-beta.2");

assertThat(pythonPath.resolve("status.json")).exists();
assertThat(pythonPath.resolve("linux_x64.urls")).exists();
assertThat(pythonPath.resolve("linux_x64.urls.sha256")).exists();
assertThat(pythonPath.resolve("mac_arm64.urls")).exists();
assertThat(pythonPath.resolve("mac_arm64.urls.sha256")).exists();
assertThat(pythonPath.resolve("windows_x64.urls")).exists();
assertThat(pythonPath.resolve("windows_x64.urls.sha256")).exists();


}
}
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@
<updatePomFile>true</updatePomFile>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down