@@ -0,0 +1,3509 @@
+/*%0A * Copyright 2006-2014 The Kuali Foundation%0A *%0A * Licensed under the Educational Community License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.opensource.org/licenses/ecl2.php%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.kuali.rice.core.api.resourceloader;%0A%0Aimport org.kuali.rice.core.api.CoreConstants;%0Aimport org.kuali.rice.core.api.config.property.ConfigContext;%0Aimport org.kuali.rice.core.api.exception.RiceRuntimeException;%0Aimport org.kuali.rice.core.framework.config.property.SimpleConfig;%0Aimport org.kuali.rice.core.framework.resourceloader.BaseResourceLoader;%0A%0Aimport javax.xml.namespace.QName;%0Aimport java.util.Map;%0Aimport java.util.concurrent.ConcurrentHashMap;%0A%0A/**%0A * Utility class to allow the injection of services that are fetched via the%0A * %7B@link GlobalResourceLoader%7D.%0A *%0A * @author Kuali Rice Team (rice.collab@kuali.org)%0A */%0Apublic final class GlobalResourceLoaderTestUtils %7B%0A%0A    private static Map%3CString, Object%3E mockServiceMap;%0A%0A    private volatile boolean initialized = false;%0A%0A    // private constructor, instances are not allowed%0A    private GlobalResourceLoaderTestUtils() %7B%0A        throw new UnsupportedOperationException(%22Don't construct me, I'm all about the static methods.%22);%0A    %7D%0A%0A    /**%0A     * Inject a service into the %7B@link org.kuali.rice.core.api.resourceloader.GlobalResourceLoader%7D such that anytime%0A     * that service is fetched by serviceName, the supplied mockService will be returned.%0A     *%0A     * @param serviceName the name that the service is known by in the GRL%0A     * @param mockService the service to inject%0A     */%0A    public static void addMockService(final String serviceName, final Object mockService) %7B%0A        getMockServiceMap().put(serviceName, mockService);%0A    %7D%0A%0A    /**%0A     * Getter for the mockServiceMap, which on first call constructs it and also initializes our hack of the GRL.%0A     *%0A     * @return the mockServiceMap%0A     */%0A    private static synchronized Map%3CString, Object%3E getMockServiceMap() %7B%0A        // the first time this is called, inject our special resource loader%0A        if (mockServiceMap == null) %7B%0A            mockServiceMap = new ConcurrentHashMap%3CString, Object%3E();%0A%0A            // this little dance is required to prevent issues when%0A%0A            SimpleConfig config = new SimpleConfig();%0A            config.putProperty(CoreConstants.Config.APPLICATION_ID, %22TEST%22);%0A            ConfigContext.init(config);%0A%0A            try %7B%0A                GlobalResourceLoader.stop();%0A            %7D catch (Exception e) %7B%0A                throw new RiceRuntimeException(e);%0A            %7D%0A%0A            // Add to the front of the line our hacked resource loader which will fetch services from the mockServiceMap%0A            GlobalResourceLoader.addResourceLoaderFirst(new BaseResourceLoader(new QName(%22TEST%22, %22TEST%22)) %7B%0A                @Override%0A                public Object getService(QName serviceQName) %7B%0A%0A                    String localPart = serviceQName.getLocalPart();%0A                    return mockServiceMap.get(localPart);%0A                %7D%0A            %7D);%0A        %7D%0A%0A        return mockServiceMap;%0A    %7D%0A%7D%0A

Add annotation to enable serialization opt-in / opt-out for individual maintenance doc fields * Missed this needed utility for the unit tests related to this issue