Project

General

Profile

« Previous | Next » 

Revision 6596

make MNodeServiceTest pass JUnit testing

View differences:

test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java
396 396
      InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
397 397
      SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
398 398
      Identifier newPid = new Identifier();
399
      newPid.setValue("testUpdate." + System.currentTimeMillis());
399
      newPid.setValue("testUpdate." + (System.currentTimeMillis() + 1)); // ensure it is different from original
400 400
      Identifier pid = 
401 401
        MNodeService.getInstance(request).create(session, guid, object, sysmeta);
402 402
      
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
190 190
    			"The obsoletedBy field cannot have a value when creating entries.");
191 191
	}
192 192
    
193
    // check for permission
193
    // TODO: this probably needs to be refined more
194 194
    try {
195 195
      allowed = isAuthorized(session, pid, Permission.WRITE);
196 196
            
197 197
    } catch (NotFound e) {
198 198
      // The identifier doesn't exist, writing should be fine.
199 199
      allowed = true;
200
      
201 200
    }
202 201
    
203 202
    // verify checksum, only if we can reset the inputstream
......
599 598
        HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
600 599
        
601 600
    }
601
    
602
    // throw not found if it was not found
603
    if (systemMetadata == null) {
604
    	throw new NotFound("1800", "No system metadata could be founnd for given PID: " + pid);
605
    }
602 606
	    
603 607
    // do we own it?
604 608
    for (Subject s: subjects) {
src/edu/ucsb/nceas/metacat/dataone/hazelcast/HazelcastService.java
345 345
			// warrants a replication event, what type (DATA, METADATA, RESOURCE),
346 346
			// iteratively lock the PID, create and submit the tasks, and expect a
347 347
			// result back. Deal with exceptions.
348
			boolean isMetadata = D1NodeService.isScienceMetadata(event.getValue());
349
			// TODO: do we need to do anything explicit here?
348
			SystemMetadata sysmeta = event.getValue();
349
			if (sysmeta != null) {
350
				boolean isMetadata = D1NodeService.isScienceMetadata(event.getValue());
351
				// TODO: do we need to do anything explicit here?
352
			}
350 353
	  
351 354
	}
352 355
	

Also available in: Unified diff