mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
102879: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) 102769: MNT-13947: Merged DEV to 5.0.N (5.0.2) 102637: MNT-13947: Java API: ServiceRegistry has incorrect bean ids - Fix ServiceRegistry to return beans by correct ids. Add unit test that checks ServiceRegistry getters. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@103571 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.service;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
public class ServiceRegistryTest
|
||||
{
|
||||
protected static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
|
||||
|
||||
protected ServiceRegistry serviceRegistry;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServiceRegistryGetters() throws Exception
|
||||
{
|
||||
Method[] methods = serviceRegistry.getClass().getMethods();
|
||||
for (Method method : methods)
|
||||
{
|
||||
if (method.getName().startsWith("get") && (method.getParameterTypes().length == 0))
|
||||
{
|
||||
try
|
||||
{
|
||||
method.invoke(serviceRegistry, null);
|
||||
}
|
||||
catch (java.lang.reflect.InvocationTargetException i)
|
||||
{
|
||||
if (i.getTargetException() instanceof UnsupportedOperationException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
fail("Failed to invoke " + method.getName() + " : " + i.getTargetException().getMessage());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
fail("Failed to invoke " + method.getName() + " : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user