Commits

dloy  committed d5db437

Add test for multi-extract

  • Participants
  • Parent commits 3afb086

Comments (0)

Files changed (1)

File core/src/test/java/org/cdlib/mrt/core/DCTest.java

         try {
             boolean dumpMets = false;
             LinkedHashList<String, String> retList = null;
-            retList = testMets(dumpMets, "mets-dc.xml");
+            retList = testMets(dumpMets, "mets-dc.xml", 10);
             assertTrue(retList.size() > 5);
-            retList = testMets(dumpMets, "mets-mods.xml");
+            retList = testMets(dumpMets, "mets-mods.xml", 10);
             assertTrue(retList.size() > 5);
-            retList = testMets(dumpMets, "mets-mods2.xml");
+            retList = testMets(dumpMets, "mets-mods2.xml", 10);
             assertTrue(retList.size() > 5);
-            retList = testMets(dumpMets, "mets-dc-no-qualifieddc.xml");
+            retList = testMets(dumpMets, "mets-dc-no-qualifieddc.xml", 10);
+            assertTrue(retList.size() > 5);
+            assertTrue(true);
+
+
+        } catch (Exception ex) {
+            System.out.println("Exception:" + ex);
+            ex.printStackTrace();
+            assertFalse("TestIT exception:" + ex, true);
+        }
+    }
+
+    @Test
+    public void TestMultiSecs()
+        throws TException
+    {
+        try {
+            boolean dumpMets = false;
+            LinkedHashList<String, String> retList = null;
+            System.out.println("************TEST CNT=1");
+            retList = testMets(dumpMets, "1864_mets_mods.xml", 1);
+            Vector<String> list = retList.get("contributor");
+            assertTrue(list.size()== 1);
+            System.out.println("************TEST CNT=20");
+            retList = testMets(dumpMets, "1864_mets_mods.xml", 20);
+            list = retList.get("contributor");
+            assertTrue(list.size()== 20);
             assertTrue(retList.size() > 5);
             assertTrue(true);
 
 
     public LinkedHashList<String, String> testMets(
             boolean dumpMets,
-            String resourceName
+            String resourceName,
+            int max
             )
         throws TException
     {
             if (dumpMets) System.out.println("METS:" + metsS);
             metsStream = getResource(resourceName);
             Document mets = getDocument(metsStream, logger);
-            LinkedHashList<String, String> list = DC.getDC (mets, logger);
+            LinkedHashList<String, String> list = DC.getDC (mets, max, logger);
 
             dumpList("*****" + resourceName + "*****", list);
             assertTrue(true);