summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@yahooinc.com>2023-10-20 15:13:07 +0200
committerGitHub <noreply@github.com>2023-10-20 15:13:07 +0200
commit3e9ab5c48f01d35029fe9224c51c60ee96099f1d (patch)
tree533423b94173fbc5fed1bd69759dcd8933880261 /controller-server
parent9a3c43468a97ed26f24dc8d4783d54174afbc778 (diff)
parent33f6a3df544a3c7915158251471372a0453ecc5c (diff)
Merge pull request #29029 from vespa-engine/olaa/line-item-aggregation
Move bill exporting to BillingReporter
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/BillingReportMaintainerTest.java2
3 files changed, 6 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java
index cbf26e81f98..35d09fd541b 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java
@@ -19,6 +19,7 @@ import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.TenantController;
import com.yahoo.vespa.hosted.controller.api.integration.billing.Bill;
import com.yahoo.vespa.hosted.controller.api.integration.billing.BillingController;
+import com.yahoo.vespa.hosted.controller.api.integration.billing.BillingReporter;
import com.yahoo.vespa.hosted.controller.api.integration.billing.CollectionMethod;
import com.yahoo.vespa.hosted.controller.api.integration.billing.Plan;
import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanId;
@@ -55,6 +56,7 @@ public class BillingApiHandlerV2 extends RestApiRequestHandler<BillingApiHandler
private final ApplicationController applications;
private final TenantController tenants;
private final BillingController billing;
+ private final BillingReporter billingReporter;
private final PlanRegistry planRegistry;
private final Clock clock;
@@ -65,6 +67,7 @@ public class BillingApiHandlerV2 extends RestApiRequestHandler<BillingApiHandler
this.billing = controller.serviceRegistry().billingController();
this.planRegistry = controller.serviceRegistry().planRegistry();
this.clock = controller.serviceRegistry().clock();
+ this.billingReporter = controller.serviceRegistry().billingReporter();
}
private static RestApi createRestApi(BillingApiHandlerV2 self) {
@@ -312,7 +315,7 @@ public class BillingApiHandlerV2 extends RestApiRequestHandler<BillingApiHandler
var cloudTenant = tenants.require(bill.tenant(), CloudTenant.class);
var exportMethod = slime.get().field("method").asString();
- var result = billing.exportBill(bill, exportMethod, cloudTenant);
+ var result = billingReporter.exportBill(bill, exportMethod, cloudTenant);
var responseSlime = new Slime();
responseSlime.setObject().setString("invoiceId", result);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
index bbd65e2bd94..5c6853bccdb 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
@@ -317,7 +317,7 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
@Override
public BillingReporter billingReporter() {
- return new BillingReporterMock(clock());
+ return new BillingReporterMock(clock(), billingDb);
}
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/BillingReportMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/BillingReportMaintainerTest.java
index 0a57cf51f2e..a224af83401 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/BillingReportMaintainerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/BillingReportMaintainerTest.java
@@ -55,7 +55,7 @@ public class BillingReportMaintainerTest {
billingController.setPlan(t1, PlanRegistryMock.paidPlan.id(), false, true);
- billingController.exportBill(billingDb.readBill(bill2).get(), "FOO", cloudTenant(t1));
+ tester.controller().serviceRegistry().billingReporter().exportBill(billingDb.readBill(bill2).get(), "FOO", cloudTenant(t1));
var updates = maintainer.maintainInvoices();
assertEquals(new InvoiceUpdate(0, 0, 1), updates);