Project

General

Profile

« Previous | Next » 

Revision 6319

include getLogRecords() test, though it is commented out at the moment

View differences:

test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java
30 30
import java.io.InputStream;
31 31
import java.io.InputStreamReader;
32 32
import java.io.Reader;
33
import java.text.SimpleDateFormat;
33 34
import java.util.Date;
34 35

  
35 36
import junit.framework.Test;
......
48 49
import org.dataone.service.types.AccessRule;
49 50
import org.dataone.service.types.Checksum;
50 51
import org.dataone.service.types.ChecksumAlgorithm;
52
import org.dataone.service.types.Event;
51 53
import org.dataone.service.types.Identifier;
54
import org.dataone.service.types.Log;
52 55
import org.dataone.service.types.NodeReference;
53 56
import org.dataone.service.types.ObjectFormat;
54 57
import org.dataone.service.types.ObjectFormatIdentifier;
......
109 112
		suite.addTest(new CNodeServiceTest("testCreate"));
110 113
		suite.addTest(new CNodeServiceTest("testGet"));
111 114
		suite.addTest(new CNodeServiceTest("testGetFormat"));
115
		//suite.addTest(new CNodeServiceTest("testGetLogRecords"));
112 116
		suite.addTest(new CNodeServiceTest("testGetSystemMetadata"));
113 117
		suite.addTest(new CNodeServiceTest("testListFormats"));
114 118
		suite.addTest(new CNodeServiceTest("testListNodes"));
......
175 179
        }
176 180
	}
177 181
	
182
	public void testGetLogRecords() {
183
	    printTestHeader("testGetLogRecords");
184
	    try {
185

  
186
		    Session session = getTestSession();
187
		    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
188
		    Date fromDate = sdf.parse("2010-01-01");
189
		    Date toDate = new Date();
190
		    Event event = Event.CREATE;
191
		    int start = 0;
192
		    int count = 1000;
193
	    
194
		    Log log = CNodeService.getInstance().getLogRecords(session, fromDate, toDate, 
195
		    	event, start, count);
196
		    assertNotNull(log);
197
		    assertTrue(log.getCount() == 1000);
198
		    assertTrue(log.getStart() == 0);
199
		    assertTrue(log.getTotal() > 1);
200
	    } catch (Exception e) {
201
		    e.printStackTrace();
202
		    fail("Unexpected error: " + e.getMessage());
203
	    } 
204
	}
205
	
178 206
	public void testCreate() {
179 207
	    printTestHeader("testCreate");
180 208

  

Also available in: Unified diff