Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
56a77f9
Initial migration from TestNG to JUnit 5
Knud-Aage Dec 11, 2025
d41038e
Initial
Knud-Aage Dec 15, 2025
f50949f
Merge remote-tracking branch 'origin/master' into BITMAG-1244-replace…
Knud-Aage Dec 16, 2025
7ec116c
Changes due to PR
Knud-Aage Dec 16, 2025
305d6fa
Working but with errors in a few tests.
Knud-Aage Dec 17, 2025
c58d749
Merge remote-tracking branch 'origin/BITMAG-1244-replace-testng-with-…
Knud-Aage Dec 17, 2025
155ad25
Put a @Disabled at testManyTimes() and commented it out, so people ca…
Knud-Aage Dec 17, 2025
8d421a4
The branch has now the same test methods that are wrong, but mvn clea…
Knud-Aage Dec 18, 2025
6d94dcf
Able to test in junit
Knud-Aage Dec 18, 2025
330c1ef
Merge branch 'BITMAG-1244-junit-bitrepository-core' into BITMAG-1244-…
Knud-Aage Dec 18, 2025
56f5133
Many tests migrated to junit but a log missing
Knud-Aage Dec 19, 2025
5888407
All tests succeeds after having been migrated from TestNG to JUnit 5
Knud-Aage Dec 26, 2025
f96a705
Removed the TestNG dependency
Knud-Aage Jan 1, 2026
7553d82
The suite classes looks for tags instead of classes
Knud-Aage Jan 5, 2026
c565330
Modified setupPillarIntegrationTest method so it reflects junit 5 ins…
Knud-Aage Jan 5, 2026
bbeace6
Now closer to without testng
Knud-Aage Jan 6, 2026
dc838ff
Minor adjustments
Knud-Aage Jan 13, 2026
c99b44c
Changes due to PR review
Knud-Aage Jan 21, 2026
af01ae1
Changes due to PR review
Knud-Aage Jan 21, 2026
c5a6865
Changes due to PR review
Knud-Aage Jan 21, 2026
66b0dfb
Changes due to PR review
Knud-Aage Jan 21, 2026
3ed247d
Changes due to PR review
Knud-Aage Jan 21, 2026
ffb86f3
Changes due to PR review
Knud-Aage Jan 21, 2026
321294c
Changes due to PR review
Knud-Aage Jan 25, 2026
139bd5f
Changes due to PR review
Knud-Aage Jan 25, 2026
f9b322f
Changes due to PR review
Knud-Aage Jan 26, 2026
a695e1e
In the middle of refactoring
Knud-Aage Jan 27, 2026
6c0f819
In the middle of refactoring
Knud-Aage Jan 29, 2026
bea4ac8
In the middle of refactoring
Knud-Aage Jan 29, 2026
77c8b58
In the middle of refactoring
Knud-Aage Jan 29, 2026
47c6b5c
In the middle of refactoring
Knud-Aage Feb 3, 2026
92b7eb5
In the middle of refactoring
Knud-Aage Feb 4, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,48 @@
* Copyright (C) 2010 - 2012 The State and University Library, The Royal Library and The State Archives, Denmark
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
package org.bitrepository.alarm;

import org.jaccept.structure.ExtendedTestCase;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

