160b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair/*
260b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * Copyright 2008 the original author or authors.
360b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair *
460b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * Licensed under the Apache License, Version 2.0 (the "License");
560b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * you may not use this file except in compliance with the License.
660b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * You may obtain a copy of the License at
760b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair *
860b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair *      http://www.apache.org/licenses/LICENSE-2.0
960b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair *
1060b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * Unless required by applicable law or agreed to in writing, software
1160b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * distributed under the License is distributed on an "AS IS" BASIS,
1260b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1360b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * See the License for the specific language governing permissions and
1460b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * limitations under the License.
1560b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair */
1660b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismairpackage org.mockftpserver.fake.filesystem
1760b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
1860b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair/**
1960b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * Tests for DirectoryEntry
2060b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair *
2160b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * @version $Revision$ - $Date$
2260b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair *
2360b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair * @author Chris Mair
2460b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair */
2560b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismairpublic class DirectoryEntryTest extends AbstractFileSystemEntryTest {
2660b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
2760b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    private DirectoryEntry entry
2860b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
2960b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    void testCloneWithNewPath() {
3060b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        entry.lastModified = LAST_MODIFIED
3160b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        entry.owner = USER
3260b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        entry.group = GROUP
3360b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        entry.permissions = PERMISSIONS
3460b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        def clone = entry.cloneWithNewPath(NEW_PATH)
3560b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
3660b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert !clone.is(entry)
3760b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert clone.path == NEW_PATH
3860b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert clone.lastModified == LAST_MODIFIED
3960b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert clone.owner == USER
4060b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert clone.group == GROUP
4160b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert clone.permissions == PERMISSIONS
4260b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert clone.size == 0
4360b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        assert clone.directory
4460b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    }
4560b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
4660b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    /**
4760b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair     * @see org.mockftpserver.fake.filesystem.AbstractFileSystemEntryTest#getImplementationClass()
4860b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair     */
4960b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    protected Class getImplementationClass() {
5060b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        return DirectoryEntry.class
5160b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    }
5260b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
5360b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    /**
5460b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair     * @see org.mockftpserver.fake.filesystem.AbstractFileSystemEntryTest#isDirectory()
5560b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair     */
5660b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    protected boolean isDirectory() {
5760b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        return true
5860b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    }
5960b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
6060b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    void setUp() {
6160b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        super.setUp()
6260b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair        entry = new DirectoryEntry(PATH)
6360b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair    }
6460b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair
6560b81e2faf8511148f0d1e8f296e0b40ce9c7971chrismair}
66