aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/test/java/com/yahoo/vespa
diff options
context:
space:
mode:
Diffstat (limited to 'controller-api/src/test/java/com/yahoo/vespa')
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/identifiers/IdentifierTest.java2
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/ConsoleUrlsTest.java44
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatusTest.java19
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/StatusHistoryTest.java89
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificateTest.java31
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java4
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTargetTest.java2
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java4
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/maven/MetadataTest.java2
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/user/RolesTest.java2
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/resource/ResourceSnapshotTest.java1
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/PathGroupTest.java2
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/RoleTest.java136
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTargetTest.java4
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java2
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/tenant/ArchiveAccessTest.java5
16 files changed, 200 insertions, 149 deletions
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/identifiers/IdentifierTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/identifiers/IdentifierTest.java
index 902d260c86d..a48301f10b2 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/identifiers/IdentifierTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/identifiers/IdentifierTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.identifiers;
import com.yahoo.config.provision.zone.ZoneId;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/ConsoleUrlsTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/ConsoleUrlsTest.java
new file mode 100644
index 00000000000..259a279671b
--- /dev/null
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/ConsoleUrlsTest.java
@@ -0,0 +1,44 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration;
+
+import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.Environment;
+import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
+import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
+import org.junit.jupiter.api.Test;
+
+import java.net.URI;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * @author freva
+ */
+class ConsoleUrlsTest {
+
+ private final ConsoleUrls urls = new ConsoleUrls(URI.create("https://console.tld/"));
+
+ @Test
+ void urls() {
+ ApplicationId app = ApplicationId.from("t1", "a1", "i1");
+ ZoneId prod = ZoneId.from("prod", "us-north-1");
+ ZoneId dev = ZoneId.from("dev", "eu-west-2");
+ ZoneId test = ZoneId.from("test", "ap-east-3");
+ ClusterSpec.Id cluster = ClusterSpec.Id.from("c1");
+
+ assertEquals("https://console.tld", urls.root());
+ assertEquals("https://console.tld/tenant/t1", urls.tenantOverview(app.tenant()));
+ assertEquals("https://console.tld/tenant/t1/account/notifications", urls.tenantNotifications(app.tenant()));
+ assertEquals("https://console.tld/tenant/t1/account/billing", urls.tenantBilling(app.tenant()));
+ assertEquals("https://console.tld/tenant/t1/application/a1/prod/instance", urls.prodApplicationOverview(app.tenant(), app.application()));
+ assertEquals("https://console.tld/tenant/t1/application/a1/prod/instance/i1", urls.instanceOverview(app, Environment.test));
+ assertEquals("https://console.tld/tenant/t1/application/a1/dev/instance/i1?i1.dev.eu-west-2=clusters%2Cc1", urls.clusterOverview(app, dev, cluster));
+ assertEquals("https://console.tld/tenant/t1/application/a1/prod/instance/i1?i1.prod.us-north-1=clusters%2Cc1%3Dreindexing", urls.clusterReindexing(app, prod, cluster));
+ assertEquals("https://console.tld/tenant/t1/application/a1/prod/instance/i1/job/production-us-north-1/run/1", urls.deploymentRun(new RunId(app, JobType.deploymentTo(prod), 1)));
+ assertEquals("https://console.tld/tenant/t1/application/a1/prod/instance/i1/job/system-test/run/1", urls.deploymentRun(new RunId(app, JobType.deploymentTo(test), 1)));
+ assertEquals("https://console.tld/tenant/t1/application/a1/dev/instance/i1/job/dev-eu-west-2/run/1", urls.deploymentRun(new RunId(app, JobType.deploymentTo(dev), 1)));
+ assertEquals("https://console.tld/verify?code=test123", urls.verifyEmail("test123"));
+ }
+}
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatusTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatusTest.java
new file mode 100644
index 00000000000..022474406b9
--- /dev/null
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatusTest.java
@@ -0,0 +1,19 @@
+package com.yahoo.vespa.hosted.controller.api.integration.billing;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * @author gjoranv
+ */
+public class BillStatusTest {
+
+ @Test
+ void legacy_states_are_converted() {
+ assertEquals(BillStatus.OPEN, BillStatus.from("ISSUED"));
+ assertEquals(BillStatus.OPEN, BillStatus.from("EXPORTED"));
+ assertEquals(BillStatus.VOID, BillStatus.from("CANCELED"));
+ }
+
+}
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/StatusHistoryTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/StatusHistoryTest.java
new file mode 100644
index 00000000000..46a4c7e199c
--- /dev/null
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/billing/StatusHistoryTest.java
@@ -0,0 +1,89 @@
+package com.yahoo.vespa.hosted.controller.api.integration.billing;
+
+import org.junit.jupiter.api.Test;
+
+import java.time.Clock;
+import java.time.ZonedDateTime;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * @author gjoranv
+ */
+public class StatusHistoryTest {
+
+ private final Clock clock = Clock.systemUTC();
+
+ @Test
+ void open_can_change_to_any_status() {
+ var history = StatusHistory.open(clock);
+ history.checkValidTransition(BillStatus.FROZEN);
+ history.checkValidTransition(BillStatus.CLOSED);
+ history.checkValidTransition(BillStatus.VOID);
+ }
+
+ @Test
+ void frozen_cannot_change_to_open() {
+ var history = new StatusHistory(historyWith(BillStatus.FROZEN));
+
+ history.checkValidTransition(BillStatus.CLOSED);
+ history.checkValidTransition(BillStatus.VOID);
+
+ assertThrows(IllegalArgumentException.class, () -> history.checkValidTransition(BillStatus.OPEN));
+ }
+
+ @Test
+ void closed_cannot_change() {
+ var history = new StatusHistory(historyWith(BillStatus.CLOSED));
+
+ assertThrows(IllegalArgumentException.class, () -> history.checkValidTransition(BillStatus.OPEN));
+ assertThrows(IllegalArgumentException.class, () -> history.checkValidTransition(BillStatus.FROZEN));
+ assertThrows(IllegalArgumentException.class, () -> history.checkValidTransition(BillStatus.VOID));
+ }
+
+ @Test
+ void void_cannot_change() {
+ var history = new StatusHistory(historyWith(BillStatus.VOID));
+
+ assertThrows(IllegalArgumentException.class, () -> history.checkValidTransition(BillStatus.OPEN));
+ assertThrows(IllegalArgumentException.class, () -> history.checkValidTransition(BillStatus.FROZEN));
+ assertThrows(IllegalArgumentException.class, () -> history.checkValidTransition(BillStatus.CLOSED));
+ }
+
+ @Test
+ void any_status_can_change_to_itself() {
+ var history = new StatusHistory(historyWith(BillStatus.OPEN));
+ history.checkValidTransition(BillStatus.OPEN);
+
+ history = new StatusHistory(historyWith(BillStatus.FROZEN));
+ history.checkValidTransition(BillStatus.FROZEN);
+
+ history = new StatusHistory(historyWith(BillStatus.CLOSED));
+ history.checkValidTransition(BillStatus.CLOSED);
+
+ history = new StatusHistory(historyWith(BillStatus.VOID));
+ history.checkValidTransition(BillStatus.VOID);
+ }
+
+ @Test
+ void it_validates_status_history_in_constructor() {
+ assertThrows(IllegalArgumentException.class, () -> new StatusHistory(historyWith(BillStatus.FROZEN, BillStatus.OPEN)));
+ assertThrows(IllegalArgumentException.class, () -> new StatusHistory(historyWith(BillStatus.CLOSED, BillStatus.OPEN)));
+ assertThrows(IllegalArgumentException.class, () -> new StatusHistory(historyWith(BillStatus.CLOSED, BillStatus.FROZEN)));
+ assertThrows(IllegalArgumentException.class, () -> new StatusHistory(historyWith(BillStatus.CLOSED, BillStatus.VOID)));
+ assertThrows(IllegalArgumentException.class, () -> new StatusHistory(historyWith(BillStatus.VOID, BillStatus.OPEN)));
+ assertThrows(IllegalArgumentException.class, () -> new StatusHistory(historyWith(BillStatus.VOID, BillStatus.FROZEN)));
+ assertThrows(IllegalArgumentException.class, () -> new StatusHistory(historyWith(BillStatus.VOID, BillStatus.CLOSED)));
+ }
+
+ private SortedMap<ZonedDateTime, BillStatus> historyWith(BillStatus... statuses) {
+ var history = new TreeMap<>(Map.of(ZonedDateTime.now(clock), BillStatus.OPEN));
+ for (var status : statuses) {
+ history.put(ZonedDateTime.now(clock), status);
+ }
+ return history;
+ }
+}
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificateTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificateTest.java
new file mode 100644
index 00000000000..e165157dac2
--- /dev/null
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/EndpointCertificateTest.java
@@ -0,0 +1,31 @@
+package com.yahoo.vespa.hosted.controller.api.integration.certificates;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * @author mpolden
+ */
+class EndpointCertificateTest {
+
+ @Test
+ public void san_matches() {
+ List<String> sans = List.of("*.a.example.com", "b.example.com", "c.example.com");
+ assertTrue(EndpointCertificate.sanMatches("b.example.com", sans));
+ assertTrue(EndpointCertificate.sanMatches("c.example.com", sans));
+ assertTrue(EndpointCertificate.sanMatches("foo.a.example.com", sans));
+ assertFalse(EndpointCertificate.sanMatches("", List.of()));
+ assertFalse(EndpointCertificate.sanMatches("example.com", List.of()));
+ assertFalse(EndpointCertificate.sanMatches("example.com", sans));
+ assertFalse(EndpointCertificate.sanMatches("d.example.com", sans));
+ assertFalse(EndpointCertificate.sanMatches("a.example.com", sans));
+ assertFalse(EndpointCertificate.sanMatches("aa.example.com", sans));
+ assertFalse(EndpointCertificate.sanMatches("c.c.example.com", sans));
+ assertFalse(EndpointCertificate.sanMatches("a.a.a.example.com", sans));
+ }
+
+}
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java
index 1693f752b89..552b313e454 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.deployment;
import com.yahoo.config.provision.zone.ZoneId;
@@ -48,4 +48,4 @@ public class JobTypeTest {
assertTrue(JobType.test("snohetta").isProduction());
}
-} \ No newline at end of file
+}
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTargetTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTargetTest.java
index c859cc020ab..2ef254a7f2d 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTargetTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTargetTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
import com.yahoo.config.provision.HostName;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java
index f262821a638..f6414113d4e 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
import com.yahoo.config.provision.zone.ZoneId;
@@ -33,4 +33,4 @@ class DirectTargetTest {
}
}
-} \ No newline at end of file
+}
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/maven/MetadataTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/maven/MetadataTest.java
index a6f7a5ee069..e78e9fb64d9 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/maven/MetadataTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/maven/MetadataTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.maven;
import com.yahoo.collections.Iterables;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/user/RolesTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/user/RolesTest.java
index 59484fbb0ce..f8bd0243c02 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/user/RolesTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/user/RolesTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.user;
import com.yahoo.config.provision.ApplicationName;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/resource/ResourceSnapshotTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/resource/ResourceSnapshotTest.java
index e5d615f8803..a6d70b360aa 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/resource/ResourceSnapshotTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/resource/ResourceSnapshotTest.java
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.resource;
import com.yahoo.config.provision.ApplicationId;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/PathGroupTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/PathGroupTest.java
index 4a8e9785c88..87e76b7ce09 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/PathGroupTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/PathGroupTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.role;
import org.junit.jupiter.api.Test;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/RoleTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/RoleTest.java
index a4ce45f44ea..c8020666906 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/RoleTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/role/RoleTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.role;
import com.yahoo.config.provision.ApplicationName;
@@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test;
import java.net.URI;
import java.util.List;
-import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -146,139 +145,6 @@ public class RoleTest {
}
}
- @Test
- void payment_instrument() {
- URI paymentInstrumentUri = URI.create("/billing/v1/tenant/t1/instrument/foobar");
- URI tenantPaymentInstrumentUri = URI.create("/billing/v1/tenant/t1/instrument");
- URI tokenUri = URI.create("/billing/v1/tenant/t1/token");
-
- Role user = Role.reader(TenantName.from("t1"));
- assertTrue(publicCdEnforcer.allows(user, Action.read, paymentInstrumentUri));
- assertTrue(publicCdEnforcer.allows(user, Action.delete, paymentInstrumentUri));
- assertFalse(publicCdEnforcer.allows(user, Action.update, tenantPaymentInstrumentUri));
- assertFalse(publicCdEnforcer.allows(user, Action.read, tokenUri));
-
- Role developer = Role.developer(TenantName.from("t1"));
- assertTrue(publicCdEnforcer.allows(developer, Action.read, paymentInstrumentUri));
- assertTrue(publicCdEnforcer.allows(developer, Action.delete, paymentInstrumentUri));
- assertFalse(publicCdEnforcer.allows(developer, Action.update, tenantPaymentInstrumentUri));
- assertFalse(publicCdEnforcer.allows(developer, Action.read, tokenUri));
-
- Role admin = Role.administrator(TenantName.from("t1"));
- assertTrue(publicCdEnforcer.allows(admin, Action.read, paymentInstrumentUri));
- assertFalse(publicCdEnforcer.allows(admin, Action.delete, paymentInstrumentUri));
- assertFalse(publicCdEnforcer.allows(admin, Action.update, tenantPaymentInstrumentUri));
- assertFalse(publicCdEnforcer.allows(admin, Action.read, tokenUri));
- }
-
- @Test
- void billing_tenant() {
- URI billing = URI.create("/billing/v1/tenant/t1/billing");
-
- Role user = Role.reader(TenantName.from("t1"));
- Role developer = Role.developer(TenantName.from("t1"));
- Role admin = Role.administrator(TenantName.from("t1"));
-
- Stream.of(user, developer, admin).forEach(role -> {
- assertTrue(publicCdEnforcer.allows(role, Action.read, billing));
- assertFalse(publicCdEnforcer.allows(role, Action.update, billing));
- assertFalse(publicCdEnforcer.allows(role, Action.delete, billing));
- assertFalse(publicCdEnforcer.allows(role, Action.create, billing));
- });
-
- }
-
- @Test
- void billing_test() {
- var tester = new EnforcerTester(publicEnforcer);
-
- var accountant = Role.hostedAccountant();
- var operator = Role.hostedOperator();
- var reader = Role.reader(TenantName.from("t1"));
- var developer = Role.developer(TenantName.from("t1"));
- var admin = Role.administrator(TenantName.from("t1"));
- var otherAdmin = Role.administrator(TenantName.from("t2"));
-
- tester.on("/billing/v1/tenant/t1/token")
- .assertAction(accountant)
- .assertAction(operator)
- .assertAction(reader)
- .assertAction(developer)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/tenant/t1/instrument")
- .assertAction(accountant)
- .assertAction(operator, Action.read)
- .assertAction(reader, Action.read, Action.delete)
- .assertAction(developer, Action.read, Action.delete)
- .assertAction(admin, Action.read)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/tenant/t1/instrument/i1")
- .assertAction(accountant)
- .assertAction(operator, Action.read)
- .assertAction(reader, Action.read, Action.delete)
- .assertAction(developer, Action.read, Action.delete)
- .assertAction(admin, Action.read)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/tenant/t1/billing")
- .assertAction(accountant)
- .assertAction(operator, Action.read)
- .assertAction(reader, Action.read)
- .assertAction(developer, Action.read)
- .assertAction(admin, Action.read)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/tenant/t1/plan")
- .assertAction(accountant, Action.update)
- .assertAction(operator, Action.read)
- .assertAction(reader)
- .assertAction(developer)
- .assertAction(admin)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/tenant/t1/collection")
- .assertAction(accountant, Action.update)
- .assertAction(operator, Action.read)
- .assertAction(reader)
- .assertAction(developer)
- .assertAction(admin)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/billing")
- .assertAction(accountant, Action.create, Action.read, Action.update, Action.delete)
- .assertAction(operator, Action.read)
- .assertAction(reader)
- .assertAction(developer)
- .assertAction(admin)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/invoice/tenant/t1/line-item")
- .assertAction(accountant, Action.create, Action.read, Action.update, Action.delete)
- .assertAction(operator, Action.read)
- .assertAction(reader)
- .assertAction(developer)
- .assertAction(admin)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/invoice")
- .assertAction(accountant, Action.create, Action.read, Action.update, Action.delete)
- .assertAction(operator, Action.read)
- .assertAction(reader)
- .assertAction(developer)
- .assertAction(admin)
- .assertAction(otherAdmin);
-
- tester.on("/billing/v1/invoice/i1/status")
- .assertAction(accountant, Action.create, Action.read, Action.update, Action.delete)
- .assertAction(operator, Action.read)
- .assertAction(reader)
- .assertAction(developer)
- .assertAction(admin)
- .assertAction(otherAdmin);
- }
-
private static class EnforcerTester {
private final Enforcer enforcer;
private final URI resource;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTargetTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTargetTest.java
index 9177813e38f..10ed4a278ee 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTargetTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTargetTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.systemflags.v1;
import com.yahoo.config.provision.SystemName;
@@ -38,4 +38,4 @@ class FlagsTargetTest {
assertEquals(expectedMessage, e.getMessage());
}
-} \ No newline at end of file
+}
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java
index 6d7dc3a179e..352cf820894 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.systemflags.v1;
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/tenant/ArchiveAccessTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/tenant/ArchiveAccessTest.java
index 87e02793361..bcff84884a4 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/tenant/ArchiveAccessTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/tenant/ArchiveAccessTest.java
@@ -1,4 +1,5 @@
-package com.yahoo.vespa.hosted.controller.tenant;// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.tenant;
import com.yahoo.text.Text;
import org.junit.jupiter.api.Test;
@@ -42,4 +43,4 @@ class ArchiveAccessTest {
private static ArchiveAccess archiveAccess(String iamRole) { return new ArchiveAccess().withAWSRole(iamRole); }
-} \ No newline at end of file
+}