Skip to content
Snippets Groups Projects
Commit 0789327a authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- fixed tests

parent ad13627b
No related branches found
No related tags found
No related merge requests found
package org.slub.rosetta.dps.repository.plugin.storage.nfs; package org.slub.rosetta.dps.repository.plugin.storage.nfs;
import com.exlibris.core.sdk.storage.containers.StoredEntityMetaData;
import com.exlibris.digitool.common.dnx.DnxDocument;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
...@@ -18,28 +16,21 @@ import static org.junit.Assert.assertTrue; ...@@ -18,28 +16,21 @@ import static org.junit.Assert.assertTrue;
*/ */
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class TestSLUBStoragePlugin { public class TestSLUBStoragePlugin {
@Test
public void helloWorld() {
System.out.println("Hallo Welt!");
assertTrue("helloworld test", true );
}
@Test @Test
public void getStreamDirectory() { public void getStreamDirectory() {
SLUBStoragePlugin mock = new SLUBStoragePlugin(); SLUBStoragePlugin mock = new SLUBStoragePlugin();
HashMap <String, String> map = new HashMap<String,String> (); HashMap<String, String> map = new HashMap<String,String> ();
map.put("DIR_ROOT", "./"); map.put("DIR_ROOT", "./");
map.put("DIR_PREFIX", "./"); map.put("DIR_PREFIX", "./");
map.put("FILES_HANDLING_METHOD", "move"); map.put("FILES_HANDLING_METHOD", "move");
mock.setParameters( map ); mock.setParameters( map );
// TODO: // TODO:
File calced_path = mock.getStreamDirectory("foo", "bar"); File calced_path = mock.getStreamDirectory("foo", "bar");
System.out.println("getStreamDirectory:"+ calced_path.getName()+ "\n"); //System.out.println("getStreamDirectory:"+ calced_path.getName()+ "\n");
assertTrue("getStreamDirectory test", true ); assertTrue("getStreamDirectory test", calced_path.getName().equals("bar"));
} }
/*
@Test @Test
public void getStreamRelativePath() throws Exception { public void getStreamRelativePath() throws Exception {
SLUBStoragePlugin mock = new SLUBStoragePlugin(); SLUBStoragePlugin mock = new SLUBStoragePlugin();
...@@ -48,14 +39,23 @@ public class TestSLUBStoragePlugin { ...@@ -48,14 +39,23 @@ public class TestSLUBStoragePlugin {
map.put("DIR_PREFIX", "./"); map.put("DIR_PREFIX", "./");
map.put("FILES_HANDLING_METHOD", "move"); map.put("FILES_HANDLING_METHOD", "move");
mock.setParameters( map ); mock.setParameters( map );
// TODO: // TODO:
StoredEntityMetaData storedEntityMetaData = new StoredEntityMetaData(); StoredEntityMetaData storedEntityMetaData = new StoredEntityMetaData();
storedEntityMetaData.setEntityType(StoredEntityMetaData.EntityType.IE); File file = new File("resources/iemets.xml");
storedEntityMetaData.setCurrentFilePath("foo"); InputStream ioStream = new FileInputStream(file);
storedEntityMetaData.setEntityPid("IE00000"); InputStreamReader isr = new InputStreamReader(ioStream);
DnxDocument iedoc = DnxDocument(); char[] charArray = new char[(int)file.length()];
iedoc.setDocumentXml(" <mets:mets xmlns:mets='http://www.loc.gov/METS/'> <mets:dmdSec ID='ie-dmd'> <mets:mdWrap MDTYPE='DC'> <mets:xmlData> <dc:record xmlns:dc='http://purl.org/dc/elements/1.1/'> <dc:identifier>slub:goobi:vorgang:10008</dc:identifier> <dc:coverage>DE-14</dc:coverage> <dc:coverage>Hist.Sax.M.37.t,120</dc:coverage> <dc:relation>Saxonica</dc:relation> <dc:identifier>oai:de:slub-dresden:db:id-319037843</dc:identifier> <dc:format>[1] Bl.</dc:format> <dc:identifier>319037843</dc:identifier> <dc:identifier>http://digital.slub-dresden.de/id319037843</dc:identifier> <dc:identifier>urn:nbn:de:bsz:14-db-id3190378431</dc:identifier> <dc:identifier>266278965</dc:identifier> <dc:title>Eingabe der Handelskammer zu Leipzig den Entwurf eines Tabak-Steuer-Gesetzes betr.</dc:title> <dc:language>de</dc:language> <dc:date>1893</dc:date> <dc:subject>eingdehaz</dc:subject> </dc:record> </mets:xmlData> </mets:mdWrap> </mets:dmdSec>"); isr.read(charArray);
String iemets = new String(charArray);
System.out.println(iemets);
DnxDocument iedoc = DnxDocumentFactory.getInstance().parse(iemets);
storedEntityMetaData.setIeDnx(iedoc); storedEntityMetaData.setIeDnx(iedoc);
mock.getStreamRelativePath( storedEntityMetaData); storedEntityMetaData.setEntityType(StoredEntityMetaData.EntityType.FILE); //search in File-AMD
storedEntityMetaData.setCurrentFilePath("foo");
storedEntityMetaData.setEntityPid("FL225130");
storedEntityMetaData.setIePid("IE225095");
mock.getStreamRelativePath( storedEntityMetaData);
} }
*/
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment