X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dashboard%2Fwebapp-backend%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fcontroller%2FAppManagerControllerTest.java;h=0132c1978eb3a0e88280aa7484fe365184295906;hb=329b53efb578dd41a6de31eafd5f228f3f10987c;hp=52a383ec255d408493c59d6d73da49e6936fe9c3;hpb=64a5e9470799236f0af4ce2df98f77c94eb1bed3;p=portal%2Fric-dashboard.git diff --git a/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AppManagerControllerTest.java b/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AppManagerControllerTest.java index 52a383ec..0132c197 100644 --- a/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AppManagerControllerTest.java +++ b/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AppManagerControllerTest.java @@ -24,20 +24,21 @@ import java.net.URI; import org.junit.jupiter.api.Assertions; 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.XAppConfig; -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.oransc.ricplt.appmgr.client.model.AllDeployedXapps; +import org.oransc.ricplt.appmgr.client.model.AllXappConfig; +import org.oransc.ricplt.appmgr.client.model.XAppConfig; +import org.oransc.ricplt.appmgr.client.model.Xapp; +import org.oransc.ricplt.appmgr.client.model.XappDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestClientException; public class AppManagerControllerTest extends AbstractControllerTest { @@ -102,9 +103,15 @@ public class AppManagerControllerTest extends AbstractControllerTest { URI uri = buildUri(null, AppManagerController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY, RICInstanceMockConfiguration.INSTANCE_KEY_1, AppManagerController.XAPPS_METHOD); logger.info("Invoking {}", uri); - XappDescriptor descr = new XappDescriptor(); + XappDescriptor descr = new XappDescriptor().xappName("app"); Xapp app = testRestTemplateAdminRole().postForObject(uri, descr, Xapp.class); + Assertions.assertNotNull(app); Assertions.assertFalse(app.getName().isEmpty()); + + // An invalid request must be rejected + Assertions.assertThrows(RestClientException.class, () -> { + testRestTemplateAdminRole().postForObject(uri, new XappDescriptor(), Xapp.class); + }); } @Test