use of com.epam.ta.reportportal.database.entity.item.TestItem in project commons-dao by reportportal.
the class MoreCollectorsTest method getTestData.
private List<TestItem> getTestData(final int count) {
List<TestItem> list = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
TestItem testItem = new TestItem();
testItem.setId(String.valueOf(i));
testItem.setUniqueId("unique" + i);
list.add(testItem);
}
return list;
}
use of com.epam.ta.reportportal.database.entity.item.TestItem in project commons-dao by reportportal.
the class TestItemRepositoryTest method setUp.
@Before
public void setUp() {
String launch = "launch";
TestItem testItem = new TestItem();
testItem.setLaunchRef(launch);
testItem.setId(testItemId1);
testItem.setName("test");
testItem.setIssue(new TestItemIssue(TestItemIssueType.SYSTEM_ISSUE.getLocator(), null));
TestItem testItem1 = new TestItem();
testItem1.setId(testItemId2);
testItem1.setName("testName");
testItem1.setLaunchRef(launch);
testItem1.setType(TestItemType.SUITE);
testItem1.setIssue(new TestItemIssue(TestItemIssueType.NO_DEFECT.getLocator(), null));
TestItem testItem2 = new TestItem();
testItem2.setId(testItemId3);
testItem2.setName("test2");
testItem2.setIssue(new TestItemIssue("nd_custom", null));
testItem2.setType(TestItemType.SUITE);
testItem2.setLaunchRef(launch);
testItemRepository.save(testItem2);
testItemRepository.save(testItem1);
testItemRepository.save(testItem);
TestItem child = new TestItem();
child.setId(testItemId4);
child.setName("child");
child.setStatus(Status.FAILED);
child.setParent(testItem.getId());
testItemRepository.save(child);
}
use of com.epam.ta.reportportal.database.entity.item.TestItem in project commons-dao by reportportal.
the class TestItemRepositoryTest method updateExecutionStatisticsTest.
@Test
public void updateExecutionStatisticsTest() {
final TestItem testItem = new TestItem();
testItem.setStatistics(new Statistics(new ExecutionCounter(2, 2, 0, 0), new IssueCounter()));
testItem.setStatus(Status.PASSED);
testItemRepository.save(testItem);
testItemRepository.updateExecutionStatistics(testItem);
final TestItem item = testItemRepository.findOne(testItem.getId());
final ExecutionCounter executionCounter = item.getStatistics().getExecutionCounter();
assertThat(executionCounter.getTotal()).isEqualTo(3);
assertThat(executionCounter.getFailed()).isEqualTo(0);
assertThat(executionCounter.getPassed()).isEqualTo(3);
assertThat(executionCounter.getSkipped()).isEqualTo(0);
}
use of com.epam.ta.reportportal.database.entity.item.TestItem in project commons-dao by reportportal.
the class CriteriaMapTest method dynamicCriteriaTest.
@Test
public void dynamicCriteriaTest() {
CriteriaMap<TestItem> testItemCriteriaMap = new CriteriaMap<>(TestItem.class);
assertThat(testItemCriteriaMap.getCriteriaHolderUnchecked(IssueCounter.PRODUCT_BUG_CRITERIA)).isPresent();
Filter filter = Filter.builder().withCondition(FilterCondition.builder().withCondition(Condition.EQUALS).withSearchCriteria("statistics$defects$product_bug$total").withValue("10").build()).withTarget(TestItem.class).build();
Query q = QueryBuilder.newBuilder().with(filter).build();
assertThat(q.getQueryObject().get("statistics.issueCounter.productBug.total")).isEqualTo(10L);
}
use of com.epam.ta.reportportal.database.entity.item.TestItem in project commons-dao by reportportal.
the class TestItemRepositoryCustomImpl method findIdsWithNameByLaunchesRef.
@Override
public Set<String> findIdsWithNameByLaunchesRef(String name, Set<String> launchRef) {
Query query = query(where(LAUNCH_REFERENCE).in(launchRef)).addCriteria(where(NAME).is(name));
query.fields().include("_id");
return mongoTemplate.find(query, TestItem.class).stream().map(TestItem::getId).collect(toSet());
}
Aggregations