mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 04:23:13 +00:00
[DS-3895] Rename Bitstream.getSize() to getSizeBytes().
This commit is contained in:
@@ -547,7 +547,7 @@ public class ItemExportServiceImpl implements ItemExportService {
|
||||
List<Bitstream> bitstreams = bundle.getBitstreams();
|
||||
for (Bitstream bitstream : bitstreams) {
|
||||
// add up the size
|
||||
size += bitstream.getSize();
|
||||
size += bitstream.getSizeBytes();
|
||||
}
|
||||
}
|
||||
items.add(item.getID());
|
||||
@@ -574,7 +574,7 @@ public class ItemExportServiceImpl implements ItemExportService {
|
||||
List<Bitstream> bitstreams = bundle.getBitstreams();
|
||||
for (Bitstream bitstream : bitstreams) {
|
||||
// add up the size
|
||||
size += bitstream.getSize();
|
||||
size += bitstream.getSizeBytes();
|
||||
}
|
||||
}
|
||||
items.add(item.getID());
|
||||
@@ -593,7 +593,7 @@ public class ItemExportServiceImpl implements ItemExportService {
|
||||
List<Bitstream> bitstreams = bundle.getBitstreams();
|
||||
for (Bitstream bitstream : bitstreams) {
|
||||
// add up the size
|
||||
size += bitstream.getSize();
|
||||
size += bitstream.getSizeBytes();
|
||||
}
|
||||
}
|
||||
ArrayList<UUID> items = new ArrayList<>();
|
||||
|
@@ -220,7 +220,7 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
||||
} catch (Exception e) {
|
||||
String handle = myItem.getHandle();
|
||||
List<Bundle> bundles = myBitstream.getBundles();
|
||||
long size = myBitstream.getSize();
|
||||
long size = myBitstream.getSizeBytes();
|
||||
String checksum = myBitstream.getChecksum() + " (" + myBitstream.getChecksumAlgorithm() + ")";
|
||||
int assetstore = myBitstream.getStoreNumber();
|
||||
|
||||
|
@@ -86,7 +86,7 @@ public class GoogleBitstreamComparator implements Comparator<Bitstream> {
|
||||
if (priority1 > priority2) {
|
||||
return 1;
|
||||
} else if (priority1 == priority2) {
|
||||
if (b1.getSize() <= b2.getSize()) {
|
||||
if (b1.getSizeBytes() <= b2.getSizeBytes()) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
|
@@ -366,7 +366,7 @@ public class SyndicationFeed {
|
||||
if (ArrayUtils.contains(podcastableMIMETypes, mime)) {
|
||||
SyndEnclosure enc = new SyndEnclosureImpl();
|
||||
enc.setType(bit.getFormat(context).getMIMEType());
|
||||
enc.setLength(bit.getSize());
|
||||
enc.setLength(bit.getSizeBytes());
|
||||
enc.setUrl(urlOfBitstream(request, bit));
|
||||
enclosures.add(enc);
|
||||
} else {
|
||||
|
@@ -92,7 +92,7 @@ public class ResultsLogger implements ChecksumResultsCollector {
|
||||
LOG.info(msg("internal-id") + ": " + bitstream.getInternalId());
|
||||
LOG.info(msg("name") + ": " + bitstream.getName());
|
||||
LOG.info(msg("store-number") + ": " + bitstream.getStoreNumber());
|
||||
LOG.info(msg("size") + ": " + bitstream.getSize());
|
||||
LOG.info(msg("size") + ": " + bitstream.getSizeBytes());
|
||||
LOG.info(msg("bitstream-format") + ": " + (bitstream.getFormat(context) != null ? bitstream.getFormat(context)
|
||||
.getID() : "-1"));
|
||||
LOG.info(msg("user-format-description") + ": "
|
||||
|
@@ -306,7 +306,7 @@ public class SimpleReporterServiceImpl implements SimpleReporterService {
|
||||
info.getInternalId()).append("\n");
|
||||
buf.append(msg("name")).append(" = ").append(info.getName())
|
||||
.append("\n");
|
||||
buf.append(msg("size")).append(" = ").append(info.getSize())
|
||||
buf.append(msg("size")).append(" = ").append(info.getSizeBytes())
|
||||
.append("\n");
|
||||
buf.append(msg("source")).append(" = ").append(info.getSource())
|
||||
.append("\n");
|
||||
|
@@ -212,7 +212,7 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
*
|
||||
* @return the size in bytes
|
||||
*/
|
||||
public long getSize() {
|
||||
public long getSizeBytes() {
|
||||
return sizeBytes;
|
||||
}
|
||||
|
||||
|
@@ -233,7 +233,7 @@ public class InstallItemServiceImpl implements InstallItemService {
|
||||
// Add sizes and checksums of bitstreams
|
||||
for (Bitstream bitstream : bitstreams) {
|
||||
myMessage.append(bitstream.getName()).append(": ")
|
||||
.append(bitstream.getSize()).append(" bytes, checksum: ")
|
||||
.append(bitstream.getSizeBytes()).append(" bytes, checksum: ")
|
||||
.append(bitstream.getChecksum()).append(" (")
|
||||
.append(bitstream.getChecksumAlgorithm()).append(")\n");
|
||||
}
|
||||
|
@@ -236,7 +236,7 @@ public class OREDisseminationCrosswalk
|
||||
bs.getName()) + "?sequence=" + bs.getSequenceID());
|
||||
arLink.setAttribute("title", bs.getName());
|
||||
arLink.setAttribute("type", bs.getFormat(context).getMIMEType());
|
||||
arLink.setAttribute("length", Long.toString(bs.getSize()));
|
||||
arLink.setAttribute("length", Long.toString(bs.getSizeBytes()));
|
||||
|
||||
aggregation.addContent(arLink);
|
||||
|
||||
|
@@ -108,9 +108,9 @@ public class PREMISCrosswalk
|
||||
if (ssize != null) {
|
||||
try {
|
||||
int size = Integer.parseInt(ssize);
|
||||
if (bitstream.getSize() != size) {
|
||||
if (bitstream.getSizeBytes() != size) {
|
||||
throw new MetadataValidationException(
|
||||
"Bitstream size (" + String.valueOf(bitstream.getSize()) +
|
||||
"Bitstream size (" + String.valueOf(bitstream.getSizeBytes()) +
|
||||
") does not match size in PREMIS (" + ssize + "), rejecting it.");
|
||||
}
|
||||
} catch (NumberFormatException ne) {
|
||||
@@ -274,7 +274,7 @@ public class PREMISCrosswalk
|
||||
|
||||
// size
|
||||
Element size = new Element("size", PREMIS_NS);
|
||||
size.setText(String.valueOf(bitstream.getSize()));
|
||||
size.setText(String.valueOf(bitstream.getSizeBytes()));
|
||||
ochar.addContent(size);
|
||||
|
||||
// Punt and set formatName to the MIME type; the best we can
|
||||
|
@@ -53,7 +53,6 @@ import edu.harvard.hul.ois.mets.helper.MetsException;
|
||||
import edu.harvard.hul.ois.mets.helper.MetsValidator;
|
||||
import edu.harvard.hul.ois.mets.helper.MetsWriter;
|
||||
import edu.harvard.hul.ois.mets.helper.PreformedXML;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.util.Util;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
@@ -86,6 +85,8 @@ import org.jdom.Element;
|
||||
import org.jdom.Namespace;
|
||||
import org.jdom.output.Format;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Base class for disseminator of
|
||||
@@ -124,7 +125,7 @@ public abstract class AbstractMETSDisseminator
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(AbstractMETSDisseminator.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(AbstractMETSDisseminator.class);
|
||||
|
||||
// JDOM xml output writer - indented format for readability.
|
||||
protected static XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
|
||||
@@ -442,7 +443,7 @@ public abstract class AbstractMETSDisseminator
|
||||
log.debug(new StringBuilder().append("Writing CONTENT stream of bitstream(")
|
||||
.append(bitstream.getID()).append(") to Zip: ")
|
||||
.append(zname).append(", size=")
|
||||
.append(bitstream.getSize()).toString());
|
||||
.append(bitstream.getSizeBytes()).toString());
|
||||
}
|
||||
if (lmTime != 0) {
|
||||
ze.setTime(lmTime);
|
||||
@@ -451,7 +452,7 @@ public abstract class AbstractMETSDisseminator
|
||||
// contents are unchanged
|
||||
ze.setTime(DEFAULT_MODIFIED_DATE);
|
||||
}
|
||||
ze.setSize(auth ? bitstream.getSize() : 0);
|
||||
ze.setSize(auth ? bitstream.getSizeBytes() : 0);
|
||||
zip.putNextEntry(ze);
|
||||
if (auth) {
|
||||
InputStream input = bitstreamService.retrieve(context, bitstream);
|
||||
@@ -483,10 +484,12 @@ public abstract class AbstractMETSDisseminator
|
||||
String zname = makeBitstreamURL(context, logoBs, params);
|
||||
ZipEntry ze = new ZipEntry(zname);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Writing CONTENT stream of bitstream(" + String
|
||||
.valueOf(logoBs.getID()) + ") to Zip: " + zname + ", size=" + String.valueOf(logoBs.getSize()));
|
||||
log.debug("Writing CONTENT stream of bitstream({}) to Zip: {}, size={}",
|
||||
String.valueOf(logoBs.getID()),
|
||||
zname,
|
||||
String.valueOf(logoBs.getSizeBytes()));
|
||||
}
|
||||
ze.setSize(logoBs.getSize());
|
||||
ze.setSize(logoBs.getSizeBytes());
|
||||
//Set a default modified date so that checksum of Zip doesn't change if Zip contents are unchanged
|
||||
ze.setTime(DEFAULT_MODIFIED_DATE);
|
||||
zip.putNextEntry(ze);
|
||||
@@ -921,7 +924,7 @@ public abstract class AbstractMETSDisseminator
|
||||
}
|
||||
file.setGROUPID(groupID);
|
||||
file.setMIMETYPE(bitstream.getFormat(context).getMIMEType());
|
||||
file.setSIZE(auth ? bitstream.getSize() : 0);
|
||||
file.setSIZE(auth ? bitstream.getSizeBytes() : 0);
|
||||
|
||||
// Translate checksum and type to METS
|
||||
String csType = bitstream.getChecksumAlgorithm();
|
||||
@@ -1077,7 +1080,7 @@ public abstract class AbstractMETSDisseminator
|
||||
String fileID = gensym("logo");
|
||||
file.setID(fileID);
|
||||
file.setMIMETYPE(logoBs.getFormat(context).getMIMEType());
|
||||
file.setSIZE(logoBs.getSize());
|
||||
file.setSIZE(logoBs.getSizeBytes());
|
||||
|
||||
// Translate checksum and type to METS
|
||||
String csType = logoBs.getChecksumAlgorithm();
|
||||
|
@@ -116,7 +116,7 @@ public class BitstreamsIntoMetadata extends AbstractCurationTask {
|
||||
protected void addMetadata(Item item, Bitstream bitstream, String type) throws SQLException {
|
||||
String value = bitstream.getFormat(Curator.curationContext()).getMIMEType() + "##";
|
||||
value += bitstream.getName() + "##";
|
||||
value += bitstream.getSize() + "##";
|
||||
value += bitstream.getSizeBytes() + "##";
|
||||
value += item.getHandle() + "##";
|
||||
value += bitstream.getSequenceID() + "##";
|
||||
value += bitstream.getChecksum() + "##";
|
||||
|
@@ -168,7 +168,7 @@ public class FullTextContentStreams extends ContentStreamBase {
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return bitstream.getSize();
|
||||
return bitstream.getSizeBytes();
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws SQLException, IOException, AuthorizeException {
|
||||
|
@@ -381,7 +381,7 @@ public class BitstreamStorageServiceImpl implements BitstreamStorageService, Ini
|
||||
log.info("Copying bitstream:" + bitstream
|
||||
.getID() + " from assetstore[" + assetstoreSource + "] to assetstore[" + assetstoreDestination + "] " +
|
||||
"Name:" + bitstream
|
||||
.getName() + ", SizeBytes:" + bitstream.getSize());
|
||||
.getName() + ", SizeBytes:" + bitstream.getSizeBytes());
|
||||
|
||||
InputStream inputStream = retrieve(context, bitstream);
|
||||
stores.get(assetstoreDestination).put(bitstream, inputStream);
|
||||
|
@@ -94,9 +94,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("application/pdf");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("application/pdf");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("application/pdf");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -136,9 +136,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("application/postscript");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -157,9 +157,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("application/pdf");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("application/pdf");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("application/pdf");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -181,9 +181,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("unknown");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(400));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(400));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -203,9 +203,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("unknown");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("unknown");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("unknown");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -242,9 +242,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
*/
|
||||
@Test
|
||||
public void testNoMimeType() throws Exception {
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -295,9 +295,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("application/postscript");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -318,9 +318,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("application/postscript");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -342,9 +342,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("application/postscript");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
@@ -362,9 +362,9 @@ public class GoogleBitstreamComparatorTest extends AbstractUnitTest {
|
||||
when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext");
|
||||
when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword");
|
||||
when(bitstreamFormat3.getMIMEType()).thenReturn("audio/x-wav");
|
||||
when(bitstream1.getSize()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream2.getSize()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSize()).thenReturn(Long.valueOf(100));
|
||||
when(bitstream1.getSizeBytes()).thenReturn(Long.valueOf(300));
|
||||
when(bitstream2.getSizeBytes()).thenReturn(Long.valueOf(200));
|
||||
when(bitstream3.getSizeBytes()).thenReturn(Long.valueOf(100));
|
||||
|
||||
List<Bitstream> toSort = bundle.getBitstreams();
|
||||
Collections.sort(toSort, new GoogleBitstreamComparator(context, settings));
|
||||
|
@@ -292,12 +292,12 @@ public class BitstreamTest extends AbstractDSpaceObjectTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getSize method, of class Bitstream.
|
||||
* Test of getSizeBytes method, of class Bitstream.
|
||||
*/
|
||||
@Test
|
||||
public void testGetSize() {
|
||||
long size = 238413; // yuck, hardcoded!
|
||||
assertThat("testGetSize 0", bs.getSize(), equalTo(size));
|
||||
assertThat("testGetSize 0", bs.getSizeBytes(), equalTo(size));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -225,11 +225,11 @@ public class InstallItemTest extends AbstractUnitTest {
|
||||
// Create provenance description
|
||||
String testMessage = "No. of bitstreams: 2\n";
|
||||
testMessage += "one: "
|
||||
+ one.getSize() + " bytes, checksum: "
|
||||
+ one.getSizeBytes() + " bytes, checksum: "
|
||||
+ one.getChecksum() + " ("
|
||||
+ one.getChecksumAlgorithm() + ")\n";
|
||||
testMessage += "two: "
|
||||
+ two.getSize() + " bytes, checksum: "
|
||||
+ two.getSizeBytes() + " bytes, checksum: "
|
||||
+ two.getChecksum() + " ("
|
||||
+ two.getChecksumAlgorithm() + ")\n";
|
||||
|
||||
|
@@ -72,9 +72,9 @@ public class FullTextContentStreamsTest {
|
||||
when(textBitstream2.getName()).thenReturn("Full Text 2");
|
||||
when(textBitstream3.getName()).thenReturn("Full Text 3");
|
||||
|
||||
when(textBitstream1.getSize()).thenReturn(1L);
|
||||
when(textBitstream2.getSize()).thenReturn(2L);
|
||||
when(textBitstream3.getSize()).thenReturn(3L);
|
||||
when(textBitstream1.getSizeBytes()).thenReturn(1L);
|
||||
when(textBitstream2.getSizeBytes()).thenReturn(2L);
|
||||
when(textBitstream3.getSizeBytes()).thenReturn(3L);
|
||||
|
||||
when(bitstreamService.retrieve(null, textBitstream1))
|
||||
.thenReturn(new ByteArrayInputStream("This is text 1".getBytes(Charsets.UTF_8)));
|
||||
|
@@ -230,7 +230,7 @@ public class ItemUtils {
|
||||
createValue("format", bit.getFormat(context)
|
||||
.getMIMEType()));
|
||||
bitstream.getField().add(
|
||||
createValue("size", "" + bit.getSize()));
|
||||
createValue("size", "" + bit.getSizeBytes()));
|
||||
bitstream.getField().add(createValue("url", url));
|
||||
bitstream.getField().add(
|
||||
createValue("checksum", cks));
|
||||
|
@@ -77,7 +77,7 @@ public class Bitstream extends DSpaceObject {
|
||||
|
||||
description = bitstream.getDescription();
|
||||
format = bitstreamService.getFormatDescription(context, bitstream);
|
||||
sizeBytes = bitstream.getSize();
|
||||
sizeBytes = bitstream.getSizeBytes();
|
||||
String path = new DSpace().getRequestService().getCurrentRequest().getHttpServletRequest().getContextPath();
|
||||
retrieveLink = path + "/bitstreams/" + bitstream.getID() + "/retrieve";
|
||||
mimeType = bitstreamService.getFormat(context, bitstream).getMIMEType();
|
||||
|
@@ -137,7 +137,7 @@ public class ItemFilterUtil {
|
||||
for (Bitstream bit : bundle.getBitstreams()) {
|
||||
for (String mime : mimeList) {
|
||||
if (bit.getFormat(context).getMIMEType().equals(mime.trim())) {
|
||||
if (bit.getSize() < size) {
|
||||
if (bit.getSizeBytes() < size) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ public class ItemFilterUtil {
|
||||
for (Bitstream bit : bundle.getBitstreams()) {
|
||||
for (String mime : mimeList) {
|
||||
if (bit.getFormat(context).getMIMEType().equals(mime.trim())) {
|
||||
if (bit.getSize() > size) {
|
||||
if (bit.getSizeBytes() > size) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@@ -139,7 +139,7 @@ public class BitstreamContentRestController {
|
||||
if (citationDocumentService.isCitationEnabledForBitstream(bit, context)) {
|
||||
return generateBitstreamWithCitation(context, bit);
|
||||
} else {
|
||||
return Pair.of(bitstreamService.retrieve(context, bit),bit.getSize());
|
||||
return Pair.of(bitstreamService.retrieve(context, bit),bit.getSizeBytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,7 @@ public class BitstreamConverter
|
||||
e.printStackTrace();
|
||||
}
|
||||
b.setFormat(format);
|
||||
b.setSizeBytes(obj.getSize());
|
||||
b.setSizeBytes(obj.getSizeBytes());
|
||||
return b;
|
||||
}
|
||||
|
||||
|
@@ -138,7 +138,7 @@ public class SubmissionService {
|
||||
checksum.setCheckSumAlgorithm(source.getChecksumAlgorithm());
|
||||
checksum.setValue(source.getChecksum());
|
||||
data.setCheckSum(checksum);
|
||||
data.setSizeBytes(source.getSize());
|
||||
data.setSizeBytes(source.getSizeBytes());
|
||||
data.setUrl(configurationService.getProperty("dspace.url") + "/api/" + BitstreamRest.CATEGORY + "/" + English
|
||||
.plural(BitstreamRest.NAME) + "/" + source.getID() + "/content");
|
||||
return data;
|
||||
|
@@ -34,7 +34,7 @@ public class BitstreamMatcher {
|
||||
BitstreamMetadataMatcher.matchTitle(bitstream.getName()),
|
||||
BitstreamMetadataMatcher.matchDescription(bitstream.getDescription())
|
||||
)),
|
||||
hasJsonPath("$.sizeBytes", is((int) bitstream.getSize())),
|
||||
hasJsonPath("$.sizeBytes", is((int) bitstream.getSizeBytes())),
|
||||
hasJsonPath("$.checkSum", matchChecksum()),
|
||||
hasJsonPath("$._embedded.format", matchFormat()),
|
||||
//Check links
|
||||
|
@@ -53,7 +53,8 @@ public class CollectionMatcher {
|
||||
hasJsonPath("$._embedded.logo", Matchers.not(Matchers.empty()))
|
||||
) :
|
||||
allOf(
|
||||
hasJsonPath("$._embedded.logo", BitstreamMatcher.matchBitstreamEntry(logo.getID(), logo.getSize()))
|
||||
hasJsonPath("$._embedded.logo",
|
||||
BitstreamMatcher.matchBitstreamEntry(logo.getID(), logo.getSizeBytes()))
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user