Project

General

Profile

« Previous | Next » 

Revision 9289

Added by Jing Tao over 9 years ago

Change the format id to be "application/bagit" in the getPackage method.

View differences:

test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java
83 83
import org.dataone.service.types.v1.Checksum;
84 84
import org.dataone.service.types.v1.DescribeResponse;
85 85
import org.dataone.service.types.v1.Event;
86
import org.dataone.service.types.v1.ObjectFormatIdentifier;
86 87
import org.dataone.service.types.v1.Identifier;
87 88
import org.dataone.service.types.v2.Log;
88 89
import org.dataone.service.types.v2.Node;
......
1270 1271
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
1271 1272
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
1272 1273
			Identifier pid = MNodeService.getInstance(request).create(session, guid, object, sysmeta);
1273
			InputStream bagStream = MNodeService.getInstance(request).getPackage(session, null, pid);
1274
			ObjectFormatIdentifier format = new ObjectFormatIdentifier();
1275
			format.setValue("application/bagit");
1276
			InputStream bagStream = MNodeService.getInstance(request).getPackage(session, format, pid);
1274 1277
			File bagFile = File.createTempFile("bagit.", ".zip");
1275 1278
			IOUtils.copy(bagStream, new FileOutputStream(bagFile));
1276 1279
			BagFactory bagFactory = new BagFactory();
......
1347 1350
			Identifier pid = MNodeService.getInstance(request).create(session, resourceMapId, object, sysmeta);
1348 1351
			
1349 1352
			// get the package we uploaded
1350
			InputStream bagStream = MNodeService.getInstance(request).getPackage(session, null, pid);
1353
			ObjectFormatIdentifier format = new ObjectFormatIdentifier();
1354
            format.setValue("application/bagit");
1355
			InputStream bagStream = MNodeService.getInstance(request).getPackage(session, format, pid);
1351 1356
			File bagFile = File.createTempFile("bagit.", ".zip");
1352 1357
			IOUtils.copy(bagStream, new FileOutputStream(bagFile));
1353 1358
			BagFactory bagFactory = new BagFactory();

Also available in: Unified diff