001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package mocks;
017    
018    import java.util.Collections;
019    import java.util.HashSet;
020    import java.util.Set;
021    import java.util.concurrent.locks.Lock;
022    
023    import org.kuali.rice.kew.impl.document.DocumentRefreshQueueImpl;
024    
025    /**
026     * a DocumentRefreshQueueImpl extension that keeps track of the ids for docs that were requeued
027     * 
028     * @author Kuali Rice Team (rice.collab@kuali.org)
029     *
030     */
031    public class MockDocumentRefreshQueueImpl extends DocumentRefreshQueueImpl {
032    
033            private static final Set<String> requeuedDocumentIds = new HashSet<String>();
034            private static Lock lock;
035            
036            public static Set<String> getRequeuedDocumentIds() {
037                    return Collections.unmodifiableSet(requeuedDocumentIds);
038            }
039            
040            public static void clearRequeuedDocumentIds() {
041                    requeuedDocumentIds.clear();
042            }
043    
044            /**
045             * @see org.kuali.rice.kew.impl.document.DocumentRefreshQueueImpl#requeueDocument(java.lang.Long)
046             */
047            @Override
048            public void refreshDocument(String documentId) {
049                    requeuedDocumentIds.add(documentId);
050                    super.refreshDocument(documentId);
051            }
052    }