use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class LaunchControllerValidationTest method createLaunchShouldReturnErrorWhenNameConsistsOfWhitespaces.
@Test
public void createLaunchShouldReturnErrorWhenNameConsistsOfWhitespaces() throws Exception {
// GIVEN
StartLaunchRQ startLaunchRQ = prepareLaunch();
startLaunchRQ.setName(WHITESPACES_NAME_VALUE);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + LAUNCH_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(startLaunchRQ)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn();
// THEN
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + "[" + FIELD_NAME_IS_BLANK_MESSAGE + " " + FIELD_NAME_SIZE_MESSAGE + "] ", error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class LaunchBuilderTest method addStartRqTest.
@Test
void addStartRqTest() {
final StartLaunchRQ request = new StartLaunchRQ();
final String uuid = "uuid";
request.setUuid(uuid);
request.setMode(Mode.DEFAULT);
final String description = "description";
request.setDescription(description);
final String name = "name";
request.setName(name);
final LocalDateTime now = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
request.setStartTime(TO_DATE.apply(now));
request.setAttributes(Sets.newHashSet(new ItemAttributesRQ("key", "value")));
final Launch launch = new LaunchBuilder().addStartRQ(request).addAttributes(request.getAttributes()).get();
assertEquals(name, launch.getName());
assertEquals(uuid, launch.getUuid());
assertEquals(description, launch.getDescription());
assertEquals(now, launch.getStartTime());
assertTrue(launch.getAttributes().contains(new ItemAttribute("key", "value", false)));
assertEquals(LaunchModeEnum.DEFAULT, launch.getMode());
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class JaskonRequiredPropertiesValidatorTest method testRequiredFields.
@Test
public void testRequiredFields() {
StartLaunchRQ startLaunchRQ = new StartLaunchRQ();
startLaunchRQ.setDescription("some description");
startLaunchRQ.setName("some launch name");
startLaunchRQ.setAttributes(Collections.emptySet());
JaskonRequiredPropertiesValidator validator = new JaskonRequiredPropertiesValidator();
Errors errors = new BeanPropertyBindingResult(startLaunchRQ, "startLaunchRq");
validator.validate(startLaunchRQ, errors);
assertThat(errors.getAllErrors(), not(empty()));
assertThat(errors.getFieldError("startTime"), not(nullValue()));
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-testNG by reportportal.
the class BuildTestTest method testStartLaunchRq_EmptyDescription.
@Test
public void testStartLaunchRq_EmptyDescription() {
ListenerParameters parameters = new ListenerParameters();
parameters.setDescription("");
StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(parameters);
assertThat("Description should be null", startLaunchRQ.getDescription(), nullValue());
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project agent-java-testNG by reportportal.
the class BuildTestTest method testStartLaunchRq.
@Test
public void testStartLaunchRq() {
ListenerParameters listenerParameters = defaultListenerParameters();
StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(listenerParameters);
assertThat("Incorrect launch name", startLaunchRQ.getName(), is(DEFAULT_NAME));
assertThat("Incorrect start time", startLaunchRQ.getStartTime(), notNullValue());
assertThat("Incorrect launch tags", startLaunchRQ.getAttributes(), hasItem(ATTRIBUTE));
assertThat("Incorrect launch mode", startLaunchRQ.getMode(), is(MODE));
assertThat("Incorrect description", startLaunchRQ.getDescription(), is(DEFAULT_DESCRIPTION));
}
Aggregations