CatalogProvUtilsImpl implements CatalogProvUtils { @Override public void endCreateActivity(CreateActivity createActivity, Resource recordIRI) { Entity recordEntity = entityFactory.createNew(recordIRI, createActivity.getModel()); recordEntity.addGeneratedAtTime(OffsetDateTime.now()); recordEntity.addProperty(vf.createLiteral(config.getRepositoryId()), vf.createIRI(atLocation)); createActivity.addGenerated(recordEntity); finalizeActivity(createActivity); provenanceService.updateActivity(createActivity); }  @Override CreateActivity startCreateActivity(User user); @Override void endCreateActivity(CreateActivity createActivity, Resource recordIRI); @Override DeleteActivity startDeleteActivity(User user, Resource recordIri); @Override void endDeleteActivity(DeleteActivity deleteActivity, Record record); @Override void removeActivity(Activity activity);  }
@Test public void endCreateActivityTest() throws Exception { Resource recordIRI = VALUE_FACTORY.createIRI(recordIri); utils.endCreateActivity(createActivity, recordIRI); verify(provenanceService).updateActivity(createActivity); assertTrue(createActivity.getModel().contains(createActivity.getResource(), VALUE_FACTORY.createIRI(Activity.endedAtTime_IRI), null)); assertEquals(1, createActivity.getGenerated().size()); Entity resultEntity = createActivity.getGenerated().iterator().next(); assertEquals(VALUE_FACTORY.createIRI(recordIri), resultEntity.getResource()); assertTrue(resultEntity.getModel().contains(resultEntity.getResource(), VALUE_FACTORY.createIRI(Entity.generatedAtTime_IRI), null)); assertTrue(resultEntity.getModel().contains(resultEntity.getResource(), VALUE_FACTORY.createIRI(predAtLocation), VALUE_FACTORY.createLiteral("system"))); }