use of io.codekvast.dashboard.dashboard.model.methods.GetMethodsFormData in project codekvast by crispab.
the class DashboardServiceImplTest method should_getFilterData.
@Test
public void should_getFilterData() {
// given
PricePlanDefaults ppd = PricePlanDefaults.TEST;
long customerId = 1L;
when(customerIdProvider.getCustomerId()).thenReturn(customerId);
CustomerData customerData = CustomerData.builder().customerId(customerId).customerName("customerName").pricePlan(PricePlan.of(ppd)).source("source").collectionStartedAt(null).trialPeriodEndsAt(null).build();
when(customerService.getCustomerDataByCustomerId(eq(customerId))).thenReturn(customerData);
// noinspection unchecked
when(jdbcTemplate.queryForList(anyString(), eq(String.class), eq(customerId))).thenReturn(asList("app2", "app1", "app3"), asList("env2", "env1", "env3"), asList("loc2", "loc1", "loc3"));
// when
GetMethodsFormData formData = dashboardService.getMethodsFormData();
// then
assertThat(formData, is(GetMethodsFormData.builder().application("app1").application("app2").application("app3").environment("env1").environment("env2").environment("env3").location("loc1").location("loc2").location("loc3").retentionPeriodDays(ppd.getRetentionPeriodDays()).build()));
}
use of io.codekvast.dashboard.dashboard.model.methods.GetMethodsFormData in project codekvast by crispab.
the class DashboardApiController method getMethodsFormData.
@GetMapping("/dashboard/api/v1/methodsFormData")
public GetMethodsFormData getMethodsFormData() {
GetMethodsFormData data = dashboardService.getMethodsFormData();
logger.debug("{}", data);
return data;
}
use of io.codekvast.dashboard.dashboard.model.methods.GetMethodsFormData in project codekvast by crispab.
the class DashboardIntegrationTest method should_getFilterData_for_known_customerId.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_getFilterData_for_known_customerId() {
// given
setSecurityContextCustomerId(1L);
// when
GetMethodsFormData getMethodsFormData = dashboardService.getMethodsFormData();
// then
assertThat(getMethodsFormData.getApplications(), contains("app1", "app2", "app3", "app4"));
assertThat(getMethodsFormData.getEnvironments(), contains("env1", "env2", "env3", "env4"));
assertThat(getMethodsFormData.getLocations(), contains("loc1", "loc2", "loc3"));
}
Aggregations