use of org.graylog2.rest.models.system.contentpacks.responses.CatalogResolveRequest in project graylog2-server by Graylog2.
the class CatalogResourceTest method resolveEntities.
@Test
public void resolveEntities() {
final EntityDescriptor entityDescriptor = EntityDescriptor.builder().id(ModelId.of("1234567890")).type(ModelType.of("test", "1")).build();
final MutableGraph<EntityDescriptor> entityDescriptors = GraphBuilder.directed().build();
entityDescriptors.addNode(entityDescriptor);
final EntityV1 entity = EntityV1.builder().id(ModelId.of("1234567890")).type(ModelType.of("test", "1")).data(new ObjectNode(JsonNodeFactory.instance).put("test", "1234")).build();
when(mockEntityFacade.resolveNativeEntity(entityDescriptor)).thenReturn(entityDescriptors);
when(mockEntityFacade.exportEntity(eq(entityDescriptor), any(EntityDescriptorIds.class))).thenReturn(Optional.of(entity));
final CatalogResolveRequest request = CatalogResolveRequest.create(entityDescriptors.nodes());
final CatalogResolveResponse catalogResolveResponse = catalogResource.resolveEntities(request);
assertThat(catalogResolveResponse.entities()).containsOnly(entity);
}
Aggregations