aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/a1pesimulator/controller
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/a1pesimulator/controller')
-rw-r--r--src/test/java/org/onap/a1pesimulator/controller/RanA1ControllerTest.java209
-rw-r--r--src/test/java/org/onap/a1pesimulator/controller/RanCellControllerTest.java127
-rw-r--r--src/test/java/org/onap/a1pesimulator/controller/RanControllerTest.java77
-rw-r--r--src/test/java/org/onap/a1pesimulator/controller/RanUeControllerTest.java90
-rw-r--r--src/test/java/org/onap/a1pesimulator/controller/URLHelper.java58
5 files changed, 561 insertions, 0 deletions
diff --git a/src/test/java/org/onap/a1pesimulator/controller/RanA1ControllerTest.java b/src/test/java/org/onap/a1pesimulator/controller/RanA1ControllerTest.java
new file mode 100644
index 0000000..5b846c4
--- /dev/null
+++ b/src/test/java/org/onap/a1pesimulator/controller/RanA1ControllerTest.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2021 Samsung Electronics
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.onap.a1pesimulator.controller;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.onap.a1pesimulator.TestHelpers.FIRST_UE_CELL_ID;
+import static org.onap.a1pesimulator.TestHelpers.FIRST_UE_HANDOVER_CELL;
+import static org.onap.a1pesimulator.TestHelpers.FIRST_UE_ID;
+import static org.onap.a1pesimulator.controller.URLHelper.getHealthCheckEndpoint;
+import static org.onap.a1pesimulator.controller.URLHelper.getPolicyPath;
+import static org.onap.a1pesimulator.controller.URLHelper.getPolicyTypePath;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.google.common.collect.Lists;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.a1pesimulator.data.ue.UserEquipment;
+import org.onap.a1pesimulator.service.ue.RanUeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+
+@SpringBootTest
+@AutoConfigureMockMvc
+@RunWith(SpringRunner.class)
+public class RanA1ControllerTest {
+
+ private static final String FIRST_POLICY_TYPE_ID = "1000";
+ private static final Policy.Preference FIRST_POLICY_PREFERENCE = Policy.Preference.AVOID;
+ private static final String FIRST_POLICY_ORIGINAL_ID = "ue1";
+ private static final String TEST_POLICY_SCHEMA =
+ "{\n" + " \"name\": \"samsung_policy_type\",\n" + " \"description\": \"samsung policy type;\",\n"
+ + " \"policy_type_id\": 1000,\n" + " \"create_schema\": {\n"
+ + " \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n"
+ + " \"title\": \"Samsung_demo\",\n" + " \"description\": \"Samsung demo policy type\",\n"
+ + " \"type\": \"object\",\n" + " \"additionalProperties\": false,\n" + " \"required\": [\n"
+ + " \"scope\",\n" + " \"resources\"\n" + " ]\n" + " }\n" + "}";
+
+ @Autowired
+ private MockMvc mvc;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ @Autowired
+ RanUeService ranUeService;
+
+ @Test
+ public void testHealthcheck() throws Exception {
+ this.mvc.perform(get(getHealthCheckEndpoint()));
+ }
+
+ @Test
+ public void testGetPolicyTypes() throws Exception {
+ String firstPolicyURL = URLHelper.getPolicyTypePath("1000");
+ mvc.perform(put(firstPolicyURL).content(TEST_POLICY_SCHEMA)).andExpect(status().isCreated());
+
+ String[] policyTypes = mapper.readValue(getFromController(getPolicyTypePath()), String[].class);
+
+ assertEquals(FIRST_POLICY_TYPE_ID, policyTypes[0]);
+ }
+
+ @Test
+ public void testGetPolicy() throws Exception {
+ // Remove escaping
+ Policy policy = mapper.readValue(getFromController(getPolicyPath("3", "1")), Policy.class);
+
+ assertEquals(FIRST_POLICY_ORIGINAL_ID, policy.getScope().getUeId());
+ assertEquals(FIRST_POLICY_PREFERENCE, policy.getResources().get(0).getPreference());
+ }
+
+ @Test
+ public void testPutPolicyAndTriggerHandover() throws Exception {
+ String policyURL = getPolicyPath("3", "1");
+
+ mvc.perform(put(policyURL).content(getHandoverPolicy())).andExpect(status().isAccepted());
+
+ // Remove escaping
+ Policy policy = mapper.readValue(getFromController(policyURL), Policy.class);
+
+ assertEquals(FIRST_UE_ID, policy.getScope().getUeId());
+
+ assertEquals(FIRST_POLICY_PREFERENCE, policy.getResources().get(0).getPreference());
+ assertEquals(FIRST_UE_CELL_ID, policy.getResources().get(0).getCellIdList().get(0));
+
+ UserEquipment userEquipment = ranUeService.getUserEquipment(FIRST_UE_ID).orElse(null);
+
+ assertNotNull(userEquipment);
+ assertEquals(FIRST_UE_HANDOVER_CELL, userEquipment.getCellId());
+
+ mvc.perform(put(policyURL).content(getOriginalPolicy())).andExpect(status().isAccepted());
+ }
+
+ @Test
+ public void testPutPolicyAndCantHandover() throws Exception {
+ String policyURL = getPolicyPath("3", "1");
+
+ // trigger cellId==null in the onPolicy
+ mvc.perform(put(policyURL).content(getHandoverPolicyWithoutCellId())).andExpect(status().isAccepted());
+
+ // trigger canHandover==false in the onPolicy
+ mvc.perform(put(policyURL).content(getOriginalPolicy())).andExpect(status().isAccepted());
+ }
+
+ @Test
+ public void shouldDeletePolicyInstanceAndReturn200() throws Exception {
+ String url = getPolicyPath("3", "1");
+ mvc.perform(delete(url)).andExpect(status().isAccepted());
+ }
+
+ @Test
+ public void shouldReturn404WhenPolicyInstanceNotExists() throws Exception {
+ String url = getPolicyPath("10", "321123");
+ mvc.perform(delete(url)).andExpect(status().isNotFound());
+ }
+
+ private String getFromController(String url) throws Exception {
+ return this.mvc.perform(get(url)).andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
+ }
+
+ private String getOriginalPolicy() throws JsonProcessingException {
+ return mapper.writeValueAsString(
+ Policy.builder().scope(Policy.Scope.builder().ueId(FIRST_POLICY_ORIGINAL_ID).build()).resources(
+ Lists.newArrayList(Policy.Resources.builder().cellIdList(Lists.newArrayList(FIRST_UE_CELL_ID))
+ .preference(Policy.Preference.AVOID).build())).build());
+ }
+
+ private String getHandoverPolicy() throws JsonProcessingException {
+ return mapper.writeValueAsString(Policy.builder().scope(Policy.Scope.builder().ueId(FIRST_UE_ID).build())
+ .resources(Lists.newArrayList(Policy.Resources.builder().cellIdList(
+ Lists.newArrayList(FIRST_UE_CELL_ID)).preference(
+ Policy.Preference.AVOID).build())).build());
+ }
+
+ private String getHandoverPolicyWithoutCellId() throws JsonProcessingException {
+ return mapper.writeValueAsString(Policy.builder().scope(Policy.Scope.builder().ueId(FIRST_UE_ID).build())
+ .resources(Lists.newArrayList(
+ Policy.Resources.builder().cellIdList(Lists.newArrayList())
+ .preference(Policy.Preference.AVOID).build()))
+ .build());
+ }
+
+ @Data
+ @Builder
+ @JsonSerialize
+ @NoArgsConstructor
+ @AllArgsConstructor
+ private static class Policy {
+
+ private Scope scope;
+ private List<Resources> resources;
+
+ @Data
+ @Builder
+ @JsonSerialize
+ @NoArgsConstructor
+ @AllArgsConstructor
+ private static class Scope {
+
+ private String ueId;
+ }
+
+ @Data
+ @Builder
+ @JsonSerialize
+ @NoArgsConstructor
+ @AllArgsConstructor
+ private static class Resources {
+
+ private List<String> cellIdList;
+ private Preference preference;
+ }
+
+ public enum Preference {
+ SHALL("SHALL"), PREFER("PREFER"), AVOID("AVOID"), FORBID("FORBID");
+ public final String value;
+
+ Preference(String stateName) {
+ this.value = stateName;
+ }
+ }
+
+ }
+}
diff --git a/src/test/java/org/onap/a1pesimulator/controller/RanCellControllerTest.java b/src/test/java/org/onap/a1pesimulator/controller/RanCellControllerTest.java
new file mode 100644
index 0000000..ebc93fb
--- /dev/null
+++ b/src/test/java/org/onap/a1pesimulator/controller/RanCellControllerTest.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2021 Samsung Electronics
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.onap.a1pesimulator.controller;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.onap.a1pesimulator.controller.URLHelper.getRanCellControllerEndpoint;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.a1pesimulator.data.cell.CellDetails;
+import org.onap.a1pesimulator.data.cell.RanCell;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.MediaType;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
+import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
+
+@SpringBootTest
+@AutoConfigureMockMvc
+@RunWith(SpringRunner.class)
+@ActiveProfiles(value = {"localStore"})
+public class RanCellControllerTest {
+
+ @Autowired
+ private MockMvc mvc;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ protected String mapToJson(Object obj) throws JsonProcessingException {
+ mapper = new ObjectMapper();
+ return mapper.writeValueAsString(obj);
+ }
+
+ protected <T> T mapFromJson(String json, Class<T> clazz)
+ throws JsonParseException, JsonMappingException, IOException {
+ mapper = new ObjectMapper();
+ return mapper.readValue(json, clazz);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testGetCells() throws Exception {
+ MvcResult mvcResult = this.mvc.perform(
+ MockMvcRequestBuilders.get(getRanCellControllerEndpoint()).accept(MediaType.APPLICATION_JSON_VALUE))
+ .andDo(MockMvcResultHandlers.print()).andReturn();
+
+ int status = mvcResult.getResponse().getStatus();
+ assertEquals(200, status);
+ String content = mvcResult.getResponse().getContentAsString();
+
+ RanCell[] ranCell = this.mapFromJson(content, RanCell[].class);
+
+ assertTrue(ranCell.length > 0);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testGetCellById() throws Exception {
+ MvcResult mvcResult = this.mvc.perform(
+ MockMvcRequestBuilders.get(getRanCellControllerEndpoint() + "/{identifier}", 1)
+ .accept(MediaType.APPLICATION_JSON_VALUE)).andReturn();
+
+ int status = mvcResult.getResponse().getStatus();
+ assertEquals(200, status);
+ String content = mvcResult.getResponse().getContentAsString();
+
+ CellDetails cell = this.mapFromJson(content, CellDetails.class);
+ assertEquals(cell.getId(), "1");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testStartSendingFailureVesEvents() throws Exception {
+ this.mvc.perform(MockMvcRequestBuilders.get(getRanCellControllerEndpoint() + "/1/startFailure")
+ .accept(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testStopSendingFailureVesEvents() throws Exception {
+ this.mvc.perform(MockMvcRequestBuilders.get(getRanCellControllerEndpoint() + "/1/stopFailure")
+ .accept(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testStartSendingVesEvents() throws Exception {
+ this.mvc.perform(MockMvcRequestBuilders.get(getRanCellControllerEndpoint() + "/1/start")
+ .accept(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testStopSendingVesEvents() throws Exception {
+ this.mvc.perform(MockMvcRequestBuilders.get(getRanCellControllerEndpoint() + "/1/stop")
+ .accept(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testGetVesEventStructure() throws Exception {
+ this.mvc.perform(MockMvcRequestBuilders.get(getRanCellControllerEndpoint() + "/1/structure")
+ .accept(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print());
+ }
+}
diff --git a/src/test/java/org/onap/a1pesimulator/controller/RanControllerTest.java b/src/test/java/org/onap/a1pesimulator/controller/RanControllerTest.java
new file mode 100644
index 0000000..3c2602f
--- /dev/null
+++ b/src/test/java/org/onap/a1pesimulator/controller/RanControllerTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2021 Samsung Electronics
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.onap.a1pesimulator.controller;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.onap.a1pesimulator.controller.URLHelper.getRanCellControllerEndpoint;
+import static org.onap.a1pesimulator.controller.URLHelper.getRanControllerEndpoint;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.a1pesimulator.data.Topology;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.MediaType;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
+import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
+
+@SpringBootTest
+@AutoConfigureMockMvc
+@RunWith(SpringRunner.class)
+@ActiveProfiles(value = {"localStore"})
+public class RanControllerTest {
+
+ @Autowired
+ private MockMvc mvc;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ protected <T> T mapFromJson(String json, Class<T> clazz) throws IOException {
+ mapper = new ObjectMapper();
+ return mapper.readValue(json, clazz);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testGetRan() throws Exception {
+ MvcResult mvcResult = this.mvc.perform(
+ MockMvcRequestBuilders.get(getRanControllerEndpoint()).accept(MediaType.APPLICATION_JSON_VALUE))
+ .andDo(MockMvcResultHandlers.print()).andReturn();
+
+ int status = mvcResult.getResponse().getStatus();
+ assertEquals(200, status);
+ String content = mvcResult.getResponse().getContentAsString();
+
+ Topology topology = this.mapFromJson(content, Topology.class);
+
+ assertTrue(topology.getCells().size() > 0);
+ assertTrue(topology.getUserEquipments().size() > 0);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testRefreshRan() throws Exception {
+ this.mvc.perform(MockMvcRequestBuilders.get(getRanCellControllerEndpoint() + "/refresh")
+ .accept(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print());
+ }
+}
diff --git a/src/test/java/org/onap/a1pesimulator/controller/RanUeControllerTest.java b/src/test/java/org/onap/a1pesimulator/controller/RanUeControllerTest.java
new file mode 100644
index 0000000..f474102
--- /dev/null
+++ b/src/test/java/org/onap/a1pesimulator/controller/RanUeControllerTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2021 Samsung Electronics
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.onap.a1pesimulator.controller;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.onap.a1pesimulator.controller.URLHelper.getRanUeControllerEndpoint;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.a1pesimulator.data.ue.UserEquipment;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.MediaType;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
+
+@SpringBootTest
+@AutoConfigureMockMvc
+@RunWith(SpringRunner.class)
+@ActiveProfiles(value = {"localStore"})
+public class RanUeControllerTest {
+
+ @Autowired
+ private MockMvc mvc;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ protected String mapToJson(Object obj) throws JsonProcessingException {
+ mapper = new ObjectMapper();
+ return mapper.writeValueAsString(obj);
+ }
+
+ protected <T> T mapFromJson(String json, Class<T> clazz)
+ throws JsonParseException, JsonMappingException, IOException {
+ mapper = new ObjectMapper();
+ return mapper.readValue(json, clazz);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testGetUes() throws Exception {
+ MvcResult mvcResult = this.mvc.perform(
+ MockMvcRequestBuilders.get(getRanUeControllerEndpoint()).accept(MediaType.APPLICATION_JSON_VALUE))
+ .andDo(MockMvcResultHandlers.print()).andReturn();
+
+ int status = mvcResult.getResponse().getStatus();
+ assertEquals(200, status);
+ String content = mvcResult.getResponse().getContentAsString();
+
+ UserEquipment[] ues = this.mapFromJson(content, UserEquipment[].class);
+
+ assertTrue(ues.length > 0);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testGetUeById() throws Exception {
+ MvcResult mvcResult = this.mvc.perform(
+ MockMvcRequestBuilders.get(getRanUeControllerEndpoint() + "/{identifier}", 1)
+ .accept(MediaType.APPLICATION_JSON_VALUE)).andReturn();
+
+ int status = mvcResult.getResponse().getStatus();
+ assertEquals(200, status);
+ String content = mvcResult.getResponse().getContentAsString();
+
+ UserEquipment ue = this.mapFromJson(content, UserEquipment.class);
+ assertEquals(ue.getId(), "1");
+ }
+}
diff --git a/src/test/java/org/onap/a1pesimulator/controller/URLHelper.java b/src/test/java/org/onap/a1pesimulator/controller/URLHelper.java
new file mode 100644
index 0000000..41b55dc
--- /dev/null
+++ b/src/test/java/org/onap/a1pesimulator/controller/URLHelper.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2021 Samsung Electronics
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.onap.a1pesimulator.controller;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class URLHelper {
+
+ private static final String A1_CONTROLLER_PREFIX = "/v1/a1-p";
+
+ private static final String POLICY_FORMAT = "%s/%s/policies/%s";
+
+ private static final String RAN_CELL_CONTROLLER_PREFIX = "${restapi.version}/ran/cells";
+
+ private static final String RAN_CONTROLLER_PREFIX = "${restapi.version}/ran";
+
+ private static final String RAN_UE_CONTROLLER_PREFIX = "${restapi.version}/ran/ues";
+
+ public static String getHealthCheckEndpoint() {
+ return A1_CONTROLLER_PREFIX + "/healthcheck";
+ }
+
+ public static String getPolicyTypePath() {
+ return A1_CONTROLLER_PREFIX + "/policytypes";
+ }
+
+ public static String getPolicyTypePath(String policyType) {
+ return getPolicyTypePath() + "/" + policyType;
+ }
+
+ public static String getPolicyPath(String policyType, String policy) {
+ return String.format(POLICY_FORMAT, getPolicyTypePath(), policyType, policy);
+ }
+
+ public static String getRanCellControllerEndpoint() {
+ return RAN_CELL_CONTROLLER_PREFIX;
+ }
+
+ public static String getRanControllerEndpoint() {
+ return RAN_CONTROLLER_PREFIX;
+ }
+
+ public static String getRanUeControllerEndpoint() {
+ return RAN_UE_CONTROLLER_PREFIX;
+ }
+}