* ========================LICENSE_START=================================
* O-RAN-SC
* %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * Copyright (C) 2019 AT&T Intellectual Property
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.jupiter.api.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.plt.appmgr.client.model.XappDescriptor;
+import org.oransc.ric.portal.dashboard.DashboardConstants;
+import org.oransc.ric.portal.dashboard.config.RICInstanceMockConfiguration;
import org.oransc.ric.portal.dashboard.model.DashboardDeployableXapps;
import org.oransc.ric.portal.dashboard.model.SuccessTransport;
import org.slf4j.Logger;
@Test
public void versionTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.VERSION_METHOD);
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.VERSION_METHOD);
logger.info("Invoking {}", uri);
SuccessTransport st = restTemplate.getForObject(uri, SuccessTransport.class);
Assertions.assertFalse(st.getData().toString().isEmpty());
@Test
public void healthAliveTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.HEALTH_ALIVE_METHOD);
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.HEALTH_ALIVE_METHOD);
logger.info("Invoking {}", uri);
ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
@Test
public void healthReadyTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.HEALTH_READY_METHOD);
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.HEALTH_READY_METHOD);
logger.info("Invoking {}", uri);
ResponseEntity<Void> voidResponse = restTemplate.getForEntity(uri, Void.class);
Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
@Test
public void appListTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_LIST_METHOD);
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.XAPPS_LIST_METHOD);
logger.info("Invoking {}", uri);
DashboardDeployableXapps apps = testRestTemplateStandardRole().getForObject(uri,
DashboardDeployableXapps.class);
@Test
public void appStatusesTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD);
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.XAPPS_METHOD);
logger.info("Invoking {}", uri);
AllDeployedXapps apps = testRestTemplateStandardRole().getForObject(uri, AllDeployedXapps.class);
Assertions.assertFalse(apps.isEmpty());
@Test
public void appStatusTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD, "app");
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.XAPPS_METHOD, "app");
logger.info("Invoking {}", uri);
Xapp app = testRestTemplateStandardRole().getForObject(uri, Xapp.class);
Assertions.assertFalse(app.getName().isEmpty());
@Test
public void deployAppTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD);
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.XAPPS_METHOD);
logger.info("Invoking {}", uri);
- XAppInfo info = new XAppInfo();
- Xapp app = testRestTemplateAdminRole().postForObject(uri, info, Xapp.class);
+ XappDescriptor descr = new XappDescriptor();
+ Xapp app = testRestTemplateAdminRole().postForObject(uri, descr, Xapp.class);
Assertions.assertFalse(app.getName().isEmpty());
}
@Test
public void undeployAppTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.XAPPS_METHOD, "app");
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.XAPPS_METHOD, "app");
logger.info("Invoking {}", uri);
ResponseEntity<Void> voidResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.DELETE, null,
Void.class);
@Test
public void getConfigTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.CONFIG_METHOD);
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.CONFIG_METHOD);
logger.info("Invoking {}", uri);
AllXappConfig config = testRestTemplateStandardRole().getForObject(uri, AllXappConfig.class);
Assertions.assertFalse(config.isEmpty());
}
@Test
- public void createConfigTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.CONFIG_METHOD);
+ public void modifyConfigTest() {
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.CONFIG_METHOD);
logger.info("Invoking {}", uri);
- XAppConfig newConfig = new XAppConfig();
- XAppConfig response = testRestTemplateAdminRole().postForObject(uri, newConfig, XAppConfig.class);
- Assertions.assertNotNull(response.getConfig());
+ XAppConfig modConfig = new XAppConfig();
+ HttpEntity<XAppConfig> entity = new HttpEntity<>(modConfig);
+ ResponseEntity<Void> voidResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.PUT, entity,
+ Void.class);
+ Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
}
@Test
- public void deleteConfigTest() {
- URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, AppManagerController.CONFIG_METHOD, "app");
+ public void invalidInstanceTest() {
+ URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY, "bogus",
+ AppManagerController.CONFIG_METHOD);
logger.info("Invoking {}", uri);
- ConfigMetadata delConfig = new ConfigMetadata();
- HttpEntity<ConfigMetadata> entity = new HttpEntity<>(delConfig);
- ResponseEntity<Void> voidResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.DELETE, entity,
- Void.class);
- Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
+ ResponseEntity<Void> voidResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.GET, null, Void.class);
+ Assertions.assertTrue(voidResponse.getStatusCode().is5xxServerError());
}
}