summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-01-28 12:36:50 +0200
committerIttay Stern <ittay.stern@att.com>2020-01-28 12:42:49 +0200
commit22fb6d661b72bcb99e467c2289257d360d5e13a9 (patch)
treea7d0508b4db00125de4057bb1cac2caf5ab564e4
parentabb69004c16707e1dafa7a75050e8c026de9fe31 (diff)
Rename Role's subscriberId field
It was named subscriberName, although containing the id. Issue-ID: VID-758 Change-Id: I28fd174a6eab642d34aef207e9d3ca69e8091884 Signed-off-by: Ittay Stern <ittay.stern@att.com>
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/Role.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt8
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java12
7 files changed, 28 insertions, 28 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
index e12f5403f..66eab1810 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
@@ -27,7 +27,7 @@ public class AlwaysValidRoleValidator implements RoleValidator {
}
@Override
- public boolean isSubscriberPermitted(String subscriberName) {
+ public boolean isSubscriberPermitted(String subscriberId) {
return true;
}
@@ -37,7 +37,7 @@ public class AlwaysValidRoleValidator implements RoleValidator {
}
@Override
- public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) {
return true;
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/Role.java b/vid-app-common/src/main/java/org/onap/vid/roles/Role.java
index 454483031..3d94dc00a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/Role.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/Role.java
@@ -28,15 +28,15 @@ public class Role {
private EcompRole ecompRole;
- private String subscribeName;
+ private String subscriberId;
private String serviceType;
private String tenant;
- public Role(EcompRole ecompRole, String subscribeName, String serviceType, String tenant) {
+ public Role(EcompRole ecompRole, String subscriberId, String serviceType, String tenant) {
this.ecompRole = ecompRole;
- this.subscribeName = subscribeName;
+ this.subscriberId = subscriberId;
this.serviceType = serviceType;
this.tenant = tenant;
}
@@ -46,12 +46,12 @@ public class Role {
}
- public String getSubscribeName() {
- return subscribeName;
+ public String getSubscriberId() {
+ return subscriberId;
}
- public void setSubscribeName(String subscribeName) {
- this.subscribeName = subscribeName;
+ public void setSubscriberId(String subscriberId) {
+ this.subscriberId = subscriberId;
}
public String getServiceType() {
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
index 4ad168c4f..ed280c8b8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
@@ -38,9 +38,9 @@ public interface RoleValidator {
: new RoleValidatorBySubscriberAndServiceType(roles);
}
- boolean isSubscriberPermitted(String subscriberName);
+ boolean isSubscriberPermitted(String subscriberId);
boolean isServicePermitted(WithPermissionProperties serviceInstanceSearchResult);
- boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName);
+ boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java
index 726567cc6..50fc1091e 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java
@@ -28,7 +28,7 @@ public class RoleValidatorByOwningEntity implements RoleValidator{
}
@Override
- public boolean isSubscriberPermitted(String subscriberName) {
+ public boolean isSubscriberPermitted(String subscriberId) {
return false;
}
@@ -38,7 +38,7 @@ public class RoleValidatorByOwningEntity implements RoleValidator{
}
@Override
- public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) {
return false;
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java
index 95d8a1627..1e0f9f461 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java
@@ -31,9 +31,9 @@ public class RoleValidatorBySubscriberAndServiceType implements RoleValidator {
}
@Override
- public boolean isSubscriberPermitted(String subscriberName) {
+ public boolean isSubscriberPermitted(String subscriberId) {
for (Role role : userRoles) {
- if (role.getSubscribeName().equals(subscriberName)) {
+ if (role.getSubscriberId().equals(subscriberId)) {
return true;
}
}
@@ -43,7 +43,7 @@ public class RoleValidatorBySubscriberAndServiceType implements RoleValidator {
@Override
public boolean isServicePermitted(WithPermissionProperties permissionProperties) {
for (Role role : userRoles) {
- if (role.getSubscribeName().equals(permissionProperties.getSubscriberId()) && role.getServiceType().equals(permissionProperties.getServiceType())) {
+ if (role.getSubscriberId().equals(permissionProperties.getSubscriberId()) && role.getServiceType().equals(permissionProperties.getServiceType())) {
return true;
}
}
@@ -51,9 +51,9 @@ public class RoleValidatorBySubscriberAndServiceType implements RoleValidator {
}
@Override
- public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) {
for (Role role : userRoles) {
- if (role.getSubscribeName().equals(globalCustomerId)
+ if (role.getSubscriberId().equals(subscriberId)
&& role.getServiceType().equals(serviceType)
&& (role.getTenant() == null || role.getTenant().equalsIgnoreCase(tenantName))) {
return true;
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt
index 873622389..d012cb3f3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt
@@ -7,10 +7,10 @@ class RoleValidatorsComposer(private vararg val roleValidators: RoleValidator) :
override fun isServicePermitted(p: WithPermissionProperties): Boolean =
roleValidators.any { it.isServicePermitted(p) }
- override fun isSubscriberPermitted(subscriberName: String?): Boolean =
- roleValidators.any { it.isSubscriberPermitted(subscriberName) }
+ override fun isSubscriberPermitted(subscriberId: String?): Boolean =
+ roleValidators.any { it.isSubscriberPermitted(subscriberId) }
- override fun isTenantPermitted(globalCustomerId: String?, serviceType: String?, tenantName: String?): Boolean =
- roleValidators.any { it.isTenantPermitted(globalCustomerId, serviceType, tenantName) }
+ override fun isTenantPermitted(subscriberId: String?, serviceType: String?, tenantName: String?): Boolean =
+ roleValidators.any { it.isTenantPermitted(subscriberId, serviceType, tenantName) }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
index c1033d2d0..452ae52fe 100644
--- a/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
@@ -42,7 +42,7 @@ import org.testng.annotations.Test;
public class RoleProviderTest {
private static final String SAMPLE_SUBSCRIBER = "sampleSubscriber";
- private static final String SAMPLE_CUSTOMER_ID = "sampleCustomerId";
+ private static final String SAMPLE_SUBSCRIBER_ID = "subscriberId";
private static final String SERVICE_TYPE_LOGS = "LOGS";
private static final String TENANT_PERMITTED = "PERMITTED";
private static final String SAMPLE_SERVICE = "sampleService";
@@ -83,7 +83,7 @@ public class RoleProviderTest {
Role role = roleProvider.createRoleFromStringArr(roleParts, SAMPLE_ROLE_PREFIX);
assertThat(role.getEcompRole()).isEqualTo(EcompRole.READ);
- assertThat(role.getSubscribeName()).isEqualTo(SAMPLE_CUSTOMER_ID);
+ assertThat(role.getSubscriberId()).isEqualTo(SAMPLE_SUBSCRIBER_ID);
assertThat(role.getTenant()).isEqualTo(SAMPLE_TENANT);
assertThat(role.getServiceType()).isEqualTo(SAMPLE_SERVICE);
}
@@ -97,7 +97,7 @@ public class RoleProviderTest {
Role role = roleProvider.createRoleFromStringArr(roleParts, SAMPLE_ROLE_PREFIX);
assertThat(role.getEcompRole()).isEqualTo(EcompRole.READ);
- assertThat(role.getSubscribeName()).isEqualTo(SAMPLE_CUSTOMER_ID);
+ assertThat(role.getSubscriberId()).isEqualTo(SAMPLE_SUBSCRIBER_ID);
assertThat(role.getServiceType()).isEqualTo(SAMPLE_SERVICE);
assertThat(role.getTenant()).isNullOrEmpty();
}
@@ -111,7 +111,7 @@ public class RoleProviderTest {
@Test
public void shouldProperlyRetrieveUserRolesWhenPermissionIsDifferentThanRead() {
- Role expectedRole = new Role(EcompRole.READ, SAMPLE_CUSTOMER_ID, SAMPLE_SERVICE, SAMPLE_TENANT);
+ Role expectedRole = new Role(EcompRole.READ, SAMPLE_SUBSCRIBER_ID, SAMPLE_SERVICE, SAMPLE_TENANT);
setSubscribers();
List<Role> userRoles = roleProvider.getUserRoles(request);
@@ -121,7 +121,7 @@ public class RoleProviderTest {
Role actualRole = userRoles.get(0);
assertThat(actualRole.getTenant()).isEqualTo(expectedRole.getTenant());
- assertThat(actualRole.getSubscribeName()).isEqualTo(expectedRole.getSubscribeName());
+ assertThat(actualRole.getSubscriberId()).isEqualTo(expectedRole.getSubscriberId());
assertThat(actualRole.getServiceType()).isEqualTo(expectedRole.getServiceType());
}
@@ -146,7 +146,7 @@ public class RoleProviderTest {
private void setSubscribers() {
Subscriber subscriber = new Subscriber();
subscriber.subscriberName = SAMPLE_SUBSCRIBER;
- subscriber.globalCustomerId = SAMPLE_CUSTOMER_ID;
+ subscriber.globalCustomerId = SAMPLE_SUBSCRIBER_ID;
SubscriberList subscriberList = new SubscriberList(Lists.list(subscriber));
when(aaiService.getFullSubscriberList()).thenReturn(subscriberListResponse);
when(subscriberListResponse.getT()).thenReturn(subscriberList);