Skip to content

Commit

Permalink
#657: fix installation of java 8 (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Sep 30, 2024
1 parent 805f545 commit 92c5425
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/655[#655]: CVE-2024-26308 and library updates
* https://github.com/devonfw/IDEasy/issues/627[#627]: Still log messages break processable command output
* https://github.com/devonfw/IDEasy/issues/663[#663]: Endless loop when installing Eclipse in force mode
* https://github.com/devonfw/IDEasy/issues/657[#657]: Cannot install Java 8

The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/13?closed=1[milestone 2024.09.002].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.devonfw.tools.ide.property.ToolProperty;
import com.devonfw.tools.ide.property.VersionProperty;
import com.devonfw.tools.ide.tool.ToolCommandlet;
import com.devonfw.tools.ide.validation.ValidationState;
import com.devonfw.tools.ide.version.VersionIdentifier;

/**
Expand All @@ -30,12 +29,7 @@ public InstallCommandlet(IdeContext context) {
super(context);
addKeyword(getName());
this.tool = add(new ToolProperty("", true, "tool"));
this.version = add(new VersionProperty("", false, "version",
(v, state) -> {
if (!v.isValid()) {
state.addErrorMessage("Given version " + v + " is not a valid version");
}
}));
this.version = add(new VersionProperty("", false, "version"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ protected void createStartScript(Path targetDir, String binary, boolean backgrou
}
Path bashFile = binFolder.resolve(getName());
String bashFileContentStart = "#!/usr/bin/env bash\n\"$(dirname \"$0\")/";
String bashFileContentEnd = "\" $*";
String bashFileContentEnd = "\" $@";
if (background) {
bashFileContentEnd += " &";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public void testAndroidStudioRun(String os, WireMockRuntimeInfo wmRuntimeInfo) t
commandlet.run();

// assert
assertThat(this.context).logAtInfo().hasMessage(ANDROID_STUDIO + " " + this.context.getSystemInfo().getOs() + " " + this.context.getWorkspacePath());
assertThat(commandlet.getToolBinPath().resolve("android-studio-test")).hasContent(
ANDROID_STUDIO + " " + this.context.getSystemInfo().getOs() + " " + this.context.getWorkspacePath());

checkInstallation(this.context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

/**
* Test of {@link VersionIdentifier}.
Expand Down Expand Up @@ -56,31 +58,35 @@ public void testOf() {
/**
* Test of {@link VersionIdentifier#isValid() valid} versions.
*/
@Test
public void testValid() {
@ParameterizedTest
// arrange
@ValueSource(strings = { "1.0", "0.1", "2023.08.001", "2023-06-M1", "11.0.4_11.4", "5.2.23.RELEASE" })
public void testValid(String version) {

String[] validVersions = { "1.0", "0.1", "2023.08.001", "2023-06-M1", "11.0.4_11.4", "5.2.23.RELEASE" };
for (String version : validVersions) {
VersionIdentifier vid = VersionIdentifier.of(version);
assertThat(vid.isValid()).as(version).isTrue();
assertThat(vid.isPattern()).isFalse();
assertThat(vid).hasToString(version);
}
// act
VersionIdentifier vid = VersionIdentifier.of(version);

// assert
assertThat(vid.isValid()).as(version).isTrue();
assertThat(vid.isPattern()).isFalse();
assertThat(vid).hasToString(version);
}

/**
* Test of in{@link VersionIdentifier#isValid() valid} versions.
*/
@Test
public void testInvalid() {
@ParameterizedTest
// arrange
@ValueSource(strings = { "0", "0.0", "1.0.pineapple-pen", "1.0-rc", ".1.0", "1.-0", "RC1", "Beta1", "donut", "8u412b08" })
public void testInvalid(String version) {

String[] invalidVersions = { "0", "0.0", "1.0.pineapple-pen", "1.0-rc", ".1.0", "1.-0", "RC1", "Beta1", "donut" };
for (String version : invalidVersions) {
VersionIdentifier vid = VersionIdentifier.of(version);
assertThat(vid.isValid()).as(version).isFalse();
assertThat(vid.isPattern()).isFalse();
assertThat(vid).hasToString(version);
}
// act
VersionIdentifier vid = VersionIdentifier.of(version);

// assert
assertThat(vid.isValid()).as(version).isFalse();
assertThat(vid.isPattern()).isFalse();
assertThat(vid).hasToString(version);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2024.1.1.1/android-studio-2024.1.1.1.zip
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash
echo "android-studio linux $*"
cd "$(dirname "$0")"
echo "android-studio linux $*" > android-studio-test
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash
echo "android-studio mac $*"
cd "$(dirname "$0")"
echo "android-studio mac $*" > android-studio-test
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash
echo "android-studio windows $*"
cd "$(dirname "$0")"
echo "android-studio windows $*" > android-studio-test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
cd "$(dirname $0)"
cd "$(dirname "$0")"
echo "intellij linux $*" > intellijtest
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
cd "$(dirname $0)"
cd "$(dirname "$0")"
echo "intellij windows $*" > intellijtest

0 comments on commit 92c5425

Please sign in to comment.