Fixes 9094: Remove other values for features command. Only preview allowed for now.
This commit is contained in:
parent
5aa9a09b20
commit
21ccf7dd8a
2 changed files with 34 additions and 4 deletions
|
@ -36,6 +36,7 @@ import java.io.File;
|
|||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -305,12 +306,12 @@ public final class Picocli {
|
|||
.order(ConfigCategory.FEATURE.getOrder())
|
||||
.validate(false);
|
||||
|
||||
Set<String> featuresExpectedValues = Arrays.stream(Profile.Type.values()).map(type -> type.name().toLowerCase()).collect(Collectors.toSet());
|
||||
String previewName = Profile.Type.PREVIEW.name().toLowerCase();
|
||||
|
||||
featureGroupBuilder.addArg(OptionSpec.builder(new String[] {"-ft", "--features"})
|
||||
.description("Enables a group of features. Possible values are: " + String.join(",", featuresExpectedValues))
|
||||
.paramLabel("feature")
|
||||
.completionCandidates(featuresExpectedValues)
|
||||
.description("Enables all tech preview features.")
|
||||
.paramLabel(previewName)
|
||||
.completionCandidates(Collections.singleton(previewName))
|
||||
.parameterConsumer(PropertyMapperParameterConsumer.INSTANCE)
|
||||
.type(String.class)
|
||||
.build());
|
||||
|
|
29
quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FeaturesDistTest.java
vendored
Normal file
29
quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FeaturesDistTest.java
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
package org.keycloak.it.cli.dist;
|
||||
|
||||
import io.quarkus.test.junit.main.Launch;
|
||||
import io.quarkus.test.junit.main.LaunchResult;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.keycloak.it.junit5.extension.CLIResult;
|
||||
import org.keycloak.it.junit5.extension.DistributionTest;
|
||||
import org.keycloak.quarkus.runtime.cli.command.StartDev;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@DistributionTest
|
||||
public class FeaturesDistTest {
|
||||
|
||||
@Test
|
||||
@Launch({StartDev.NAME, "--features=preview"})
|
||||
public void testPreviewFeaturesGetEnabledWhenCliArgIsSet(LaunchResult result) {
|
||||
CLIResult cliResult = (CLIResult) result;
|
||||
cliResult.assertStartedDevMode();
|
||||
assertThat(cliResult.getOutput(), CoreMatchers.allOf(
|
||||
containsString("Preview feature enabled: admin_fine_grained_authz"),
|
||||
containsString("Preview feature enabled: openshift_integration"),
|
||||
containsString("Preview feature enabled: scripts"),
|
||||
containsString("Preview feature enabled: token_exchange"),
|
||||
containsString("Preview feature enabled: declarative_user_profile")));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue