Search in sources :

Example 11 with WidgetOptions

use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.

the class LaunchExecutionAndIssueStatisticsContentValidatorTest method testValidateWithException.

@Test
public void testValidateWithException() {
    Exception exception = assertThrows(ReportPortalException.class, () -> {
        HashMap<Filter, Sort> filterSortMap = new HashMap<>();
        filterSortMap.put(Filter.builder().withTarget(Launch.class).withCondition(FilterCondition.builder().eq("id", "1").build()).build(), Sort.unsorted());
        launchExecutionAndIssueStatisticsContentValidator.validate(Collections.singletonList("test"), filterSortMap, new WidgetOptions(), 5);
    });
    String expectedMessage = "Bad content fields format";
    String actualMessage = exception.getMessage();
    assertTrue(actualMessage.contains(expectedMessage));
}
Also used : Filter(com.epam.ta.reportportal.commons.querygen.Filter) HashMap(java.util.HashMap) WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) Sort(org.springframework.data.domain.Sort) Launch(com.epam.ta.reportportal.entity.launch.Launch) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Test(org.junit.jupiter.api.Test)

Example 12 with WidgetOptions

use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.

the class FlakyCasesTableContentValidatorTest method testValidateWithException.

@Test
public void testValidateWithException() {
    Exception exception = assertThrows(ReportPortalException.class, () -> {
        flakyCasesTableContentValidator.validate(null, new HashMap<>(), new WidgetOptions(), 5);
    });
    String expectedMessage = "Unable to load widget content. Widget proprties contains errors: launchNameFilter should be specified for widget.";
    String actualMessage = exception.getMessage();
    assertTrue(actualMessage.contains(expectedMessage));
}
Also used : WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Test(org.junit.jupiter.api.Test)

Example 13 with WidgetOptions

use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.

the class LaunchesComparisonContentValidatorTest method testValidateWithException.

@Test
public void testValidateWithException() {
    Exception exception = assertThrows(ReportPortalException.class, () -> {
        HashMap<Filter, Sort> filterSortMap = new HashMap<>();
        filterSortMap.put(Filter.builder().withTarget(Launch.class).withCondition(FilterCondition.builder().eq("id", "1").build()).build(), Sort.unsorted());
        launchesComparisonContentValidator.validate(Collections.singletonList("test"), filterSortMap, new WidgetOptions(), 5);
    });
    String expectedMessage = "Bad content fields format";
    String actualMessage = exception.getMessage();
    assertTrue(actualMessage.contains(expectedMessage));
}
Also used : Filter(com.epam.ta.reportportal.commons.querygen.Filter) HashMap(java.util.HashMap) WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) Sort(org.springframework.data.domain.Sort) Launch(com.epam.ta.reportportal.entity.launch.Launch) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Test(org.junit.jupiter.api.Test)

Example 14 with WidgetOptions

use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.

the class ComponentHealthCheckContentValidatorTest method testValidateWithException.

@Test
public void testValidateWithException() {
    WidgetOptions widgetOptions = new WidgetOptions(getWidgetOptionsContentWithBlankKey());
    Exception exception = assertThrows(ReportPortalException.class, () -> сomponentHealthCheckContentValidator.validate(Collections.singletonList("test"), new HashMap<>(), widgetOptions, new String[] { "v1" }, new HashMap<>(), 100));
    String expectedMessage = "Current level key should be not blank";
    String actualMessage = exception.getMessage();
    assertTrue(actualMessage.contains(expectedMessage));
    WidgetOptions wo = new WidgetOptions(getWidgetOptionsContent());
    сomponentHealthCheckContentValidator.validate(Collections.singletonList("test"), new HashMap<>(), wo, new String[] { "v1" }, new HashMap<>(), 100);
}
Also used : HashMap(java.util.HashMap) WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Test(org.junit.jupiter.api.Test)

Example 15 with WidgetOptions

use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.

the class ActivityContentValidatorTest method testValidateWithException.

@Test
public void testValidateWithException() {
    Exception exception = assertThrows(ReportPortalException.class, () -> {
        activityContentValidator.validate(Collections.singletonList("test"), new HashMap<>(), new WidgetOptions(), 5);
    });
    String expectedMessage = "Filter-Sort mapping should not be empty";
    String actualMessage = exception.getMessage();
    assertTrue(actualMessage.contains(expectedMessage));
}
Also used : WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Test(org.junit.jupiter.api.Test)

Aggregations

WidgetOptions (com.epam.ta.reportportal.entity.widget.WidgetOptions)34 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)20 Test (org.junit.jupiter.api.Test)20 Sort (org.springframework.data.domain.Sort)15 Filter (com.epam.ta.reportportal.commons.querygen.Filter)13 WidgetOptionUtil (com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil)10 Launch (com.epam.ta.reportportal.entity.launch.Launch)10 HashMap (java.util.HashMap)10 Optional.ofNullable (java.util.Optional.ofNullable)10 WidgetContentRepository (com.epam.ta.reportportal.dao.WidgetContentRepository)8 Map (java.util.Map)8 Autowired (org.springframework.beans.factory.annotation.Autowired)8 Service (org.springframework.stereotype.Service)7 ContentLoaderConstants (com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants)6 GROUP_FILTERS (com.epam.ta.reportportal.core.widget.util.WidgetFilterUtil.GROUP_FILTERS)6 List (java.util.List)6 CollectionUtils (org.apache.commons.collections.CollectionUtils)6 BusinessRule (com.epam.ta.reportportal.commons.validation.BusinessRule)5 LoadContentStrategy (com.epam.ta.reportportal.core.widget.content.LoadContentStrategy)5 ErrorType (com.epam.ta.reportportal.ws.model.ErrorType)5