Search in sources :

Example 1 with Chef

use of com.yahoo.vespa.hosted.controller.api.integration.chef.Chef in project vespa by vespa-engine.

the class MetricsReporterTest method createReporter.

private MetricsReporter createReporter(Clock clock, Controller controller, MetricsMock metricsMock, SystemName system) {
    Chef client = Mockito.mock(Chef.class);
    PartialNodeResult result;
    try {
        result = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).readValue(testData.resolve("chef_output.json").toFile(), PartialNodeResult.class);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    when(client.partialSearchNodes(anyString(), anyListOf(AttributeMapping.class))).thenReturn(result);
    return new MetricsReporter(controller, metricsMock, client, clock, new JobControl(new MockCuratorDb()), system);
}
Also used : PartialNodeResult(com.yahoo.vespa.hosted.controller.api.integration.chef.rest.PartialNodeResult) MockCuratorDb(com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb) Chef(com.yahoo.vespa.hosted.controller.api.integration.chef.Chef) AttributeMapping(com.yahoo.vespa.hosted.controller.api.integration.chef.AttributeMapping) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 AttributeMapping (com.yahoo.vespa.hosted.controller.api.integration.chef.AttributeMapping)1 Chef (com.yahoo.vespa.hosted.controller.api.integration.chef.Chef)1 PartialNodeResult (com.yahoo.vespa.hosted.controller.api.integration.chef.rest.PartialNodeResult)1 MockCuratorDb (com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1