Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/devonfw#13-im…
Browse files Browse the repository at this point in the history
…plement-ToolCommandlet-for-AWS-CLI

# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java
  • Loading branch information
MattesMrzik committed Jan 8, 2024
2 parents 70aef25 + 1d60d9c commit eaa85fc
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ jobs:
java-version: '17'
- name: Build project with Maven
run: mvn -B -ntp -Dstyle.color=always install
- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ jobs:
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/[email protected]
1 change: 1 addition & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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"]
image:https://coveralls.io/repos/github/devonfw/IDEasy/badge.svg?branch=main["Coverage Status",link="https://coveralls.io/github/devonfw/IDEasy?branch=main"]

toc::[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,9 @@ public <O> O question(String question, O... options) {
assert (options.length >= 2);
interaction(question);
Map<String, O> mapping = new HashMap<>(options.length);
int i = 1;
int i = 0;
for (O option : options) {
i++;
String key = "" + option;
addMapping(mapping, key, option);
String numericKey = Integer.toString(i);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.devonfw.tools.ide.commandlet;

import java.util.Locale;

import org.junit.jupiter.api.Test;

import com.devonfw.tools.ide.context.AbstractIdeContext;
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeContextConsole;

public class ContextCommandletTest extends AbstractIdeContextTest {

/**
* Test of {@link ContextCommandlet} has name context.
*/
@Test
public void testNameIsContext(){
//arrange
ContextCommandlet cxt = new ContextCommandlet();
//act & assert
assertThat(cxt.getName()).isEqualTo("context");
}

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

// arrange
ContextCommandlet cxt = new ContextCommandlet();
//act & assert
assertThat(cxt.isIdeHomeRequired()).isFalse();
}

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

// arrange
ContextCommandlet cxt = new ContextCommandlet();
// act
cxt.run();
// assert
assertThat(cxt.getIdeContext()).isInstanceOf(IdeContextConsole.class);
assertThat(cxt.getIdeContext().isForceMode()).isFalse();
assertThat(cxt.getIdeContext().isBatchMode()).isFalse();
assertThat(cxt.getIdeContext().isQuietMode()).isFalse();
assertThat(cxt.getIdeContext().isOfflineMode()).isFalse();
assertThat(cxt.getIdeContext().getLocale()).isEqualTo(Locale.getDefault());

}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.devonfw.tools.ide.commandlet;

import com.devonfw.tools.ide.context.IdeContext;
import org.junit.jupiter.api.Test;

import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.context.IdeTestContextMock;
import com.devonfw.tools.ide.environment.VariableLine;
import com.devonfw.tools.ide.log.IdeLogLevel;

/**
* Test of {@link EnvironmentCommandlet}.
Expand Down Expand Up @@ -64,4 +67,38 @@ public void testNormalizeWindowsLine() {
assertThat(normalized.getName()).isEqualTo("MAGIC_PATH");
}

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

// arrange
String path = "workspaces/foo-test/my-git-repo";
IdeTestContext context = newContext("basic", path, false);
EnvironmentCommandlet env = context.getCommandletManager().getCommandlet(EnvironmentCommandlet.class);
// act
env.run();
// assert
assertLogMessage(context, IdeLogLevel.INFO, "MVN_VERSION=3.9.*");
assertLogMessage(context, IdeLogLevel.INFO, "SOME=some-${UNDEFINED}");
assertLogMessage(context, IdeLogLevel.INFO, "BAR=bar-some-${UNDEFINED}");
assertLogMessage(context, IdeLogLevel.INFO, "IDE_TOOLS=mvn,eclipse");
assertLogMessage(context, IdeLogLevel.INFO, "ECLIPSE_VERSION=2023-03");
assertLogMessage(context, IdeLogLevel.INFO, "FOO=foo-bar-some-${UNDEFINED}");
assertLogMessage(context, IdeLogLevel.INFO, "JAVA_VERSION=17*");
assertLogMessage(context, IdeLogLevel.INFO, "INTELLIJ_EDITION=ultimate");
assertLogMessage(context, IdeLogLevel.INFO, "DOCKER_EDITION=docker");
}
/**
* Test of {@link EnvironmentCommandlet} does not require home.
*/
@Test
public void testThatHomeIsNotReqired() {

// arrange
EnvironmentCommandlet env = new EnvironmentCommandlet(IdeTestContextMock.get());
// act & assert
assertThat(env.isIdeHomeRequired()).isFalse();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void testThatHomeIsNotReqired() {
// act
HelpCommandlet help = new HelpCommandlet(context);
// assert
assertThat(help.isIdeHomeRequired()).isEqualTo(false);
assertThat(help.isIdeHomeRequired()).isFalse();
}

/**
Expand Down
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

0 comments on commit eaa85fc

Please sign in to comment.