Skip to content

Commit

Permalink
Updated tests according to fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Nov 15, 2023
1 parent ab71ae3 commit ed83394
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void setup() throws Exception {
.withName("TESTINGBUNDLE")
.build();
token = getAuthToken(admin.getEmail(), password);
bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context).build();
bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context).withMimeType("application/pdf").build();
String input = "Hello, World!";
MockMultipartFile file = new MockMultipartFile("file", "hello.txt",
MediaType.TEXT_PLAIN_VALUE,
Expand Down Expand Up @@ -147,7 +147,7 @@ public void importBitstreamForExistingFileWithBundleTest() throws Exception {
.contentType(contentType)
.param("internal_id", internalId)
.param("storeNumber", Integer.toString(storeNumber))
.param("bitstreamFormat", Integer.toString(bitstreamFormat.getID()))
.param("bitstreamFormat", bitstreamFormat.getMIMEType())
.param("deleted", Boolean.toString(deleted))
.param("sequenceId", Integer.toString(sequence))
.param("primaryBundle_id", "")
Expand All @@ -156,7 +156,7 @@ public void importBitstreamForExistingFileWithBundleTest() throws Exception {
.andReturn().getResponse().getContentAsString(),
"$.id"));

checkCreatedBitstream(uuid, internalId, storeNumber, bitstreamFormat.getID(), sequence, deleted, sizeBytes,
checkCreatedBitstream(uuid, internalId, storeNumber, bitstreamFormat.getMIMEType(), sequence, deleted, sizeBytes,
checkSum);

//clean all
Expand All @@ -182,7 +182,7 @@ public void importBitstreamForExistingFileWithoutBundleTest() throws Exception {
.contentType(contentType)
.param("internal_id", internalId)
.param("storeNumber", Integer.toString(storeNumber))
.param("bitstreamFormat", Integer.toString(bitstreamFormat.getID()))
.param("bitstreamFormat", bitstreamFormat.getMIMEType())
.param("deleted", Boolean.toString(deleted))
.param("sequenceId", Integer.toString(sequence))
.param("primaryBundle_id", "")
Expand All @@ -191,7 +191,7 @@ public void importBitstreamForExistingFileWithoutBundleTest() throws Exception {
.andReturn().getResponse().getContentAsString(),
"$.id"));

checkCreatedBitstream(uuid, internalId, storeNumber, bitstreamFormat.getID(), sequence, deleted, sizeBytes,
checkCreatedBitstream(uuid, internalId, storeNumber, bitstreamFormat.getMIMEType(), sequence, deleted, sizeBytes,
checkSum);

//clean all
Expand All @@ -217,7 +217,7 @@ public void importBitstreamForExistingFileAsPrimaryBitstreamOfBundleTest() throw
.contentType(contentType)
.param("internal_id", internalId)
.param("storeNumber", Integer.toString(storeNumber))
.param("bitstreamFormat", Integer.toString(bitstreamFormat.getID()))
.param("bitstreamFormat", bitstreamFormat.getMIMEType())
.param("deleted", Boolean.toString(deleted))
.param("sequenceId", Integer.toString(sequence))
.param("primaryBundle_id", bundle.getID().toString())
Expand All @@ -226,7 +226,7 @@ public void importBitstreamForExistingFileAsPrimaryBitstreamOfBundleTest() throw
.andReturn().getResponse().getContentAsString(),
"$.id"));

checkCreatedBitstream(uuid, internalId, storeNumber, bitstreamFormat.getID(), sequence, deleted, sizeBytes,
checkCreatedBitstream(uuid, internalId, storeNumber, bitstreamFormat.getMIMEType(), sequence, deleted, sizeBytes,
checkSum);
bundle = bundleService.find(context, bundle.getID());
assertEquals(bundle.getPrimaryBitstream().getID(), bitstream.getID());
Expand Down Expand Up @@ -257,7 +257,7 @@ public void importBitstreamForExistingFileValidationErrorTest() throws Exception
.contentType(contentType)
.param("internal_id", internalId)
.param("storeNumber", Integer.toString(storeNumber))
.param("bitstreamFormat", Integer.toString(bitstreamFormat.getID()))
.param("bitstreamFormat", bitstreamFormat.getMIMEType())
.param("deleted", Boolean.toString(deleted))
.param("sequenceId", Integer.toString(sequence))
.param("primaryBundle_id", "")
Expand All @@ -271,12 +271,12 @@ public void importBitstreamForExistingFileValidationErrorTest() throws Exception
}

private void checkCreatedBitstream(UUID uuid, String internalId, int storeNumber,
Integer bitstreamFormat, int sequence, boolean deleted, long sizeBytes,
String bitstreamFormat, int sequence, boolean deleted, long sizeBytes,
String checkSum) throws SQLException {
bitstream = bitstreamService.find(context, uuid);
assertEquals(bitstream.getChecksum(), checkSum);
assertEquals(bitstream.getSizeBytes(), sizeBytes);
assertEquals(bitstream.getFormat(context).getID(), bitstreamFormat);
assertEquals(bitstream.getFormat(context).getMIMEType(), bitstreamFormat);
assertEquals(bitstream.getInternalId(), internalId);
assertEquals(bitstream.getStoreNumber(), storeNumber);
assertEquals(bitstream.getSequenceID(), sequence);
Expand Down

0 comments on commit ed83394

Please sign in to comment.