use of org.kie.kogito.persistence.mongodb.index.IndexManager.INDEX_NAME_FIELD in project kogito-apps by kiegroup.
the class IndexManagerIT method testOnSchemaRegisteredEvent.
@Test
void testOnSchemaRegisteredEvent() {
Map<String, EntityIndexDescriptor> indexes = new HashMap<>();
indexes.put("test", travelEntityIndexDescriptor);
indexManager.getCollectionIndexMapping().put("test", travelEntityIndexDescriptor.getName());
indexManager.onSchemaRegisteredEvent(new SchemaRegisteredEvent(new SchemaDescriptor("test", "test", indexes, new ProcessDescriptor("test", travelEntityIndexDescriptor.getName())), new SchemaType("test")));
MongoCollection<Document> testCollection = indexManager.getCollection("test");
collections.add(testCollection);
Set<String> testIndexes = StreamSupport.stream(testCollection.listIndexes().spliterator(), false).map(document -> document.getString(INDEX_NAME_FIELD)).filter(name -> !DEFAULT_INDEX.equals(name)).collect(toSet());
assertEquals(getTestIndexNames(), testIndexes);
mockProcessIndexEventListener.assertFire("test", travelEntityIndexDescriptor.getName());
}
Aggregations