Search in sources :

Example 1 with TestItemIssue

use of com.epam.ta.reportportal.database.entity.item.issue.TestItemIssue in project commons-dao by reportportal.

the class TestItemRepositoryCustomImpl method updateItemsIssues.

@Override
public void updateItemsIssues(Map<String, TestItemIssue> forUpdate) {
    Query query = query(where(ID).in(forUpdate.keySet()));
    Update update = new Update();
    mongoTemplate.stream(query, TestItem.class).forEachRemaining(dbo -> {
        String currentId = dbo.getId();
        TestItemIssue newValue = forUpdate.get(currentId);
        update.set(ISSUE_TYPE, newValue.getIssueType());
        update.set(ISSUE_DESCRIPTION, newValue.getIssueDescription());
        update.set(ISSUE_TICKET, newValue.getExternalSystemIssues());
        update.set(ISSUE_ANALYZED, newValue.isAutoAnalyzed());
        mongoTemplate.updateFirst(Query.query(Criteria.where(ID).is(currentId)), update, mongoTemplate.getCollectionName(TestItem.class));
    });
}
Also used : TestItemIssue(com.epam.ta.reportportal.database.entity.item.issue.TestItemIssue) Query(org.springframework.data.mongodb.core.query.Query) Update(org.springframework.data.mongodb.core.query.Update) TestItem(com.epam.ta.reportportal.database.entity.item.TestItem)

Example 2 with TestItemIssue

use of com.epam.ta.reportportal.database.entity.item.issue.TestItemIssue 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);
}
Also used : TestItemIssue(com.epam.ta.reportportal.database.entity.item.issue.TestItemIssue) TestItem(com.epam.ta.reportportal.database.entity.item.TestItem) Before(org.junit.Before)

Aggregations

TestItem (com.epam.ta.reportportal.database.entity.item.TestItem)2 TestItemIssue (com.epam.ta.reportportal.database.entity.item.issue.TestItemIssue)2 Before (org.junit.Before)1 Query (org.springframework.data.mongodb.core.query.Query)1 Update (org.springframework.data.mongodb.core.query.Update)1