Add JUnit tests of backend controllers 76/476/2
authorLott, Christopher (cl778h) <cl778h@att.com>
Fri, 5 Jul 2019 17:03:32 +0000 (13:03 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Fri, 5 Jul 2019 18:06:31 +0000 (14:06 -0400)
Change-Id: I98be18b47d5b14154d4bed018f51f86b89b9ce15
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
15 files changed:
docs/release-notes.rst
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/DashboardConstants.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/AppManagerMockConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AcXappController.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AdminController.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AnrXappController.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AppManagerController.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AbstractControllerTest.java [new file with mode: 0644]
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AcXappControllerTest.java [new file with mode: 0644]
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AdminControllerTest.java [new file with mode: 0644]
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AnrXappControllerTest.java [new file with mode: 0644]
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AppManagerControllerTest.java [new file with mode: 0644]
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/DefaultContextTest.java [moved from webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/DashboardApplicationTest.java with 74% similarity]
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/E2ManagerControllerTest.java [new file with mode: 0644]

index 7a9e784..aefe717 100644 (file)
@@ -28,8 +28,9 @@ Version 1.0.5, 5 July 2019
 * Update E2 manager client to spec version 20190703
 * Add configuration-driven mock of E2 getNodebIdList
 * Revise front-end components to use prefix 'rd'
-* Revise the notification service to allow multiple
 * Improve error handling in BE and FE code
+* Revise the notification service to display multiple notifications
+* Add JUnit test cases for controller methods
 
 Version 1.0.4, 27 June 2019
 ---------------------------
index 67826de..9b80864 100644 (file)
@@ -25,9 +25,9 @@ public abstract class DashboardConstants {
                // Sonar insists on hiding the constructor
        }
 
-       public static final String ENDPOINT_PREFIX = "/api/";
-       public static final String HEALTHCHECK_PATH = "health";
-       public static final String VERSION_PATH = "version";
-       public static final String USER_PATH = "user";
+       public static final String ENDPOINT_PREFIX = "/api";
+
+       // Factor out method names used in multiple controllers
+       public static final String VERSION_METHOD = "version";
 
 }
