예제 #1
0
  public URL getRepositoryContrib(FeaturesRunner runner) {
    String msg;
    if (isVCS()) {
      msg = "Deploying a VCS repository";
    } else if (isDBS()) {
      msg = "Deploying a DBS repository using " + coreType;
    } else {
      throw new NuxeoException("Unkown test configuration (not vcs/dbs)");
    }
    // System.out used on purpose, don't remove
    System.out.println(getClass().getSimpleName() + ": " + msg);
    log.info(msg);

    String contribPath;
    String bundleName;
    if (isVCS()) {
      bundleName = "org.nuxeo.ecm.core.storage.sql.test";
      contribPath = databaseHelper.getDeploymentContrib();
    } else {
      bundleName = "org.nuxeo.ecm.core.test";
      if (isDBSMem()) {
        contribPath = "OSGI-INF/test-storage-repo-mem-contrib.xml";
      } else if (isDBSMongoDB()) {
        contribPath = "OSGI-INF/test-storage-repo-mongodb-contrib.xml";
      } else {
        throw new NuxeoException("Unkown DBS test configuration (not mem/mongodb)");
      }
    }
    RuntimeHarness harness = runner.getFeature(RuntimeFeature.class).getHarness();
    Bundle bundle = harness.getOSGiAdapter().getRegistry().getBundle(bundleName);
    URL contribURL = bundle.getEntry(contribPath);
    assertNotNull("deployment contrib " + contribPath + " not found", contribURL);
    return contribURL;
  }
예제 #2
0
 /** Checks if the database supports multiple fulltext indexes. */
 public boolean supportsMultipleFulltextIndexes() {
   if (isVCS()) {
     return databaseHelper.supportsMultipleFulltextIndexes();
   } else {
     return false; // DBS
   }
 }
예제 #3
0
 /** Checks if the database has sub-second resolution. */
 public boolean hasSubSecondResolution() {
   if (isVCS()) {
     return databaseHelper.hasSubSecondResolution();
   } else {
     return true; // DBS
   }
 }
예제 #4
0
 /** For databases that do asynchronous fulltext indexing, sleep a bit. */
 public void sleepForFulltext() {
   if (isVCS()) {
     databaseHelper.sleepForFulltext();
   } else {
     // DBS
   }
 }
예제 #5
0
  protected void initJDBC() {
    databaseHelper = DatabaseHelper.DATABASE;

    String msg = "Deploying JDBC using " + databaseHelper.getClass().getSimpleName();
    // System.out used on purpose, don't remove
    System.out.println(getClass().getSimpleName() + ": " + msg);
    log.info(msg);

    // setup system properties for generic XML extension points
    // this is used both for VCS (org.nuxeo.ecm.core.storage.sql.RepositoryService)
    // and DataSources (org.nuxeo.runtime.datasource) extension points
    try {
      databaseHelper.setUp();
    } catch (SQLException e) {
      throw new NuxeoException(e);
    }
  }
예제 #6
0
 /** For databases that don't have sub-second resolution, sleep a bit to get to the next second. */
 public void maybeSleepToNextSecond() {
   if (isVCS()) {
     databaseHelper.maybeSleepToNextSecond();
   } else {
     // DBS
   }
   // sleep 1 ms nevertheless to have different timestamps
   try {
     Thread.sleep(1);
   } catch (InterruptedException e) {
     Thread.currentThread().interrupt(); // restore interrupted status
     throw new RuntimeException(e);
   }
 }