Search in sources :

Example 1 with MetricsAccessKey

use of jenkins.metrics.api.MetricsAccessKey in project configuration-as-code-plugin by jenkinsci.

the class EssentialsTest method essentialsTest.

@Test
@ConfiguredWithCode("EssentialsTest.yml")
public void essentialsTest() {
    final Jenkins jenkins = Jenkins.get();
    assertEquals("Welcome to Jenkins Essentials!", jenkins.getSystemMessage());
    final ExtensionList<MetricsAccessKey.DescriptorImpl> metricsDescriptors = ExtensionList.lookup(MetricsAccessKey.DescriptorImpl.class);
    assertNotNull(metricsDescriptors);
    assertThat(metricsDescriptors, hasSize(1));
    MetricsAccessKey.DescriptorImpl metricsDescriptor = metricsDescriptors.get(0);
    final List<MetricsAccessKey> accessKeys = metricsDescriptor.getAccessKeys();
    assertThat(accessKeys, hasSize(1));
    MetricsAccessKey accessKey = accessKeys.get(0);
    assertThat(accessKey.getKey(), is("evergreen"));
    assertThat(accessKey.getDescription(), is("Key for evergreen health-check"));
    assertThat(accessKey.isCanHealthCheck(), is(true));
    assertThat(accessKey.isCanPing(), is(false));
    assertThat(accessKey.isCanPing(), is(false));
    assertThat(accessKey.isCanThreadDump(), is(false));
    assertThat(accessKey.isCanMetrics(), is(false));
    assertThat(accessKey.getOrigins(), is("*"));
// metricsDescriptor.g
}
Also used : Jenkins(jenkins.model.Jenkins) MetricsAccessKey(jenkins.metrics.api.MetricsAccessKey) Test(org.junit.Test) ConfiguredWithCode(io.jenkins.plugins.casc.misc.ConfiguredWithCode)

Aggregations

ConfiguredWithCode (io.jenkins.plugins.casc.misc.ConfiguredWithCode)1 MetricsAccessKey (jenkins.metrics.api.MetricsAccessKey)1 Jenkins (jenkins.model.Jenkins)1 Test (org.junit.Test)1