Project

General

Profile

« Previous | Next » 

Revision 9251

Added by Jing Tao over 9 years ago

Add a junit test to test the querySystemMetadata method.

View differences:

test/edu/ucsb/nceas/metacattest/IdentifierManagerTest.java
33 33
import junit.framework.TestSuite;
34 34

  
35 35
import org.dataone.client.v2.itk.D1Client;
36
import org.dataone.configuration.Settings;
36 37
import org.dataone.service.types.v1.Identifier;
38
import org.dataone.service.types.v1.NodeReference;
37 39
import org.dataone.service.types.v1.NodeType;
40
import org.dataone.service.types.v1.ObjectFormatIdentifier;
41
import org.dataone.service.types.v1.ObjectList;
38 42
import org.dataone.service.types.v1.Session;
39 43
import org.dataone.service.types.v1.Subject;
40 44
import org.dataone.service.types.v2.MediaType;
......
83 87
        suite.addTest(new IdentifierManagerTest("testGenerateLocalId"));
84 88
        suite.addTest(new IdentifierManagerTest("testGetHeadPID"));
85 89
        suite.addTest(new IdentifierManagerTest("testMediaType"));
90
        suite.addTest(new IdentifierManagerTest("testQuerySystemMetadata"));
86 91
        return suite;
87 92
    }
88 93
    /**
......
1481 1486
        System.out.println("*********************** " + s + " ****************************");
1482 1487
    }
1483 1488
    
1489
    public void testQuerySystemMetadata() throws Exception {
1490
        Date startTime = null;
1491
        Date endTime = null;
1492
        ObjectFormatIdentifier objectFormatId = null;
1493
        NodeReference nodeId = null;
1494
        int start = 0;
1495
        int count =1000;
1496
        Identifier identifier = null;
1497
        boolean isSID = false;
1498
        ObjectList list = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime,
1499
                objectFormatId, nodeId, start, count, identifier, isSID);
1500
        int size1= list.sizeObjectInfoList();
1501
        assertTrue( size1>0);
1502
        nodeId = new NodeReference();
1503
        String currentNodeId = Settings.getConfiguration().getString("dataone.nodeId");
1504
        nodeId.setValue(currentNodeId);
1505
        list = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime,
1506
                objectFormatId, nodeId, start, count, identifier, isSID);
1507
        int size2= list.sizeObjectInfoList();
1508
        assertTrue( size2 > 0);
1509
        assertTrue( size1 >= size2);
1510
        nodeId.setValue("there_bei_we12");
1511
        list = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime,
1512
                objectFormatId, nodeId, start, count, identifier, isSID);
1513
        int size3 = list.sizeObjectInfoList();
1514
        assertTrue(size3==0);
1515
    }
1516
    
1484 1517
    /**
1485 1518
     * We want to act as the CN itself
1486 1519
     * @throws ServiceFailure 

Also available in: Unified diff