use of com.epam.ta.reportportal.ws.model.launch.LaunchResource in project service-api by reportportal.
the class GetLaunchHandlerImpl method getLaunchResources.
private Iterable<LaunchResource> getLaunchResources(Page<Launch> launches) {
final com.epam.ta.reportportal.ws.model.Page<LaunchResource> launchResourcePage = PagedResourcesAssembler.pageConverter(launchConverter.TO_RESOURCE).apply(launches);
applicationEventPublisher.publishEvent(new GetLaunchResourceCollectionEvent(launchResourcePage.getContent()));
return launchResourcePage;
}
use of com.epam.ta.reportportal.ws.model.launch.LaunchResource in project service-api by reportportal.
the class LaunchResourceAttributeUpdaterTest method shouldUpdate.
@Test
void shouldUpdate() {
final LaunchResource launchResource = new LaunchResource();
final List<ItemAttribute> attributes = List.of(new ItemAttribute("k1", "v1", false), new ItemAttribute("k2", "v2", false));
launchResourceAttributeUpdater.handle(launchResource, attributes);
final Set<ItemAttributeResource> resourceAttributes = launchResource.getAttributes();
Assertions.assertEquals(2, resourceAttributes.size());
final Map<String, List<ItemAttributeResource>> mapping = resourceAttributes.stream().collect(groupingBy(ItemAttributeResource::getKey));
final ItemAttributeResource firstResource = mapping.get("k1").get(0);
final ItemAttributeResource secondResource = mapping.get("k2").get(0);
final ItemAttribute firstAttribute = attributes.get(0);
final ItemAttribute secondAttribute = attributes.get(1);
shouldEqual(firstAttribute, firstResource);
shouldEqual(secondAttribute, secondResource);
}
use of com.epam.ta.reportportal.ws.model.launch.LaunchResource in project service-api by reportportal.
the class LaunchResourceMetadataAttributeUpdaterTest method shouldUpdateMetadataWhenAttributeMatches.
@Test
void shouldUpdateMetadataWhenAttributeMatches() {
final LaunchResource launchResource = new LaunchResource();
final List<ItemAttribute> attributes = List.of(new ItemAttribute(RP_CLUSTER_LAST_RUN_KEY, "v1", false), new ItemAttribute("k2", "v2", false));
updater.handle(launchResource, attributes);
final Map<String, Object> metadata = launchResource.getMetadata();
Assertions.assertFalse(metadata.isEmpty());
Assertions.assertEquals("v1", metadata.get(RP_CLUSTER_LAST_RUN_KEY));
}
use of com.epam.ta.reportportal.ws.model.launch.LaunchResource in project service-api by reportportal.
the class LaunchResourceMetadataAttributeUpdaterTest method shouldNotUpdateMetadataWhenAttributeMatches.
@Test
void shouldNotUpdateMetadataWhenAttributeMatches() {
final LaunchResource launchResource = new LaunchResource();
final List<ItemAttribute> attributes = List.of(new ItemAttribute("k1", "v1", false), new ItemAttribute("k2", "v2", false));
updater.handle(launchResource, attributes);
Assertions.assertTrue(MapUtils.isEmpty(launchResource.getMetadata()));
}
use of com.epam.ta.reportportal.ws.model.launch.LaunchResource in project service-api by reportportal.
the class GetLaunchHandlerImpl method getLaunchResource.
private LaunchResource getLaunchResource(Launch launch) {
final LaunchResource launchResource = launchConverter.TO_RESOURCE.apply(launch);
applicationEventPublisher.publishEvent(new GetLaunchResourceCollectionEvent(Collections.singletonList(launchResource)));
return launchResource;
}
Aggregations