- metricsQueryParms.clear();
- metricsQueryParms.put("app", DashboardConstants.APP_NAME_ML);
- logger.debug("Invoking {}", uri);
- successResponse = testRestTemplateStandardRole().exchange(uri, HttpMethod.GET, null, SuccessTransport.class);
- Assertions.assertFalse(successResponse.getBody().getData().toString().isEmpty());
- Assertions.assertTrue(successResponse.getStatusCode().is2xxSuccessful());
+ @Order(3)
+ @Test
+ public void updateAppStatsTest() {
+ URI uri = buildUri(null, AdminController.CONTROLLER_PATH, DashboardConstants.RIC_INSTANCE_KEY,
+ RICInstanceMockConfiguration.INSTANCE_KEY_1, AdminController.STATAPPMETRIC_METHOD);
+ logger.info("Invoking uri {}", uri);
+ ResponseEntity<List<AppStats>> response = testRestTemplateAdminRole().exchange(uri, HttpMethod.GET, null,
+ new ParameterizedTypeReference<List<AppStats>>() {
+ });
+ int statToUpdate = 0;
+ if (response.getBody() != null) {
+ statToUpdate = response.getBody().get(0).getStatsDetails().getAppId();
+ }
+ StatsDetailsTransport statsDetails = new StatsDetailsTransport();
+ statsDetails.setAppId(statToUpdate);
+ statsDetails.setAppName("MachLearn-1");
+ statsDetails.setMetricUrl("https://www.example1.com");
+ HttpEntity<StatsDetailsTransport> entity = new HttpEntity<>(statsDetails);
+ ResponseEntity<String> stringResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.PUT, entity,
+ String.class);
+ Assertions.assertTrue(stringResponse.getStatusCode().is2xxSuccessful());