-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.devonfw.tools.ide.commandlet.FileExtractor; | ||
|
||
enum ExtractorFileType { | ||
ZIP, JAR, DMG, MSI, PKG | ||
ZIP, JAR, DMG, MSI, PKG, TAR, GZ, TGZ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,64 @@ | ||
package com.devonfw.tools.ide.tool.npm; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.devonfw.tools.ide.commandlet.CommandLetExtractorMock; | ||
import com.devonfw.tools.ide.context.AbstractIdeContextTest; | ||
import com.devonfw.tools.ide.context.IdeContext; | ||
import com.devonfw.tools.ide.context.IdeTestContext; | ||
import com.devonfw.tools.ide.log.IdeLogLevel; | ||
import com.devonfw.tools.ide.repo.ToolRepositoryMock; | ||
|
||
public class NpmTest extends AbstractIdeContextTest { | ||
|
||
@Test | ||
public void npmPostInstallShouldMoveFiles() throws IOException { | ||
// arrange | ||
String path = "workspaces/foo-test/my-git-repo"; | ||
String projectTestCaseName = "npm"; | ||
|
||
ToolRepositoryMock toolRepositoryMock = buildToolRepositoryMockForNpm(projectTestCaseName); | ||
|
||
IdeContext context = newContext(projectTestCaseName, path, true, toolRepositoryMock); | ||
toolRepositoryMock.setContext(context); | ||
|
||
CommandLetExtractorMock commandLetExtractorMock = new CommandLetExtractorMock(context); | ||
Npm commandlet = new Npm(context); | ||
commandlet.setCommandletFileExtractor(commandLetExtractorMock); | ||
|
||
assertThat(context.getSoftwarePath().resolve("node/npm")).hasContent("# This is npm"); | ||
assertThat(context.getSoftwarePath().resolve("node/npx")).hasContent("# This is npx"); | ||
|
||
// act | ||
commandlet.install(); | ||
|
||
// assert | ||
String expectedMessage = "Successfully installed npm in version 9.9.2"; | ||
assertLogMessage((IdeTestContext) context, IdeLogLevel.SUCCESS, expectedMessage, false); | ||
if (context.getSystemInfo().isWindows()) { | ||
Path test = context.getSoftwarePath(); | ||
assertThat(context.getSoftwarePath().resolve("node/npm")).exists(); | ||
assertThat(context.getSoftwarePath().resolve("node/npm.cmd")).exists(); | ||
assertThat(context.getSoftwarePath().resolve("node/npx")).exists(); | ||
assertThat(context.getSoftwarePath().resolve("node/npx.cmd")).exists(); | ||
|
||
assertThat(context.getSoftwarePath().resolve("node/npm")).hasContent("# This is npm bin"); | ||
assertThat(context.getSoftwarePath().resolve("node/npx")).hasContent("# This is npx bin"); | ||
} | ||
} | ||
|
||
private static ToolRepositoryMock buildToolRepositoryMockForNpm(String projectTestCaseName) { | ||
|
||
String windowsFileFolder = "npm-9.9.2"; | ||
|
||
ToolRepositoryMock toolRepositoryMock = new ToolRepositoryMock("npm", "9.9.2", projectTestCaseName, | ||
windowsFileFolder, "", ""); | ||
|
||
toolRepositoryMock.addAlreadyInstalledTool("node", "v18.19.1"); | ||
|
||
return toolRepositoryMock; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.19.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This is npm |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo Dummy npm 9.9.2 on windows> npmTestResult.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This is npx |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo Dummy npx on windows> npxTestResult.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the tool repository |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
readme |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dummy text file |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# node-gyp |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo Dummy node-gyp> nodeGypTestResult.txt |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#******************************************************************************** | ||
# This file contains project specific environment variables defined by the user | ||
#******************************************************************************** | ||
|
||
M2_REPO=~/.m2/repository | ||
|
||
SOME=some-${UNDEFINED} | ||
|
||
TEST_ARGS1=${TEST_ARGS1} conf1 | ||
TEST_ARGS2=${TEST_ARGS2} conf2 | ||
TEST_ARGS5=${TEST_ARGS5} conf5 | ||
TEST_ARGS6=${TEST_ARGS6} conf6 | ||
TEST_ARGS7=${TEST_ARGS7} conf7 | ||
TEST_ARGS8=${TEST_ARGS8} conf8 | ||
TEST_ARGSa=${TEST_ARGS1} ${TEST_ARGS3} confa | ||
TEST_ARGSc=${TEST_ARGSc} confc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#******************************************************************************** | ||
# This file contains the global configuration from the user HOME directory. | ||
#******************************************************************************** | ||
|
||
DOCKER_EDITION=docker | ||
FOO=foo-${BAR} | ||
|
||
TEST_ARGS1=${TEST_ARGS1} user1 | ||
TEST_ARGS2=${TEST_ARGS2} user2 | ||
TEST_ARGS3=${TEST_ARGS3} user3 | ||
TEST_ARGS7=user7 | ||
TEST_ARGS10=user10 | ||
TEST_ARGSb=userb | ||
TEST_ARGSc=${TEST_ARGS1} userc | ||
TEST_ARGSd=${TEST_ARGS1} userd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugin_url=https://raw.githubusercontent.com/iloveeclipse/plugins/latest/ | ||
plugin_id=AnyEditTools.feature.group | ||
plugin_active=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the download cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the users HOME directory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the IDE_HOME directory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
the IDE CLI bash script |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugin_url=https://raw.githubusercontent.com/iloveeclipse/plugins/latest/ | ||
plugin_id=AnyEditTools.feature.group | ||
plugin_active=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugin_url=https://checkstyle.org/eclipse-cs-update-site | ||
plugin_id=net.sf.eclipsecs.feature.group | ||
plugin_active=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#******************************************************************************** | ||
# This file contains project specific environment variables | ||
#******************************************************************************** | ||
|
||
JAVA_VERSION=17* | ||
MVN_VERSION=3.9.* | ||
ECLIPSE_VERSION=2023-03 | ||
INTELLIJ_EDITION=ultimate | ||
|
||
IDE_TOOLS=mvn,eclipse | ||
|
||
BAR=bar-${SOME} | ||
|
||
TEST_ARGS1=${TEST_ARGS1} settings1 | ||
TEST_ARGS4=${TEST_ARGS4} settings4 | ||
TEST_ARGS5=${TEST_ARGS5} settings5 | ||
TEST_ARGS6=${TEST_ARGS6} settings6 | ||
TEST_ARGS7=${TEST_ARGS7} settings7 | ||
TEST_ARGS8=settings8 | ||
TEST_ARGS9=settings9 | ||
TEST_ARGSb=${TEST_ARGS10} settingsb ${TEST_ARGSa} ${TEST_ARGSb} | ||
TEST_ARGSc=${TEST_ARGSc} settingsc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
just a marker for detection of IDE_HOME |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.19.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This is npm |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo Dummy npm 9.9.2 on windows> npmTestResult.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This is npx |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo Dummy npx on windows> npxTestResult.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#******************************************************************************** | ||
# Type of {@link EnvironmentVariables} from the | ||
# {@link com.devonfw.tools.ide.context.IdeContext#getWorkspacePath() workspace directory}. | ||
#******************************************************************************** | ||
TEST_ARGS1=${TEST_ARGS1} workspace1 | ||
TEST_ARGS3=${TEST_ARGS3} workspace3 | ||
TEST_ARGS6=${TEST_ARGS6} workspace6 | ||
TEST_ARGS7=${TEST_ARGS7} workspace7 | ||
TEST_ARGS8=${TEST_ARGS8} workspace8 | ||
TEST_ARGS9=${TEST_ARGS9} workspace9 | ||
TEST_ARGS10=${TEST_ARGS10} workspace10 | ||
TEST_ARGSd=${TEST_ARGSd} workspaced |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
my-git-repo in foo-test workspace of jmc test case |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the foo-test workspace of jmc test case |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the main workspace of jmc test case |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the IDE_ROOT directory |