Changeset 30030

Show
Ignore:
Timestamp:
02/11/08 17:38:40 (10 months ago)
Author:
gracinet
Message:

NXP-2062: add a changeUser method
merge_from_5.1 -r 30023:30024

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.core/trunk/nuxeo-core-jcr-connector-test/src/main/java/org/nuxeo/ecm/core/repository/jcr/testing/RepositoryOSGITestCase.java

    r28190 r30030  
    2727import org.nuxeo.ecm.core.api.CoreInstance; 
    2828import org.nuxeo.ecm.core.api.CoreSession; 
     29import org.nuxeo.ecm.core.listener.CoreEventListenerService; 
    2930import org.nuxeo.ecm.core.model.Repository; 
    3031import org.nuxeo.ecm.core.model.Session; 
     32import org.nuxeo.runtime.api.Framework; 
    3133import org.nuxeo.runtime.test.NXRuntimeTestCase; 
    3234 
     
    5961        // deploy life cycle manager 
    6062        deployBundle("nuxeo-core-jcr-connector"); 
     63//      assertNotNull(Framework.getService(CoreEventListenerService.class)); 
    6164    } 
    6265 
     
    7174        if (repository == null) { 
    7275            // the repository should be deployed the last 
    73             // after any other bundle that is deploying doctypes 
     76            // after any other bundle that is doctypes 
    7477            deployBundle("nuxeo-core-jcr-connector-test"); 
    7578            repository = NXCore.getRepositoryService().getRepositoryManager().getRepository( 
    7679                    REPOSITORY_NAME); 
    7780        } 
    78  
    79         Map<String, Serializable> ctx = new HashMap<String, Serializable>(); 
    80         ctx.put("username", "Administrator"); 
    81         coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx); 
    82         assertNotNull(coreSession); 
     81        openCoreSession("Administrator"); 
    8382    } 
    8483 
     
    8988    protected Repository getRepository() { 
    9089        return repository; 
     90    } 
     91 
     92    protected void openCoreSession(String userName) throws Exception { 
     93        Map<String, Serializable> ctx = new HashMap<String, Serializable>(); 
     94        ctx.put("username", userName); 
     95        coreSession = CoreInstance.getInstance().open(REPOSITORY_NAME, ctx); 
     96        assertNotNull(coreSession); 
     97    } 
     98 
     99    public void changeUser(String newUser) throws Exception { 
     100        releaseCoreSession(); 
     101        openCoreSession(newUser); 
    91102    } 
    92103