public class AlarmExceptionTest extends ExtendedTestCase {

@Test(groups = {"regressiontest"})

@Test
@Tag("regressiontest")
public void alarmExceptionTest() throws Exception {
addDescription("Tests that AlarmExceptions can be thrown.");
String alarmError = "The message of the alarm exception";
try {
throw new AlarmException(alarmError);
} catch (AlarmException e) {
Assert.assertEquals(e.getMessage(), alarmError);
Assert.assertNull(e.getCause());
Assertions.assertEquals(alarmError, e.getMessage());
Assertions.assertNull(e.getCause());
}

String otherError = "This is the message of the included exception";
try {
throw new AlarmException(alarmError, new Exception(otherError));
} catch (AlarmException e) {
Assert.assertEquals(e.getMessage(), alarmError);
Assert.assertNotNull(e.getCause());
Assert.assertEquals(e.getCause().getMessage(), otherError);
Assertions.assertEquals(alarmError, e.getMessage());
Assertions.assertNotNull(e.getCause());
Assertions.assertEquals(otherError, e.getCause().getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,39 @@
import org.bitrepository.bitrepositorymessages.AlarmMessage;
import org.bitrepository.bitrepositorymessages.Message;
import org.bitrepository.protocol.IntegrationTest;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.testng.AssertJUnit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class AlarmHandlerTest extends IntegrationTest {
@Test(groups = {"regressiontest"})
@Test
@Tag("regressiontest")
public void alarmMediatorTest() throws Exception {
addDescription("Test the mediator handling of alarm messages.");
addStep("Setup mediator and create alarm handler.", "Should be ok.");
AlarmMediator mediator = new AlarmMediator(messageBus, alarmDestinationID);
MockAlarmHandler alarmHandler = new MockAlarmHandler();
mediator.addHandler(alarmHandler);
Assert.assertEquals(alarmHandler.getCallsForClose(), 0);
Assert.assertEquals(alarmHandler.getCallsForHandleAlarm(), 0);
assertEquals(0, alarmHandler.getCallsForClose());
assertEquals(0, alarmHandler.getCallsForHandleAlarm());

addStep("Try giving it a non-alarm message", "Should not call the alarm handler.");
Message msg = new Message();
mediator.onMessage(msg, null);
assertEquals(alarmHandler.getCallsForClose(), 0);
Assert.assertEquals(alarmHandler.getCallsForHandleAlarm(), 0);
assertEquals(0, alarmHandler.getCallsForClose());
assertEquals(0, alarmHandler.getCallsForHandleAlarm());

addStep("Giv the mediator an AlarmMessage", "Should be sent to the alarm handler");
AlarmMessage alarmMsg = new AlarmMessage();
mediator.onMessage(alarmMsg, null);
Assert.assertEquals(alarmHandler.getCallsForClose(), 0);
Assert.assertEquals(alarmHandler.getCallsForHandleAlarm(), 1);
assertEquals(0, alarmHandler.getCallsForClose());
assertEquals(1, alarmHandler.getCallsForHandleAlarm());

addStep("Close the mediator.", "Should also close the alarm handler.");
mediator.close();
Assert.assertEquals(alarmHandler.getCallsForClose(), 1);
Assert.assertEquals(alarmHandler.getCallsForHandleAlarm(), 1);
assertEquals(1, alarmHandler.getCallsForClose());
assertEquals(1, alarmHandler.getCallsForHandleAlarm());
}

protected class MockAlarmHandler implements AlarmHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* Copyright (C) 2010 - 2012 The State and University Library, The Royal Library and The State Archives, Denmark
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
Expand All @@ -23,8 +23,9 @@

import org.bitrepository.bitrepositoryelements.AlarmCode;
import org.jaccept.structure.ExtendedTestCase;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Date;

Expand All @@ -33,62 +34,63 @@
*/

public class AlarmDatabaseExtractionModelTest extends ExtendedTestCase {
@Test(groups = {"regressiontest"})
@Test
@Tag("regressiontest")
public void alarmExceptionTest() throws Exception {
addDescription("Test the AlarmDatabaseExtractionModel class");
addStep("Define constants etc.", "Should be OK");
boolean ascending = true;

addStep("Create an empty model", "Should be populated with nulls.");
AlarmDatabaseExtractionModel model = new AlarmDatabaseExtractionModel(null, null, null, null, null, null, null, ascending);
Assert.assertNull(model.getAlarmCode());
Assert.assertNull(model.getComponentId());
Assert.assertNull(model.getEndDate());
Assert.assertNull(model.getFileID());
Assert.assertNull(model.getStartDate());
Assert.assertNull(model.getCollectionID());
Assert.assertEquals(model.getAscending(), ascending);
Assert.assertEquals(model.getMaxCount().intValue(), Integer.MAX_VALUE);

Assertions.assertNull(model.getAlarmCode());
Assertions.assertNull(model.getComponentId());
Assertions.assertNull(model.getEndDate());
Assertions.assertNull(model.getFileID());
Assertions.assertNull(model.getStartDate());
Assertions.assertNull(model.getCollectionID());
Assertions.assertEquals(ascending, model.getAscending());
Assertions.assertEquals(Integer.MAX_VALUE, model.getMaxCount().intValue());

addStep("Test the AlarmCode", "Should be able to put a new one in and extract it again.");
AlarmCode defaultAlarmCode = AlarmCode.COMPONENT_FAILURE;
model.setAlarmCode(defaultAlarmCode);
Assert.assertEquals(model.getAlarmCode(), defaultAlarmCode);
Assertions.assertEquals(defaultAlarmCode, model.getAlarmCode());

addStep("Test the ascending", "Should be able to put a new one in and extract it again.");
boolean defaultAscending = false;
model.setAscending(defaultAscending);
Assert.assertEquals(model.getAscending(), defaultAscending);
Assertions.assertEquals(defaultAscending, model.getAscending());

addStep("Test the ComponentID", "Should be able to put a new one in and extract it again.");
String defaultComponentID = "DefaultComponentID";
model.setComponentId(defaultComponentID);
Assert.assertEquals(model.getComponentId(), defaultComponentID);
Assertions.assertEquals(defaultComponentID, model.getComponentId());

addStep("Test the EndDate", "Should be able to put a new one in and extract it again.");
Date defaultEndDate = new Date(987654321);
model.setEndDate(defaultEndDate);
Assert.assertEquals(model.getEndDate(), defaultEndDate);
Assertions.assertEquals(model.getEndDate(), defaultEndDate);

addStep("Test the FileID", "Should be able to put a new one in and extract it again.");
String defaultFileID = "DefaultFileID";
model.setFileID(defaultFileID);
Assert.assertEquals(model.getFileID(), defaultFileID);
Assertions.assertEquals(defaultFileID, model.getFileID());

addStep("Test the MaxCount", "Should be able to put a new one in and extract it again.");
Integer defaultMaxCount = 192837456;
model.setMaxCount(defaultMaxCount);
Assert.assertEquals(model.getMaxCount(), defaultMaxCount);
Assertions.assertEquals(defaultMaxCount, model.getMaxCount());

addStep("Test the StartDate", "Should be able to put a new one in and extract it again.");
Date defaultStartDate = new Date(123456789);
model.setStartDate(defaultStartDate);
Assert.assertEquals(model.getStartDate(), defaultStartDate);
Assertions.assertEquals(model.getStartDate(), defaultStartDate);

addStep("Test the CollectionID", "Should be able to put a new one in and extract it again.");
String collectionID = "collection1";
model.setCollectionID(collectionID);
Assert.assertEquals(model.getCollectionID(), collectionID);
Assertions.assertEquals(collectionID, model.getCollectionID());
}
}
Loading