use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.
the class TestItemBuilderTest method testCaseIdGeneratedFromCodeRefAndParamsTest.
@Test
void testCaseIdGeneratedFromCodeRefAndParamsTest() {
StartTestItemRQ request = new StartTestItemRQ();
request.setName("item");
request.setType("step");
String codeRef = "com.epam.ta.reportportal.core.item.identity.TestCaseIdHandlerImplTest";
request.setCodeRef(codeRef);
ParameterResource param1 = new ParameterResource();
param1.setKey("key1");
String value1 = "value1";
param1.setValue(value1);
ParameterResource param2 = new ParameterResource();
param2.setKey("key2");
String value2 = "value2";
param2.setValue(value2);
ParameterResource param3 = new ParameterResource();
param1.setKey("key3");
request.setParameters(Lists.newArrayList(param1, param2, param3));
TestItem item = new TestItemBuilder().addStartItemRequest(request).get();
String expected = codeRef + "[" + value1 + "," + value2 + ",null]";
assertEquals(expected, item.getTestCaseId());
assertEquals(expected.hashCode(), item.getTestCaseHash());
}
use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.
the class TestItemBuilderTest method addStartRqTest.
@Test
void addStartRqTest() {
final StartTestItemRQ rq = new StartTestItemRQ();
rq.setType("step");
final ParameterResource parameterResource = new ParameterResource();
parameterResource.setKey("key");
parameterResource.setValue("value");
rq.setParameters(Collections.singletonList(parameterResource));
final String uuid = "uuid";
rq.setUniqueId(uuid);
final String description = "description";
rq.setDescription(description);
final LocalDateTime now = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
rq.setStartTime(TO_DATE.apply(now));
final String name = "name";
rq.setName(name);
final TestItem testItem = new TestItemBuilder().addStartItemRequest(rq).get();
assertEquals(TestItemTypeEnum.STEP, testItem.getType());
final Parameter param = new Parameter();
param.setKey("key");
param.setValue("value");
assertTrue(testItem.getParameters().contains(param));
assertEquals(uuid, testItem.getUniqueId());
assertEquals(description, testItem.getDescription());
assertEquals(now, testItem.getStartTime());
assertEquals(name, testItem.getName());
}
use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.
the class ParametersConverterTest method getResource.
private static ParameterResource getResource() {
ParameterResource resource = new ParameterResource();
resource.setKey("key");
resource.setValue("value");
return resource;
}
use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.
the class TestItemControllerTest method getParameters.
private List<ParameterResource> getParameters() {
ParameterResource parameters = new ParameterResource();
parameters.setKey("CardNumber");
parameters.setValue("4444333322221111");
ParameterResource parameters1 = new ParameterResource();
parameters1.setKey("Stars");
parameters1.setValue("2 stars");
return ImmutableList.<ParameterResource>builder().add(parameters).add(parameters1).build();
}
use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.
the class TestItemBuilderTest method testItemBuilder.
@Test
void testItemBuilder() {
final Launch launch = new Launch();
launch.setId(1L);
launch.setName("name");
final ParameterResource parameterResource = new ParameterResource();
parameterResource.setKey("key");
parameterResource.setValue("value");
final String description = "description";
final String typeValue = "step";
final TestItem testItem = new TestItemBuilder().addDescription(description).addType(typeValue).addLaunchId(launch.getId()).addParameters(Collections.singletonList(parameterResource)).addAttributes(Sets.newHashSet(new ItemAttributesRQ("key", "value"))).addParentId(1L).get();
assertThat(testItem.getLaunchId()).isEqualToComparingFieldByField(launch.getId());
assertEquals(description, testItem.getDescription());
assertEquals(TestItemTypeEnum.STEP, testItem.getType());
final Parameter param = new Parameter();
param.setKey("key");
param.setValue("value");
assertTrue(testItem.getParameters().contains(param));
assertThat(testItem.getAttributes()).containsExactly(new ItemAttribute("key", "value", false));
assertNotNull(testItem.getParentId());
}
Aggregations