Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1faa50b
[maven-release-plugin] prepare release droid-6.9.5
tna-da-bot Sep 15, 2025
8691b07
[maven-release-plugin] prepare for next development iteration
tna-da-bot Sep 15, 2025
6b27d05
Merge pull request #1442 from digital-preservation/version-bump-17731…
MancunianSam Sep 16, 2025
8d00727
Dependency updates
dependabot[bot] Sep 15, 2025
28bc169
Merge branch 'develop' into dependabot/maven/org.apache.maven.plugins…
MancunianSam Sep 16, 2025
bfa287b
Merge pull request #1446 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 16, 2025
bee7562
Add debug mode
MancunianSam Sep 17, 2025
091cd29
Fix checkstyle issue
MancunianSam Sep 17, 2025
a1eee5b
Merge pull request #1448 from digital-preservation/add-debug-mode
MancunianSam Sep 19, 2025
f7b9308
Bump log4j2.version from 2.25.1 to 2.25.2
dependabot[bot] Sep 22, 2025
1a5ae39
Bump org.apache.maven.plugins:maven-compiler-plugin
dependabot[bot] Sep 22, 2025
00186f1
Bump aws.version from 2.33.9 to 2.34.0
dependabot[bot] Sep 22, 2025
11662b7
Bump org.mockito:mockito-core from 5.19.0 to 5.20.0
dependabot[bot] Sep 22, 2025
bfa1a1c
Bump org.owasp:dependency-check-maven from 12.1.3 to 12.1.5
dependabot[bot] Sep 22, 2025
cb1e2bb
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.11.3 to 3.12.0
dependabot[bot] Sep 22, 2025
b7bd941
Merge pull request #1453 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 23, 2025
ef93dfc
Merge pull request #1452 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 23, 2025
efccd33
Merge pull request #1451 from digital-preservation/dependabot/maven/a…
MancunianSam Sep 23, 2025
fb5ff55
Merge pull request #1450 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 23, 2025
214401f
Merge pull request #1449 from digital-preservation/dependabot/maven/l…
MancunianSam Sep 23, 2025
e11fff9
Bump aws.version from 2.33.9 to 2.34.1
dependabot[bot] Sep 23, 2025
a20be14
Disable dependency check
MancunianSam Sep 23, 2025
4bbd997
Bump log4j2.version from 2.25.1 to 2.25.2
dependabot[bot] Sep 23, 2025
4f0b55d
Bump org.glassfish.jaxb:jaxb-runtime from 4.0.5 to 4.0.6
dependabot[bot] Sep 23, 2025
f1b546e
Bump org.mockito:mockito-core from 5.19.0 to 5.20.0
dependabot[bot] Sep 23, 2025
43a9e4a
Bump org.apache.maven.plugins:maven-compiler-plugin
dependabot[bot] Sep 23, 2025
f3dac47
Bump org.owasp:dependency-check-maven from 12.1.3 to 12.1.5
dependabot[bot] Sep 23, 2025
567d67b
Merge pull request #1459 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 23, 2025
feffa22
Merge pull request #1458 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 23, 2025
29099e1
Merge pull request #1457 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 23, 2025
730a94e
Merge pull request #1456 from digital-preservation/dependabot/maven/l…
MancunianSam Sep 23, 2025
e507642
Merge pull request #1455 from digital-preservation/dependabot/maven/a…
MancunianSam Sep 23, 2025
0870480
Merge branch 'dependabot/maven/org.owasp-dependency-check-maven-12.1.…
MancunianSam Sep 23, 2025
7867981
Merge pull request #1454 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 23, 2025
20e1759
Remove dependency check plugin
MancunianSam Sep 23, 2025
3587080
Remove dependency check plugin
MancunianSam Sep 23, 2025
be4a88b
Merge pull request #1460 from digital-preservation/dependabot/maven/o…
MancunianSam Sep 24, 2025
fdb9bc4
Fix typo in help pages listener.
MancunianSam Sep 29, 2025
6727673
Bump sig file versions in CLI test
MancunianSam Sep 29, 2025
b72384b
Update CLI tests
MancunianSam Sep 29, 2025
d3a7e44
Merge pull request #1467 from digital-preservation/fix-typo-in-help-p…
MancunianSam Sep 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
- run: |
mvn clean package -DskipTests=true
docker build -t cli-tests -f cli-tests/Dockerfile .
docker run -v "$PWD:/code" cli-tests /code/cli-tests/test
docker run -v "$PWD:/code" cli-tests /code/cli-tests/test
14 changes: 8 additions & 6 deletions cli-tests/test/cli-test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,26 @@ setup() {

@test "check for signature updates" {
run $DROID_BIN -c
assert_output 'No signature updates are available'
assert_output -p 'Container signature update Version 20250925 is available'
assert_output -p 'Binary signature update Version 121 is available'
}

@test "download signature updates" {
run $DROID_BIN -d
assert_output 'No signature updates are available'
assert_output -p 'Signature update version 20,250,925 has been downloaded'
assert_output -p 'Signature update version 121 has been downloaded'
}

@test "list signature files" {
run $DROID_BIN -X
assert_output -p "Type: Binary Version: 120 File name: DROID_SignatureFile_V120.xml"
assert_output -p "Type: Container Version: 20240715 File name: container-signature-20240715.xml"
assert_output -p "Type: Binary Version: 121 File name: DROID_SignatureFile_V121.xml"
assert_output -p "Type: Container Version: 20250925 File name: container-signature-20250925.xml"
}

@test "display signature file" {
run $DROID_BIN -x
assert_output -p "Type: Container Version: 20240715 File name: container-signature-20240715.xml"
assert_output -p "Type: Binary Version: 120 File name: DROID_SignatureFile_V120.xml"
assert_output -p "Type: Container Version: 20250925 File name: container-signature-20250925.xml"
assert_output -p "Type: Binary Version: 121 File name: DROID_SignatureFile_V121.xml"
}

@test "set signature file" {
Expand Down
2 changes: 1 addition & 1 deletion droid-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>droid-parent</artifactId>
<groupId>uk.gov.nationalarchives</groupId>
<version>6.9.5-SNAPSHOT</version>
<version>6.9.6-SNAPSHOT</version>
<relativePath>../droid-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion droid-binary/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>droid-parent</artifactId>
<groupId>uk.gov.nationalarchives</groupId>
<version>6.9.5-SNAPSHOT</version>
<version>6.9.6-SNAPSHOT</version>
<relativePath>../droid-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion droid-build-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>droid-parent</artifactId>
<groupId>uk.gov.nationalarchives</groupId>
<version>6.9.5-SNAPSHOT</version>
<version>6.9.6-SNAPSHOT</version>
<relativePath>../droid-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion droid-command-line/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>droid-parent</artifactId>
<groupId>uk.gov.nationalarchives</groupId>
<version>6.9.5-SNAPSHOT</version>
<version>6.9.6-SNAPSHOT</version>
<relativePath>../droid-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion droid-container/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>droid-parent</artifactId>
<groupId>uk.gov.nationalarchives</groupId>
<version>6.9.5-SNAPSHOT</version>
<version>6.9.6-SNAPSHOT</version>
<relativePath>../droid-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion droid-core-interfaces/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>droid-parent</artifactId>
<groupId>uk.gov.nationalarchives</groupId>
<version>6.9.5-SNAPSHOT</version>
<version>6.9.6-SNAPSHOT</version>
<relativePath>../droid-parent</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,12 @@ public interface IdentificationRequest<T> extends Closeable {
* @return the identifier
*/
RequestIdentifier getIdentifier();

/**
* Is this a debug request.
* @return if it is a debug request.
*/
default boolean isDebug() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ public enum DroidGlobalProperty {
FILES_FROM_S3("profile.s3", PropertyType.BOOLEAN, true),

/** The last updated time of the binary signature file .*/
BINARY_SIGNATURE_LAST_UPDATED("profile.binarySignatureLastUpdated", PropertyType.LONG, true);
BINARY_SIGNATURE_LAST_UPDATED("profile.binarySignatureLastUpdated", PropertyType.LONG, true),

/** Output CSV which shows the number of bytes read per signature. */
DEBUG("profile.debug", PropertyType.BOOLEAN, true);

private static Map<String, DroidGlobalProperty> allValues = new HashMap<String, DroidGlobalProperty>();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (c) 2016, The National Archives <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the The National Archives nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package uk.gov.nationalarchives.droid.core.interfaces.resource;

import net.byteseek.io.reader.FileReader;
import net.byteseek.io.reader.cache.WindowCache;
import net.byteseek.io.reader.windows.Window;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

public class DebugFileReader extends FileReader {

private long bytesReadFromFile;

private long bytesReadFromCache;

public DebugFileReader(File file, WindowCache cache) throws FileNotFoundException {
super(file, cache);
}

@Override
protected Window createWindow(long windowStart) throws IOException {
bytesReadFromFile += windowSize;
return super.createWindow(windowStart);
}

@Override
public Window getWindow(final long position) throws IOException {
if (this.cache.getWindow(position) != null) {
bytesReadFromCache += windowSize;
}
return super.getWindow(position);
}

public long getBytesReadFromFile() {
return bytesReadFromFile;
}

public long getBytesReadFromCache() {
return bytesReadFromCache;
}

public void resetBytesRead() {
this.bytesReadFromFile = 0;
this.bytesReadFromCache = 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2016, The National Archives <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the The National Archives nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package uk.gov.nationalarchives.droid.core.interfaces.resource;

import net.byteseek.io.reader.cache.TopAndTailFixedLengthCache;
import net.byteseek.io.reader.cache.WindowCache;
import uk.gov.nationalarchives.droid.core.interfaces.RequestIdentifier;

import java.io.IOException;
import java.nio.file.Path;

public class DebugFileSystemIdentificationRequest extends FileSystemIdentificationRequest {

private static final int TOP_TAIL_BUFFER_CAPACITY = 8 * 1024 * 1024; // buffer 8Mb on the top and tail of files.

/**
* Constructs a new identification request.
*
* @param metaData the metaData about the binary.
* @param identifier the request's identifier
*/
public DebugFileSystemIdentificationRequest(RequestMetaData metaData, RequestIdentifier identifier) {
super(metaData, identifier);
}

@Override
public final void open(final Path theFile) throws IOException {
super.open(theFile);
final WindowCache cache = new TopAndTailFixedLengthCache(theFile.toFile().length(), TOP_TAIL_BUFFER_CAPACITY);
setFileReader(new DebugFileReader(theFile.toFile(), cache));
}

@Override
public boolean isDebug() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public class FileSystemIdentificationRequest implements IdentificationRequest<Pa
private String extension;
private final String fileName;
private final long size;
private WindowReader fileReader;
private final RequestIdentifier identifier;
private RequestMetaData requestMetaData;
private Path file;
private WindowReader fileReader;

/**
* Constructs a new identification request.
Expand All @@ -77,7 +77,7 @@ public FileSystemIdentificationRequest(final RequestMetaData metaData, final Req
* {@inheritDoc}
*/
@Override
public final void open(final Path theFile) throws IOException {
public void open(final Path theFile) throws IOException {
// Use a caching strategy that uses soft references, to allow the GC to reclaim
// cached file bytes in low memory conditions.
final WindowCache cache = new TopAndTailFixedLengthCache(theFile.toFile().length(), TOP_TAIL_BUFFER_CAPACITY);
Expand Down Expand Up @@ -124,7 +124,7 @@ public final long size() {
* {@inheritDoc}
*/
@Override
public final void close() throws IOException {
public void close() throws IOException {
file = null;
fileReader.close();
}
Expand Down Expand Up @@ -176,4 +176,8 @@ public WindowReader getWindowReader() {
public Path getFile() {
return file;
}

protected void setFileReader(WindowReader fileReader) {
this.fileReader = fileReader;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (c) 2016, The National Archives <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the The National Archives nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package uk.gov.nationalarchives.droid.core.interfaces.resource;

import net.byteseek.io.reader.cache.WindowCache;
import net.byteseek.io.reader.windows.Window;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.Objects;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class DebugFileReaderTest {

private DebugFileReader createDebugFileReader() throws IOException {
return createDebugFileReader(null);
}

private DebugFileReader createDebugFileReader(Window cacheResponse) throws IOException {
WindowCache windowCache = mock(WindowCache.class);
when(windowCache.getWindow(anyLong())).thenReturn(cacheResponse);
File file = new File(Objects.requireNonNull(DebugFileReaderTest.class.getResource("/testXmlFile.xml")).getPath());
return new DebugFileReader(file, windowCache);
}

@Test
public void testDebugFileReaderIncrementsReadBytesOnCreateWindow() throws IOException {
try (DebugFileReader debugFileReader = createDebugFileReader()) {
assertEquals(0, debugFileReader.getBytesReadFromFile());
debugFileReader.createWindow(0);
assertEquals(4096, debugFileReader.getBytesReadFromFile());
}
}

@Test
public void testDebugFileReaderDoesNotIncrementCacheBytesIfWindowNotInCache() throws IOException {
try (DebugFileReader debugFileReader = createDebugFileReader()) {
assertEquals(0, debugFileReader.getBytesReadFromCache());
debugFileReader.getWindow(0);
assertEquals(0, debugFileReader.getBytesReadFromCache());
}
}

@Test
public void testDebugFileReaderIncrementsCacheBytesIfWindowInCache() throws IOException {
try(DebugFileReader debugFileReader = createDebugFileReader(mock(Window.class))) {
assertEquals(0, debugFileReader.getBytesReadFromCache());
debugFileReader.getWindow(0);
assertEquals(4096, debugFileReader.getBytesReadFromCache());
}
}
}
Loading
Loading