index 10517e8..2dfb814 100644 (file)
@@ -108,22 +108,21 @@ public class AppManagerMockConfiguration {
 
                when(mockApi.getAllXappConfig()).thenReturn(allXappConfigs);
 
-               when(mockApi.createXappConfig(any(XAppConfig.class))).thenReturn(new XAppConfig());
+               when(mockApi.createXappConfig(any(XAppConfig.class))).thenReturn(allXappConfigs.get(0));
 
-               when(mockApi.modifyXappConfig(any(XAppConfig.class))).thenReturn(new XAppConfig());
+               when(mockApi.modifyXappConfig(any(XAppConfig.class))).thenReturn(allXappConfigs.get(0));
 
                doAnswer(i -> {
                        return null;
                }).when(mockApi).deleteXappConfig(any(ConfigMetadata.class));
 
-               when(mockApi.deployXapp(any(XAppInfo.class))).thenReturn(new Xapp());
+               when(mockApi.deployXapp(any(XAppInfo.class))).thenReturn(deployedXapps.get(0));
 
                when(mockApi.listAllXapps()).thenReturn(availXapps);
 
                when(mockApi.getAllXapps()).thenReturn(deployedXapps);
 
-               Xapp xappByName = new Xapp().name("name").status(StatusEnum.UNKNOWN).version("v1");
-               when(mockApi.getXappByName(any(String.class))).thenReturn(xappByName);
+               when(mockApi.getXappByName(any(String.class))).thenReturn(deployedXapps.get(0));
 
                doAnswer(i -> {
                        return null;
index 46a4aab..2fa3eeb 100644 (file)
@@ -49,11 +49,16 @@ import io.swagger.annotations.ApiParam;
  * gateway.</blockquote>
  */
 @RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/xapp/ac", produces = MediaType.APPLICATION_JSON_VALUE)
+@RequestMapping(value = AcXappController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
 public class AcXappController {
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+       // Publish paths in constants so tests are easy to write
+       public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/xapp/ac";
+       // Endpoints
+       public static final String ADMCTRL_METHOD = "/admctrl";
+
        // A "control" is an element in the XApp descriptor
        private static final String AC_CONTROL_NAME = "admission_control_policy";
 
@@ -69,7 +74,7 @@ public class AcXappController {
        }
 
        @ApiOperation(value = "Gets the A1 client library MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
-       @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
+       @RequestMapping(value = DashboardConstants.VERSION_METHOD, method = RequestMethod.GET)
        public SuccessTransport getA1MediatorClientVersion() {
                return new SuccessTransport(200, DashboardApplication.getImplementationVersion(A1MediatorApi.class));
        }
@@ -78,7 +83,7 @@ public class AcXappController {
         * GET policy is not supported at present by A1 Mediator! Always returns 501.
         */
        @ApiOperation(value = "Gets the admission control policy for AC xApp via the A1 Mediator")
-       @RequestMapping(value = "admctrl", method = RequestMethod.GET)
+       @RequestMapping(value = ADMCTRL_METHOD, method = RequestMethod.GET)
        public Object getAdmissionControlPolicy(HttpServletResponse response) {
                logger.debug("getAdmissionControlPolicy");
                response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
@@ -90,7 +95,7 @@ public class AcXappController {
         * fields are defined in the ACAdmissionIntervalControl Typescript interface.
         */
        @ApiOperation(value = "Sets the admission control policy for AC xApp via the A1 Mediator")
-       @RequestMapping(value = "catime", method = RequestMethod.PUT)
+       @RequestMapping(value = ADMCTRL_METHOD, method = RequestMethod.PUT)
        public void setAdmissionControlPolicy(@ApiParam(value = "Admission control policy") @RequestBody JsonNode acPolicy, //
                        HttpServletResponse response) {
                logger.debug("setAdmissionControlPolicy {}", acPolicy);
index ed4837d..2f14148 100644 (file)
@@ -38,11 +38,16 @@ import io.swagger.annotations.ApiOperation;
  * Answers REST requests for admin services like version, health etc.
  */
 @RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/admin", produces = MediaType.APPLICATION_JSON_VALUE)
+@RequestMapping(value = AdminController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
 public class AdminController {
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+       // Publish paths in constants so tests are easy to write
+       public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/admin";
+       public static final String USER_METHOD = "user";
+       public static final String HEALTH_METHOD = "health";
+
        private final DashboardUser[] users;
 
        public AdminController() {
@@ -56,7 +61,7 @@ public class AdminController {
        }
 
        @ApiOperation(value = "Gets the Dashboard MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
-       @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
+       @RequestMapping(value = DashboardConstants.VERSION_METHOD, method = RequestMethod.GET)
        public SuccessTransport getVersion() {
                logger.debug("getVersion");
                return new SuccessTransport(200,
@@ -64,14 +69,14 @@ public class AdminController {
        }
 
        @ApiOperation(value = "Checks the health of the application.", response = SuccessTransport.class)
-       @RequestMapping(value = DashboardConstants.HEALTHCHECK_PATH, method = RequestMethod.GET)
+       @RequestMapping(value = HEALTH_METHOD, method = RequestMethod.GET)
        public SuccessTransport getHealth() {
                logger.debug("getHealth");
                return new SuccessTransport(200, "Dashboard is healthy!");
        }
 
        @ApiOperation(value = "Gets the list of application users.", response = DashboardUser.class, responseContainer = "List")
-       @RequestMapping(value = DashboardConstants.USER_PATH, method = RequestMethod.GET)
+       @RequestMapping(value = USER_METHOD, method = RequestMethod.GET)
        public DashboardUser[] getUsers() {
                logger.debug("getUsers");
                return users;
index 2449caa..e33b355 100644 (file)
@@ -52,18 +52,25 @@ import io.swagger.annotations.ApiOperation;
  */
 @Configuration
 @RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/xapp/anr", produces = MediaType.APPLICATION_JSON_VALUE)
+@RequestMapping(value = AnrXappController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
 public class AnrXappController {
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-       // Query parameters
-       private static final String QP_NODEB = "ggnodeb";
-       private static final String QP_SERVING = "servingCellNrcgi";
-       private static final String QP_NEIGHBOR = "neighborCellNrpci";
+       // Publish paths in constants so tests are easy to write
+       public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/xapp/anr";
+       // Endpoints
+       public static final String HEALTH_ALIVE_METHOD = "/health/alive";
+       public static final String HEALTH_READY_METHOD = "/health/ready";
+       public static final String GNODEBS_METHOD = "/gnodebs";
+       public static final String NCRT_METHOD = "/ncrt";
        // Path parameters
-       private static final String PP_SERVING = "servingcells";
-       private static final String PP_NEIGHBOR = "neighborcells";
+       public static final String PP_SERVING = "servingcells";
+       public static final String PP_NEIGHBOR = "neighborcells";
+       // Query parameters
+       public static final String QP_NODEB = "ggnodeb";
+       public static final String QP_SERVING = "servingCellNrcgi";
+       public static final String QP_NEIGHBOR = "neighborCellNrpci";
 
        // Populated by the autowired constructor
        private final HealthApi healthApi;
@@ -81,13 +88,13 @@ public class AnrXappController {
        }
 
        @ApiOperation(value = "Gets the ANR client library MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
-       @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
+       @RequestMapping(value = DashboardConstants.VERSION_METHOD, method = RequestMethod.GET)
        public SuccessTransport getAnrXappClientVersion() {
                return new SuccessTransport(200, DashboardApplication.getImplementationVersion(HealthApi.class));
        }
 
        @ApiOperation(value = "Performs a liveness probe on the ANR xApp, result expressed as the response code.")
-       @RequestMapping(value = "/health/alive", method = RequestMethod.GET)
+       @RequestMapping(value = HEALTH_ALIVE_METHOD, method = RequestMethod.GET)
        public void getHealthAlive(HttpServletResponse response) {
                logger.debug("getHealthAlive");
                healthApi.getHealthAlive();
@@ -95,7 +102,7 @@ public class AnrXappController {
        }
 
        @ApiOperation(value = "Performs a readiness probe on the ANR xApp, result expressed as the response code.")
-       @RequestMapping(value = "/health/ready", method = RequestMethod.GET)
+       @RequestMapping(value = HEALTH_READY_METHOD, method = RequestMethod.GET)
        public void getHealthReady(HttpServletResponse response) {
                logger.debug("getHealthReady");
                healthApi.getHealthReady();
@@ -103,14 +110,14 @@ public class AnrXappController {
        }
 
        @ApiOperation(value = "Returns list of gNodeB IDs based on NCRT in ANR", response = GgNodeBTable.class)
-       @RequestMapping(value = "/gnodebs", method = RequestMethod.GET)
+       @RequestMapping(value = GNODEBS_METHOD, method = RequestMethod.GET)
        public GgNodeBTable getGnodebs() {
                logger.debug("getGnodebs");
                return ncrtApi.getgNodeB();
        }
 
        @ApiOperation(value = "Returns neighbor cell relation table for all gNodeBs or based on query parameters", response = NeighborCellRelationTable.class)
-       @RequestMapping(value = "/ncrt", method = RequestMethod.GET)
+       @RequestMapping(value = NCRT_METHOD, method = RequestMethod.GET)
        public NeighborCellRelationTable getNcrt( //
                        @RequestParam(name = QP_NODEB, required = false) String ggnbId, //
                        @RequestParam(name = QP_SERVING, required = false) String servingCellNrcgi, //
@@ -122,7 +129,7 @@ public class AnrXappController {
 
        // /ncrt/servingcells/{servCellNrcgi}/neighborcells/{neighCellNrpci} :
        @ApiOperation(value = "Modify neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI")
-       @RequestMapping(value = "/ncrt/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR
+       @RequestMapping(value = NCRT_METHOD + "/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR
                        + "}", method = RequestMethod.PUT)
        public void modifyNcrt(@PathVariable(PP_SERVING) String servingCellNrcgi, //
                        @PathVariable(PP_NEIGHBOR) String neighborCellNrpci, //
@@ -134,7 +141,7 @@ public class AnrXappController {
        }
 
        @ApiOperation(value = "Delete neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI")
-       @RequestMapping(value = "/ncrt/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR
+       @RequestMapping(value = NCRT_METHOD + "/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR
                        + "}", method = RequestMethod.DELETE)
        public void deleteNcrt(@PathVariable(PP_SERVING) String servingCellNrcgi, //
                        @PathVariable(PP_NEIGHBOR) String neighborCellNrpci, //
index 9c356ca..ddef5b4 100644 (file)
@@ -58,11 +58,22 @@ import io.swagger.annotations.ApiOperation;
  */
 @Configuration
 @RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/appmgr", produces = MediaType.APPLICATION_JSON_VALUE)
+@RequestMapping(value = AppManagerController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
 public class AppManagerController {
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+       // Publish paths in constants so tests are easy to write
+       public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/appmgr";
+       // Endpoints
+       public static final String HEALTH_ALIVE_METHOD = "/health/alive";
+       public static final String HEALTH_READY_METHOD = "/health/ready";
+       public static final String CONFIG_METHOD = "/config";
+       public static final String XAPPS_METHOD = "/xapps";
+       public static final String XAPPS_LIST_METHOD = XAPPS_METHOD + "/list";
+       // Path parameters
+       public static final String PP_XAPP_NAME = "xAppName";
+
        // Populated by the autowired constructor
        private final HealthApi healthApi;
        private final XappApi xappApi;
@@ -79,13 +90,13 @@ public class AppManagerController {
        }
 
        @ApiOperation(value = "Gets the XApp manager client library MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
-       @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
+       @RequestMapping(value = DashboardConstants.VERSION_METHOD, method = RequestMethod.GET)
        public SuccessTransport getXappManagerClientVersion() {
                return new SuccessTransport(200, DashboardApplication.getImplementationVersion(HealthApi.class));
        }
 
        @ApiOperation(value = "Health check of xApp Manager - Liveness probe.")
-       @RequestMapping(value = "/health/alive", method = RequestMethod.GET)
+       @RequestMapping(value = HEALTH_ALIVE_METHOD, method = RequestMethod.GET)
        public void getHealth(HttpServletResponse response) {
                logger.debug("getHealthAlive");
                healthApi.getHealthAlive();
@@ -93,7 +104,7 @@ public class AppManagerController {
        }
 
        @ApiOperation(value = "Readiness check of xApp Manager - Readiness probe.")
-       @RequestMapping(value = "/health/ready", method = RequestMethod.GET)
+       @RequestMapping(value = HEALTH_READY_METHOD, method = RequestMethod.GET)
        public void getHealthReady(HttpServletResponse response) {
                logger.debug("getHealthReady");
                healthApi.getHealthReady();
@@ -101,28 +112,28 @@ public class AppManagerController {
        }
 
        @ApiOperation(value = "Returns the configuration of all xapps.", response = AllXappConfig.class)
-       @RequestMapping(value = "/config", method = RequestMethod.GET)
+       @RequestMapping(value = CONFIG_METHOD, method = RequestMethod.GET)
        public AllXappConfig getAllXappConfig() {
                logger.debug("getAllXappConfig");
                return xappApi.getAllXappConfig();
        }
 
        @ApiOperation(value = "Create xApp config.", response = XAppConfig.class)
-       @RequestMapping(value = "/config", method = RequestMethod.POST)
+       @RequestMapping(value = CONFIG_METHOD, method = RequestMethod.POST)
        public XAppConfig createXappConfig(@RequestBody XAppConfig xAppConfig) {
                logger.debug("createXappConfig {}", xAppConfig);
                return xappApi.createXappConfig(xAppConfig);
        }
 
        @ApiOperation(value = "Modify xApp config.", response = XAppConfig.class)
-       @RequestMapping(value = "/config", method = RequestMethod.PUT)
+       @RequestMapping(value = CONFIG_METHOD, method = RequestMethod.PUT)
        public XAppConfig modifyXappConfig(@RequestBody XAppConfig xAppConfig) {
                logger.debug("modifyXappConfig {}", xAppConfig);
                return xappApi.modifyXappConfig(xAppConfig);
        }
 
        @ApiOperation(value = "Delete xApp configuration.")
-       @RequestMapping(value = "/config/{xAppName}", method = RequestMethod.DELETE)
+       @RequestMapping(value = CONFIG_METHOD + "/{" + PP_XAPP_NAME + "}", method = RequestMethod.DELETE)
        public void deleteXappConfig(@RequestBody ConfigMetadata configMetadata, HttpServletResponse response) {
                logger.debug("deleteXappConfig {}", configMetadata);
                xappApi.deleteXappConfig(configMetadata);
@@ -130,8 +141,8 @@ public class AppManagerController {
        }
 
        @ApiOperation(value = "Returns a list of deployable xapps.", response = DashboardDeployableXapps.class)
-       @RequestMapping(value = "/xapps/list", method = RequestMethod.GET)
-       public DashboardDeployableXapps getAvailableXapps() {
+       @RequestMapping(value = XAPPS_LIST_METHOD, method = RequestMethod.GET)
+       public Object getAvailableXapps() {
                logger.debug("getAvailableXapps");
                AllDeployableXapps appNames = xappApi.listAllXapps();
                // Answer a collection of structure instead of string
@@ -144,28 +155,28 @@ public class AppManagerController {
        }
 
        @ApiOperation(value = "Returns the status of all deployed xapps.", response = AllDeployedXapps.class)
-       @RequestMapping(value = "/xapps", method = RequestMethod.GET)
+       @RequestMapping(value = XAPPS_METHOD, method = RequestMethod.GET)
        public AllDeployedXapps getDeployedXapps() {
                logger.debug("getDeployedXapps");
                return xappApi.getAllXapps();
        }
 
        @ApiOperation(value = "Returns the status of a given xapp.", response = Xapp.class)
-       @RequestMapping(value = "/xapps/{xAppName}", method = RequestMethod.GET)
+       @RequestMapping(value = XAPPS_METHOD + "/{" + PP_XAPP_NAME + "}", method = RequestMethod.GET)
        public Xapp getXapp(@PathVariable("xAppName") String xAppName) {
                logger.debug("getXapp {}", xAppName);
                return xappApi.getXappByName(xAppName);
        }
 
        @ApiOperation(value = "Deploy a xapp.", response = Xapp.class)
-       @RequestMapping(value = "/xapps", method = RequestMethod.POST)
+       @RequestMapping(value = XAPPS_METHOD, method = RequestMethod.POST)
        public Xapp deployXapp(@RequestBody XAppInfo xAppInfo) {
                logger.debug("deployXapp {}", xAppInfo);
                return xappApi.deployXapp(xAppInfo);
        }
 
        @ApiOperation(value = "Undeploy an existing xapp.")
-       @RequestMapping(value = "/xapps/{xAppName}", method = RequestMethod.DELETE)
+       @RequestMapping(value = XAPPS_METHOD + "/{" + PP_XAPP_NAME + "}", method = RequestMethod.DELETE)
        public void undeployXapp(@PathVariable("xAppName") String xAppName, HttpServletResponse response) {
                logger.debug("undeployXapp {}", xAppName);
                xappApi.undeployXapp(xAppName);
index a4533b6..3d52b8c 100644 (file)
@@ -62,13 +62,20 @@ import io.swagger.annotations.ApiOperation;
  */
 @Configuration
 @RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/e2mgr", produces = MediaType.APPLICATION_JSON_VALUE)
+@RequestMapping(value = E2ManagerController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
 public class E2ManagerController {
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-       private final List<NodebIdentity> mockNodebIdList;
-
+       // Publish paths in constants so tests are easy to write
+       public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/e2mgr";
+       // Endpoints
+       public static final String HEALTH_METHOD = "health";
+       public static final String NODEB_METHOD = "/nodeb";
+       public static final String NODEB_LIST_METHOD = "/nodeb-ids";
+       public static final String RAN_METHOD = "/ran";
+       public static final String ENDC_SETUP_METHOD = "/endcSetup";
+       public static final String X2_SETUP_METHOD = "/x2Setup";
        // Path parameters
        private static final String PP_RANNAME = "ranName";
 
@@ -76,6 +83,9 @@ public class E2ManagerController {
        private final HealthCheckApi e2HealthCheckApi;
        private final NodebApi e2NodebApi;
 
+       // TODO: remove this when E2 delivers the feature
+       private final List<NodebIdentity> mockNodebIdList;
+
        @Autowired
        public E2ManagerController(final HealthCheckApi e2HealthCheckApi, final NodebApi e2NodebApi,
                        @Value("${e2mgr.mock.rannames:#{null}}") final String mockRanNames) {
@@ -94,13 +104,13 @@ public class E2ManagerController {
        }
 
        @ApiOperation(value = "Gets the E2 manager client library MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
-       @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
+       @RequestMapping(value = DashboardConstants.VERSION_METHOD, method = RequestMethod.GET)
        public SuccessTransport getE2ManagerClientVersion() {
                return new SuccessTransport(200, DashboardApplication.getImplementationVersion(HealthCheckApi.class));
        }
 
        @ApiOperation(value = "Gets the health from the E2 manager, expressed as the response code.")
-       @RequestMapping(value = "/health", method = RequestMethod.GET)
+       @RequestMapping(value = HEALTH_METHOD, method = RequestMethod.GET)
        public void healthGet(HttpServletResponse response) {
                logger.debug("healthGet");
                e2HealthCheckApi.healthGet();
@@ -109,7 +119,7 @@ public class E2ManagerController {
 
        // This calls other methods to simplify the task of the front-end.
        @ApiOperation(value = "Gets all RAN identities and statuses from the E2 manager.", response = RanDetailsTransport.class, responseContainer = "List")
-       @RequestMapping(value = "/ran", method = RequestMethod.GET)
+       @RequestMapping(value = RAN_METHOD, method = RequestMethod.GET)
        public List<RanDetailsTransport> getRanDetails() {
                logger.debug("getRanDetails");
                // TODO: remove mock when e2mgr delivers the getNodebIdList() method
@@ -131,21 +141,21 @@ public class E2ManagerController {
        }
 
        @ApiOperation(value = "Get RAN identities list.", response = NodebIdentity.class, responseContainer = "List")
-       @RequestMapping(value = "/nodeb-ids", method = RequestMethod.GET)
+       @RequestMapping(value = NODEB_LIST_METHOD, method = RequestMethod.GET)
        public List<NodebIdentity> getNodebIdList() {
                logger.debug("getNodebIdList");
                return e2NodebApi.getNodebIdList();
        }
 
        @ApiOperation(value = "Get RAN by name.", response = GetNodebResponse.class)
-       @RequestMapping(value = "/nodeb/{" + PP_RANNAME + "}", method = RequestMethod.GET)
+       @RequestMapping(value = NODEB_METHOD + "/{" + PP_RANNAME + "}", method = RequestMethod.GET)
        public GetNodebResponse getNb(@PathVariable(PP_RANNAME) String ranName) {
                logger.debug("getNb {}", ranName);
                return e2NodebApi.getNb(ranName);
        }
 
        @ApiOperation(value = "Close all connections to the RANs and delete the data from the nodeb-rnib DB.")
-       @RequestMapping(value = "/nodeb", method = RequestMethod.DELETE)
+       @RequestMapping(value = NODEB_METHOD, method = RequestMethod.DELETE)
        public void nodebDelete(HttpServletResponse response) {
                logger.debug("nodebDelete");
                e2NodebApi.nodebDelete();
@@ -153,7 +163,7 @@ public class E2ManagerController {
        }
 
        @ApiOperation(value = "Sets up an EN-DC RAN connection via the E2 manager.")
-       @RequestMapping(value = "/endcSetup", method = RequestMethod.POST)
+       @RequestMapping(value = ENDC_SETUP_METHOD, method = RequestMethod.POST)
        public void endcSetup(@RequestBody SetupRequest setupRequest, HttpServletResponse response) {
                logger.debug("endcSetup {}", setupRequest);
                e2NodebApi.endcSetup(setupRequest);
@@ -161,7 +171,7 @@ public class E2ManagerController {
        }
 
        @ApiOperation(value = "Sets up an X2 RAN connection via the E2 manager.")
-       @RequestMapping(value = "/x2Setup", method = RequestMethod.POST)
+       @RequestMapping(value = X2_SETUP_METHOD, method = RequestMethod.POST)
        public void x2Setup(@RequestBody SetupRequest setupRequest, HttpServletResponse response) {
                logger.debug("x2Setup {}", setupRequest);
                e2NodebApi.x2Setup(setupRequest);
diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AbstractControllerTest.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AbstractControllerTest.java
new file mode 100644 (file)
index 0000000..80fd977
--- /dev/null
@@ -0,0 +1,97 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard;
+
+import java.lang.invoke.MethodHandles;
+import java.net.URI;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.util.UriComponentsBuilder;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+// Need the fake answers from the backend
+@ActiveProfiles("mock")
+public class AbstractControllerTest {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       // Created by Spring black magic
+       // https://spring.io/guides/gs/testing-web/
+       @LocalServerPort
+       private int localServerPort;
+
+       @Autowired
+       protected TestRestTemplate restTemplate;
+
+       /**
+        * Flexible URI builder.
+        * 
+        * @param queryParams
+        *                        Map of string-string query parameters
+        * @param path
+        *                        Array of path components. If a component has an
+        *                        embedded slash, the string is split and each
+        *                        subcomponent is added individually.
+        * @return URI
+        */
+       protected URI buildUri(final Map<String, String> queryParams, final String... path) {
+               UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + localServerPort + "/");
+               for (int p = 0; p < path.length; ++p) {
+                       if (path[p] == null || path[p].isEmpty()) {
+                               throw new IllegalArgumentException("Unexpected null or empty at path index " + Integer.toString(p));
+                       } else if (path[p].contains("/")) {
+                               String[] subpaths = path[p].split("/");
+                               for (String s : subpaths)
+                                       if (!s.isEmpty())
+                                               builder.pathSegment(s);
+                       } else {
+                               builder.pathSegment(path[p]);
+                       }
+               }
+               if (queryParams != null && queryParams.size() > 0) {
+                       for (Map.Entry<String, String> entry : queryParams.entrySet()) {
+                               if (entry.getKey() == null || entry.getValue() == null)
+                                       throw new IllegalArgumentException("Unexpected null key or value");
+                               else
+                                       builder.queryParam(entry.getKey(), entry.getValue());
+                       }
+               }
+               return builder.build().encode().toUri();
+       }
+
+       // Must have at least one test here
+       @Test
+       public void contextLoads() {
+               logger.info("Context loads on mock profile");
+       }
+
+}
diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AcXappControllerTest.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AcXappControllerTest.java
new file mode 100644 (file)
index 0000000..2910d86
--- /dev/null
@@ -0,0 +1,69 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard;
+
+import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.net.URI;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.oransc.ric.portal.dashboard.controller.AcXappController;
+import org.oransc.ric.portal.dashboard.model.SuccessTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AcXappControllerTest extends AbstractControllerTest {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       @Test
+       public void versionTest() {
+               URI uri = buildUri(null, AcXappController.CONTROLLER_PATH, DashboardConstants.VERSION_METHOD);
+               logger.info("Invoking {}", uri);
+               SuccessTransport st = restTemplate.getForObject(uri, SuccessTransport.class);
+               Assert.assertFalse(st.getData().toString().isEmpty());
+       }
+
+       @Test
+       public void getTest() throws IOException {
+               // Always returns 501; surprised that no exception is thrown.
+               URI uri = buildUri(null, AcXappController.CONTROLLER_PATH, AcXappController.ADMCTRL_METHOD);
+               logger.info("Invoking {}", uri);
+               restTemplate.getForObject(uri, String.class);
+       }
+
+       @Test
+       public void putTest() throws IOException {
+               ObjectMapper mapper = new ObjectMapper();
+               JsonNode body = mapper.readTree("{ \"policy\" : true }");
+               URI uri = buildUri(null, AcXappController.CONTROLLER_PATH, AcXappController.ADMCTRL_METHOD);
+               HttpEntity<JsonNode> entity = new HttpEntity<>(body);
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.PUT, entity, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+}
diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AdminControllerTest.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AdminControllerTest.java
new file mode 100644 (file)
index 0000000..1a84c5a
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard;
+
+import java.lang.invoke.MethodHandles;
+import java.net.URI;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.oransc.ric.portal.dashboard.controller.AdminController;
+import org.oransc.ric.portal.dashboard.model.DashboardUser;
+import org.oransc.ric.portal.dashboard.model.SuccessTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+public class AdminControllerTest extends AbstractControllerTest {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       @Test
+       public void versionTest() {
+               URI uri = buildUri(null, AdminController.CONTROLLER_PATH, DashboardConstants.VERSION_METHOD);
+               logger.info("Invoking {}", uri);
+               SuccessTransport st = restTemplate.getForObject(uri, SuccessTransport.class);
+               Assert.assertFalse(st.getData().toString().isEmpty());
+       }
+
+       @Test
+       public void healthTest() {
+               URI uri = buildUri(null, AdminController.CONTROLLER_PATH, AdminController.HEALTH_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void usersTest() {
+               URI uri = buildUri(null, AdminController.CONTROLLER_PATH, AdminController.USER_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<List<DashboardUser>> response = restTemplate.exchange(uri, HttpMethod.GET, null,
+                               new ParameterizedTypeReference<List<DashboardUser>>() {
+                               });
+               Assert.assertFalse(response.getBody().isEmpty());
+       }
+
+}
diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AnrXappControllerTest.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AnrXappControllerTest.java
new file mode 100644 (file)
index 0000000..43fc080
--- /dev/null
@@ -0,0 +1,101 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard;
+
+import java.lang.invoke.MethodHandles;
+import java.net.URI;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.oransc.ric.anrxapp.client.model.GgNodeBTable;
+import org.oransc.ric.anrxapp.client.model.NeighborCellRelationMod;
+import org.oransc.ric.anrxapp.client.model.NeighborCellRelationTable;
+import org.oransc.ric.portal.dashboard.controller.AnrXappController;
+import org.oransc.ric.portal.dashboard.model.SuccessTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+public class AnrXappControllerTest extends AbstractControllerTest {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       @Test
+       public void versionTest() {
+               URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, DashboardConstants.VERSION_METHOD);
+               logger.info("Invoking {}", uri);
+               SuccessTransport st = restTemplate.getForObject(uri, SuccessTransport.class);
+               Assert.assertFalse(st.getData().toString().isEmpty());
+       }
+
+       @Test
+       public void healthAliveTest() {
+               URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.HEALTH_ALIVE_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void healthReadyTest() {
+               URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.HEALTH_READY_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void gnodebsTest() {
+               URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.GNODEBS_METHOD);
+               logger.info("Invoking {}", uri);
+               GgNodeBTable list = restTemplate.getForObject(uri, GgNodeBTable.class);
+               Assert.assertFalse(list.getGNodeBIds().isEmpty());
+       }
+
+       @Test
+       public void ncrtGetTest() {
+               URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.NCRT_METHOD);
+               logger.info("Invoking {}", uri);
+               NeighborCellRelationTable table = restTemplate.getForObject(uri, NeighborCellRelationTable.class);
+               Assert.assertFalse(table.getNcrtRelations().isEmpty());
+       }
+
+       @Test
+       public void ncrtPutTest() {
+               URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.NCRT_METHOD,
+                               AnrXappController.PP_SERVING, "serving", AnrXappController.PP_NEIGHBOR, "neighbor");
+               logger.info("Invoking {}", uri);
+               HttpEntity<NeighborCellRelationMod> entity = new HttpEntity<>(new NeighborCellRelationMod());
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.PUT, entity, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void ncrtDeleteTest() {
+               URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.NCRT_METHOD,
+                               AnrXappController.PP_SERVING, "serving", AnrXappController.PP_NEIGHBOR, "neighbor");
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.DELETE, null, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+}
diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AppManagerControllerTest.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/AppManagerControllerTest.java
new file mode 100644 (file)
index 0000000..50bdf45
--- /dev/null
@@ -0,0 +1,138 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard;
+
+import java.lang.invoke.MethodHandles;
+import java.net.URI;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.oransc.ric.plt.appmgr.client.model.AllDeployedXapps;
+import org.oransc.ric.plt.appmgr.client.model.AllXappConfig;
+import org.oransc.ric.plt.appmgr.client.model.ConfigMetadata;
+import org.oransc.ric.plt.appmgr.client.model.XAppConfig;
+import org.oransc.ric.plt.appmgr.client.model.XAppInfo;
+import org.oransc.ric.plt.appmgr.client.model.Xapp;
+import org.oransc.ric.portal.dashboard.controller.AppManagerController;
+import org.oransc.ric.portal.dashboard.model.DashboardDeployableXapps;
+import org.oransc.ric.portal.dashboard.model.SuccessTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+public class AppManagerControllerTest extends AbstractControllerTest {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       @Test
+       public void versionTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.VERSION_METHOD);
+               logger.info("Invoking {}", uri);
+               SuccessTransport st = restTemplate.getForObject(uri, SuccessTransport.class);
+               Assert.assertFalse(st.getData().toString().isEmpty());
+       }
+
+       @Test
+       public void healthAliveTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.HEALTH_ALIVE_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void healthReadyTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.HEALTH_READY_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void appListTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_LIST_METHOD);
+               logger.info("Invoking {}", uri);
+               DashboardDeployableXapps apps = restTemplate.getForObject(uri, DashboardDeployableXapps.class);
+               Assert.assertFalse(apps.isEmpty());
+       }
+
+       @Test
+       public void appStatusesTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD);
+               logger.info("Invoking {}", uri);
+               AllDeployedXapps apps = restTemplate.getForObject(uri, AllDeployedXapps.class);
+               Assert.assertFalse(apps.isEmpty());
+       }
+
+       @Test
+       public void appStatusTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD, "app");
+               logger.info("Invoking {}", uri);
+               Xapp app = restTemplate.getForObject(uri, Xapp.class);
+               Assert.assertFalse(app.getName().isEmpty());
+       }
+
+       @Test
+       public void deployAppTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD);
+               logger.info("Invoking {}", uri);
+               XAppInfo info = new XAppInfo();
+               Xapp app = restTemplate.postForObject(uri, info, Xapp.class);
+               Assert.assertFalse(app.getName().isEmpty());
+       }
+
+       @Test
+       public void undeployAppTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD, "app");
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.DELETE, null, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void getConfigTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.CONFIG_METHOD);
+               logger.info("Invoking {}", uri);
+               AllXappConfig config = restTemplate.getForObject(uri, AllXappConfig.class);
+               Assert.assertFalse(config.isEmpty());
+       }
+
+       @Test
+       public void createConfigTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.CONFIG_METHOD);
+               logger.info("Invoking {}", uri);
+               XAppConfig newConfig = new XAppConfig();
+               XAppConfig response = restTemplate.postForObject(uri, newConfig, XAppConfig.class);
+               Assert.assertNotNull(response.getConfig());
+       }
+
+       @Test
+       public void deleteConfigTest() {
+               URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.CONFIG_METHOD, "app");
+               logger.info("Invoking {}", uri);
+               ConfigMetadata delConfig = new ConfigMetadata();
+               HttpEntity<ConfigMetadata> entity = new HttpEntity<>(delConfig);
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.DELETE, entity, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+}
  */
 package org.oransc.ric.portal.dashboard;
 
+import java.lang.invoke.MethodHandles;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+/**
+ * Tests whether the default (not mock) configuration classes run to completion.
+ */
 @RunWith(SpringRunner.class)
 @SpringBootTest
-public class DashboardApplicationTest {
+public class DefaultContextTest {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
        @Test
        public void contextLoads() {
+               logger.info("Context loads on default profile");
        }
 
 }
diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/E2ManagerControllerTest.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/E2ManagerControllerTest.java
new file mode 100644 (file)
index 0000000..f54ac77
--- /dev/null
@@ -0,0 +1,117 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard;
+
+import java.lang.invoke.MethodHandles;
+import java.net.URI;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.oransc.ric.e2mgr.client.model.GetNodebResponse;
+import org.oransc.ric.e2mgr.client.model.NodebIdentity;
+import org.oransc.ric.e2mgr.client.model.SetupRequest;
+import org.oransc.ric.portal.dashboard.controller.E2ManagerController;
+import org.oransc.ric.portal.dashboard.model.RanDetailsTransport;
+import org.oransc.ric.portal.dashboard.model.SuccessTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+public class E2ManagerControllerTest extends AbstractControllerTest {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       @Test
+       public void versionTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, DashboardConstants.VERSION_METHOD);
+               logger.info("Invoking {}", uri);
+               SuccessTransport st = restTemplate.getForObject(uri, SuccessTransport.class);
+               Assert.assertFalse(st.getData().toString().isEmpty());
+       }
+
+       @Test
+       public void healthTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.HEALTH_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void ranDetailsTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.RAN_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<List<RanDetailsTransport>> response = restTemplate.exchange(uri, HttpMethod.GET, null,
+                               new ParameterizedTypeReference<List<RanDetailsTransport>>() {
+                               });
+               Assert.assertFalse(response.getBody().isEmpty());
+       }
+
+       @Test
+       public void nodebListTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.NODEB_LIST_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<List<NodebIdentity>> response = restTemplate.exchange(uri, HttpMethod.GET, null,
+                               new ParameterizedTypeReference<List<NodebIdentity>>() {
+                               });
+               Assert.assertFalse(response.getBody().isEmpty());
+       }
+
+       @Test
+       public void nodebStatusTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.NODEB_METHOD, "nodeb");
+               logger.info("Invoking {}", uri);
+               GetNodebResponse response = restTemplate.getForObject(uri, GetNodebResponse.class);
+               Assert.assertNotNull(response.getRanName());
+       }
+
+       @Test
+       public void bigRedButtonTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.NODEB_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.DELETE, null, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void endcSetupTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.ENDC_SETUP_METHOD);
+               logger.info("Invoking {}", uri);
+               SetupRequest setup = new SetupRequest();
+               HttpEntity<SetupRequest> entity = new HttpEntity<>(setup);
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.POST, entity, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+       @Test
+       public void x2SetupTest() {
+               URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.X2_SETUP_METHOD);
+               logger.info("Invoking {}", uri);
+               SetupRequest setup = new SetupRequest();
+               HttpEntity<SetupRequest> entity = new HttpEntity<>(setup);
+               ResponseEntity<Void> voidResponse = restTemplate.exchange(uri, HttpMethod.POST, entity, Void.class);
+               Assert.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+       }
+
+}