Changeset 1279


Ignore:
Timestamp:
05/11/11 08:40:17 (13 years ago)
Author:
twagoo
Message:

Made spring config more modular, so implementations will have their own configuration that can be easily switched between. Also updated bean reference to ComponentRegistryFactoryImpl?

+ Test packages updated

Location:
ComponentRegistry/trunk/ComponentRegistry
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/pom.xml

    r1257 r1279  
    225225                                <include>index.jsp</include>
    226226                                <include>WEB-INF/applicationContext.xml</include>
     227                                <include>WEB-INF/spring-config/**</include>
    227228                            </includes>
    228229                        </resource>
  • ComponentRegistry/trunk/ComponentRegistry/src/main/webresources/WEB-INF/applicationContext.xml

    r1251 r1279  
    33  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    44
    5 
    6   <bean id="configuration" class="clarin.cmdi.componentregistry.Configuration" init-method="init" factory-method="getInstance">
    7     <property name="registryRoot" value="${registryRoot}" />
    8     <property name="adminUsers">
    9       <set>
    10         <value>patdui@mpi.nl</value> <!-- short names are for shibbolet on lux16 -->
    11         <value>patrick.duin@mpi.nl</value>
    12         <value>guisil@mpi.nl</value>
    13         <value>guilherme.silva@mpi.nl</value>
    14         <value>twagoo@mpi.nl</value>
    15         <value>twan.goosen@mpi.nl</value>
    16         <value>daan.broeder@mpi.nl</value>
    17       </set>
    18     </property>
    19     <property name="generalComponentSchema" value="http://www.clarin.eu/cmd/general-component-schema.xsd" />
    20     <!-- <property name="component2SchemaXsl" value="http://www.clarin.eu/cmd/comp2schema.xsl" />-->
    21     <property name="component2SchemaXsl" value="http://www.clarin.eu/cmd/xslt/comp2schema-v2/comp2schema.xsl"/>
    22     <property name="componentSpecSchemaLocation" value="http://www.clarin.eu/cmd http://www.clarin.eu/cmd/general-component-schema.xsd" />
    23     <property name="isocatRestUrl" value="http://www.isocat.org/rest/" />
    24     <!-- Extra attribute keys that are passed in a shibboleth authenticated request principal.
    25          You need to configure the shhaa.xml file to enable the extra attributes.
    26      -->
    27     <property name="displayNameShibbolethKeys">
    28         <list>
    29           <value>displayName</value>
    30           <value>commonName</value>
    31         </list>
    32     </property>
    33   </bean>
    34 
    35   <bean id="componentRegistryFactory" class="clarin.cmdi.componentregistry.ComponentRegistryFactory" factory-method="getInstance">
    36   </bean>
     5    <import resource="spring-config/component-registry.xml"/>
     6    <import resource="spring-config/filesystem-impl.xml"/>
    377
    388</beans>
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/filesystem/CMDComponentSpecExpanderTest.java

    r1277 r1279  
    11package clarin.cmdi.componentregistry.impl.filesystem;
    22
    3 import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactory;
     3import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactoryImpl;
    44import clarin.cmdi.componentregistry.impl.filesystem.CMDComponentSpecExpander;
    55import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryImpl;
     
    9090    public void testExpandProfileWithNestedComponentsFromUserRegistry() throws Exception {
    9191        ComponentRegistryImpl registry = ComponentRegistryTestCase.getTestRegistry(getRegistryDir());
    92         ComponentRegistryImpl userRegistry = (ComponentRegistryImpl) ComponentRegistryFactory.getInstance().getComponentRegistry(true,
     92        ComponentRegistryImpl userRegistry = (ComponentRegistryImpl) ComponentRegistryFactoryImpl.getInstance().getComponentRegistry(true,
    9393                DummyPrincipal.DUMMY_CREDENTIALS);
    9494
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/filesystem/ComponentRegistryFactoryTest.java

    r1277 r1279  
    55import clarin.cmdi.componentregistry.MDMarshaller;
    66import clarin.cmdi.componentregistry.UserCredentials;
    7 import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactory;
     7import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactoryImpl;
    88import static org.junit.Assert.assertEquals;
    99import static org.junit.Assert.assertFalse;
     
    3737    @Test
    3838    public void testGetOrCreateUserDir() throws Exception {
    39         ComponentRegistryFactory instance = ComponentRegistryFactory.getInstance();
     39        ComponentRegistryFactoryImpl instance = ComponentRegistryFactoryImpl.getInstance();
    4040        assertFalse(Configuration.getInstance().getUserDirMappingFile().exists());
    4141        ComponentRegistry componentRegistry = instance.getComponentRegistry(true, createUserCredentials("noot", "Mr.Noot"));
     
    6666    @Test
    6767    public void testGetOtherUserComponentRegistry() throws Exception {
    68         ComponentRegistryFactory instance = ComponentRegistryFactory.getInstance();
     68        ComponentRegistryFactoryImpl instance = ComponentRegistryFactoryImpl.getInstance();
    6969        ComponentRegistry reg1 = instance.getComponentRegistry(true, createUserCredentials("noot", "Mr.Noot"));
    7070        assertNotNull(reg1);
     
    109109        Configuration.getInstance().setRegistryRoot(registryDir);
    110110        Configuration.getInstance().init();
    111         ComponentRegistryFactory.getInstance().reset();
     111        ComponentRegistryFactoryImpl.getInstance().reset();
    112112    }
    113113
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/filesystem/ComponentRegistryImplTest.java

    r1277 r1279  
    55import clarin.cmdi.componentregistry.ResourceConfig;
    66import clarin.cmdi.componentregistry.UserUnauthorizedException;
    7 import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactory;
     7import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactoryImpl;
    88import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryImpl;
    99import static junit.framework.Assert.assertEquals;
     
    123123    public void testCacheLoadCorrect() throws Exception {
    124124        ComponentRegistryImpl publicReg = getTestRegistry(getRegistryDir());
    125         ComponentRegistryImpl userReg = (ComponentRegistryImpl) ComponentRegistryFactory.getInstance().getComponentRegistry(true,
     125        ComponentRegistryImpl userReg = (ComponentRegistryImpl) ComponentRegistryFactoryImpl.getInstance().getComponentRegistry(true,
    126126                DummyPrincipal.DUMMY_CREDENTIALS);
    127127
     
    411411        assertEquals(0, registry.getComponentDescriptions().size());
    412412
    413         registry = ComponentRegistryFactory.getInstance().getComponentRegistry(true, USER_CREDS); //user registry
     413        registry = ComponentRegistryFactoryImpl.getInstance().getComponentRegistry(true, USER_CREDS); //user registry
    414414        registry.register(description, testComp);
    415415        assertEquals(1, registry.getComponentDescriptions().size());
     
    442442        assertEquals(0, registry.getProfileDescriptions().size());
    443443
    444         registry = ComponentRegistryFactory.getInstance().getComponentRegistry(true, USER_CREDS); //user registry
     444        registry = ComponentRegistryFactoryImpl.getInstance().getComponentRegistry(true, USER_CREDS); //user registry
    445445        registry.register(description, testComp);
    446446        assertEquals(1, registry.getProfileDescriptions().size());
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/filesystem/ComponentRegistryTestCase.java

    r1277 r1279  
    33import clarin.cmdi.componentregistry.Configuration;
    44import clarin.cmdi.componentregistry.UserCredentials;
    5 import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactory;
     5import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactoryImpl;
    66import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryImpl;
    77import static org.junit.Assert.assertTrue;
     
    3131    @After
    3232    public void cleanupRegistryDir() {
    33         ComponentRegistryFactory.getInstance().reset();
     33        ComponentRegistryFactoryImpl.getInstance().reset();
    3434        cleanUpRegistryDir(tmpRegistryDir);
    3535        tmpRegistryDir = null;
     
    4747        config.setAdminUsers(adminUsers);
    4848        config.init();
    49         ComponentRegistryFactory.getInstance().reset();
    50         ComponentRegistryImpl register = (ComponentRegistryImpl) ComponentRegistryFactory.getInstance().getPublicRegistry();
     49        ComponentRegistryFactoryImpl.getInstance().reset();
     50        ComponentRegistryImpl register = (ComponentRegistryImpl) ComponentRegistryFactoryImpl.getInstance().getPublicRegistry();
    5151        register.setResourceConfig(config.getPublicResourceConfig()); //LOADS cache again but is necessary for tests normally we wouldn't have this
    5252        return register;
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestServiceTest.java

    r1277 r1279  
    1919
    2020import clarin.cmdi.componentregistry.ComponentRegistry;
    21 import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactory;
     21import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactoryImpl;
    2222import clarin.cmdi.componentregistry.components.CMDComponentSpec;
    2323import clarin.cmdi.componentregistry.model.AbstractDescription;
     
    440440    @Test
    441441    public void testRegisterWithUserComponents() throws Exception {
    442         ComponentRegistry userRegistry = ComponentRegistryFactory.getInstance()
     442        ComponentRegistry userRegistry = ComponentRegistryFactoryImpl.getInstance()
    443443                .getComponentRegistry(true, DummyPrincipal.DUMMY_CREDENTIALS);
    444444        String content = "";
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/MDValidatorTest.java

    r1277 r1279  
    1717
    1818import clarin.cmdi.componentregistry.ComponentRegistry;
    19 import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactory;
     19import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryFactoryImpl;
    2020import clarin.cmdi.componentregistry.impl.filesystem.ComponentRegistryTestCase;
    2121import clarin.cmdi.componentregistry.model.ComponentDescription;
     
    114114        String id1 = "component1";
    115115        String id2 = "component2";
    116         ComponentRegistry userRegistry = ComponentRegistryFactory.getInstance()
     116        ComponentRegistry userRegistry = ComponentRegistryFactoryImpl.getInstance()
    117117                .getComponentRegistry(true, DummyPrincipal.DUMMY_CREDENTIALS);
    118118
Note: See TracChangeset for help on using the changeset viewer.