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;
008
009import java.io.IOException;
010
011import javax.xml.stream.XMLStreamException;
012
013import org.junit.Before;
014import org.springframework.context.ConfigurableApplicationContext;
015import org.springframework.context.support.ClassPathXmlApplicationContext;
016
017/**
018 * A series of tests that cover all the features used in processing
019 * FOXML found in a fedora objectStore directory.
020 * @author mdurbin
021 */
022public class FoxmlStorageMigratorTest extends Example1TestSuite {
023
024    private static DummyHandler result;
025
026    private static DummyURLFetcher fetcher;
027
028    @Before
029    public synchronized void processFoxml() throws XMLStreamException, IOException {
030        if (getResult() == null) {
031            final ConfigurableApplicationContext context =
032                    new ClassPathXmlApplicationContext("spring/stored-foxml.xml");
033            this.result = (DummyHandler) context.getBean("dummyHandler");
034            this.fetcher = (DummyURLFetcher) context.getBean("dummyFetcher");
035            final Migrator m = (Migrator) context.getBean("migrator");
036            m.run();
037            context.close();
038        }
039    }
040
041    @Override
042    protected DummyHandler getResult() {
043        return result;
044    }
045
046    @Override
047    protected DummyURLFetcher getFetcher() {
048        return fetcher;
049    }
050}