Search in sources :

Example 1 with TestItem

use of com.epam.ta.reportportal.entity.item.TestItem in project commons-dao by reportportal.

the class LogRepositoryTest method findLogMessagesByItemIdAndLogLevelNestedTest.

@Sql("/db/fill/item/items-with-nested-steps.sql")
@Test
void findLogMessagesByItemIdAndLogLevelNestedTest() {
    TestItem testItem = testItemRepository.findById(132L).get();
    List<String> messagesByItemIdAndLevelGte = logRepository.findMessagesByLaunchIdAndItemIdAndPathAndLevelGte(testItem.getLaunchId(), testItem.getItemId(), testItem.getPath(), LogLevel.ERROR.toInt());
    assertTrue(CollectionUtils.isNotEmpty(messagesByItemIdAndLevelGte));
    assertEquals(1, messagesByItemIdAndLevelGte.size());
    assertEquals("java.lang.NullPointerException: Oops\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n" + "\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" + "\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n", messagesByItemIdAndLevelGte.get(0));
}
Also used : TestItem(com.epam.ta.reportportal.entity.item.TestItem) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test) Sql(org.springframework.test.context.jdbc.Sql)

Example 2 with TestItem

use of com.epam.ta.reportportal.entity.item.TestItem in project commons-dao by reportportal.

the class LogRepositoryTest method findLogMessagesByItemIdAndLoLevelGteTest.

@Test
void findLogMessagesByItemIdAndLoLevelGteTest() {
    TestItem testItem = testItemRepository.findById(3L).get();
    List<String> messagesByItemIdAndLevelGte = logRepository.findMessagesByLaunchIdAndItemIdAndPathAndLevelGte(testItem.getLaunchId(), testItem.getItemId(), testItem.getPath(), LogLevel.WARN.toInt());
    assertTrue(CollectionUtils.isNotEmpty(messagesByItemIdAndLevelGte));
    assertEquals(7, messagesByItemIdAndLevelGte.size());
    messagesByItemIdAndLevelGte.forEach(it -> assertEquals("log", it));
}
Also used : TestItem(com.epam.ta.reportportal.entity.item.TestItem) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Example 3 with TestItem

use of com.epam.ta.reportportal.entity.item.TestItem in project commons-dao by reportportal.

the class CreateLogAttachmentServiceTest method getLogWithoutAttachment.

private Log getLogWithoutAttachment() {
    Log log = new Log();
    log.setId(1L);
    log.setLaunch(new Launch(2L));
    log.setTestItem(new TestItem(3L));
    log.setLogLevel(4000);
    log.setLogMessage("message");
    log.setLogTime(LocalDateTime.now());
    return log;
}
Also used : Log(com.epam.ta.reportportal.entity.log.Log) Launch(com.epam.ta.reportportal.entity.launch.Launch) TestItem(com.epam.ta.reportportal.entity.item.TestItem)

Example 4 with TestItem

use of com.epam.ta.reportportal.entity.item.TestItem in project commons-dao by reportportal.

the class ItemAttributeTest method getAttribute.

private ItemAttribute getAttribute(Long id, String key, String value, boolean system, Long launchId, Long itemId) {
    ItemAttribute attr = new ItemAttribute();
    attr.setId(id);
    attr.setKey(key);
    attr.setValue(value);
    attr.setSystem(system);
    if (launchId != null) {
        Launch launch = new Launch();
        launch.setId(launchId);
        attr.setLaunch(launch);
    }
    if (itemId != null) {
        TestItem item = new TestItem();
        item.setItemId(itemId);
        attr.setTestItem(item);
    }
    return attr;
}
Also used : Launch(com.epam.ta.reportportal.entity.launch.Launch) TestItem(com.epam.ta.reportportal.entity.item.TestItem)

Aggregations

TestItem (com.epam.ta.reportportal.entity.item.TestItem)4 BaseTest (com.epam.ta.reportportal.BaseTest)2 Launch (com.epam.ta.reportportal.entity.launch.Launch)2 Test (org.junit.jupiter.api.Test)2 Log (com.epam.ta.reportportal.entity.log.Log)1 Sql (org.springframework.test.context.jdbc.Sql)1