コード例 #1
0
  /**
   * Check that for two different repositories we get the connections from two different pools. If
   * not, TransactionCachingInterceptor will return a session from the first repository when asked
   * for a new session for the second repository.
   */
  @Test
  public void testMultipleRepositoriesPerTransaction() throws Exception {
    // config for second repo available only for H2
    assumeTrue("Test only works with H2", database.isVCSH2());

    DatabaseH2 db = (DatabaseH2) DatabaseHelper.DATABASE;
    db.setUp2();
    deployContrib(
        "org.nuxeo.ecm.core.storage.sql.test", "OSGI-INF/test-pooling-h2-repo2-contrib.xml");
    // open a second repository
    try (CoreSession session2 =
        CoreInstance.openCoreSession(
            database.getRepositoryName() + "2", SecurityConstants.ADMINISTRATOR)) {
      doTestMultipleRepositoriesPerTransaction(session2);
    }
  }
コード例 #2
0
ファイル: TestTreeIndexing.java プロジェクト: mindis/nuxeo
 protected CoreSession getRestrictedSession(String userName) {
   RepositoryManager rm = Framework.getLocalService(RepositoryManager.class);
   Map<String, Serializable> ctx = new HashMap<>();
   ctx.put("principal", new UserPrincipal(userName, null, false, false));
   return CoreInstance.openCoreSession(rm.getDefaultRepositoryName(), ctx);
 }
コード例 #3
0
 public CoreSession openSessionAs(NuxeoPrincipal principal) throws ClientException {
   return CoreInstance.openCoreSession(repositoryName, principal);
 }
コード例 #4
0
 public CoreSession openSessionAs(String username) throws ClientException {
   return CoreInstance.openCoreSession(repositoryName, username);
 }
コード例 #5
0
 protected CoreSession openSessionAs(String username) {
   return CoreInstance.openCoreSession(session.getRepositoryName(), username);
 }