Package org.evolizer.model.resources.entities.fs

Examples of org.evolizer.model.resources.entities.fs.Directory


     * @param path
     *            the Path of the directory to create
     * @return the {@link Directory} created
     */
    private Directory createDirectory(String path) {
        Directory directory = fDirectories.get(path);
        if (directory == null) {
            directory = new Directory(path, null);
            Directory parent = null;
            if (path != null) {
                String parentPath = this.getParentDirectoryPath(path);
                if (parentPath != null) {
                    parent = fDirectories.get(parentPath);
                    if (parent == null) {
                        parent = createDirectory(parentPath);
                    }
                    directory.setParentDirectory(parent);
                    parent.add(directory);
                }
            }
            fDirectories.put(path, directory);
            LOGGER.debug("Created Directory [" + directory + "]");
        }
View Full Code Here


        VersionedFile file = fFiles.get(path);
        if (file == null) {
            file = new VersionedFile(path, null);
            String parentPath = this.getParentDirectoryPath(path);
            if (parentPath != null) {
                Directory parent = fDirectories.get(parentPath);
                if (parent == null) {
                    parent = this.createDirectory(parentPath);
                }
                file.setParentDirectory(parent);
                parent.add(file);
            }
            fFiles.put(path, file);
            LOGGER.debug("Created File [" + file + "]");
        }
        return file;
View Full Code Here

            currentPath = parentPath + currentSegment;
        } else {
            currentPath = parentPath + "/" + currentSegment;
        }

        Directory dir;
        if (!fAllocatedDirectories.containsKey(currentPath)) {
            dir = new Directory(currentPath, parent);
            fAllocatedDirectories.put(currentPath, dir);
            fParent.add(dir);
        } else {
            dir = fAllocatedDirectories.get(currentPath);
        }
View Full Code Here

     * Factory-method to create a <code>File</code> from a <code>LogEntry</code>.
     */
    private void createFile() {
        String fullPath = "/" + fCurrentLogEntry.getWorkingFile();
        String parentDirPath = fullPath.substring(0, fullPath.lastIndexOf("/"));
        Directory parent = fAllocatedDirectories.get(parentDirPath);
        VersionedFile currentFile = new VersionedFile(fullPath, parent);

        fParent.add(currentFile);
        fCurrentFile = currentFile;
    }
View Full Code Here

    assertEquals(new Long(5),i);
    //testing quantity of files
    Long j = fSession.uniqueResult("select count(file) from VersionedFile as file", Long.class);
    assertEquals(new Long(3),j);   
    //testing directory "layout/"
    Directory testDir1 = fSession.uniqueResult("from Directory as dir where dir.path='/cvsroot/mozilla/layout'", Directory.class);
    assertEquals("layout",testDir1.getName());
    assertEquals(1,testDir1.getChildren().size());
    assertEquals("", testDir1.getParentDirectory().getParentDirectory().getParentDirectory().getName());
    //testing directory "layout/generic/"
    Directory testDir2 = fSession.uniqueResult("from Directory as directory where directory.path ='/cvsroot/mozilla/layout/generic'", Directory.class);
    assertEquals("generic",testDir2.getName());
    assertEquals("layout",testDir2.getParentDirectory().getName());
    assertEquals("/cvsroot/mozilla/layout",testDir2.getParentDirectory().getPath());
    assertEquals(3,testDir2.getChildren().size());
    List<String> expectedChildrenNames = new Vector<String>();
    expectedChildrenNames.add("nsViewportFrame.cpp");
    expectedChildrenNames.add("nsViewportFrame.h");
    expectedChildrenNames.add("punct_marks.ccmap");
    List<String> childrenNames = new Vector<String>();
    for(File dir : testDir2.getChildren()){
      childrenNames.add(dir.getName());
    }
    assertTrue(childrenNames.containsAll(expectedChildrenNames));
    assertTrue(expectedChildrenNames.containsAll(childrenNames))
  }
View Full Code Here

    assertEquals("foo", loadedFile.getName());
  }

  @Test
  public void testDirectoryMapping() {
    Directory dir = new Directory("foo_dir/foo", null);
    Directory loadedDir = saveAndReloadUniqueFromDB(dir,
        "from Directory", Directory.class);
    assertNotNull(loadedDir);
    assertEquals("foo", loadedDir.getName());
    assertEquals("foo_dir/foo", loadedDir.getPath());
  }
View Full Code Here

    assertEquals("foo_dir/foo", loadedDir.getPath());
  }

  @Test
  public void testDirectoryFileMapping() {
    Directory dir1 = new Directory("/dir_one", Directory.ROOT);
    VersionedFile file1 = new VersionedFile("/dir_one/file_one", dir1);
    VersionedFile file2 = new VersionedFile("/dir_one/file_two", dir1);
    dir1.add(file1);
    dir1.add(file2);
    Directory loadedDir = saveAndReloadUniqueFromDB(Directory.ROOT,
        "from Directory as d where d.path = '/dir_one'", Directory.class);
    assertNotNull(loadedDir);
    VersionedFile loadedFile = loadUniqueFromDB("from File f where f.path = '/dir_one/file_one'", VersionedFile.class);
    assertNotNull(loadedFile);
  }
View Full Code Here

    assertEquals("1.1", resultInvolvedRevision.getNumber());
  }
 
  @Test
  public void testDirectoryEqualsAndHashCode(){
    Directory d1 = new Directory("/foo/subDir", null);
    Directory d2 = new Directory("/foo/subDir", null);
    Directory d3 = new Directory("/foo/subDir2", null);
   
    assertEquals(false, d1.equals(null));
    assertEquals(false, d1.equals(new Revision("1.1")));
   
    assertEquals(true, d1.equals(d2));
View Full Code Here

        if (fromFile != null) {
            SVNVersionedFile newFile = (SVNVersionedFile) createFile(toPath);
            addFile(branch, release, changeSet, date, fromFile, newFile, message, author, toRevNum, fromRevNum);
        } else {
            // If it's not a file that is being added, it must be a directory, otherwise I throw an exception
            Directory dir = fDirectories.get(fromPath);
            if (dir != null) {
                /*
                 * If it's a Directory I need to get all the Files belonging to
                 * it and to all its sub directories. First though I check if
                 * I'm adding contents directly to the folder I'm copying from.
View Full Code Here

            String message,
            String author,
            long toRevNum,
            long fromRevNum,
            Directory toIgnore) throws SVNImporterException {
        Directory directory = fDirectories.get(currDirPath);
        if (directory != null) {
            for (File unit : directory.getChildren()) {
                if (unit instanceof SVNVersionedFile) {
                    SVNVersionedFile newFile = (SVNVersionedFile) createFile(unit.getPath().replace(fromPath, toPath));
                    addFile(
                            branch,
                            release,
View Full Code Here

TOP

Related Classes of org.evolizer.model.resources.entities.fs.Directory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.