Project

General

Profile

« Previous | Next » 

Revision 9158

Added by Jing Tao over 9 years ago

Add a code to test the getLogRecord method handling SID.

View differences:

test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java
733 733
        assertNotNull(objectList);
734 734
        assertTrue(objectList.getCount() == count);
735 735
        assertTrue(objectList.getStart() == 0);
736
        assertTrue(objectList.getTotal() > 1);
736
        assertTrue(objectList.getTotal() >= 1);
737 737
        
738 738
      } catch (Exception e) {
739 739
        e.printStackTrace();
......
1435 1435
        String str1 = "object1";
1436 1436
        String str2 = "object2";
1437 1437
        String str3 = "object3";
1438
        Date fromDate = new Date();
1439
        Calendar calendar = Calendar.getInstance();
1440
        calendar.setTime(fromDate);
1441
        calendar.roll(Calendar.YEAR, false);
1442
        fromDate = calendar.getTime();
1438 1443
        try {
1439 1444
            //insert test documents with a series id
1440 1445
            Session session = getTestSession();
......
1551 1556
            } catch (NotFound e) {
1552 1557
                
1553 1558
            }
1559
            
1560
            Session cnsession = getCNSession();
1561
            Date toDate = new Date();
1562
            Event event = Event.READ;
1563
            int start = 0;
1564
            int count = 1;
1565
          Log log = MNodeService.getInstance(request).getLogRecords(cnsession, null, null, 
1566
            event.xmlValue(), seriesId.getValue(), start, count);
1567
          
1568
          assertNotNull(log);      
1569
          assertTrue(log.getCount() == count);
1570
          assertTrue(log.getStart() == start);
1571
          assertTrue(log.getTotal() >= 1);
1572
          assertTrue(log.getLogEntry(0).getIdentifier().equals(guid));
1554 1573

  
1555 1574
            //do a update with the same series id
1556 1575
            Thread.sleep(1000);
......
1790 1809
                   
1791 1810
               }
1792 1811
            
1812
            toDate = new Date();
1813
            event = Event.READ;
1814
            start = 0;
1815
            count = 1;
1816
            log = MNodeService.getInstance(request).getLogRecords(cnsession, null, null, 
1817
            event.xmlValue(), seriesId.getValue(), start, count);
1818
          
1819
            assertNotNull(log);      
1820
            assertTrue(log.getCount() == count);
1821
            assertTrue(log.getStart() == start);
1822
            assertTrue(log.getTotal() >= 1);
1823
            assertTrue(log.getLogEntry(0).getIdentifier().equals(newPid));
1793 1824
            
1794 1825
            //do another update with invalid series ids
1795 1826
            Thread.sleep(1000);

Also available in: Unified diff