Example #1
0
 /**
  * Get an instance of the configured repository.
  *
  * @return repository
  */
 public static Repository getRepository() {
   if (instance != null) return instance;
   try {
     if (SystemProperties.get("adito.repositoryClass") != null) {
       instance =
           (Repository) Class.forName(SystemProperties.get("adito.repositoryClass")).newInstance();
     } else instance = new LocalRepository();
   } catch (Exception e) {
     log.error("Failed to initialize repository", e);
     return null;
   }
   return instance;
 }
  @Test
  public void localPath() throws Exception {
    // Local path
    String dir = SystemProperties.get("user.dir");
    NetworkPlace np = create(dir);
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, dir, "", "");

    // Windows path
    dir = "C:\\Program Files\\Adito";
    np = create(dir);
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, dir, "", "");

    // UNIX path
    dir = "/home/joeb/My Documents";
    np = create(dir);
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, dir, "", "");
  }