diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-09-10 11:16:26 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2019-09-10 11:24:18 +0200 |
commit | fe7475d74b15c32a32d0f3e7be7df6c872e27eb5 (patch) | |
tree | 11596d2feb10321e35022427cf746ea4097a67a1 /controller-api | |
parent | e906d38cd418490f0d18854d296977833bf7a8c2 (diff) |
Move CostReportConsumerMock to controller-api
Diffstat (limited to 'controller-api')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumerMock.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumerMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumerMock.java new file mode 100644 index 00000000000..c59e13246cd --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumerMock.java @@ -0,0 +1,36 @@ +package com.yahoo.vespa.hosted.controller.api.integration.resource; + +import com.yahoo.vespa.hosted.controller.api.identifiers.Property; + +import java.util.Map; +import java.util.function.Consumer; + +/** + * @author ldalves + */ +public class CostReportConsumerMock implements CostReportConsumer { + + private final Consumer<String> csvConsumer; + private final Map<Property, ResourceAllocation> fixedAllocations; + + public CostReportConsumerMock() { + this.csvConsumer = (ignored) -> {}; + this.fixedAllocations = Map.of(); + } + + public CostReportConsumerMock(Consumer<String> csvConsumer, Map<Property, ResourceAllocation> fixedAllocations) { + this.csvConsumer = csvConsumer; + this.fixedAllocations = Map.copyOf(fixedAllocations); + } + + @Override + public void consume(String csv) { + csvConsumer.accept(csv); + } + + @Override + public Map<Property, ResourceAllocation> fixedAllocations() { + return fixedAllocations; + } + +} |