diff options
author | Øyvind Grønnesby <oyving@verizonmedia.com> | 2020-11-09 11:06:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-09 11:06:37 +0100 |
commit | 90b384a0288242fc818392843455ebf28f593066 (patch) | |
tree | 84b5418c0d91328b88d526a2ae60dd6dfd8196bf /controller-api | |
parent | bb75c5975c5588b8e05e9bd62016d1dce0a6d654 (diff) | |
parent | 4f411eb3206bf20878aee30cb12afac178fc7089 (diff) |
Merge pull request #15199 from vespa-engine/revert-15198-revert-15197-smorgrav/collection_methods_take_2
Revert "Revert "Add collection method enumerations - change default""
Diffstat (limited to 'controller-api')
4 files changed, 29 insertions, 6 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java index 2f05c99ab66..ce03dccc86b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java @@ -52,7 +52,7 @@ public interface BillingController { void deleteBillingInfo(TenantName tenant, Set<User> users, boolean isPrivileged); default CollectionMethod getCollectionMethod(TenantName tenant) { - return CollectionMethod.AUTO; + return CollectionMethod.NONE; } default CollectionResult setCollectionMethod(TenantName tenant, CollectionMethod method) { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionMethod.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionMethod.java index 010ce56d1d7..fd586b0faf0 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionMethod.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionMethod.java @@ -1,6 +1,8 @@ package com.yahoo.vespa.hosted.controller.api.integration.billing; public enum CollectionMethod { - AUTO, - INVOICE + NONE, + EPAY, + INVOICE, + AUTO // Deprecated - this has never been serialized and can be removed in subsequent release } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionResult.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionResult.java index d2eb77ba94c..4322cdc81b3 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionResult.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/CollectionResult.java @@ -1,6 +1,7 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.billing; +import java.util.Objects; import java.util.Optional; /** @@ -31,4 +32,24 @@ public class CollectionResult { public Optional<String> getErrorMessage() { return errorMessage; } + + @Override + public String toString() { + return "CollectionResult{" + + "errorMessage=" + errorMessage + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CollectionResult that = (CollectionResult) o; + return Objects.equals(errorMessage, that.errorMessage); + } + + @Override + public int hashCode() { + return Objects.hash(errorMessage); + } }
\ No newline at end of file diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java index 4b09c744537..b84c3083f41 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java @@ -24,7 +24,7 @@ public class MockBillingController implements BillingController { Map<TenantName, List<Invoice>> committedInvoices = new HashMap<>(); Map<TenantName, Invoice> uncommittedInvoices = new HashMap<>(); Map<TenantName, List<Invoice.LineItem>> unusedLineItems = new HashMap<>(); - CollectionMethod collectionMethod = CollectionMethod.AUTO; + Map<TenantName, CollectionMethod> collectionMethod = new HashMap<>(); @Override public PlanId getPlan(TenantName tenant) { @@ -138,12 +138,12 @@ public class MockBillingController implements BillingController { @Override public CollectionMethod getCollectionMethod(TenantName tenant) { - return collectionMethod; + return collectionMethod.getOrDefault(tenant, CollectionMethod.AUTO); } @Override public CollectionResult setCollectionMethod(TenantName tenant, CollectionMethod method) { - collectionMethod = method; + collectionMethod.put(tenant, method); return CollectionResult.success(); } |