summaryrefslogtreecommitdiffstats
path: root/vespa-athenz
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@oath.com>2018-08-16 12:24:45 +0200
committerBjørn Christian Seime <bjorncs@oath.com>2018-08-16 12:24:45 +0200
commit2830f78c98dd6c57afd251b563b32b2d7dac326c (patch)
treee32d6e7dc65424e744a78280c782e228237443f2 /vespa-athenz
parent9bf4c6a5c602f3ae72f18dff295d774390fc4e12 (diff)
Remove workaround for missing identity type
Diffstat (limited to 'vespa-athenz')
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java4
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java30
-rw-r--r--vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceIdTest.java12
3 files changed, 7 insertions, 39 deletions
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java
index 956092d7f9b..5fb61ba659e 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java
@@ -46,7 +46,7 @@ public class EntityBindingsMapper {
entity.instanceHostname,
entity.createdAt,
entity.ipAddresses,
- entity.identityType != null ? IdentityType.fromId(entity.identityType) : null); // TODO Remove support for legacy representation without type
+ IdentityType.fromId(entity.identityType));
}
public static SignedIdentityDocumentEntity toSignedIdentityDocumentEntity(SignedIdentityDocument model) {
@@ -60,7 +60,7 @@ public class EntityBindingsMapper {
model.instanceHostname(),
model.createdAt(),
model.ipAddresses(),
- model.identityType() != null ? model.identityType().id() : null); // TODO Remove support for legacy representation without type
+ model.identityType().id());
}
public static SignedIdentityDocument readSignedIdentityDocumentFromFile(Path file) {
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java
index be94cc59691..cc7b862a6dd 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java
@@ -37,40 +37,20 @@ public class VespaUniqueInstanceId {
this.type = type;
}
- // TODO Remove support for legacy representation without type
- @Deprecated
- public VespaUniqueInstanceId(int clusterIndex,
- String clusterId,
- String instance,
- String application,
- String tenant,
- String region,
- String environment) {
- this(clusterIndex, clusterId, instance, application, tenant, region, environment, null);
- }
-
- // TODO Remove support for legacy representation without type
public static VespaUniqueInstanceId fromDottedString(String instanceId) {
String[] tokens = instanceId.split("\\.");
- if (tokens.length != 7 && tokens.length != 8) {
+ if (tokens.length != 8) {
throw new IllegalArgumentException("Invalid instance id: " + instanceId);
}
return new VespaUniqueInstanceId(
- Integer.parseInt(tokens[0]), tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens.length == 8 ? IdentityType.fromId(tokens[7]) : null);
+ Integer.parseInt(tokens[0]), tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], IdentityType.fromId(tokens[7]));
}
- // TODO Remove support for legacy representation without type
public String asDottedString() {
- if (type != null) {
- return String.format(
- "%d.%s.%s.%s.%s.%s.%s.%s",
- clusterIndex, clusterId, instance, application, tenant, region, environment, type.id());
- } else {
- return String.format(
- "%d.%s.%s.%s.%s.%s.%s",
- clusterIndex, clusterId, instance, application, tenant, region, environment);
- }
+ return String.format(
+ "%d.%s.%s.%s.%s.%s.%s.%s",
+ clusterIndex, clusterId, instance, application, tenant, region, environment, type.id());
}
public int clusterIndex() {
diff --git a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceIdTest.java b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceIdTest.java
index 86b6c566987..ec258a42131 100644
--- a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceIdTest.java
+++ b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceIdTest.java
@@ -21,16 +21,4 @@ public class VespaUniqueInstanceIdTest {
assertEquals(id, deserializedId);
}
- // TODO Remove support for legacy representation without type
- @Test
- public void supports_legacy_representation_without_type() {
- VespaUniqueInstanceId id =
- new VespaUniqueInstanceId(1, "cluster-id", "instance", "application", "tenant", "region", "environment");
- String stringRepresentation = id.asDottedString();
- String expectedStringRepresentation = "1.cluster-id.instance.application.tenant.region.environment";
- assertEquals(expectedStringRepresentation, stringRepresentation);
- VespaUniqueInstanceId deserializedId = VespaUniqueInstanceId.fromDottedString(stringRepresentation);
- assertEquals(id, deserializedId);
- }
-
} \ No newline at end of file