Project

General

Profile

« Previous | Next » 

Revision 9355

Added by Jing Tao about 9 years ago

Adjust code according the change on cn.updateSystemMetadata.

View differences:

test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java
1255 1255
          Session session = getCNSession();
1256 1256
          Identifier guid = new Identifier();
1257 1257
          guid.setValue(generateDocumentId());
1258
          System.out.println("?????????????update the id without archive is "+guid.getValue());
1258 1259
          InputStream object1 = new ByteArrayInputStream(str1.getBytes("UTF-8"));
1259 1260
          SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object1);
1260 1261
          String sid1= "sid."+System.nanoTime();
......
1277 1278
          BigInteger version = sysmeta.getSerialVersion();
1278 1279
          version = version.add(BigInteger.ONE);
1279 1280
          sysmeta1.setSerialVersion(version);
1280
          sysmeta1.setArchived(true);
1281
          AccessPolicy accessPolicy = new AccessPolicy();
1282
          AccessRule accessRule = new AccessRule();
1283
          accessRule.addPermission(Permission.WRITE);
1284
          Subject publicSubject = new Subject();
1285
          publicSubject.setValue("hello");
1286
          accessRule.addSubject(publicSubject);
1287
          accessPolicy.addAllow(accessRule);
1288
          AccessRule allow = new AccessRule();
1289
          allow.addPermission(Permission.READ);
1290
          Subject publicSubject2 = new Subject();
1291
          publicSubject2.setValue(Constants.SUBJECT_PUBLIC);
1292
          allow.addSubject(publicSubject2);
1293
          accessPolicy.addAllow(allow);
1294
          sysmeta1.setAccessPolicy(accessPolicy);
1281 1295
          try {
1282 1296
              CNodeService.getInstance(request).updateSystemMetadata(testSession, guid, sysmeta1);
1283 1297
              fail("It shouldn't get there since the test session can't update system metadata");
......
1294 1308
          SystemMetadata metadata2 = CNodeService.getInstance(request).getSystemMetadata(session, seriesId);
1295 1309
          assertTrue(metadata2.getIdentifier().equals(guid));
1296 1310
          assertTrue(metadata2.getSeriesId().equals(seriesId));
1297
          assertTrue(metadata2.getArchived().equals(true));
1311
          //assertTrue(metadata2.getArchived().equals(true));
1312
          assertTrue(metadata2.getAccessPolicy().getAllowList().size() == 2);
1298 1313
          assertTrue(metadata2.getChecksum().getValue().equals(metadata.getChecksum().getValue()));
1299 1314
          assertTrue(metadata2.getDateSysMetadataModified().getTime() == date.getTime());
1300 1315
          
......
1352 1367
          // test cn.updateSystemMetadata will ignore the serial version and replica list
1353 1368
          Identifier id = new Identifier();
1354 1369
          id.setValue(generateDocumentId());
1370
          System.out.println("?????????????update the id with archive is "+id.getValue());
1355 1371
          object1 = new ByteArrayInputStream(str1.getBytes("UTF-8"));
1356 1372
          SystemMetadata sysmeta10 = createSystemMetadata(id, session.getSubject(), object1);
1357 1373
          List<Replica> replicas = new ArrayList<Replica>();

Also available in: Unified diff