KEYCLOAK-9708 Enable SmallRye Health and Metrics extensions
This commit is contained in:
parent
8d42c9193b
commit
5808ad2de0
8 changed files with 257 additions and 0 deletions
|
@ -37,6 +37,9 @@
|
||||||
<subsystem>security.xml</subsystem>
|
<subsystem>security.xml</subsystem>
|
||||||
<subsystem>security-manager.xml</subsystem>
|
<subsystem>security-manager.xml</subsystem>
|
||||||
<subsystem>transactions.xml</subsystem>
|
<subsystem>transactions.xml</subsystem>
|
||||||
|
<subsystem>microprofile-config-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-health-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-metrics-smallrye.xml</subsystem>
|
||||||
<subsystem>keycloak-undertow.xml</subsystem>
|
<subsystem>keycloak-undertow.xml</subsystem>
|
||||||
<subsystem>keycloak-server.xml</subsystem>
|
<subsystem>keycloak-server.xml</subsystem>
|
||||||
</subsystems>
|
</subsystems>
|
||||||
|
@ -64,6 +67,9 @@
|
||||||
<subsystem>security.xml</subsystem>
|
<subsystem>security.xml</subsystem>
|
||||||
<subsystem>security-manager.xml</subsystem>
|
<subsystem>security-manager.xml</subsystem>
|
||||||
<subsystem>transactions.xml</subsystem>
|
<subsystem>transactions.xml</subsystem>
|
||||||
|
<subsystem>microprofile-config-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-health-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-metrics-smallrye.xml</subsystem>
|
||||||
<subsystem supplement="ha">keycloak-undertow.xml</subsystem>
|
<subsystem supplement="ha">keycloak-undertow.xml</subsystem>
|
||||||
<subsystem>keycloak-server.xml</subsystem>
|
<subsystem>keycloak-server.xml</subsystem>
|
||||||
</subsystems>
|
</subsystems>
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
<subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
|
<subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
|
||||||
<subsystem>security.xml</subsystem>
|
<subsystem>security.xml</subsystem>
|
||||||
<subsystem>transactions.xml</subsystem>
|
<subsystem>transactions.xml</subsystem>
|
||||||
|
<subsystem>microprofile-config-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-health-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-metrics-smallrye.xml</subsystem>
|
||||||
<subsystem supplement="ha">keycloak-undertow.xml</subsystem>
|
<subsystem supplement="ha">keycloak-undertow.xml</subsystem>
|
||||||
<subsystem>keycloak-server.xml</subsystem>
|
<subsystem>keycloak-server.xml</subsystem>
|
||||||
</subsystems>
|
</subsystems>
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
<subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
|
<subsystem supplement="standalone-wildfly">elytron.xml</subsystem>
|
||||||
<subsystem>security.xml</subsystem>
|
<subsystem>security.xml</subsystem>
|
||||||
<subsystem>transactions.xml</subsystem>
|
<subsystem>transactions.xml</subsystem>
|
||||||
|
<subsystem>microprofile-config-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-health-smallrye.xml</subsystem>
|
||||||
|
<subsystem>microprofile-metrics-smallrye.xml</subsystem>
|
||||||
<subsystem>keycloak-undertow.xml</subsystem>
|
<subsystem>keycloak-undertow.xml</subsystem>
|
||||||
<subsystem>keycloak-server.xml</subsystem>
|
<subsystem>keycloak-server.xml</subsystem>
|
||||||
</subsystems>
|
</subsystems>
|
||||||
|
|
|
@ -621,4 +621,50 @@ if (result == false) of /profile=$clusteredProfile/subsystem=webservices/:read-a
|
||||||
echo
|
echo
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /profile=$clusteredProfile/subsystem=microprofile-config-smallrye/:read-resource
|
||||||
|
try
|
||||||
|
echo Trying to add microprofile-config-smallrye extension
|
||||||
|
/extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)
|
||||||
|
echo
|
||||||
|
catch
|
||||||
|
echo Wasn't able to add microprofile-config-smallrye extension, it should be already added by migrate-domain-standalone.cli
|
||||||
|
echo
|
||||||
|
end-try
|
||||||
|
echo Adding microprofile-config-smallrye subsystem
|
||||||
|
/profile=$clusteredProfile/subsystem=microprofile-config-smallrye/:add
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /profile=$clusteredProfile/subsystem=microprofile-health-smallrye/:read-resource
|
||||||
|
try
|
||||||
|
echo Trying to add microprofile-health-smallrye extension
|
||||||
|
/extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)
|
||||||
|
echo
|
||||||
|
catch
|
||||||
|
echo Wasn't able to add microprofile-health-smallrye extension, it should be already added by migrate-domain-standalone.cli
|
||||||
|
echo
|
||||||
|
end-try
|
||||||
|
echo Adding microprofile-health-smallrye subsystem
|
||||||
|
/profile=$clusteredProfile/subsystem=microprofile-health-smallrye/:add
|
||||||
|
/profile=$clusteredProfile/subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:read-resource
|
||||||
|
try
|
||||||
|
echo Trying to add microprofile-metrics-smallrye extension
|
||||||
|
/extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)
|
||||||
|
echo
|
||||||
|
catch
|
||||||
|
echo Wasn't able to add microprofile-metrics-smallrye extension, it should be already added by migrate-domain-standalone.cli
|
||||||
|
echo
|
||||||
|
end-try
|
||||||
|
echo Adding microprofile-metrics-smallrye subsystem
|
||||||
|
/profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:add
|
||||||
|
/profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
/profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])
|
||||||
|
/profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
echo *** End Migration of /profile=$clusteredProfile ***
|
echo *** End Migration of /profile=$clusteredProfile ***
|
||||||
|
|
|
@ -546,4 +546,50 @@ if (result == false) of /profile=$standaloneProfile/subsystem=webservices/:read-
|
||||||
echo
|
echo
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /profile=$standaloneProfile/subsystem=microprofile-config-smallrye/:read-resource
|
||||||
|
try
|
||||||
|
echo Trying to add microprofile-config-smallrye extension
|
||||||
|
/extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)
|
||||||
|
echo
|
||||||
|
catch
|
||||||
|
echo Wasn't able to add microprofile-config-smallrye extension, it should be already added by migrate-domain-clustered.cli
|
||||||
|
echo
|
||||||
|
end-try
|
||||||
|
echo Adding microprofile-config-smallrye subsystem
|
||||||
|
/profile=$standaloneProfile/subsystem=microprofile-config-smallrye/:add
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /profile=$standaloneProfile/subsystem=microprofile-health-smallrye/:read-resource
|
||||||
|
try
|
||||||
|
echo Trying to add microprofile-health-smallrye extension
|
||||||
|
/extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)
|
||||||
|
echo
|
||||||
|
catch
|
||||||
|
echo Wasn't able to add microprofile-health-smallrye extension, it should be already added by migrate-domain-clustered.cli
|
||||||
|
echo
|
||||||
|
end-try
|
||||||
|
echo Adding microprofile-health-smallrye subsystem
|
||||||
|
/profile=$standaloneProfile/subsystem=microprofile-health-smallrye/:add
|
||||||
|
/profile=$standaloneProfile/subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:read-resource
|
||||||
|
try
|
||||||
|
echo Trying to add microprofile-metrics-smallrye extension
|
||||||
|
/extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)
|
||||||
|
echo
|
||||||
|
catch
|
||||||
|
echo Wasn't able to add microprofile-metrics-smallrye extension, it should be already added by migrate-domain-clustered.cli
|
||||||
|
echo
|
||||||
|
end-try
|
||||||
|
echo Adding microprofile-metrics-smallrye subsystem
|
||||||
|
/profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:add
|
||||||
|
/profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
/profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])
|
||||||
|
/profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
echo *** End Migration of /profile=$standaloneProfile ***
|
echo *** End Migration of /profile=$standaloneProfile ***
|
||||||
|
|
|
@ -617,4 +617,44 @@ if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-e
|
||||||
echo
|
echo
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /extension=org.wildfly.extension.microprofile.config-smallrye/:read-resource
|
||||||
|
echo Adding microprofile.config-smallrye extension...
|
||||||
|
/extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /subsystem=microprofile-config-smallrye/:read-resource
|
||||||
|
echo Adding microprofile-config-smallrye subsystem
|
||||||
|
/subsystem=microprofile-config-smallrye/:add
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /extension=org.wildfly.extension.microprofile.health-smallrye/:read-resource
|
||||||
|
echo Adding microprofile.health-smallrye extension...
|
||||||
|
/extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /subsystem=microprofile-health-smallrye/:read-resource
|
||||||
|
echo Adding microprofile-health-smallrye subsystem
|
||||||
|
/subsystem=microprofile-health-smallrye/:add
|
||||||
|
/subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /extension=org.wildfly.extension.microprofile.metrics-smallrye/:read-resource
|
||||||
|
echo Adding microprofile.metrics-smallrye extension...
|
||||||
|
/extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /subsystem=microprofile-metrics-smallrye/:read-resource
|
||||||
|
echo Adding microprofile-metrics-smallrye subsystem
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:add
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
echo *** End Migration ***
|
echo *** End Migration ***
|
||||||
|
|
|
@ -506,4 +506,44 @@ if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-e
|
||||||
echo
|
echo
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /extension=org.wildfly.extension.microprofile.health-smallrye/:read-resource
|
||||||
|
echo Adding microprofile.health-smallrye extension...
|
||||||
|
/extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /subsystem=microprofile-health-smallrye/:read-resource
|
||||||
|
echo Adding microprofile-health-smallrye subsystem
|
||||||
|
/subsystem=microprofile-health-smallrye/:add
|
||||||
|
/subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /extension=org.wildfly.extension.microprofile.config-smallrye/:read-resource
|
||||||
|
echo Adding microprofile.config-smallrye extension...
|
||||||
|
/extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /subsystem=microprofile-config-smallrye/:read-resource
|
||||||
|
echo Adding microprofile-config-smallrye subsystem
|
||||||
|
/subsystem=microprofile-config-smallrye/:add
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /extension=org.wildfly.extension.microprofile.metrics-smallrye/:read-resource
|
||||||
|
echo Adding microprofile.metrics-smallrye extension...
|
||||||
|
/extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
|
if (outcome == failed) of /subsystem=microprofile-metrics-smallrye/:read-resource
|
||||||
|
echo Adding microprofile-metrics-smallrye subsystem
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:add
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])
|
||||||
|
/subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})
|
||||||
|
echo
|
||||||
|
end-if
|
||||||
|
|
||||||
echo *** End Migration ***
|
echo *** End Migration ***
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.keycloak.testsuite.metrics;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.ws.rs.client.Client;
|
||||||
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
|
import org.keycloak.testsuite.util.ContainerAssume;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
import static org.keycloak.testsuite.util.Matchers.body;
|
||||||
|
import static org.keycloak.testsuite.util.Matchers.statusCodeIs;
|
||||||
|
|
||||||
|
public class MetricsRestServiceTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
|
private static final String MGMT_PORT = System.getProperty("auth.server.management.port", "10090");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
|
// no test realms
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void enabled() {
|
||||||
|
ContainerAssume.assumeNotAuthServerUndertow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHealthEndpoint() {
|
||||||
|
Client client = ClientBuilder.newClient();
|
||||||
|
|
||||||
|
try (Response response = client.target("http://localhost:" + MGMT_PORT + "/health").request().get()) {
|
||||||
|
Assert.assertThat(response, statusCodeIs(Status.OK));
|
||||||
|
Assert.assertThat(response, body(containsString("{\"outcome\":\"UP\",\"checks\":[]}")));
|
||||||
|
} finally {
|
||||||
|
client.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMetricsEndpoint() {
|
||||||
|
Client client = ClientBuilder.newClient();
|
||||||
|
|
||||||
|
try (Response response = client.target("http://localhost:" + MGMT_PORT + "/metrics").request().get()) {
|
||||||
|
Assert.assertThat(response, statusCodeIs(Status.OK));
|
||||||
|
Assert.assertThat(response, body(containsString("base:classloader_total_loaded_class_count")));
|
||||||
|
} finally {
|
||||||
|
client.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue