forked from ls1intum/Artemis
-
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.
Programming exercises: Add button to start online IDE from exercise d…
…etails (ls1intum#8697)
- Loading branch information
Showing
16 changed files
with
165 additions
and
2 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
.idea/runConfigurations/Artemis__Server__LocalVC___LocalCI__Theia_.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
26 changes: 26 additions & 0 deletions
26
src/main/java/de/tum/in/www1/artemis/service/theia/TheiaInfoContributor.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,26 @@ | ||
package de.tum.in.www1.artemis.service.theia; | ||
|
||
import static de.tum.in.www1.artemis.config.Constants.PROFILE_THEIA; | ||
|
||
import java.net.URL; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.actuate.info.Info; | ||
import org.springframework.boot.actuate.info.InfoContributor; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
|
||
import de.tum.in.www1.artemis.config.Constants; | ||
|
||
@Profile(PROFILE_THEIA) | ||
@Component | ||
public class TheiaInfoContributor implements InfoContributor { | ||
|
||
@Value("${theia.portal-url}") | ||
private URL theiaPortalURL; | ||
|
||
@Override | ||
public void contribute(Info.Builder builder) { | ||
builder.withDetail(Constants.THEIA_PORTAL_URL, theiaPortalURL); | ||
} | ||
} |
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
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 @@ | ||
theia: | ||
portal-url: https://your-theia-instance.com |
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
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
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
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
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
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
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
36 changes: 36 additions & 0 deletions
36
src/test/java/de/tum/in/www1/artemis/theia/TheiaInfoContributorTest.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,36 @@ | ||
package de.tum.in.www1.artemis.theia; | ||
|
||
import static de.tum.in.www1.artemis.config.Constants.PROFILE_THEIA; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.actuate.info.Info; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
import de.tum.in.www1.artemis.config.Constants; | ||
import de.tum.in.www1.artemis.service.theia.TheiaInfoContributor; | ||
|
||
@Profile(PROFILE_THEIA) | ||
class TheiaInfoContributorTest { | ||
|
||
@Value("${theia.portal-url}") | ||
private String expectedValue; | ||
|
||
TheiaInfoContributor theiaInfoContributor; | ||
|
||
@Test | ||
void testContribute() { | ||
Info.Builder builder = new Info.Builder(); | ||
theiaInfoContributor = new TheiaInfoContributor(); | ||
try { | ||
theiaInfoContributor.contribute(builder); | ||
} | ||
catch (NullPointerException e) { | ||
} | ||
|
||
Info info = builder.build(); | ||
assertThat(info.getDetails().get(Constants.THEIA_PORTAL_URL)).isEqualTo(expectedValue); | ||
|
||
} | ||
} |
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
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
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