use of org.cloudfoundry.promregator.auth.NullEnricher in project promregator by promregator.
the class MetricsFetcherSimulatorTest method testCall.
@Test
void testCall() throws Exception {
AbstractMetricFamilySamplesEnricher mfse = new CFAllLabelsMetricFamilySamplesEnricher("testOrgName", "testSpaceName", "testapp", "testinstance1:0");
Gauge up = Gauge.build("up_test", "help test").labelNames(CFAllLabelsMetricFamilySamplesEnricher.getEnrichingLabelNames()).create();
Child upChild = up.labels(mfse.getEnrichedLabelValues(new LinkedList<>()).toArray(new String[0]));
MetricsFetcherSimulator subject = new MetricsFetcherSimulator("accessUrl", new NullEnricher(), mfse, Mockito.mock(MetricsFetcherMetrics.class), upChild);
HashMap<String, MetricFamilySamples> result = subject.call();
Assertions.assertEquals(3, result.size());
}
use of org.cloudfoundry.promregator.auth.NullEnricher in project promregator by promregator.
the class PromregatorApplication method authenticationEnricher.
@Bean
public AuthenticationEnricher authenticationEnricher(PromregatorConfiguration promregatorConfiguration) {
AuthenticationEnricher ae = null;
String type = promregatorConfiguration.getAuthenticator().getType();
if ("OAuth2XSUAA".equalsIgnoreCase(type)) {
ae = new OAuth2XSUAAEnricher(promregatorConfiguration.getAuthenticator().getOauth2xsuaa());
} else if ("none".equalsIgnoreCase(type) || "null".equalsIgnoreCase(type)) {
ae = new NullEnricher();
} else if ("basic".equalsIgnoreCase(type)) {
ae = new BasicAuthenticationEnricher(promregatorConfiguration.getAuthenticator().getBasic());
} else {
log.warn(String.format("Authenticator type %s is unknown; skipping", type));
}
return ae;
}
Aggregations