Project

General

Profile

« Previous | Next » 

Revision 9358

Added by Jing Tao about 9 years ago

Adjust the test code base on the new contrains on setRightHolder, archive. The new contrains is they only apply to the objects whose authoriative node is v1.

View differences:

test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java
338 338
			assertTrue(rightsHolder.equals(sysmeta.getRightsHolder()));
339 339
			
340 340
        } catch(Exception e) {
341
            fail("Unexpected error: " + e.getMessage());
341
            if(e instanceof ServiceFailure) {
342
                assertTrue(e.getMessage().contains("Couldn't determine the version"));
343
            } else {
344
                fail("Unexpected error: " + e.getMessage());
345
            }
342 346
        }
343 347
	}
344 348
	
......
1158 1162
          
1159 1163
          //test archive a series id by v1
1160 1164
          try {
1161
              edu.ucsb.nceas.metacat.dataone.v1.CNodeService.getInstance(request).archive(session, seriesId2);
1165
              edu.ucsb.nceas.metacat.dataone.v1.MNodeService.getInstance(request).archive(session, seriesId2);
1162 1166
              fail("we can't reach here since the v1 archive method doesn't support the sid ");
1163 1167
          } catch (NotFound nf2) {
1164 1168
              
......
1174 1178
          }
1175 1179
          
1176 1180
          // test archive a series id by v2
1177
          CNodeService.getInstance(request).archive(session, seriesId2);
1181
          MNodeService.getInstance(request).archive(session, seriesId2);
1178 1182
          SystemMetadata archived = CNodeService.getInstance(request).getSystemMetadata(session, seriesId2);
1179 1183
          assertTrue(archived.getArchived());
1180 1184
          archived = CNodeService.getInstance(request).getSystemMetadata(session, newPid2);
......
1207 1211
          }
1208 1212
          
1209 1213
          //archive seriesId
1210
          CNodeService.getInstance(request).archive(mnSession, seriesId);
1214
          MNodeService.getInstance(request).archive(mnSession, seriesId);
1211 1215
          archived = CNodeService.getInstance(request).getSystemMetadata(session, seriesId);
1212 1216
          assertTrue(archived.getArchived());
1213 1217
          archived = CNodeService.getInstance(request).getSystemMetadata(session, newPid);
......
1448 1452
      InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
1449 1453
      SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
1450 1454
      Identifier pid = CNodeService.getInstance(request).create(session, guid, object, sysmeta);
1451
      CNodeService.getInstance(request).archive(session, guid);
1452
      SystemMetadata result = CNodeService.getInstance(request).getSystemMetadata(session, guid);
1453
      assertTrue(result.getArchived());
1455
      try {
1456
          CNodeService.getInstance(request).archive(session, guid);
1457
      } catch (Exception e) {
1458
         if(e instanceof ServiceFailure) {
1459
          assertTrue(e.getMessage().contains("Couldn't determine the version"));
1460
        } else {
1461
          fail("Unexpected error: " + e.getMessage());
1462
        }
1463
     }
1454 1464
  }
1455 1465
  
1456 1466
  public Session getMNSessionFromCN() throws NotImplemented, ServiceFailure {

Also available in: Unified diff