maito.datacollecting.oaipmh
Class ListRecordsTest

java.lang.Object
  extended by TestCase
      extended by maito.datacollecting.oaipmh.ListRecordsTest

public class ListRecordsTest
extends TestCase

The main target of this test driver is the class maito.datacollecting.oaipmh.ListRecords. Also maito.datacollecting.oaipmh.ListRecordsContentHandler can be seen as a target for this test. This test covers 100% of the code in that class. NOTE: This test driver uses some test stubs that act as the OAI-PMH repository. The stubs are found at http://db.cs.helsinki.fi/~saarekas/stub/.

Author:
Antti Laitinen

Constructor Summary
ListRecordsTest(java.lang.String name)
           
 
Method Summary
 void testAskNegativeAmount()
          Tests that ListRecords behaves correctly when asked for a negative amount of characters.
 void testAskZeroAmount()
          Tests that ListRecords behaves correctly when asked for zero characters.
 void testBadConstructorParameters()
          Tests that ListRecords behaves correctly when the parameters passed to it's constructor are incorrect.
 void testDateFrom()
          Tests that the dateFrom parameter is passed in the request unchanged.
 void testErrorHandling()
          Tests that ListRecords behaves correctly when one of the server's responses is an unparseable xml.
 void testFlowControl()
          Tests flow control.
 void testHugePartSize()
          Tests reading a huge part at the time from the response.
 void testInvalidXML()
          Tests that ListRecords behaves correctly when the response is an invalid xml.
 void testOAIPMHError()
          Tests that ListRecords behaves correctly when the OAIPMH response contains an error.
 void testRecordTagsOnly()
          Tests that the received response contains only record tags from the OAI-PMH response.
 void testSmallPartSize()
          Tests reading the smallest possible part at the time from the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListRecordsTest

public ListRecordsTest(java.lang.String name)
Method Detail

testBadConstructorParameters

public void testBadConstructorParameters()
Tests that ListRecords behaves correctly when the parameters passed to it's constructor are incorrect. ListRecords should only throw OAIPMHException.


testDateFrom

public void testDateFrom()
Tests that the dateFrom parameter is passed in the request unchanged.


testHugePartSize

public void testHugePartSize()
Tests reading a huge part at the time from the response.


testSmallPartSize

public void testSmallPartSize()
Tests reading the smallest possible part at the time from the response.


testAskNegativeAmount

public void testAskNegativeAmount()
Tests that ListRecords behaves correctly when asked for a negative amount of characters.


testAskZeroAmount

public void testAskZeroAmount()
Tests that ListRecords behaves correctly when asked for zero characters.


testOAIPMHError

public void testOAIPMHError()
Tests that ListRecords behaves correctly when the OAIPMH response contains an error. The test stub must return an OAI-PMH error at some point.


testInvalidXML

public void testInvalidXML()
Tests that ListRecords behaves correctly when the response is an invalid xml.


testRecordTagsOnly

public void testRecordTagsOnly()
Tests that the received response contains only record tags from the OAI-PMH response.


testFlowControl

public void testFlowControl()
Tests flow control. The stub that is used should result in 3 record elements if the flow control works in ListRecords.


testErrorHandling

public void testErrorHandling()
Tests that ListRecords behaves correctly when one of the server's responses is an unparseable xml. The xml should be omitted and harvesting should continue if a resumptionToken is still found from the data. The test stub that is used here should return 3 xml documents. The second should be invalid and the harvesting should result in 2 records.