use of com.epam.ta.reportportal.entity.cluster.Cluster in project commons-dao by reportportal.
the class ClusterRepositoryTest method shouldSaveClusterTestItems.
@Test
void shouldSaveClusterTestItems() {
final Cluster cluster = clusterRepository.findAllByLaunchId(LAUNCH_ID).get(0);
final int inserted = clusterRepository.saveClusterTestItems(cluster, Set.of(1L, 2L));
assertEquals(2, inserted);
}
use of com.epam.ta.reportportal.entity.cluster.Cluster in project commons-dao by reportportal.
the class ClusterRepositoryTest method shouldDeleteClusterTestItemsByProjectId.
@Test
void shouldDeleteClusterTestItemsByProjectId() {
final Cluster cluster = clusterRepository.findByIndexIdAndLaunchId(1L, 1L).get();
clusterRepository.saveClusterTestItems(cluster, Set.of(1L));
final int removed = clusterRepository.deleteClusterTestItemsByProjectId(1L);
assertEquals(1, removed);
}
use of com.epam.ta.reportportal.entity.cluster.Cluster in project commons-dao by reportportal.
the class ClusterRepositoryTest method shouldDeleteByLaunchId.
@Test
void shouldDeleteByLaunchId() {
final int removed = clusterRepository.deleteAllByLaunchId(LAUNCH_ID);
assertEquals(3, removed);
final Pageable pageable = PageRequest.of(0, 3, Sort.by(Sort.Order.by(CRITERIA_ID)));
final Page<Cluster> clusters = clusterRepository.findAllByLaunchId(LAUNCH_ID, pageable);
assertTrue(clusters.isEmpty());
}
use of com.epam.ta.reportportal.entity.cluster.Cluster in project commons-dao by reportportal.
the class ClusterRepositoryTest method insertClusters.
@BeforeEach
void insertClusters() {
final List<Cluster> clusters = LongStream.range(CLUSTER_ID_START_VALUE, CLUSTER_ID_END_VALUE).mapToObj(id -> {
final Cluster cluster = new Cluster();
cluster.setIndexId(id);
cluster.setProjectId(PROJECT_ID);
cluster.setLaunchId(LAUNCH_ID);
cluster.setMessage("Message");
return cluster;
}).collect(Collectors.toList());
clusterRepository.saveAll(clusters);
clusters.stream().map(Cluster::getId).forEach(savedIds::add);
}
use of com.epam.ta.reportportal.entity.cluster.Cluster in project commons-dao by reportportal.
the class ClusterRepositoryTest method shouldFindByLaunchId.
@Test
void shouldFindByLaunchId() {
final Pageable pageable = PageRequest.of(0, 3, Sort.by(Sort.Order.by(CRITERIA_ID)));
final Page<Cluster> clusters = clusterRepository.findAllByLaunchId(LAUNCH_ID, pageable);
assertFalse(clusters.isEmpty());
assertEquals(3, clusters.getContent().size());
clusters.getContent().forEach(cluster -> assertEquals(LAUNCH_ID, cluster.getLaunchId()));
}
Aggregations