aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java18
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java46
-rw-r--r--vid-app-common/src/test/resources/responses/aai/listServicesByProject.json95
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java31
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java26
7 files changed, 189 insertions, 32 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
index 1baca9ffa..78164462c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -149,7 +149,7 @@ public class AaiClient implements AaiClientInterface {
}
@Override
- public AaiResponse getServicesByProjectNames(List<String> projectNames){
+ public AaiResponse<ProjectResponse> getServicesByProjectNames(List<String> projectNames){
Response resp = doAaiGet(getUrlFromLIst("business/projects?", "project-name=", projectNames), false);
return processAaiResponse(resp, ProjectResponse.class, null);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
index b39b80943..b4b908cc3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
@@ -31,6 +31,7 @@ import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.model.ModelVer;
import org.onap.vid.aai.model.OwningEntityResponse;
import org.onap.vid.aai.model.PortDetailsTranslator;
+import org.onap.vid.aai.model.ProjectResponse;
import org.onap.vid.aai.model.Properties;
import org.onap.vid.aai.model.ResourceType;
import org.onap.vid.model.SubscriberList;
@@ -76,7 +77,7 @@ public interface AaiClientInterface extends ProbeInterface {
ModelVer getLatestVersionByInvariantId(String modelInvariantId);
- AaiResponse getServicesByProjectNames(List<String> projectNames);
+ AaiResponse<ProjectResponse> getServicesByProjectNames(List<String> projectNames);
AaiResponse getServiceModelsByDistributionStatus();
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
index a992519cf..1e79ab4c8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
@@ -179,33 +179,36 @@ public class AaiServiceImpl implements AaiService {
if (owningEntityResponse.getT() != null) {
for (OwningEntity owningEntity : owningEntityResponse.getT().getOwningEntity()) {
if (owningEntity.getRelationshipList() != null) {
- serviceInstanceSearchResultList = convertRelationshipToSearchResult(owningEntity, serviceInstanceSearchResultList, roleValidator);
+ serviceInstanceSearchResultList.addAll(convertRelationshipToSearchResult(owningEntity, roleValidator, owningEntity.getOwningEntityId()));
}
}
}
return serviceInstanceSearchResultList;
}
- private List<ServiceInstanceSearchResult> getServicesByProjectNames(List<String> projectNames, RoleValidator roleValidator) {
+ List<ServiceInstanceSearchResult> getServicesByProjectNames(List<String> projectNames, RoleValidator roleValidator) {
AaiResponse<ProjectResponse> projectByIdResponse = aaiClient.getServicesByProjectNames(projectNames);
List<ServiceInstanceSearchResult> serviceInstanceSearchResultList = new ArrayList<>();
if (projectByIdResponse.getT() != null) {
for (Project project : projectByIdResponse.getT().getProject()) {
if (project.getRelationshipList() != null) {
- serviceInstanceSearchResultList = convertRelationshipToSearchResult(project, serviceInstanceSearchResultList, roleValidator);
+ serviceInstanceSearchResultList.addAll(convertRelationshipToSearchResult(project, roleValidator, null));
}
}
}
return serviceInstanceSearchResultList;
}
- private List<ServiceInstanceSearchResult> convertRelationshipToSearchResult(AaiRelationResponse owningEntityResponse, List<ServiceInstanceSearchResult> serviceInstanceSearchResultList, RoleValidator roleValidator) {
- if (owningEntityResponse.getRelationshipList().getRelationship() != null) {
- List<Relationship> relationshipList = owningEntityResponse.getRelationshipList().getRelationship();
+ private List<ServiceInstanceSearchResult> convertRelationshipToSearchResult(AaiRelationResponse aaiRelationResponse, RoleValidator roleValidator, String owningEntityId) {
+ List<ServiceInstanceSearchResult> serviceInstanceSearchResultList = new ArrayList<>();
+ if (aaiRelationResponse.getRelationshipList().getRelationship() != null) {
+ List<Relationship> relationshipList = aaiRelationResponse.getRelationshipList().getRelationship();
for (Relationship relationship : relationshipList) {
ServiceInstanceSearchResult serviceInstanceSearchResult = new ServiceInstanceSearchResult();
extractRelationshipData(relationship, serviceInstanceSearchResult, roleValidator);
extractRelatedToProperty(relationship, serviceInstanceSearchResult);
+ serviceInstanceSearchResult.setOwningEntityId(owningEntityId);
+ serviceInstanceSearchResult.setIsPermitted(roleValidator.isServicePermitted(serviceInstanceSearchResult));
serviceInstanceSearchResultList.add(serviceInstanceSearchResult);
}
}
@@ -226,9 +229,6 @@ public class AaiServiceImpl implements AaiService {
serviceInstanceSearchResult.setSubscriberId(relationshipData.getRelationshipValue());
}
}
-
- boolean isPermitted = roleValidator.isServicePermitted(serviceInstanceSearchResult);
- serviceInstanceSearchResult.setIsPermitted(isPermitted);
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java
index 663d86255..4d6566f5b 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java
@@ -43,6 +43,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import org.jetbrains.annotations.NotNull;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -55,6 +56,7 @@ import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.model.LogicalLinkResponse;
import org.onap.vid.aai.model.OwningEntityResponse;
+import org.onap.vid.aai.model.ProjectResponse;
import org.onap.vid.aai.model.Relationship;
import org.onap.vid.aai.model.RelationshipData;
import org.onap.vid.aai.model.RelationshipList;
@@ -286,21 +288,53 @@ public class AaiServiceTest {
@Test
public void testGetServicesByOwningEntityId() {
- List<String> owningEntityIds = ImmutableList.of("43b8a85a-0421-4265-9069-117dd6526b8a", "26dcc4aa-725a-447d-8346-aa26dfaa4eb7");
- RoleValidator roleValidator = mock(RoleValidator.class);
+ //given
+ List<String> owningEntityIds = ImmutableList.of("43b8a85a-0421-4265-9069-117dd6526b8a", "26dcc4aa-725a-447d-8346-aa26dfaa4eb7");
OwningEntityResponse owningEntityResponse = TestUtils.readJsonResourceFileAsObject("/responses/aai/listServicesByOwningEntity.json", OwningEntityResponse.class);
- when(roleValidator.isServicePermitted(any(WithPermissionProperties.class))).thenReturn(true);
when(aaiClientInterface.getServicesByOwningEntityId(owningEntityIds)).thenReturn(new AaiResponse<>(owningEntityResponse, "", 200));
+ RoleValidator roleValidator = createAlwaysTrueRoleValidator();
+
+ //when
List<ServiceInstanceSearchResult> result = aaiService.getServicesByOwningEntityId(owningEntityIds, roleValidator);
+ //then
+ ServiceInstanceSearchResult expected1 = new ServiceInstanceSearchResult(
+ "af9d52f9-13b2-4657-a198-463677f82dc0", "256cddb4-3aa1-43cc-a08f-315bb50b275e", "MSO-dev-service-type", "xbghrftgr_shani", null, null, null, "43b8a85a-0421-4265-9069-117dd6526b8a", true);
+ ServiceInstanceSearchResult expected2 = new ServiceInstanceSearchResult(
+ "49769492-5def-4c89-8e73-b236f958fa40", "e02fd6f2-7fc2-434b-a92d-15abdb24b68d", "JUST-another-service-type", "fghghfhgf", null, null, null, "43b8a85a-0421-4265-9069-117dd6526b8a", true);
+ ServiceInstanceSearchResult expected3 = new ServiceInstanceSearchResult(
+ "1d8fd482-2f53-4d62-a7bd-20e4bab14c45", "256cddb4-3aa1-43cc-a08f-315bb50b275e", "MSO-dev-service-type", "Bryant", null, null, null, "26dcc4aa-725a-447d-8346-aa26dfaa4eb7", true);
+
+ assertThat(result, jsonEquals(ImmutableList.of(expected1, expected2, expected3)).when(IGNORING_ARRAY_ORDER).whenIgnoringPaths("[*].subscriberName")); //ignore in array
+ }
+
+ @NotNull
+ private RoleValidator createAlwaysTrueRoleValidator() {
+ RoleValidator roleValidator = mock(RoleValidator.class);
+ when(roleValidator.isServicePermitted(any(WithPermissionProperties.class))).thenReturn(true);
+ return roleValidator;
+ }
+
+ @Test
+ public void testGetServicesByProjectNames() {
+
+ //given
+ List<String> projectNames = ImmutableList.of("x1", "y2");
+ ProjectResponse projectResponse = TestUtils.readJsonResourceFileAsObject("/responses/aai/listServicesByProject.json", ProjectResponse.class);
+ when(aaiClientInterface.getServicesByProjectNames(projectNames)).thenReturn(new AaiResponse<>(projectResponse, "", 200));
+ RoleValidator roleValidator = createAlwaysTrueRoleValidator();
+
+ //when
+ List<ServiceInstanceSearchResult> result = aaiService.getServicesByProjectNames(projectNames, roleValidator);
+ //then
ServiceInstanceSearchResult expected1 = new ServiceInstanceSearchResult(
- "af9d52f9-13b2-4657-a198-463677f82dc0", "256cddb4-3aa1-43cc-a08f-315bb50b275e", "MSO-dev-service-type", "xbghrftgr_shani", null, null, null, null, true);
+ "3f826016-3ac9-4928-9561-beee75fd91d5", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", "Emanuel", "Lital_SRIOV2_001", null, null, null, null, true);
ServiceInstanceSearchResult expected2 = new ServiceInstanceSearchResult(
- "49769492-5def-4c89-8e73-b236f958fa40", "e02fd6f2-7fc2-434b-a92d-15abdb24b68d", "JUST-another-service-type", "fghghfhgf", null, null, null, null, true);
+ "7e4f8130-5dee-47c4-8770-1abc5f5ded83", "3d15d7ea-4174-49b6-89ec-e569381f7231", "vMOG", "justAname", null, null, null, null, true);
ServiceInstanceSearchResult expected3 = new ServiceInstanceSearchResult(
- "1d8fd482-2f53-4d62-a7bd-20e4bab14c45", "256cddb4-3aa1-43cc-a08f-315bb50b275e", "MSO-dev-service-type", "Bryant", null, null, null, null, true);
+ "ff2d9326-1ef5-4760-aba0-0eaf372ae675", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", "Yoda", "anotherName", null, null, null, null, true);
assertThat(result, jsonEquals(ImmutableList.of(expected1, expected2, expected3)).when(IGNORING_ARRAY_ORDER).whenIgnoringPaths("[*].subscriberName")); //ignore in array
}
diff --git a/vid-app-common/src/test/resources/responses/aai/listServicesByProject.json b/vid-app-common/src/test/resources/responses/aai/listServicesByProject.json
new file mode 100644
index 000000000..6d6b09f78
--- /dev/null
+++ b/vid-app-common/src/test/resources/responses/aai/listServicesByProject.json
@@ -0,0 +1,95 @@
+{
+ "project": [
+ {
+ "project-name": "x1",
+ "resource-version": "1527026201826",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Emanuel/service-instances/service-instance/3f826016-3ac9-4928-9561-beee75fd91d5",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "Emanuel"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "3f826016-3ac9-4928-9561-beee75fd91d5"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "Lital_SRIOV2_001"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "project-name": "y2",
+ "resource-version": "1527026341826",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+ "related-link": "/aai/v12/business/customers/customer/3d15d7ea-4174-49b6-89ec-e569381f7231/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/7e4f8130-5dee-47c4-8770-1abc5f5ded83",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "3d15d7ea-4174-49b6-89ec-e569381f7231"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "vMOG"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "7e4f8130-5dee-47c4-8770-1abc5f5ded83"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "justAname"
+ }
+ ]
+ },
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Yoda/service-instances/service-instance/ff2d9326-1ef5-4760-aba0-0eaf372ae675",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "Yoda"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "ff2d9326-1ef5-4760-aba0-0eaf372ae675"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "anotherName"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java
index ae921fd79..88ea09ae5 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java
@@ -1,18 +1,31 @@
package org.onap.simulator.presetGenerator.presets.aai;
import com.google.common.collect.ImmutableMap;
-import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
-import org.springframework.http.HttpMethod;
-
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
+import org.springframework.http.HttpMethod;
public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset {
- String oeName;
+
+ private static final String DEFAULT_OWNING_ENTITY_ID = "43b8a85a-0421-4265-9069-117dd6526b8a";
+ private static final String DEFAULT_SUBSCRIBER_ID = "CAR_2020_ER";
+
+ private String oeName;
+ private String oeId;
+ private String subscriberId;
public PresetAAIGetModelsByOwningEntity(String oeName) {
this.oeName = oeName;
+ this.oeId = DEFAULT_OWNING_ENTITY_ID;
+ this.subscriberId = DEFAULT_SUBSCRIBER_ID;
+ }
+
+ public PresetAAIGetModelsByOwningEntity(String oeName, String oeId, String subscriberId) {
+ this.oeName = oeName;
+ this.oeId = oeId;
+ this.subscriberId = subscriberId;
}
@Override
@@ -37,7 +50,7 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset {
return "{" +
" \"owning-entity\": [" +
" {" +
- " \"owning-entity-id\": \"43b8a85a-0421-4265-9069-117dd6526b8a\"," +
+ " \"owning-entity-id\": \"" + oeId + "\"," +
" \"owning-entity-name\": \"" + oeName + "\"," +
" \"resource-version\": \"1527418700853\"," +
" \"relationship-list\": {" +
@@ -45,11 +58,11 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset {
" {" +
" \"related-to\": \"service-instance\"," +
" \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," +
- " \"related-link\": \"/aai/v12/business/customers/customer/CAR_2020_ER/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/af9d52f9-13b2-4657-a198-463677f82dc0\"," +
+ " \"related-link\": \"/aai/v12/business/customers/customer/" + subscriberId + "/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/af9d52f9-13b2-4657-a198-463677f82dc0\"," +
" \"relationship-data\": [" +
" {" +
" \"relationship-key\": \"customer.global-customer-id\"," +
- " \"relationship-value\": \"CAR_2020_ER\"" +
+ " \"relationship-value\": \"" + subscriberId + "\"" +
" }," +
" {" +
" \"relationship-key\": \"service-subscription.service-type\"," +
@@ -70,11 +83,11 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset {
" {" +
" \"related-to\": \"service-instance\"," +
" \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," +
- " \"related-link\": \"/aai/v12/business/customers/customer/CAR_2020_ER/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/49769492-5def-4c89-8e73-b236f958fa40\"," +
+ " \"related-link\": \"/aai/v12/business/customers/customer/" + DEFAULT_SUBSCRIBER_ID + "/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/49769492-5def-4c89-8e73-b236f958fa40\"," +
" \"relationship-data\": [" +
" {" +
" \"relationship-key\": \"customer.global-customer-id\"," +
- " \"relationship-value\": \"CAR_2020_ER\"" +
+ " \"relationship-value\": \"" + DEFAULT_SUBSCRIBER_ID + "\"" +
" }," +
" {" +
" \"relationship-key\": \"service-subscription.service-type\"," +
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
index ca09d796b..54300c22a 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
@@ -47,6 +47,7 @@ import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroups
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetL3NetworksByCloudRegion;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetL3NetworksByCloudRegionSpecificState;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByOwningEntity;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetails;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetailsInvalidRequest;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetailsRequiredMissing;
@@ -903,20 +904,34 @@ public class AaiApiTest extends BaseApiAaiTest {
}
@Test
- public void searchServiceInstances_serviceInstanceOfAnotherSubscriber_authIsFollowingFeatureToggle() {
+ public void searchServiceInstancesBySubscriber_serviceInstanceOfAnotherSubscriber_authIsFollowingFeatureToggle() {
String craigRobertsSubscriberId = "31739f3e-526b-11e6-beb8-9e71128cae77";
- String aServiceInstanceId = "4ea864f2-b946-473a-b51c-51a7c10b8391";
String aServiceOwningEntityId = "f160c875-ddd1-4ef5-84d8-d098784daa3a";
String currentUserAuthorizedOwningEntityId = "SILVIA ROBBINS"; // this will need to change with translateOwningEntityNameToOwningEntityId
- boolean expectedPermission = Features.FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY.isActive();
-
SimulatorApi.registerExpectation(GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS,
ImmutableMap.of(aServiceOwningEntityId, currentUserAuthorizedOwningEntityId), CLEAR_THEN_SET);
+
+ searchServicesAndAssertIsPermitted("subscriberId=" + craigRobertsSubscriberId, "4ea864f2-b946-473a-b51c-51a7c10b8391");
+ }
+
+ @Test
+ public void searchServiceInstancesByOwningEntity_serviceInstanceOfAnotherSubscriber_authIsFollowingFeatureToggle() {
+ String owningEntityName = "someOwning";
+ String owningEntityId = "SILVIA ROBBINS"; // this will need to change with translateOwningEntityNameToOwningEntityId
+
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIGetModelsByOwningEntity(owningEntityName, owningEntityId, "fakeSubscriberId"), CLEAR_THEN_SET);
+
+ searchServicesAndAssertIsPermitted("owningEntity=" + owningEntityName, "af9d52f9-13b2-4657-a198-463677f82dc0");
+ }
+
+ private void searchServicesAndAssertIsPermitted(String queryParams, String aServiceInstanceId) {
+ boolean expectedPermission = Features.FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY.isActive();
+
SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), APPEND);
JsonNode serviceInstancesResult = restTemplate
- .getForObject(uri + "/search_service_instances?subscriberId=" + craigRobertsSubscriberId, JsonNode.class);
+ .getForObject(uri + "/search_service_instances?" + queryParams, JsonNode.class);
assertThat(serviceInstancesResult.path("service-instances").isArray(), is(true));
@@ -929,7 +944,6 @@ public class AaiApiTest extends BaseApiAaiTest {
assertThat(aServiceResult.toString(),
aServiceResult.path("isPermitted").booleanValue(), is(expectedPermission));
-
}
private void assertResponse(Object expected, String response) {