Search in sources :

Example 1 with Log

use of com.epam.ta.reportportal.database.entity.Log in project commons-dao by reportportal.

the class LogRepositoryTest method findModifiedLaterAgo.

@Test
public void findModifiedLaterAgo() {
    final Log log = new Log();
    logRepository.save(log);
    List<Log> logs = mongoTemplate.find(findModifiedLaterThanPeriod(Duration.ofHours(-26)), Log.class);
    Assert.assertTrue(logs.size() == 2);
    Assert.assertTrue(logs.contains(saved));
}
Also used : Log(com.epam.ta.reportportal.database.entity.Log) BaseDaoTest(com.epam.ta.reportportal.BaseDaoTest) Test(org.junit.Test)

Example 2 with Log

use of com.epam.ta.reportportal.database.entity.Log in project commons-dao by reportportal.

the class LogRepositoryTest method addLogWithBinaryData.

@Before
public void addLogWithBinaryData() {
    Map<String, String> metaInfo = new HashMap<>();
    metaInfo.put("project", "EPMRPP");
    BinaryData binaryData = new BinaryData(CONTENT_TYPE, 64807L, this.getClass().getClassLoader().getResourceAsStream("meh.jpg"));
    filename = dataStorage.saveData(binaryData, "filename", metaInfo);
    thumbnail = dataStorage.saveData(binaryData, "thumbnail", metaInfo);
    BinaryContent binaryContent = new BinaryContent(filename, thumbnail, CONTENT_TYPE);
    Log log = new Log();
    log.setBinaryContent(binaryContent);
    saved = logRepository.save(log);
}
Also used : HashMap(java.util.HashMap) Log(com.epam.ta.reportportal.database.entity.Log) BinaryData(com.epam.ta.reportportal.database.BinaryData) BinaryContent(com.epam.ta.reportportal.database.entity.BinaryContent) Before(org.junit.Before)

Example 3 with Log

use of com.epam.ta.reportportal.database.entity.Log in project commons-dao by reportportal.

the class LogRepositoryTest method logs.

public List<Log> logs() {
    Log log1 = new Log();
    log1.setTestItemRef("item1");
    log1.setBinaryContent(new BinaryContent("binary1", "thumbnail1", "contentType1"));
    Log log2 = new Log();
    log2.setTestItemRef("item1");
    log2.setBinaryContent(new BinaryContent("binary2", "thumbnail2", "contentType2"));
    Log log3 = new Log();
    log3.setTestItemRef("item2");
    log3.setBinaryContent(new BinaryContent("binary3", "thumbnail3", "contentType3"));
    return asList(log1, log2, log3);
}
Also used : Log(com.epam.ta.reportportal.database.entity.Log) BinaryContent(com.epam.ta.reportportal.database.entity.BinaryContent)

Example 4 with Log

use of com.epam.ta.reportportal.database.entity.Log in project commons-dao by reportportal.

the class LogRepositoryTest method deleteByItemRef.

@Test
public void deleteByItemRef() {
    final String itemRef = "itemRef";
    final Log log = new Log();
    log.setTestItemRef(itemRef);
    logRepository.save(log);
    logRepository.deleteByItemRef(singletonList(itemRef));
    Assert.assertFalse(logRepository.exists(log.getId()));
}
Also used : Log(com.epam.ta.reportportal.database.entity.Log) BaseDaoTest(com.epam.ta.reportportal.BaseDaoTest) Test(org.junit.Test)

Aggregations

Log (com.epam.ta.reportportal.database.entity.Log)4 BaseDaoTest (com.epam.ta.reportportal.BaseDaoTest)2 BinaryContent (com.epam.ta.reportportal.database.entity.BinaryContent)2 Test (org.junit.Test)2 BinaryData (com.epam.ta.reportportal.database.BinaryData)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1