public void commit()

in src/main/java/org/apache/sling/testing/resourceresolver/MockResourceResolver.java [364:391]


    public void commit() throws PersistenceException {
        EventAdmin eventAdmin = this.options.getEventAdmin();
        synchronized ( this.resources ) {
            for(final String path : this.deletedResources ) {
                if ( this.resources.remove(path) != null && eventAdmin != null ) {
                    final Dictionary<String, Object> props = new Hashtable<String, Object>();
                    props.put(SlingConstants.PROPERTY_PATH, path);
                    final Event e = new Event(SlingConstants.TOPIC_RESOURCE_REMOVED, props);
                    eventAdmin.sendEvent(e);
                }
                this.temporaryResources.remove(path);
            }
            for(final String path : this.temporaryResources.keySet() ) {
                final boolean changed = this.resources.containsKey(path);
                this.resources.put(path, this.temporaryResources.get(path));
                if ( eventAdmin != null ) {
                    final Dictionary<String, Object> props = new Hashtable<String, Object>();
                    props.put(SlingConstants.PROPERTY_PATH, path);
                    if ( this.resources.get(path).get(ResourceResolver.PROPERTY_RESOURCE_TYPE) != null ) {
                        props.put(SlingConstants.PROPERTY_RESOURCE_TYPE, this.resources.get(path).get(ResourceResolver.PROPERTY_RESOURCE_TYPE));
                    }
                    final Event e = new Event(changed ? SlingConstants.TOPIC_RESOURCE_CHANGED : SlingConstants.TOPIC_RESOURCE_ADDED, props);
                    eventAdmin.sendEvent(e);
                }
            }
        }
        this.revert();
    }