001/**
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 *
006 */
007package org.fcrepo.migration.foxml;
008
009import org.apache.commons.io.FileUtils;
010import org.junit.Assert;
011import org.junit.After;
012import org.junit.Before;
013import org.junit.Test;
014
015import java.io.File;
016import java.io.IOException;
017import java.io.UnsupportedEncodingException;
018
019/**
020 * @author mikedurbin
021 */
022public class LegacyFSIDResolverTest {
023
024    private LegacyFSIDResolver idResolver;
025
026    private File tempDir;
027
028    @Before
029    public void setup() throws IOException {
030        tempDir = File.createTempFile("tempfile", "basedir");
031        tempDir.delete();
032        tempDir.mkdir();
033        idResolver = new LegacyFSIDResolver(tempDir);
034    }
035
036    @Test
037    public void testIDMapping() throws UnsupportedEncodingException {
038        Assert.assertEquals("example:1+DS2+DS2.0", idResolver.getInternalIdForFile(new File("example_1+DS2+DS2.0")));
039    }
040
041    @After
042    public void cleanup() throws IOException {
043        FileUtils.deleteDirectory(tempDir);
044    }
045}