From 56a77f90deee51bf5f19c33f5cf51b58c520ccba Mon Sep 17 00:00:00 2001
From: kaah JUnit 5 Annotations Used: Options in a JUnit 5 Suite: Example Usage: JUnit 5 Annotations Used: Options in a JUnit 5 Suite: Example Usage:
+ *
+ *
+ *
+ *
+ *
+ *
+ * {@code
+ * @Suite
+ * @SelectClasses({IntegrationTest.class}) // List your test classes here
+ * @SelectPackages("org.bitrepository.protocol") // List your test packages here
+ * @IncludeTags("integration") // List your include tags here
+ * @ExcludeTags("slow") // List your exclude tags here
+ * @ExtendWith(GlobalSuiteExtension.class)
+ * public class BitrepositoryTestSuite {
+ * // No need for methods here; this just groups and extends
+ * }
+ * }
+ *
+ */
+@Suite
+@SelectClasses({IntegrationTest.class}) // List your test classes here
+@ExtendWith(GlobalSuiteExtension.class)
+public class BitrepositoryTestSuite {
+ // No need for methods here; this just groups and extends
+}
+
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
new file mode 100644
index 000000000..8b8754b74
--- /dev/null
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
@@ -0,0 +1,208 @@
+package org.bitrepository.protocol;
+
+import org.bitrepository.common.settings.Settings;
+import org.bitrepository.common.settings.TestSettingsProvider;
+import org.bitrepository.common.utils.SettingsUtils;
+import org.bitrepository.common.utils.TestFileHelper;
+import org.bitrepository.protocol.bus.LocalActiveMQBroker;
+import org.bitrepository.protocol.bus.MessageReceiver;
+import org.bitrepository.protocol.fileexchange.HttpServerConfiguration;
+import org.bitrepository.protocol.http.EmbeddedHttpServer;
+import org.bitrepository.protocol.messagebus.MessageBus;
+import org.bitrepository.protocol.messagebus.MessageBusManager;
+import org.bitrepository.protocol.messagebus.SimpleMessageBus;
+import org.bitrepository.protocol.security.DummySecurityManager;
+import org.bitrepository.protocol.security.SecurityManager;
+import org.jaccept.TestEventManager;
+import org.junit.jupiter.api.extension.*;
+
+import javax.jms.JMSException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class GlobalSuiteExtension implements BeforeAllCallback, AfterAllCallback {
+
+ private static boolean initialized = false;
+ protected static TestEventManager testEventManager = TestEventManager.getInstance();
+ public static LocalActiveMQBroker broker;
+ public static EmbeddedHttpServer server;
+ public static HttpServerConfiguration httpServerConfiguration;
+ public static MessageBus messageBus;
+ private MessageReceiverManager receiverManager;
+ protected static String alarmDestinationID;
+ protected static MessageReceiver alarmReceiver;
+ protected static SecurityManager securityManager;
+ protected static Settings settingsForCUT;
+ protected static Settings settingsForTestClient;
+ protected static String collectionID;
+ protected String NON_DEFAULT_FILE_ID;
+ protected static String DEFAULT_FILE_ID;
+ protected static URL DEFAULT_FILE_URL;
+ protected static String DEFAULT_DOWNLOAD_FILE_ADDRESS;
+ protected static String DEFAULT_UPLOAD_FILE_ADDRESS;
+ protected String DEFAULT_AUDIT_INFORMATION;
+ protected String testMethodName;
+
+ @Override
+ public void beforeAll(ExtensionContext context) {
+ if (!initialized) {
+ initialized = true;
+ settingsForCUT = loadSettings(getComponentID());
+ settingsForTestClient = loadSettings("TestSuiteInitialiser");
+ makeUserSpecificSettings(settingsForCUT);
+ makeUserSpecificSettings(settingsForTestClient);
+ httpServerConfiguration = new HttpServerConfiguration(settingsForTestClient.getReferenceSettings().getFileExchangeSettings());
+ collectionID = settingsForTestClient.getCollections().get(0).getID();
+
+ securityManager = createSecurityManager();
+ DEFAULT_FILE_ID = "DefaultFile";
+ try {
+ DEFAULT_FILE_URL = httpServerConfiguration.getURL(TestFileHelper.DEFAULT_FILE_ID);
+ DEFAULT_DOWNLOAD_FILE_ADDRESS = DEFAULT_FILE_URL.toExternalForm();
+ DEFAULT_UPLOAD_FILE_ADDRESS = DEFAULT_FILE_URL.toExternalForm() + "-" + DEFAULT_FILE_ID;
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("Never happens");
+ }
+ }
+ }
+
+ @Override
+ public void afterAll(ExtensionContext context) {
+ if (initialized) {
+ teardownMessageBus();
+ teardownHttpServer();
+ }
+ }
+
+ /**
+ * May be extended by subclasses needing to have their receivers managed. Remember to still call
+ * super.registerReceivers() when overriding
+ */
+ protected void registerMessageReceivers() {
+ alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination(), testEventManager);
+ addReceiver(alarmReceiver);
+ }
+
+ protected void addReceiver(MessageReceiver receiver) {
+ receiverManager.addReceiver(receiver);
+ }
+ protected void initializeCUT() {}
+
+ /**
+ * Purges all messages from the receivers.
+ */
+ protected void clearReceivers() {
+ receiverManager.clearMessagesInReceivers();
+ }
+
+ /**
+ * May be overridden by specific tests wishing to do stuff. Remember to call super if this is overridden.
+ */
+ protected void shutdownCUT() {}
+
+ /**
+ * Initializes the settings. Will postfix the alarm and collection topics with '-${user.name}
+ */
+ protected void setupSettings() {
+ settingsForCUT = loadSettings(getComponentID());
+ makeUserSpecificSettings(settingsForCUT);
+ SettingsUtils.initialize(settingsForCUT);
+
+ alarmDestinationID = settingsForCUT.getRepositorySettings().getProtocolSettings().getAlarmDestination();
+
+ settingsForTestClient = loadSettings(testMethodName);
+ makeUserSpecificSettings(settingsForTestClient);
+ }
+
+
+ protected Settings loadSettings(String componentID) {
+ return TestSettingsProvider.reloadSettings(componentID);
+ }
+
+ private void makeUserSpecificSettings(Settings settings) {
+ settings.getRepositorySettings().getProtocolSettings()
+ .setCollectionDestination(settings.getCollectionDestination() + getTopicPostfix());
+ settings.getRepositorySettings().getProtocolSettings().setAlarmDestination(settings.getAlarmDestination() + getTopicPostfix());
+ }
+
+ /**
+ * Indicated whether an embedded active MQ should be started and used
+ */
+ public boolean useEmbeddedMessageBus() {
+ return System.getProperty("useEmbeddedMessageBus", "true").equals("true");
+ }
+
+ /**
+ * Indicated whether an embedded http server should be started and used
+ */
+ public boolean useEmbeddedHttpServer() {
+ return System.getProperty("useEmbeddedHttpServer", "false").equals("true");
+ }
+
+ /**
+ * Hooks up the message bus.
+ */
+ protected void setupMessageBus() {
+ if (useEmbeddedMessageBus()) {
+ if (messageBus == null) {
+ messageBus = new SimpleMessageBus();
+ }
+ }
+ }
+
+ /**
+ * Shutdown the message bus.
+ */
+ private void teardownMessageBus() {
+ MessageBusManager.clear();
+ if (messageBus != null) {
+ try {
+ messageBus.close();
+ messageBus = null;
+ } catch (JMSException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ if (broker != null) {
+ try {
+ broker.stop();
+ broker = null;
+ } catch (Exception e) {
+ // No reason to pollute the test output with this
+ }
+ }
+ }
+
+ /**
+ * Shutdown the embedded http server if any.
+ */
+ protected void teardownHttpServer() {
+ if (useEmbeddedHttpServer()) {
+ server.stop();
+ }
+ }
+
+ /**
+ * Returns the postfix string to use when accessing user specific topics, which is the mechanism we use in the
+ * bit repository tests.
+ *
+ * @return The string to postfix all topix names with.
+ */
+ protected String getTopicPostfix() {
+ return "-" + System.getProperty("user.name");
+ }
+
+ protected String getComponentID() {
+ return getClass().getSimpleName();
+ }
+
+ protected String createDate() {
+ return Long.toString(System.currentTimeMillis());
+ }
+
+ protected SecurityManager createSecurityManager() {
+ return new DummySecurityManager();
+ }
+
+}
\ No newline at end of file
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
index ece1da863..2d9c82ff4 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
@@ -81,6 +81,10 @@ public abstract class IntegrationTest extends ExtendedTestCase {
@BeforeSuite(alwaysRun = true)
public void initializeSuite(ITestContext testContext) {
+ //
+ }
+
+ private void initializationMethod() {
settingsForCUT = loadSettings(getComponentID());
settingsForTestClient = loadSettings("TestSuiteInitialiser");
makeUserSpecificSettings(settingsForCUT);
@@ -114,6 +118,7 @@ protected void addReceiver(MessageReceiver receiver) {
@BeforeClass(alwaysRun = true)
public void initMessagebus() {
+ initializationMethod();
setupMessageBus();
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
index d5b9bf884..6b284a415 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
@@ -8,12 +8,12 @@
* 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
* License along with this program. If not, see
* TimeMeasureComparator class.
*/
public class TimeMeasurementUtilsTest extends ExtendedTestCase {
- @Test (groups = { "regressiontest" })
+ @Test @Tag("regressiontest")
public void testCompareMilliSeconds() {
addDescription("Test the comparison between TimeMeasure units.");
TimeMeasureTYPE referenceTime = new TimeMeasureTYPE();
@@ -47,19 +49,19 @@ public void testCompareMilliSeconds() {
compareTime.setTimeMeasureValue(new BigInteger("3"));
compareTime.setTimeMeasureUnit(TimeMeasureUnit.MILLISECONDS);
- Assert.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
" should be smaller than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("1"));
- Assert.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- Assert.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) == 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) == 0, referenceTime +
" should be same as " + compareTime);
}
- @Test (groups = { "regressiontest" })
+ @Test @Tag("regressiontest")
public void testCompareMilliSecondsToHours() {
addDescription("Test the comparison between milliseconds and hours.");
long millis = 7200000L;
@@ -71,31 +73,31 @@ public void testCompareMilliSecondsToHours() {
compareTime.setTimeMeasureValue(new BigInteger("3"));
compareTime.setTimeMeasureUnit(TimeMeasureUnit.HOURS);
- Assert.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
" should be smaller than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("1"));
- Assert.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- Assert.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) == 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) == 0, referenceTime +
" should be same as " + compareTime);
- Assert.assertEquals(TimeMeasurementUtils.getTimeMeasureInLong(referenceTime), millis);
+ Assertions.assertEquals(TimeMeasurementUtils.getTimeMeasureInLong(referenceTime), millis);
}
- @Test (groups = { "regressiontest" })
+ @Test @Tag("regressiontest" )
public void testMaxValue() {
addDescription("Test the Maximum value");
TimeMeasureTYPE time = TimeMeasurementUtils.getMaximumTime();
- Assert.assertEquals(time.getTimeMeasureValue().longValue(), Long.MAX_VALUE);
- Assert.assertEquals(time.getTimeMeasureUnit(), TimeMeasureUnit.HOURS);
+ Assertions.assertEquals(time.getTimeMeasureValue().longValue(), Long.MAX_VALUE);
+ Assertions.assertEquals(time.getTimeMeasureUnit(), TimeMeasureUnit.HOURS);
TimeMeasureTYPE time2 = TimeMeasurementUtils.getTimeMeasurementFromMilliseconds(
BigInteger.valueOf(Long.MAX_VALUE));
time2.setTimeMeasureUnit(TimeMeasureUnit.HOURS);
- Assert.assertEquals(TimeMeasurementUtils.compare(time, time2), 0);
+ Assertions.assertEquals(TimeMeasurementUtils.compare(time, time2), 0);
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
index 13ecbf7b5..086a09685 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
@@ -22,8 +22,10 @@
package org.bitrepository.common.utils;
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.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -39,13 +41,13 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TimeUtilsTest extends ExtendedTestCase {
private static final ZonedDateTime BASE = Instant.EPOCH.atZone(ZoneOffset.UTC);
- @Test(groups = {"regressiontest"})
+ @Test @Tag("regressiontest")
public void timeTester() throws Exception {
addDescription("Tests the TimeUtils. Pi days = 271433605 milliseconds");
addStep("Test that milliseconds can be converted into human readable seconds",
@@ -81,7 +83,8 @@ public void timeTester() throws Exception {
assertTrue(human.contains(expectedDays), human);
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void printsHumanDuration() {
assertEquals(TimeUtils.durationToHumanUsingEstimates(ChronoUnit.YEARS.getDuration()), "1y");
assertEquals(TimeUtils.durationToHumanUsingEstimates(ChronoUnit.MONTHS.getDuration()), "1m");
@@ -97,7 +100,8 @@ public void printsHumanDuration() {
assertEquals(TimeUtils.durationToHumanUsingEstimates(Duration.ofHours(4_382_910)), "500y");
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void zeroIntervalTest() throws Exception {
addDescription("Verifies that a 0 ms interval is represented correctly");
addStep("Call millisecondsToHuman with 0 ms", "The output should be '0 ms'");
@@ -105,7 +109,8 @@ public void zeroIntervalTest() throws Exception {
assertEquals(zeroTimeString, " 0 ms");
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void durationsPrintHumanly() {
addDescription("Tests durationToHuman()");
@@ -127,7 +132,9 @@ public void durationsPrintHumanly() {
Duration allUnits = Duration.parse("P3DT5H7M11.013000017S");
assertEquals(TimeUtils.durationToHuman(allUnits), "3d 5h 7m 11s 13000017 ns");
}
- @Test(groups = {"regressiontest"})
+
+ @Test
+ @Tag("regressiontest")
public void differencesPrintHumanly() {
addDescription("TimeUtils.humanDifference() should return" +
" similar human readable strings to those from millisecondsToHuman()");
@@ -171,7 +178,8 @@ public void differencesPrintHumanly() {
assertEquals(oneDaySomethingString, "1d 23h 59m");
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void differencesPrintsWithAppropriatePrecision() {
// Include hours if months are 6 or less.
testHumanDifference("11m", Period.ofMonths(11), Duration.ofHours(23));
@@ -216,46 +224,48 @@ private void testHumanDifference(String expected, TemporalAmount... amounts) {
* formatted to depends on the default/system timezone. At some time the use of the old java Date
* api should be discontinued and the new Java Time api used instead.
*/
- @Test(groups = {"regressiontest"})
+ @Test @Tag("regressiontest")
public void shortDateTest() {
DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.ROOT);
Date date = new Date(1360069129256L);
String shortDateString = TimeUtils.shortDate(date);
- Assert.assertEquals(shortDateString, formatter.format(date));
+ Assertions.assertEquals(shortDateString, formatter.format(date));
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void rejectsNegativeDuration() {
- Assert.assertThrows(IllegalArgumentException.class,
+ Assertions.assertThrows(IllegalArgumentException.class,
() -> TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MIN_VALUE)));
- Assert.assertThrows(IllegalArgumentException.class,
+ Assertions.assertThrows(IllegalArgumentException.class,
() -> TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(-1)));
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void convertsDurationToCountAndTimeUnit() {
CountAndTimeUnit expectedZero = TimeUtils.durationToCountAndTimeUnit(Duration.ZERO);
- Assert.assertEquals(expectedZero.getCount(), 0);
- Assert.assertNotNull(expectedZero.getUnit());
+ Assertions.assertEquals(expectedZero.getCount(), 0);
+ Assertions.assertNotNull(expectedZero.getUnit());
- Assert.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(1)),
+ Assertions.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(1)),
new CountAndTimeUnit(1, TimeUnit.NANOSECONDS));
- Assert.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(Long.MAX_VALUE)),
+ Assertions.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(Long.MAX_VALUE)),
new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.NANOSECONDS));
- Assert.assertEquals(
+ Assertions.assertEquals(
TimeUtils.durationToCountAndTimeUnit(Duration.of(Long.MAX_VALUE / 1000 + 1, ChronoUnit.MICROS)),
new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.MICROSECONDS));
- Assert.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.of(Long.MAX_VALUE, ChronoUnit.MICROS)),
+ Assertions.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.of(Long.MAX_VALUE, ChronoUnit.MICROS)),
new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.MICROSECONDS));
- Assert.assertEquals(
+ Assertions.assertEquals(
TimeUtils.durationToCountAndTimeUnit(Duration.ofMillis(Long.MAX_VALUE / 1000 + 1)),
new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.MILLISECONDS));
- Assert.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofMillis(Long.MAX_VALUE)),
+ Assertions.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofMillis(Long.MAX_VALUE)),
new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.MILLISECONDS));
- Assert.assertEquals(
+ Assertions.assertEquals(
TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MAX_VALUE / 1000 + 1)),
new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.SECONDS));
- Assert.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MAX_VALUE)),
+ Assertions.assertEquals(TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MAX_VALUE)),
new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.SECONDS));
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
index 2bf1b2bab..651f9187c 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
@@ -3,68 +3,76 @@
import org.bitrepository.bitrepositoryelements.TimeMeasureTYPE;
import org.bitrepository.bitrepositoryelements.TimeMeasureUnit;
import org.jaccept.structure.ExtendedTestCase;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import java.math.BigInteger;
import java.time.Duration;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
public class XmlUtilsTest extends ExtendedTestCase {
private DatatypeFactory factory;
- @BeforeMethod(alwaysRun = true)
+ @BeforeEach
public void setUpFactory() throws DatatypeConfigurationException {
factory = DatatypeFactory.newInstance();
}
- @Test(groups = {"regressiontest"}, expectedExceptions = IllegalArgumentException.class)
+ @Test
+ @Tag("regressiontest")
public void negativeDurationIsRejected() {
- XmlUtils.validateNonNegative(factory.newDuration("-PT0.00001S"));
+ assertThrows(IllegalArgumentException.class, () -> {
+ XmlUtils.validateNonNegative(factory.newDuration("-PT0.00001S"));
+ });
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void testXmlDurationToDuration() {
addDescription("Tests xmlDurationToDuration in sunshine scenario cases");
addStep("Durations of 0 of some time unit", "Duration.ZERO");
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P0Y")), Duration.ZERO);
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P0M")), Duration.ZERO);
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P0D")), Duration.ZERO);
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0H")), Duration.ZERO);
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0M")), Duration.ZERO);
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0S")), Duration.ZERO);
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0.0000S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P0Y")), Duration.ZERO);
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P0M")), Duration.ZERO);
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P0D")), Duration.ZERO);
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0H")), Duration.ZERO);
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0M")), Duration.ZERO);
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0S")), Duration.ZERO);
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT0.0000S")),
Duration.ZERO);
addStep("Test correct and precise conversion",
"Hours, minutes and seconds are converted with full precision");
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3S")),
Duration.ofSeconds(3));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.3S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.3S")),
Duration.ofSeconds(3, 300_000_000));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.000000003S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.000000003S")),
Duration.ofSeconds(3, 3));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.123456789S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.123456789S")),
Duration.ofSeconds(3, 123_456_789));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT4M")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT4M")),
Duration.ofMinutes(4));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT5H")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT5H")),
Duration.ofHours(5));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT6H7M8.9S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT6H7M8.9S")),
Duration.ofHours(6).plusMinutes(7).plusSeconds(8).plusMillis(900));
addStep("Test approximate conversion",
"Days, months and years are converted using estimated factors");
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P2D")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P2D")),
Duration.ofDays(2));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P3DT4M")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P3DT4M")),
Duration.ofDays(3).plusMinutes(4));
// We require a month to be between 28 and 31 days exclusive
@@ -80,18 +88,19 @@ public void testXmlDurationToDuration() {
assertBetweenExclusive(convertedTwoYears, minTwoYearsLengthExclusive, maxTwoYearsLengthExclusive);
}
- @Test(groups = {"regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void testNegativeXmlDurationToDuration() {
// WorkflowInterval may be negative (meaning don’t run automatically)
addDescription("Tests that xmlDurationToDuration() accepts a negative duration and converts it correctly");
addStep("Negative XML durations", "Corresponding negative java.time durations");
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT3S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT3S")),
Duration.ofSeconds(-3));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT0.000001S")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT0.000001S")),
Duration.ofNanos(-1000));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT24H")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT24H")),
Duration.ofHours(-24));
- Assert.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-P1D")),
+ Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-P1D")),
Duration.ofDays(-1));
// We require minus 1 month to be between -31 and -28 days exclusive
@@ -108,50 +117,55 @@ public void testNegativeXmlDurationToDuration() {
}
private static
+ *
+ *
+ *
+ *
+ *
+ *
+ * {@code
+ * @Suite
+ * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
+ * @SelectPackages("org.bitrepository.pillar") // List your test packages here
+ * @IncludeTags("integration") // List your include tags here
+ * @ExcludeTags("slow") // List your exclude tags here
+ * @ExtendWith(GlobalSuiteExtension.class)
+ * public class BitrepositoryTestSuite {
+ * // No need for methods here; this just groups and extends
+ * }
+ * }
+ *
+ */
+@Suite
+@SelectClasses({IntegrationTest.class, ActiveMQMessageBusTest.class}) // List your test classes here
+@ExtendWith(GlobalSuiteExtension.class)
+public class BitrepositoryPillarTestSuite {
+}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java
index c7628b5a7..d567ab5b0 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java
@@ -35,8 +35,10 @@
import org.bitrepository.service.audit.MockAuditManager;
import org.bitrepository.service.contributor.ResponseDispatcher;
import org.bitrepository.service.contributor.handler.RequestHandler;
-
-
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import java.math.BigInteger;
@@ -49,7 +51,7 @@ public class MediatorTest extends DefaultFixturePillarTest {
MessageHandlerContext context;
StorageModel model = null;
- @BeforeMethod (alwaysRun=true)
+ @BeforeEach
public void initialiseTest() {
audits = new MockAuditManager();
context = new MessageHandlerContext(
@@ -60,7 +62,9 @@ public void initialiseTest() {
audits);
}
- @Test @Tag("regressiontest", "pillartest"})
+ @Test
+ @Tag("regressiontest")
+ @Tag("pillartest")
public void testMediatorRuntimeExceptionHandling() {
addDescription("Tests the handling of a runtime exception");
addStep("Setup create and start the mediator.", "");
@@ -84,7 +88,7 @@ public void testMediatorRuntimeExceptionHandling() {
messageBus.sendMessage(request);
MessageResponse response = clientReceiver.waitForMessage(IdentifyContributorsForGetStatusResponse.class);
- Assertions.assertEquals(response.getResponseInfo().getResponseCode(), ResponseCode.FAILURE);
+ Assertions.assertEquals(ResponseCode.FAILURE, response.getResponseInfo().getResponseCode());
Assertions.assertNotNull(alarmReceiver.waitForMessage(AlarmMessage.class));
} finally {
mediator.close();
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/common/SettingsHelperTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/common/SettingsHelperTest.java
index c2a70ce53..9180152de 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/common/SettingsHelperTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/common/SettingsHelperTest.java
@@ -25,6 +25,9 @@
import org.bitrepository.pillar.integration.func.Assert;
import org.bitrepository.settings.repositorysettings.Collection;
import org.bitrepository.settings.repositorysettings.PillarIDs;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
@@ -32,7 +35,8 @@
import java.util.List;
public class SettingsHelperTest {
- @Test @Tag("regressiontest"})
+ @Test
+ @Tag("regressiontest")
public void getPillarCollectionsTest() {
String myPillarID = "myPillarID";
String otherPillarID = "OtherPillar";
@@ -43,12 +47,12 @@ public void getPillarCollectionsTest() {
collection.add(createCollection("otherCollection", new String[] {otherPillarID}));
ListchecksumPillarTest a checksum pillar is started, else a normal 'full' reference pillar is started.
*
JUnit 5 Annotations Used:
+ *Options in a JUnit 5 Suite:
+ *Example Usage:
+ *
+ * {@code
+ * @Suite
+ * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
+ * @SelectPackages("org.bitrepository.pillar") // List your test packages here
+ * @IncludeTags("integration") // List your include tags here
+ * @ExcludeTags("slow") // List your exclude tags here
+ * @ExtendWith(GlobalSuiteExtension.class)
+ * public class BitrepositoryTestSuite {
+ * // No need for methods here; this just groups and extends
+ * }
+ * }
+ *
+ */
+@Suite
+@SuiteDisplayName("Checksum Pillar Acceptance Test")
+// Select the package(s) where the tests are located
+@SelectPackages("org.bitrepository.pillar.integration.func")
+// Filter to only run methods that have the specific @Tag
+@IncludeTags(PillarTestGroups.CHECKSUM_PILLAR_TEST)
+public class BitrepositoryChecksumPillarTestSuite {
+}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
index a96d68393..f9943c50a 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
@@ -9,6 +9,7 @@
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;
+import org.junit.platform.suite.api.SuiteDisplayName;
/**
* BitrepositoryPillarTestSuite is a JUnit 5 suite class that groups and configures multiple test classes
@@ -57,7 +58,10 @@
*
*/
@Suite
-@SelectClasses({IntegrationTest.class, ActiveMQMessageBusTest.class}) // List your test classes here
-@ExtendWith(GlobalSuiteExtension.class)
+@SuiteDisplayName("Full Pillar Acceptance Test")
+// Select the package(s) where the tests are located
+@SelectPackages("org.bitrepository.pillar.integration.func")
+// Filter to only run methods that have the specific @Tag
+@IncludeTags(PillarTestGroups.FULL_PILLAR_TEST)
public class BitrepositoryPillarTestSuite {
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
index 00e7ba460..64cc5b5ff 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
@@ -45,7 +45,7 @@ protected void initializeCUT() {
@Test
@Tag(PillarTestGroups.FULL_PILLAR_TEST)
@Tag(PillarTestGroups.CHECKSUM_PILLAR_TEST)
- public void eventSortingTest() throws NegativeResponseException{
+ public void eventSortingTest() throws NegativeResponseException{
addDescription("Test whether the audit trails are sorted based on sequence numbers, with the largest " +
"sequence number last..");
addFixture("Ensure at least two files are present on the pillar.");
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java
index 7a73fc171..616c85818 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java
@@ -51,7 +51,8 @@ public void initialiseReferenceTest() throws Exception {
}
@Test
- @Tag(PillarTestGroups.FULL_PILLAR_TEST) @Tag(PillarTestGroups.CHECKSUM_PILLAR_TEST)
+ @Tag(PillarTestGroups.FULL_PILLAR_TEST)
+ @Tag(PillarTestGroups.CHECKSUM_PILLAR_TEST)
public void normalIdentificationTest() {
addDescription("Verifies the normal behaviour for getChecksums identification");
addStep("Setup for test", "2 files on the pillar");
From c565330fc8612c5a6547cdbacff0808a544d920f Mon Sep 17 00:00:00 2001
From: kaah super.registerReceivers() when overriding
+ */
+ protected void registerMessageReceivers() {
+ alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination(), testEventManager);
+ addReceiver(alarmReceiver);
+ }
+
+ protected void addReceiver(MessageReceiver receiver) {
+ receiverManager.addReceiver(receiver);
+ }
+ protected void initializeCUT() {}
+
+ /**
+ * Purges all messages from the receivers.
+ */
+ protected void clearReceivers() {
+ receiverManager.clearMessagesInReceivers();
+ }
+
+ /**
+ * May be overridden by specific tests wishing to do stuff. Remember to call super if this is overridden.
+ */
+ protected void shutdownCUT() {}
+
+ /**
+ * Initializes the settings. Will postfix the alarm and collection topics with '-${user.name}
+ */
+ protected void setupSettings() {
+ settingsForCUT = loadSettings(getComponentID());
+ makeUserSpecificSettings(settingsForCUT);
+ SettingsUtils.initialize(settingsForCUT);
+
+ alarmDestinationID = settingsForCUT.getRepositorySettings().getProtocolSettings().getAlarmDestination();
+
+ settingsForTestClient = loadSettings(testMethodName);
+ makeUserSpecificSettings(settingsForTestClient);
+ }
+
+
+ protected Settings loadSettings(String componentID) {
+ return TestSettingsProvider.reloadSettings(componentID);
+ }
+
+ private void makeUserSpecificSettings(Settings settings) {
+ settings.getRepositorySettings().getProtocolSettings()
+ .setCollectionDestination(settings.getCollectionDestination() + getTopicPostfix());
+ settings.getRepositorySettings().getProtocolSettings().setAlarmDestination(settings.getAlarmDestination() + getTopicPostfix());
+ }
+
+ /**
+ * Indicated whether an embedded active MQ should be started and used
+ */
+ public boolean useEmbeddedMessageBus() {
+ return System.getProperty("useEmbeddedMessageBus", "true").equals("true");
+ }
+
+ /**
+ * Indicated whether an embedded http server should be started and used
+ */
+ public boolean useEmbeddedHttpServer() {
+ return System.getProperty("useEmbeddedHttpServer", "false").equals("true");
+ }
+
+ /**
+ * Hooks up the message bus.
+ */
+ protected void setupMessageBus() {
+ if (useEmbeddedMessageBus()) {
+ if (messageBus == null) {
+ messageBus = new SimpleMessageBus();
+ }
+ }
+ }
+
+ /**
+ * Shutdown the message bus.
+ */
+ private void teardownMessageBus() {
+ MessageBusManager.clear();
+ if (messageBus != null) {
+ try {
+ messageBus.close();
+ messageBus = null;
+ } catch (JMSException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ if (broker != null) {
+ try {
+ broker.stop();
+ broker = null;
+ } catch (Exception e) {
+ // No reason to pollute the test output with this
+ }
+ }
+ }
+
+ /**
+ * Shutdown the embedded http server if any.
+ */
+ protected void teardownHttpServer() {
+ if (useEmbeddedHttpServer()) {
+ server.stop();
+ }
+ }
+
+ /**
+ * Returns the postfix string to use when accessing user specific topics, which is the mechanism we use in the
+ * bit repository tests.
+ *
+ * @return The string to postfix all topix names with.
+ */
+ protected String getTopicPostfix() {
+ return "-" + System.getProperty("user.name");
+ }
+
+ protected String getComponentID() {
+ return getClass().getSimpleName();
+ }
+
+ protected String createDate() {
+ return Long.toString(System.currentTimeMillis());
+ }
+
+ protected SecurityManager createSecurityManager() {
+ return new DummySecurityManager();
+ }
+
+}
\ No newline at end of file
From f38d907f3f393c390b819483a6dd7f6885f4deca Mon Sep 17 00:00:00 2001
From: kaah TestEventManager used to manage the event for the associated test. */
- private final TestEventManager testEventManager;
+
/** The queue used to store the received messages. */
private final BlockingQueueTestEventManager used to manage the event for the associated test. */
- private final TestEventManager testEventManager;
+
/** The queue used to store the received operation events. */
private final BlockingQueueTestEventManager used to manage the event for the associated test.
*/
- public TestEventHandler(TestEventManager testEventManager) {
+ public TestEventHandler() {
super();
- this.testEventManager = testEventManager;
+
}
@Override
public void handleEvent(OperationEvent event) {
- testEventManager.addResult("Received event: "+ event);
- eventQueue.add(event);
+ io.qameta.allure.Allure.step("Received event: " + event, () -> {
+ eventQueue.add(event);
+ });
}
/**
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
index c10060f29..b4a9a7423 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
@@ -23,13 +23,15 @@
import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.client.exceptions.NegativeResponseException;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class NegativeResponseExceptionTest extends ExtendedTestCase {
+
+public class NegativeResponseExceptionTest {
@Test
@Tag("regressiontest")
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
index 516620475..5c8726811 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
@@ -22,13 +22,15 @@
package org.bitrepository.client.exception;
import org.bitrepository.client.exceptions.UnexpectedResponseException;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class UnexpectedResponseExceptionTest extends ExtendedTestCase {
+
+public class UnexpectedResponseExceptionTest {
@Test
@Tag( "regressiontest")
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
index 1f9e2c91c..faca64276 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
@@ -23,17 +23,18 @@
import org.apache.commons.cli.Option;
import org.bitrepository.commandline.utils.CommandLineArgumentsHandler;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class CommandLineTest extends ExtendedTestCase {
+public class CommandLineTest {
private static final String SETTINGS_DIR = "SettingsDir";
private static final String KEY_FILE = "KeyFile";
private static final String DUMMY_DATA = "DummyData";
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
index 09bf3c756..94b02d31f 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
@@ -79,7 +79,7 @@ public void deleteClientTester() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
String checksum = "123checksum321";
@@ -157,7 +157,7 @@ public void deleteClientTester() throws Exception {
public void fileAlreadyDeletedFromPillar() throws Exception {
addDescription("Test that a delete on a pillar completes successfully when the file is missing " +
"(has already been deleted). This is a test of the Idempotent behaviour of the delete client");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
addStep("Request a file to be deleted on pillar1.",
@@ -199,7 +199,7 @@ public void deleteClientIdentificationTimeout() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
settingsForCUT.getRepositorySettings().getClientSettings()
.setIdentificationTimeoutDuration(datatypeFactory.newDuration(1000));
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
String checksum = "123checksum321";
@@ -238,7 +238,7 @@ public void deleteClientOperationTimeout() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
settingsForCUT.getRepositorySettings().getClientSettings()
.setOperationTimeoutDuration(datatypeFactory.newDuration(100));
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
String checksum = "123checksum321";
@@ -288,7 +288,7 @@ public void deleteClientPillarFailedDuringPerform() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
String checksum = "123checksum321";
@@ -342,7 +342,7 @@ public void deleteClientPillarFailedDuringPerform() throws Exception {
@Test @Tag("regressiontest")
public void deleteClientSpecifiedPillarFailedDuringIdentification() throws Exception {
addDescription("Tests the handling of a identification failure for a pillar for the DeleteClient. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
addStep("Request a file to be deleted on the pillar1.",
@@ -370,7 +370,7 @@ public void deleteClientSpecifiedPillarFailedDuringIdentification() throws Excep
@Test @Tag("regressiontest")
public void deleteClientOtherPillarFailedDuringIdentification() throws Exception {
addDescription("Tests the handling of a identification failure for a pillar for the DeleteClient. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
addStep("Request a file to be deleted on the pillar1.",
@@ -414,7 +414,7 @@ public void deleteClientOtherPillarFailedDuringIdentification() throws Exception
@Test @Tag("regressiontest")
public void deleteOnChecksumPillar() throws Exception {
addDescription("Verify that the DeleteClient works correctly when a checksum pillar is present. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
addStep("Request a file to be deleted on the pillar1.",
@@ -456,7 +456,7 @@ public void deleteOnChecksumPillar() throws Exception {
public void deleteOnChecksumPillarWithDefaultReturnChecksumType() throws Exception {
addDescription("Verify that the DeleteClient works correctly when a return checksum of the default type" +
"is requested. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
addStep("Request a file to be deleted on the pillar1. The call should include a request for a check sum of the " +
@@ -494,7 +494,7 @@ public void deleteOnChecksumPillarWithDefaultReturnChecksumType() throws Excepti
public void deleteOnChecksumPillarWithSaltedReturnChecksumType() throws Exception {
addDescription("Verify that the DeleteClient works correctly when a return checksum with a salt " +
"is requested. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
DeleteFileClient deleteClient = createDeleteFileClient();
addStep("Request a file to be deleted on the pillar1. The call should include a request for a salted check sum ",
@@ -536,6 +536,6 @@ public void deleteOnChecksumPillarWithSaltedReturnChecksumType() throws Exceptio
*/
private DeleteFileClient createDeleteFileClient() {
return new DeleteFileClientTestWrapper(new ConversationBasedDeleteFileClient(
- messageBus, conversationMediator, settingsForCUT, settingsForTestClient.getComponentID()), testEventManager);
+ messageBus, conversationMediator, settingsForCUT, settingsForTestClient.getComponentID()));
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java
index 25b7ab2a4..a379e509f 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java
@@ -27,7 +27,8 @@
import org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE;
import org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE;
import org.bitrepository.client.eventhandler.EventHandler;
-import org.jaccept.TestEventManager;
+
+import io.qameta.allure.Allure;
/**
* Wrapper class for a DeleteFileClient adding testmanager logging.
@@ -35,27 +36,30 @@
public class DeleteFileClientTestWrapper implements DeleteFileClient {
/** The PutClient to wrap. */
private DeleteFileClient wrappedDeleteClient;
- /** The manager to monitor the operations.*/
- private TestEventManager testEventManager;
/**
* Constructor.
* @param deleteClientInstance The instance to wrap and monitor.
- * @param eventManager The manager to monitor the operations.
*/
- public DeleteFileClientTestWrapper(DeleteFileClient deleteClientInstance, TestEventManager eventManager) {
+ public DeleteFileClientTestWrapper(DeleteFileClient deleteClientInstance) {
this.wrappedDeleteClient = deleteClientInstance;
- this.testEventManager = eventManager;
}
@Override
public void deleteFile(String collectionID, String fileID, String pillarID,
ChecksumDataForFileTYPE checksumForPillar,
- ChecksumSpecTYPE checksumRequested, EventHandler eventHandler, String auditTrailInformation) {
- testEventManager.addStimuli("Calling deleteFile(" + fileID + ", " + pillarID + ", " + checksumForPillar + ", "
- + checksumRequested + ", eventHandler, " + auditTrailInformation + ")");
- wrappedDeleteClient.deleteFile(collectionID, fileID, pillarID, checksumForPillar, checksumRequested,
- eventHandler,
- auditTrailInformation);
+ ChecksumSpecTYPE checksumRequested, EventHandler eventHandler, String auditTrailInformation) {
+ String stepName = "Calling deleteFile for file: " + fileID;
+ String details = "Collection: " + collectionID + "\n"
+ + "Pillar: " + pillarID + "\n"
+ + "Checksum: " + checksumForPillar + "\n"
+ + "Audit Info: " + auditTrailInformation;
+
+ Allure.step(stepName, () -> {
+ Allure.addAttachment("Delete Request Parameters", details);
+ wrappedDeleteClient.deleteFile(collectionID, fileID, pillarID, checksumForPillar, checksumRequested,
+ eventHandler,
+ auditTrailInformation);
+ });
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
index 81c2f942e..579cc5069 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
@@ -82,7 +82,7 @@ public void normalPutFile() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
@@ -151,7 +151,7 @@ public void noPillarsResponding() throws Exception {
settingsForCUT.getRepositorySettings().getClientSettings()
.setIdentificationTimeoutDuration(datatypeFactory.newDuration(100));
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Request the putting of a file through the PutClient",
@@ -180,7 +180,7 @@ public void onePillarRespondingWithPartialPutAllowed() throws Exception {
settingsForCUT.getRepositorySettings().getClientSettings()
.setIdentificationTimeoutDuration(datatypeFactory.newDuration(100));
settingsForCUT.getReferenceSettings().getPutFileSettings().setPartialPutsAllow(true);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Request the putting of a file through the PutClient",
@@ -227,7 +227,7 @@ public void onePillarRespondingWithPartialPutDisallowed() throws Exception {
settingsForCUT.getRepositorySettings().getClientSettings()
.setIdentificationTimeoutDuration(datatypeFactory.newDuration(100));
settingsForCUT.getReferenceSettings().getPutFileSettings().setPartialPutsAllow(false);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Request the putting of a file through the PutClient",
@@ -263,7 +263,7 @@ public void putClientOperationTimeout() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
settingsForCUT.getRepositorySettings().getClientSettings()
.setOperationTimeoutDuration(datatypeFactory.newDuration(100));
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Request the putting of a file through the PutClient",
@@ -302,7 +302,7 @@ public void putClientPillarOperationFailed() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Ensure that the test-file is placed on the HTTP server.", "Should be removed an reuploaded.");
@@ -347,7 +347,7 @@ public void putClientPillarOperationFailed() throws Exception {
public void fileExistsOnPillarNoChecksumFromPillar() throws Exception {
addDescription("Tests that PutClient handles the presence of a file correctly, when the pillar doesn't return a " +
"checksum in the identification response. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Call putFile.",
@@ -380,7 +380,7 @@ public void fileExistsOnPillarNoChecksumFromPillar() throws Exception {
public void fileExistsOnPillarDifferentChecksumFromPillar() throws Exception {
addDescription("Tests that PutClient handles the presence of a file correctly, when the pillar " +
"returns a checksum different from the file being put. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Call putFile.",
@@ -418,7 +418,7 @@ public void fileExistsOnPillarDifferentChecksumFromPillar() throws Exception {
public void sameFileExistsOnOnePillar() throws Exception {
addDescription("Tests that PutClient handles the presence of a file correctly, when the pillar " +
"returns a checksum equal the file being put (idempotent).");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Call putFile.",
@@ -473,7 +473,7 @@ public void sameFileExistsOnOnePillar() throws Exception {
public void fileExistsOnPillarChecksumFromPillarNoClientChecksum() throws Exception {
addDescription("Tests that PutClient handles the presence of a file correctly, when the pillar " +
"returns a checksum but the putFile was called without a checksum. ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Call putFile.",
@@ -513,7 +513,7 @@ public void saltedReturnChecksumsWithChecksumPillar() throws Exception {
"put, replace and delete clients fails if return checksums are requested and a checksumpillar is " +
"involved");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Call putFile while requesting a salted checksum to be returned.",
@@ -565,7 +565,7 @@ public void defaultReturnChecksumsWithChecksumPillar() throws Exception {
addDescription("Tests that PutClient handles the presence of a ChecksumPillar correctly, when a return" +
" checksum of default type is requested (which a checksum pillar can provide). ");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Call putFile while requesting a salted checksum to be returned.",
@@ -616,7 +616,7 @@ public void noReturnChecksumsWithChecksumPillar() throws Exception {
addDescription("Tests that PutClient handles the presence of a ChecksumPillar correctly, when no return" +
" checksum is requested.");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Call putFile while requesting a salted checksum to be returned.",
@@ -667,7 +667,7 @@ public void onePillarPutRetrySuccess() throws Exception {
settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(BigInteger.valueOf(2));
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Request the putting of a file through the PutClient",
@@ -720,7 +720,7 @@ public void onePillarPutRetryFailure() throws Exception {
settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(BigInteger.valueOf(2));
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Request the putting of a file through the PutClient",
@@ -787,7 +787,7 @@ public void putToOtherCollection() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(1).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(1).getPillarIDs().getPillarID().add(PILLAR2_ID);
String otherCollection = settingsForCUT.getRepositorySettings().getCollections().getCollection().get(1).getID();
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
PutFileClient putClient = createPutFileClient();
addStep("Request the putting of a file through the PutClient for collection2",
@@ -830,6 +830,6 @@ public void putToOtherCollection() throws Exception {
private PutFileClient createPutFileClient() {
return new PutFileClientTestWrapper(new ConversationBasedPutFileClient(
messageBus, conversationMediator, settingsForCUT, settingsForTestClient.getComponentID())
- , testEventManager);
+ );
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java
index 7866467aa..e7f3a19d8 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java
@@ -24,10 +24,10 @@
*/
package org.bitrepository.modify.putfile;
+import io.qameta.allure.Allure;
import org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE;
import org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE;
import org.bitrepository.client.eventhandler.EventHandler;
-import org.jaccept.TestEventManager;
import java.net.URL;
@@ -35,28 +35,32 @@
* Wrapper class for a PutFileClient adding test event logging.
*/
public class PutFileClientTestWrapper implements PutFileClient {
- private PutFileClient wrappedPutClient;
- private TestEventManager testEventManager;
+ private final PutFileClient wrappedPutClient;
/**
* Constructor.
* @param putClientInstance The instance to wrap and monitor.
- * @param eventManager The manager to monitor the operations.
*/
- public PutFileClientTestWrapper(PutFileClient putClientInstance, TestEventManager eventManager) {
+ public PutFileClientTestWrapper(PutFileClient putClientInstance) {
this.wrappedPutClient = putClientInstance;
- this.testEventManager = eventManager;
}
@Override
public void putFile(String collectionID, URL url, String fileID, long sizeOfFile,
ChecksumDataForFileTYPE checksumForValidationAtPillar,
- ChecksumSpecTYPE checksumRequestsForValidation, EventHandler eventHandler, String auditTrailInformation) {
- testEventManager.addStimuli("Calling PutFileWithId(" + url + ", " + fileID + ", " + sizeOfFile + ", "
- + checksumForValidationAtPillar + ", " + checksumRequestsForValidation + ", " + eventHandler + ", "
- + auditTrailInformation + ")");
- wrappedPutClient.putFile(collectionID, url, fileID, sizeOfFile, checksumForValidationAtPillar,
- checksumRequestsForValidation,
- eventHandler, auditTrailInformation);
+ ChecksumSpecTYPE checksumRequestsForValidation, EventHandler eventHandler, String auditTrailInformation) {
+ String stepName = "Calling putFile for file: " + fileID;
+ StringBuilder details = new StringBuilder();
+ details.append("Collection: ").append(collectionID).append("\n")
+ .append("URL: ").append(url).append("\n")
+ .append("Size: ").append(sizeOfFile).append("\n")
+ .append("Audit Info: ").append(auditTrailInformation);
+
+ Allure.step(stepName, () -> {
+ Allure.addAttachment("Put Request Parameters", details.toString());
+ wrappedPutClient.putFile(collectionID, url, fileID, sizeOfFile, checksumForValidationAtPillar,
+ checksumRequestsForValidation,
+ eventHandler, auditTrailInformation);
+ });
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
index f78799008..c2e342487 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
@@ -89,7 +89,7 @@ public void replaceClientTester() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
checksumRequest.setChecksumType(ChecksumType.SHA1);
@@ -166,7 +166,7 @@ public void replaceClientIdentificationTimeout() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
settingsForCUT.getRepositorySettings().getClientSettings()
.setIdentificationTimeoutDuration(datatypeFactory.newDuration(100));
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
checksumRequest.setChecksumType(ChecksumType.SHA1);
@@ -199,7 +199,7 @@ public void replaceClientOperationTimeout() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
settingsForCUT.getRepositorySettings().getClientSettings()
.setOperationTimeoutDuration(datatypeFactory.newDuration(100));
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
@@ -247,7 +247,7 @@ public void replaceClientPillarFailed() throws Exception {
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
@@ -301,7 +301,7 @@ public void saltedReturnChecksumsForNewFileWithChecksumPillar() throws Exception
addDescription("Tests that the ReplaceClient handles the presence of a ChecksumPillar correctly, " +
"when a salted return checksum (which a checksum pillar can't provide) is requested for the new file.");
- TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
+ TestEventHandler testEventHandler = new TestEventHandler();
ReplaceFileClient replaceClient = createReplaceFileClient();
addStep("Call replaceFile while requesting a salted checksum to be returned.",
@@ -344,8 +344,7 @@ public void saltedReturnChecksumsForNewFileWithChecksumPillar() throws Exception
*/
private ReplaceFileClient createReplaceFileClient() {
return new ReplaceFileClientTestWrapper(new ConversationBasedReplaceFileClient(
- messageBus, conversationMediator, settingsForCUT, settingsForTestClient.getComponentID()),
- testEventManager);
+ messageBus, conversationMediator, settingsForCUT, settingsForTestClient.getComponentID()));
}
private ChecksumDataForFileTYPE createChecksumData(String checksum) {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java
index 65e1d6360..3f46e5ec1 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java
@@ -24,10 +24,11 @@
*/
package org.bitrepository.modify.replacefile;
+import io.qameta.allure.Allure;
import org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE;
import org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE;
import org.bitrepository.client.eventhandler.EventHandler;
-import org.jaccept.TestEventManager;
+
import java.net.URL;
@@ -36,32 +37,35 @@
*/
public class ReplaceFileClientTestWrapper implements ReplaceFileClient {
/** The PutClient to wrap. */
- private ReplaceFileClient wrappedReplaceClient;
- /** The manager to monitor the operations.*/
- private TestEventManager testEventManager;
+ private final ReplaceFileClient wrappedReplaceClient;
/**
* @param putClientInstance The instance to wrap and monitor.
- * @param eventManager The manager to monitor the operations.
*/
- public ReplaceFileClientTestWrapper(ReplaceFileClient putClientInstance, TestEventManager eventManager) {
+ public ReplaceFileClientTestWrapper(ReplaceFileClient putClientInstance) {
this.wrappedReplaceClient = putClientInstance;
- this.testEventManager = eventManager;
}
@Override
public void replaceFile(String collectionID, String fileID, String pillarID,
ChecksumDataForFileTYPE checksumForDeleteAtPillar,
- ChecksumSpecTYPE checksumRequestedForDeletedFile, URL url, long sizeOfNewFile,
- ChecksumDataForFileTYPE checksumForNewFileValidationAtPillar, ChecksumSpecTYPE checksumRequestsForNewFile,
- EventHandler eventHandler, String auditTrailInformation) {
- testEventManager.addStimuli("replaceFile(" + fileID + ", " + pillarID + ", " + checksumForDeleteAtPillar + ", "
- + checksumRequestedForDeletedFile + ", " + url + ", " + sizeOfNewFile + ", "
- + checksumForNewFileValidationAtPillar + ", " + checksumRequestsForNewFile + ", " + eventHandler + ", "
- + auditTrailInformation);
- wrappedReplaceClient.replaceFile(collectionID, fileID, pillarID, checksumForDeleteAtPillar,
- checksumRequestedForDeletedFile,
- url, sizeOfNewFile, checksumForNewFileValidationAtPillar, checksumRequestsForNewFile, eventHandler,
- auditTrailInformation);
+ ChecksumSpecTYPE checksumRequestedForDeletedFile, URL url, long sizeOfNewFile,
+ ChecksumDataForFileTYPE checksumForNewFileValidationAtPillar, ChecksumSpecTYPE checksumRequestsForNewFile,
+ EventHandler eventHandler, String auditTrailInformation) {
+ String stepName = "Calling replaceFile for: " + fileID;
+ StringBuilder details = new StringBuilder();
+ details.append("Collection: ").append(collectionID).append("\n")
+ .append("Pillar: ").append(pillarID).append("\n")
+ .append("URL: ").append(url).append("\n")
+ .append("New Size: ").append(sizeOfNewFile).append("\n")
+ .append("Audit Info: ").append(auditTrailInformation);
+
+ Allure.step(stepName, () -> {
+ Allure.addAttachment("Replace Request Parameters", details.toString());
+ wrappedReplaceClient.replaceFile(collectionID, fileID, pillarID, checksumForDeleteAtPillar,
+ checksumRequestedForDeletedFile,
+ url, sizeOfNewFile, checksumForNewFileValidationAtPillar, checksumRequestsForNewFile, eventHandler,
+ auditTrailInformation);
+ });
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
index f792c7058..5bc8e3860 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
@@ -21,7 +21,6 @@
*/
package org.bitrepository.common;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -30,8 +29,13 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
+import org.bitrepository.protocol.utils.AllureTestUtils;
-public class ArgumentValidatorTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+
+public class ArgumentValidatorTest {
@Test @Tag("regressiontest")
public void testArgumentValidatorObject() throws Exception {
addDescription("Test the argument validator for arguments not null");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
index f92e9285c..f9d416d54 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
@@ -22,12 +22,16 @@
package org.bitrepository.common.exception;
import org.bitrepository.common.exceptions.UnableToFinishException;
-import org.jaccept.structure.ExtendedTestCase;
+import org.bitrepository.protocol.utils.AllureTestUtils;
+
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-public class UnableToFinishExceptionTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class UnableToFinishExceptionTest {
@Test
@Tag("regressiontest")
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsLoaderTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsLoaderTest.java
index 609225f11..6b2c916bf 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsLoaderTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsLoaderTest.java
@@ -24,14 +24,13 @@
*/
package org.bitrepository.common.settings;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import java.util.List;
-public class SettingsLoaderTest extends ExtendedTestCase {
+public class SettingsLoaderTest {
private static final String PATH_TO_SETTINGS = "settings/xml/bitrepository-devel";
private static final String PATH_TO_EXAMPLE_SETTINGS = "examples/settings";
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
index 78d89e9d3..258682ad0 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
@@ -1,6 +1,5 @@
package org.bitrepository.common.settings;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
@@ -11,9 +10,11 @@
import java.math.BigInteger;
import java.time.Duration;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
-public class SettingsTest extends ExtendedTestCase {
+public class SettingsTest {
private DatatypeFactory factory;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/settings/XMLFileSettingsLoaderTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/settings/XMLFileSettingsLoaderTest.java
index 528799d11..1bd2e74f7 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/settings/XMLFileSettingsLoaderTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/settings/XMLFileSettingsLoaderTest.java
@@ -25,12 +25,11 @@
package org.bitrepository.common.settings;
import org.bitrepository.settings.repositorysettings.RepositorySettings;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-public class XMLFileSettingsLoaderTest extends ExtendedTestCase{
+public class XMLFileSettingsLoaderTest{
private static final String PATH_TO_SETTINGS = "settings/xml/bitrepository-devel";
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java
index 5b9606ac1..a302b3a1b 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java
@@ -22,15 +22,17 @@
package org.bitrepository.common.utils;
import org.apache.commons.codec.DecoderException;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
/**
* Utility class for handling encoding and decoding of base64 bytes.
*/
-public class Base16UtilsTest extends ExtendedTestCase {
+public class Base16UtilsTest {
private final String DECODED_CHECKSUM = "ff5aca7ae8c80c9a3aeaf9173e4dfd27";
private final byte[] ENCODED_CHECKSUM = new byte[]{-1,90,-54,122,-24,-56,12,-102,58,-22,-7,23,62,77,-3,39};
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java
index 01507f406..e007be1f8 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java
@@ -21,7 +21,6 @@
*/
package org.bitrepository.common.utils;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -33,8 +32,13 @@
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
+import org.bitrepository.protocol.utils.AllureTestUtils;
-public class CalendarUtilsTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+
+public class CalendarUtilsTest {
long DATE_IN_MILLIS = 123456789L;
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java
index bd46db775..839d375ce 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java
@@ -28,7 +28,6 @@
import org.bitrepository.bitrepositoryelements.ChecksumType;
import org.bitrepository.common.settings.Settings;
import org.bitrepository.common.settings.TestSettingsProvider;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -39,7 +38,10 @@
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
-public class ChecksumUtilsTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class ChecksumUtilsTest {
@Test
@Tag("regressiontest")
public void calculateHmacChecksums() throws Exception {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java
index 46616d437..6afff7f34 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java
@@ -22,12 +22,14 @@
package org.bitrepository.common.utils;
import org.bitrepository.bitrepositoryelements.FileIDs;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-public class FileIDUtilsTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class FileIDUtilsTest {
String FILE_ID = "Test-File-Id";
@Test @Tag("regressiontest")
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDValidatorTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDValidatorTest.java
index d00fc91ce..380abf7c1 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDValidatorTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDValidatorTest.java
@@ -23,15 +23,18 @@
import org.bitrepository.common.settings.Settings;
import org.bitrepository.common.settings.TestSettingsProvider;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
+import org.bitrepository.protocol.utils.AllureTestUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class FileIDValidatorTest extends ExtendedTestCase {
+public class FileIDValidatorTest {
/** The settings for the tests. Should be instantiated in the setup.*/
Settings settings;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java
index c72fe8efa..6ac488c7d 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java
@@ -22,7 +22,6 @@
package org.bitrepository.common.utils;
import org.apache.activemq.util.ByteArrayInputStream;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -32,7 +31,10 @@
import java.io.File;
import java.nio.charset.StandardCharsets;
-public class FileUtilsTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class FileUtilsTest {
String DIR = "test-directory";
String SUB_DIR = "sub-directory";
String TEST_FILE_NAME = "test.file.name";
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java
index cf7f13719..040dfb2c3 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java
@@ -23,13 +23,15 @@
import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.bitrepositoryelements.ResponseInfo;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class ResponseInfoUtilsTest extends ExtendedTestCase {
+
+public class ResponseInfoUtilsTest {
@Test
@Tag("regressiontest")
public void responseInfoTester() throws Exception {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
index d2febcbb2..b051aae57 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
@@ -22,15 +22,19 @@
package org.bitrepository.common.utils;
import org.apache.activemq.util.ByteArrayInputStream;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import org.bitrepository.protocol.utils.AllureTestUtils;
+
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
-public class StreamUtilsTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class StreamUtilsTest {
String DATA = "The data for the streams.";
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
index c94773cd8..e1439bda4 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
@@ -26,7 +26,6 @@
import org.bitrepository.bitrepositoryelements.TimeMeasureTYPE;
import org.bitrepository.bitrepositoryelements.TimeMeasureUnit;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -34,10 +33,12 @@
import java.math.BigInteger;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+
/**
* Tests the TimeMeasureComparator class.
*/
-public class TimeMeasurementUtilsTest extends ExtendedTestCase {
+public class TimeMeasurementUtilsTest {
@Test @Tag("regressiontest")
public void testCompareMilliSeconds() {
addDescription("Test the comparison between TimeMeasure units.");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
index 086a09685..e47fbe7c1 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
@@ -21,7 +21,6 @@
*/
package org.bitrepository.common.utils;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -41,10 +40,12 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class TimeUtilsTest extends ExtendedTestCase {
+public class TimeUtilsTest {
private static final ZonedDateTime BASE = Instant.EPOCH.atZone(ZoneOffset.UTC);
@Test @Tag("regressiontest")
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
index 8d0178f6d..07643fb9f 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
@@ -2,7 +2,6 @@
import org.bitrepository.bitrepositoryelements.TimeMeasureTYPE;
import org.bitrepository.bitrepositoryelements.TimeMeasureUnit;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
@@ -14,9 +13,11 @@
import java.math.BigInteger;
import java.time.Duration;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
-public class XmlUtilsTest extends ExtendedTestCase {
+public class XmlUtilsTest {
private DatatypeFactory factory;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
index 886419ac8..6238b6bfa 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
@@ -13,7 +13,7 @@
import org.bitrepository.protocol.messagebus.SimpleMessageBus;
import org.bitrepository.protocol.security.DummySecurityManager;
import org.bitrepository.protocol.security.SecurityManager;
-import org.jaccept.TestEventManager;
+
import org.junit.jupiter.api.extension.*;
import javax.jms.JMSException;
@@ -23,7 +23,7 @@
public class GlobalSuiteExtension implements BeforeAllCallback, AfterAllCallback {
private static boolean initialized = false;
- protected static TestEventManager testEventManager = TestEventManager.getInstance();
+
public static LocalActiveMQBroker broker;
public static EmbeddedHttpServer server;
public static HttpServerConfiguration httpServerConfiguration;
@@ -79,7 +79,7 @@ public void afterAll(ExtensionContext context) {
* super.registerReceivers() when overriding
*/
protected void registerMessageReceivers() {
- alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination(), testEventManager);
+ alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination());
addReceiver(alarmReceiver);
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
index 00b63c846..f2cdaa3f4 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
@@ -1,29 +1,7 @@
-/*
- * #%L
- * Bitrepository Common
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 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
- * 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
- * License along with this program. If not, see
- * super.registerReceivers() when overriding
*/
+ @Step("Register message receivers")
protected void registerMessageReceivers() {
- alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination(), testEventManager);
+ alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination());
addReceiver(alarmReceiver);
}
@@ -112,14 +105,18 @@ protected void addReceiver(MessageReceiver receiver) {
@BeforeAll
public void initMessagebus() {
- initializationMethod();
- setupMessageBus();
+ Allure.step("Initialize message bus", () -> {
+ initializationMethod();
+ setupMessageBus();
+ });
}
@AfterAll
public void shutdownSuite() {
- teardownMessageBus();
- teardownHttpServer();
+ Allure.step("Shutdown test suite", () -> {
+ teardownMessageBus();
+ teardownHttpServer();
+ });
}
/**
@@ -128,35 +125,40 @@ public void shutdownSuite() {
@BeforeEach
public final void beforeMethod(TestInfo testInfo) {
testMethodName = testInfo.getTestMethod().get().getName();
- setupSettings();
- NON_DEFAULT_FILE_ID = TestFileHelper.createUniquePrefix(testMethodName);
- DEFAULT_AUDIT_INFORMATION = testMethodName;
- receiverManager = new MessageReceiverManager(messageBus);
- registerMessageReceivers();
- messageBus.setCollectionFilter(List.of());
- messageBus.setComponentFilter(List.of());
- receiverManager.startListeners();
- initializeCUT();
+
+ Allure.step("Setup test: " + testMethodName, () -> {
+ setupSettings();
+ NON_DEFAULT_FILE_ID = TestFileHelper.createUniquePrefix(testMethodName);
+ DEFAULT_AUDIT_INFORMATION = testMethodName;
+ receiverManager = new MessageReceiverManager(messageBus);
+ registerMessageReceivers();
+ messageBus.setCollectionFilter(List.of());
+ messageBus.setComponentFilter(List.of());
+ receiverManager.startListeners();
+ initializeCUT();
+ });
}
protected void initializeCUT() {}
@AfterEach
public final void afterMethod() {
- if (receiverManager != null) {
- receiverManager.stopListeners();
- }
- if (TestWatcherExtension.isTestSuccessful()) {
- afterMethodVerification();
- }
- shutdownCUT();
+ Allure.step("Teardown test: " + testMethodName, () -> {
+ if (receiverManager != null) {
+ receiverManager.stopListeners();
+ }
+ if (TestWatcherExtension.isTestSuccessful()) {
+ afterMethodVerification();
+ }
+ shutdownCUT();
+ });
}
-
/**
* May be used by specific tests for general verification when the test method has finished. Will only be run
* if the test has passed (so far).
*/
+ @Step("Verify no messages remain in receivers")
protected void afterMethodVerification() {
receiverManager.checkNoMessagesRemainInReceivers();
}
@@ -164,6 +166,7 @@ protected void afterMethodVerification() {
/**
* Purges all messages from the receivers.
*/
+ @Step("Clear all receivers")
protected void clearReceivers() {
receiverManager.clearMessagesInReceivers();
}
@@ -176,6 +179,7 @@ protected void shutdownCUT() {}
/**
* Initializes the settings. Will postfix the alarm and collection topics with '-${user.name}
*/
+ @Step("Setup settings")
protected void setupSettings() {
settingsForCUT = loadSettings(getComponentID());
makeUserSpecificSettings(settingsForCUT);
@@ -187,7 +191,6 @@ protected void setupSettings() {
makeUserSpecificSettings(settingsForTestClient);
}
-
protected Settings loadSettings(String componentID) {
return TestSettingsProvider.reloadSettings(componentID);
}
@@ -277,4 +280,4 @@ protected String createDate() {
protected SecurityManager createSecurityManager() {
return new DummySecurityManager();
}
-}
+}
\ No newline at end of file
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
index ddef0ee6f..ef4c4460f 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
@@ -30,7 +30,6 @@
import org.bitrepository.bitrepositorymessages.GetChecksumsFinalResponse;
import org.bitrepository.common.JaxbHelper;
import org.bitrepository.protocol.message.ExampleMessageFactory;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
@@ -49,13 +48,15 @@
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Test whether we are able to create message objects from xml. The input XML is the example code defined in the
* message-xml, thereby also testing whether this is valid. *
*/
-public class MessageCreationTest extends ExtendedTestCase {
+public class MessageCreationTest {
@Test @Tag("regressiontest")
public void messageCreationTest() throws Exception {
addDescription("Tests if we are able to create message objects from xml. The input XML is the example code " +
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
index 419e6f620..1740284a1 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
@@ -54,7 +54,7 @@ protected void setupMessageBus() {
broker.start();
}
messageBus = new MessageBusWrapper(ProtocolComponentFactory.getInstance().getMessageBus(
- settingsForTestClient, securityManager), testEventManager);
+ settingsForTestClient, securityManager));
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
index b7ba4d935..af6c6c412 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
@@ -28,7 +28,7 @@
import org.bitrepository.protocol.IntegrationTest;
import org.bitrepository.protocol.message.ExampleMessageFactory;
import org.bitrepository.protocol.messagebus.MessageBusManager;
-import org.jaccept.TestEventManager;
+
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -44,7 +44,7 @@ public class GeneralMessageBusTest extends IntegrationTest {
@Override
protected void registerMessageReceivers() {
super.registerMessageReceivers();
- collectionReceiver = new MessageReceiver(settingsForCUT.getCollectionDestination(), testEventManager);
+ collectionReceiver = new MessageReceiver(settingsForCUT.getCollectionDestination());
addReceiver(collectionReceiver);
}
@@ -76,13 +76,12 @@ public final void busActivityTest() throws Exception {
@Tag("regressiontest")
public final void twoListenersForTopicTest() throws Exception {
addDescription("Verifies that two listeners on the same topic both receive the message");
- TestEventManager testEventManager = TestEventManager.getInstance();
addStep("Make a connection to the message bus and add two listeners", "No exceptions should be thrown");
- MessageReceiver receiver1 = new MessageReceiver(alarmDestinationID, testEventManager);
+ MessageReceiver receiver1 = new MessageReceiver(alarmDestinationID);
addReceiver(receiver1);
messageBus.addListener(receiver1.getDestination(), receiver1.getMessageListener());
- MessageReceiver receiver2 = new MessageReceiver(alarmDestinationID, testEventManager);
+ MessageReceiver receiver2 = new MessageReceiver(alarmDestinationID);
addReceiver(receiver2);
messageBus.addListener(receiver2.getDestination(), receiver2.getMessageListener());
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java
index 0592da9e7..25bdf8d6a 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java
@@ -27,24 +27,23 @@
import org.bitrepository.bitrepositorymessages.Message;
import org.bitrepository.protocol.messagebus.MessageBus;
import org.bitrepository.protocol.messagebus.MessageListener;
-import org.jaccept.TestEventManager;
+
import javax.jms.JMSException;
import java.util.List;
public class MessageBusWrapper implements MessageBus {
private final MessageBus messageBus;
- private final TestEventManager testEventManager;
+
- public MessageBusWrapper(MessageBus messageBus, TestEventManager testEventManager) {
+ public MessageBusWrapper(MessageBus messageBus) {
super();
this.messageBus = messageBus;
- this.testEventManager = testEventManager;
}
@Override
public void sendMessage(Message content) {
- testEventManager.addStimuli("Sending message: " + content);
+// testEventManager.addStimuli("Sending message: " + content);
messageBus.sendMessage(content);
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java
index 278c48654..4497e89dd 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java
@@ -27,7 +27,7 @@
import org.bitrepository.bitrepositorymessages.Message;
import org.bitrepository.protocol.MessageContext;
import org.bitrepository.protocol.messagebus.MessageListener;
-import org.jaccept.TestEventManager;
+
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,15 +65,14 @@ public class MessageReceiver {
private final MessageModel messageModel = new MessageModel();
private final String destination;
private final MessageListener messageListener;
- private final TestEventManager testEventManager;
+
/**
* @param destination The destination to use for the receiver. Primarily used for logging purposes.
- * @param testEventManager The test event manager to use for
*/
- public MessageReceiver(String destination, TestEventManager testEventManager) {
+ public MessageReceiver(String destination) {
this.destination = destination;
- this.testEventManager = testEventManager;
+
messageListener = new TestMessageHandler();
}
@@ -153,7 +152,6 @@ public @@ -64,7 +66,7 @@ * This is controlled through the variables 'WRITE_RESULTS_TO_FILE', which deternimes whether to write to the file, and * 'OUTPUT_FILE_NAME' which is the name of the file to write the output results. */ -public class MessageBusNumberOfListenersStressTest extends ExtendedTestCase { +public class MessageBusNumberOfListenersStressTest { /** * The queue name. */ diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java index 355a27f6e..c9a1fc450 100644 --- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java +++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java @@ -37,7 +37,6 @@ import org.bitrepository.protocol.messagebus.MessageListener; import org.bitrepository.protocol.security.DummySecurityManager; import org.bitrepository.protocol.security.SecurityManager; -import org.jaccept.structure.ExtendedTestCase; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -47,10 +46,13 @@ import java.util.Date; +import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription; +import static org.bitrepository.protocol.utils.AllureTestUtils.addStep; + /** * Stress testing of the messagebus. */ -public class MessageBusNumberOfMessagesStressTest extends ExtendedTestCase { +public class MessageBusNumberOfMessagesStressTest { /** The name of the queue to send the messages.*/ private static String QUEUE = "TEST-QUEUE"; private Settings settings; diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java index 63e69a045..3df50e220 100644 --- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java +++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java @@ -41,22 +41,24 @@ import org.bitrepository.protocol.security.DummySecurityManager; import org.bitrepository.protocol.security.SecurityManager; import org.bitrepository.settings.repositorysettings.MessageBusConfiguration; -import org.jaccept.structure.ExtendedTestCase; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; - +import org.bitrepository.protocol.utils.AllureTestUtils; import java.util.Date; +import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription; +import static org.bitrepository.protocol.utils.AllureTestUtils.addStep; + /** * Stress testing of the messagebus. *
* The size is regulated by the 'BUFFER_TEXT' and the 'NUMBER_OF_REPEATS_OF_BUFFER_TEXT'.
* Currently, the buffer text is 100 bytes, and it is repeated 100 times, thus generating a message of size 10 kB.
*/
-public class MessageBusSizeOfMessageStressTest extends ExtendedTestCase {
+public class MessageBusSizeOfMessageStressTest {
private static String QUEUE = "TEST-QUEUE";
private final long TIME_FRAME = 60000L;
private Settings settings;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
index e36e5f91c..81aaa8f9e 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
@@ -38,7 +38,6 @@
import org.bitrepository.protocol.security.DummySecurityManager;
import org.bitrepository.protocol.security.SecurityManager;
import org.bitrepository.settings.repositorysettings.MessageBusConfiguration;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
@@ -47,10 +46,13 @@
import java.util.Date;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
/**
* Stress testing of the messagebus.
*/
-public class MessageBusTimeToSendMessagesStressTest extends ExtendedTestCase {
+public class MessageBusTimeToSendMessagesStressTest {
/** The time to wait when sending a message before it definitely should
* have been consumed by a listener.*/
static final int TIME_FOR_MESSAGE_TRANSFER_WAIT = 500;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
index d1f66f9c2..6b66fe5f7 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
@@ -26,7 +26,6 @@
import org.bouncycastle.cms.SignerInformation;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.util.encoders.Base64;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -40,7 +39,10 @@
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
-public class CertificateIDTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class CertificateIDTest {
@Test
@Tag("regressiontest")
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
index be20bdf14..7fe42400c 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
@@ -26,7 +26,6 @@
import org.bouncycastle.cms.SignerId;
import org.bouncycastle.cms.SignerInformation;
import org.bouncycastle.util.encoders.Base64;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -34,9 +33,12 @@
import java.math.BigInteger;
import java.security.cert.X509Certificate;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addFixture;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
-public class PermissionStoreTest extends ExtendedTestCase {
+public class PermissionStoreTest {
private static final String componentID = "TEST";
private PermissionStore permissionStore;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
index 1bf4a7b2a..df2c3dfde 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
@@ -37,7 +37,6 @@
import org.bitrepository.settings.repositorysettings.Permission;
import org.bitrepository.settings.repositorysettings.PermissionSet;
import org.bouncycastle.util.encoders.Base64;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
@@ -51,7 +50,10 @@
import java.nio.charset.StandardCharsets;
import java.util.List;
-public class SecurityManagerTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class SecurityManagerTest {
private final Logger log = LoggerFactory.getLogger(getClass());
private org.bitrepository.protocol.security.SecurityManager securityManager;
private PermissionStore permissionStore;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java
index 46addbde1..919badf2e 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java
@@ -21,13 +21,15 @@
*/
package org.bitrepository.protocol.security.exception;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class CertificateUseExceptionTest extends ExtendedTestCase {
+
+public class CertificateUseExceptionTest {
@Test
@Tag("regressiontest" )
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
index 94bda84d8..50f30910c 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
@@ -21,13 +21,15 @@
*/
package org.bitrepository.protocol.security.exception;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class MessageAuthenticationExceptionTest extends ExtendedTestCase {
+
+public class MessageAuthenticationExceptionTest {
@Test @Tag("regressiontest" )
public void testMessageAuthenticationException() throws Exception {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java
index 123b675b7..65959be94 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java
@@ -21,12 +21,16 @@
*/
package org.bitrepository.protocol.security.exception;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import org.bitrepository.protocol.utils.AllureTestUtils;
-public class MessageSignerExceptionTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+
+public class MessageSignerExceptionTest {
@Test
@Tag("regressiontest")
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
index 4ba44cb01..ee916b7e0 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
@@ -21,13 +21,15 @@
*/
package org.bitrepository.protocol.security.exception;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class OperationAuthorizationExceptionTest extends ExtendedTestCase {
+
+public class OperationAuthorizationExceptionTest {
@Test @Tag("regressiontest" )
public void testOperationAuthorizationException() throws Exception {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
index b1f5c00ef..cb6ea64b6 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
@@ -21,13 +21,15 @@
*/
package org.bitrepository.protocol.security.exception;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class PermissionStoreExceptionTest extends ExtendedTestCase {
+
+public class PermissionStoreExceptionTest {
@Test @Tag("regressiontest")
public void testPermissionStoreException() throws Exception {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
index 55f18cbb0..68395d905 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
@@ -21,12 +21,14 @@
*/
package org.bitrepository.protocol.security.exception;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-public class SecurityExceptionTest extends ExtendedTestCase {
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
+public class SecurityExceptionTest {
@Test @Tag("regressiontest" )
public void testSecurityException() throws Exception {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
index c2e261603..06581f74f 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
@@ -21,13 +21,15 @@
*/
package org.bitrepository.protocol.security.exception;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
-public class UnregisteredPermissionTest extends ExtendedTestCase {
+
+public class UnregisteredPermissionTest {
@Test @Tag("regressiontest")
public void testUnregisteredPermissionException() throws Exception {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/AllureEventLogger.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/AllureEventLogger.java
new file mode 100644
index 000000000..ea240f24b
--- /dev/null
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/AllureEventLogger.java
@@ -0,0 +1,161 @@
+package org.bitrepository.protocol.utils;
+
+import io.qameta.allure.Allure;
+import io.qameta.allure.Step;
+import io.qameta.allure.model.Status;
+import com.google.gson.Gson;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+public class AllureEventLogger {
+ private final ListTestEventManager used to manage the event for the associated test. */
- private final TestEventManager testEventManager;
+
/** The constructor.
- *
- * @param testEventManager The TestEventManager used to manage the event for the associated test.
*/
- public ClientEventLogger(TestEventManager testEventManager) {
+ public ClientEventLogger() {
super();
- this.testEventManager = testEventManager;
+
}
@Override
public void handleEvent(OperationEvent event) {
- testEventManager.addResult("Received event: "+ event);
+ io.qameta.allure.Allure.step("Received event: " + event.getEventType(), () -> {
+ io.qameta.allure.Allure.addAttachment("Event Details", event.toString());
+ });
}
}
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java
index b7e6b9491..dd47ef841 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java
@@ -52,7 +52,7 @@ public void generalMethodSetup(TestInfo testInfo) throws Exception {
protected void registerMessageReceivers() {
super.registerMessageReceivers();
- clientReceiver = new MessageReceiver(settingsForTestClient.getReceiverDestinationID(), testEventManager);
+ clientReceiver = new MessageReceiver(settingsForTestClient.getReceiverDestinationID());
addReceiver(clientReceiver);
Collectionsuper.registerReceivers() when overriding
*/
protected void registerMessageReceivers() {
- alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination(), testEventManager);
+ alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination());
addReceiver(alarmReceiver);
}
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/ContributorTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/ContributorTest.java
index c03ed49cd..95cd95f1e 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/ContributorTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/ContributorTest.java
@@ -42,12 +42,12 @@ protected void registerMessageReceivers() {
super.registerMessageReceivers();
clientDestinationId = settingsForTestClient.getReceiverDestinationID();
- clientReceiver = new MessageReceiver(clientDestinationId, testEventManager);
+ clientReceiver = new MessageReceiver(clientDestinationId);
addReceiver(clientReceiver);
contributorDestinationId =
settingsForCUT.getCollectionDestination() + "-" + getContributorID() + "-" + getTopicPostfix();
- contributorReceiver = new MessageReceiver(contributorDestinationId + " topic receiver", testEventManager);
+ contributorReceiver = new MessageReceiver(contributorDestinationId + " topic receiver");
addReceiver(contributorReceiver);
}
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java
index 666869cd6..5501911d9 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java
@@ -28,7 +28,6 @@
import org.bitrepository.service.database.DatabaseUtils;
import org.bitrepository.service.database.DerbyDatabaseDestroyer;
import org.bitrepository.settings.referencesettings.DatabaseSpecifics;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
@@ -36,6 +35,8 @@
import java.io.File;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.bitrepository.service.audit.AuditDatabaseConstants.AUDIT_TRAIL_AUDIT;
import static org.bitrepository.service.audit.AuditDatabaseConstants.DATABASE_VERSION_ENTRY;
import static org.bitrepository.service.audit.AuditDatabaseConstants.FILE_FILE_ID;
@@ -46,7 +47,7 @@
/** Test database migration. Generates jaccept reports.
*
*/
-public class AuditTrailContributorDatabaseMigrationTest extends ExtendedTestCase {
+public class AuditTrailContributorDatabaseMigrationTest {
protected Settings settings;
static final String PATH_TO_DATABASE_UNPACKED = "target/test/audits/auditcontributerdb-v1";
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java
index 0c70e6f10..27a9d4828 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java
@@ -29,7 +29,6 @@
import org.bitrepository.service.database.DatabaseManager;
import org.bitrepository.service.database.DerbyDatabaseDestroyer;
import org.bitrepository.settings.referencesettings.DatabaseSpecifics;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
@@ -41,9 +40,12 @@
import java.util.Date;
import java.util.Locale;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
/** Run audit trail contributor database test using Derby. Generates jaccept reports. */
-public class AuditTrailContributorDatabaseTest extends ExtendedTestCase {
+public class AuditTrailContributorDatabaseTest {
private Settings settings;
private DatabaseSpecifics databaseSpecifics;
private String firstCollectionID;
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java
index 4e3ee220c..e9e928d3b 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java
@@ -22,16 +22,18 @@
package org.bitrepository.service.exception;
import org.bitrepository.bitrepositoryelements.ResponseCode;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
/**
* jaccept steps to validate that the exception thrown is the exception thrown.
*/
-public class IdentifyContributorExceptionTest extends ExtendedTestCase {
+public class IdentifyContributorExceptionTest {
private final String TEST_COLLECTION_ID = "test-collection-id";
@Test
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java
index e34690947..2abd7cc3c 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java
@@ -22,10 +22,11 @@
package org.bitrepository.service.exception;
import org.bitrepository.bitrepositoryelements.ResponseCode;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -36,7 +37,7 @@
* Test that IllegalOperationException behaves as expected.
*/
-public class IllegalOperationExceptionTest extends ExtendedTestCase {
+public class IllegalOperationExceptionTest {
private final String TEST_COLLECTION_ID = "test-collection-id";
@Test
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java
index ee2629689..ddf21746f 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java
@@ -23,16 +23,18 @@
import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.bitrepositoryelements.ResponseInfo;
-import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+
/**
* Test that InvalidMessageException works as expected.
*/
-public class InvalidMessageExceptionTest extends ExtendedTestCase {
+public class InvalidMessageExceptionTest {
private final String TEST_COLLECTION_ID = "test-collection-id";
@Test
diff --git a/pom.xml b/pom.xml
index d57801d8d..cbc9d9cbc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -213,17 +213,35 @@
* Note that the normal way of creating client through the module factory would reuse components with settings from
* previous tests.
+ *
* @return A new GetFileIDsClient(Wrapper).
*/
private GetFileIDsClient createGetFileIDsClient() {
@@ -404,16 +414,14 @@ private GetFileIDsClient createGetFileIDsClient() {
@Override
protected MessageResponse createIdentifyResponse(MessageRequest identifyRequest, String from, String to) {
- MessageResponse response = messageFactory.createIdentifyPillarsForGetFileIDsResponse(
- (IdentifyPillarsForGetFileIDsRequest)identifyRequest, from, to);
- return response;
+ return messageFactory.createIdentifyPillarsForGetFileIDsResponse(
+ (IdentifyPillarsForGetFileIDsRequest) identifyRequest, from, to);
}
@Override
protected MessageResponse createFinalResponse(MessageRequest request, String from, String to) {
- MessageResponse response = messageFactory.createGetFileIDsFinalResponse(
- (GetFileIDsRequest)request, from, to);
- return response;
+ return messageFactory.createGetFileIDsFinalResponse(
+ (GetFileIDsRequest) request, from, to);
}
@Override
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java
index 6197abec6..3c3bafca9 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java
@@ -34,8 +34,12 @@ public GetStatusClientTestWrapper(GetStatusClient getStatusClient) {
@Override
public void getStatus(EventHandler eventHandler) {
- io.qameta.allure.Allure.step("Calling getStatus", () -> {
+ if (io.qameta.allure.Allure.getLifecycle().getCurrentTestCase().isPresent()) {
+ io.qameta.allure.Allure.step("Calling getStatus", () -> {
+ getStatusClient.getStatus(eventHandler);
+ });
+ } else {
getStatusClient.getStatus(eventHandler);
- });
+ }
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
index a6da3cb2a..55eff7cf4 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
@@ -24,8 +24,11 @@
*/
package org.bitrepository.protocol;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.core.util.StatusPrinter;
import io.qameta.allure.Allure;
import io.qameta.allure.Step;
+import io.qameta.allure.junit5.AllureJunit5;
import org.bitrepository.common.settings.Settings;
import org.bitrepository.common.settings.TestSettingsProvider;
import org.bitrepository.common.utils.SettingsUtils;
@@ -41,7 +44,7 @@
import org.bitrepository.protocol.security.SecurityManager;
import org.bitrepository.protocol.utils.AllureTestUtils;
import org.bitrepository.protocol.utils.TestWatcherExtension;
-import org.bitrepository.protocol.utils.AllureEventLogger; // NEW
+import org.bitrepository.protocol.utils.AllureEventLogger;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
@@ -49,6 +52,7 @@
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.slf4j.LoggerFactory;
import javax.jms.JMSException;
import java.net.MalformedURLException;
@@ -57,6 +61,7 @@
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ExtendWith(TestWatcherExtension.class)
+@ExtendWith(AllureJunit5.class)
public abstract class IntegrationTest {
public static LocalActiveMQBroker broker;
public static EmbeddedHttpServer server;
@@ -69,6 +74,7 @@ public abstract class IntegrationTest {
protected static Settings settingsForCUT;
protected static Settings settingsForTestClient;
protected static String collectionID;
+ protected AllureEventLogger eventLogger;
protected String NON_DEFAULT_FILE_ID;
protected static String DEFAULT_FILE_ID;
protected static URL DEFAULT_FILE_URL;
@@ -101,6 +107,7 @@ private void initializationMethod() {
makeUserSpecificSettings(settingsForTestClient);
httpServerConfiguration = new HttpServerConfiguration(settingsForTestClient.getReferenceSettings().getFileExchangeSettings());
collectionID = settingsForTestClient.getCollections().get(0).getID();
+ eventLogger = new AllureEventLogger(getComponentID());
securityManager = createSecurityManager();
DEFAULT_FILE_ID = "DefaultFile";
@@ -133,8 +140,6 @@ public void initMessagebus() {
initializationMethod();
setupMessageBus();
});
- initializationMethod();
- setupMessageBus();
if (System.getProperty("enableLogStatus", "false").equals("true")) {
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
StatusPrinter.print(lc);
@@ -260,14 +265,13 @@ protected void setupMessageBus() {
* Shutdown the message bus.
*/
private void teardownMessageBus() {
- MessageBusManager.clear();
- if (messageBus != null) {
- try {
+ try {
+ if (messageBus != null) {MessageBusManager.clear();
messageBus.close();
messageBus = null;
- } catch (JMSException e) {
- throw new RuntimeException(e);
}
+ } catch (JMSException e) {
+ throw new RuntimeException(e);
}
if (broker != null) {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java
index 25bdf8d6a..43f112df1 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageBusWrapper.java
@@ -43,8 +43,14 @@ public MessageBusWrapper(MessageBus messageBus) {
@Override
public void sendMessage(Message content) {
-// testEventManager.addStimuli("Sending message: " + content);
- messageBus.sendMessage(content);
+ if (io.qameta.allure.Allure.getLifecycle().getCurrentTestCase().isPresent()) {
+ io.qameta.allure.Allure.step("Sending message: " + content.getClass().getSimpleName(), () -> {
+ io.qameta.allure.Allure.addAttachment("Message Content", content.toString());
+ messageBus.sendMessage(content);
+ });
+ } else {
+ messageBus.sendMessage(content);
+ }
}
@Override
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/BitrepositoryEvent.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/BitrepositoryEvent.java
index f746551c6..7b21d3103 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/BitrepositoryEvent.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/BitrepositoryEvent.java
@@ -9,10 +9,6 @@ public class BitrepositoryEvent {
private final Instant timestamp;
private final Map
* Note that the normal way of creating client through the module factory would reuse components with settings from
* previous tests.
+ *
* @return A new AuditTrailClient(Wrapper).
*/
private AuditTrailClient createAuditTrailClient() {
return new AuditTrailClientTestWrapper(new ConversationBasedAuditTrailClient(
- settingsForCUT, conversationMediator, messageBus, settingsForTestClient.getComponentID()) , testEventManager);
+ settingsForCUT, conversationMediator, messageBus, settingsForTestClient.getComponentID()), testEventManager);
}
private ResultingAuditTrails createTestResultingAuditTrails(String componentID) {
@@ -528,7 +529,7 @@ protected MessageResponse createIdentifyResponse(
@Override
protected MessageResponse createFinalResponse(MessageRequest request, String from, String to) {
- MessageResponse response = testMessageFactory.createGetAuditTrailsFinalResponse(
+ MessageResponse response = testMessageFactory.createGetAuditTrailsFinalResponse(
(GetAuditTrailsRequest) request, from, to, null);
return response;
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java
index 729c76df6..730adf578 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java
@@ -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
*
* Note that the normal way of creating client through the module factory would reuse components with settings from
* previous tests.
+ *
* @return A new GetFileClient(Wrapper).
*/
private GetChecksumsClient createGetChecksumsClient() {
@@ -388,7 +389,7 @@ protected MessageResponse createIdentifyResponse(MessageRequest identifyRequest,
@Override
protected MessageResponse createFinalResponse(MessageRequest request, String from, String to) {
- MessageResponse response = messageFactory.createGetChecksumsFinalResponse(
+ MessageResponse response = messageFactory.createGetChecksumsFinalResponse(
(GetChecksumsRequest) request, from, to);
return response;
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
index 3eb9c8523..b1ec002b2 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
@@ -1,23 +1,23 @@
/*
* #%L
* bitrepository-access-client
- *
+ *
* $Id$
* $HeadURL$
* %%
* Copyright (C) 2010 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
*
* Note that the normal way of creating client through the module factory would reuse components with settings from
* previous tests.
+ *
* @return A new GetFileClient(Wrapper).
*/
private GetFileClient createGetFileClient() {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
index bc94be755..bb5666ac8 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
@@ -8,16 +8,16 @@
* Copyright (C) 2010 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
*
* Note that the normal way of creating client through the module factory would reuse components with settings from
* previous tests.
+ *
* @return A new GetFileIDsClient(Wrapper).
*/
private GetFileIDsClient createGetFileIDsClient() {
@@ -408,14 +410,14 @@ private GetFileIDsClient createGetFileIDsClient() {
@Override
protected MessageResponse createIdentifyResponse(MessageRequest identifyRequest, String from, String to) {
MessageResponse response = messageFactory.createIdentifyPillarsForGetFileIDsResponse(
- (IdentifyPillarsForGetFileIDsRequest)identifyRequest, from, to);
+ (IdentifyPillarsForGetFileIDsRequest) identifyRequest, from, to);
return response;
}
@Override
protected MessageResponse createFinalResponse(MessageRequest request, String from, String to) {
- MessageResponse response = messageFactory.createGetFileIDsFinalResponse(
- (GetFileIDsRequest)request, from, to);
+ MessageResponse response = messageFactory.createGetFileIDsFinalResponse(
+ (GetFileIDsRequest) request, from, to);
return response;
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
index 52b3858ed..0f3eb74d8 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
@@ -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
*
+ * Note that the normal way of creating client through the module factory would reuse components with settings from
+ * previous tests.
+ *
+ * @return A new GetStatusClient(Wrapper).
+ */
+ private GetStatusClient createGetStatusClient() {
+ return new GetStatusClientTestWrapper(new ConversationBasedGetStatusClient(
+ messageBus, conversationMediator, settingsForCUT, settingsForTestClient.getComponentID()), testEventManager);
+ }
+
+ private ResultingStatus createTestResultingStatus(String componentID) {
+ ResultingStatus resultingStatus = new ResultingStatus();
+ StatusInfo info = new StatusInfo();
+ info.setStatusCode(StatusCode.OK);
+ info.setStatusText("Everythings fine..");
+ resultingStatus.setStatusInfo(info);
+ resultingStatus.setStatusTimestamp(CalendarUtils.getNow());
+ return resultingStatus;
+ }
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
index bb9ec8719..e13726449 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
@@ -6,16 +6,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
* " +
- "Finally a operation request should be sent to pillar1 and a REQUEST_SENT event be " +
- "generated");
+ "event should be generated followed by a IDENTIFICATION_COMPLETE. " +
+ "Finally a operation request should be sent to pillar1 and a REQUEST_SENT event be " +
+ "generated");
messageBus.sendMessage(createIdentifyResponse(identifyRequest, PILLAR1_ID, pillar1DestinationId));
- assertEquals(testEventHandler.waitForEvent().getEventType(), OperationEventType.COMPONENT_IDENTIFIED);
+ assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
MessageResponse identifyResponse2 = createIdentifyResponse(identifyRequest, PILLAR2_ID, pillar2DestinationId);
identifyResponse2.getResponseInfo().setResponseCode(ResponseCode.IDENTIFICATION_NEGATIVE);
messageBus.sendMessage(identifyResponse2);
- assertEquals(testEventHandler.waitForEvent().getEventType(), OperationEventType.COMPONENT_FAILED);
- assertEquals(testEventHandler.waitForEvent().getEventType(), OperationEventType.IDENTIFICATION_COMPLETE);
+ assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
waitForRequest(pillar1Receiver);
- assertEquals(testEventHandler.waitForEvent().getEventType(), OperationEventType.REQUEST_SENT);
+ assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Wait for 1 second", "An FAILED event should be received");
- assertEquals(testEventHandler.waitForEvent().getEventType(),
- OperationEventType.FAILED);
+ assertEquals(OperationEventType.FAILED,
+ testEventHandler.waitForEvent().getEventType());
}
-
+
@Test
@Tag("regressiontest")
public void collectionIDIncludedInEventsTest() throws Exception {
@@ -246,46 +246,46 @@ public void collectionIDIncludedInEventsTest() throws Exception {
addStep("Start the operation", "A IDENTIFY_REQUEST_SENT event should be received.");
startOperation(testEventHandler);
-
+
OperationEvent event1 = testEventHandler.waitForEvent();
- assertEquals(event1.getEventType(), OperationEventType.IDENTIFY_REQUEST_SENT);
+ assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, event1.getEventType());
assertEquals(event1.getCollectionID(), collectionID);
MessageRequest identifyRequest = waitForIdentifyRequest();
addStep("Send positive responses from the pillar1 and a negative response from pillar2",
"A COMPONENT_IDENTIFIED + a " +
- "event should be generated followed by a IDENTIFICATION_COMPLETE. " +
- "Finally a operation request should be sent to pillar1 and a REQUEST_SENT event be " +
- "generated");
+ "event should be generated followed by a IDENTIFICATION_COMPLETE. " +
+ "Finally a operation request should be sent to pillar1 and a REQUEST_SENT event be " +
+ "generated");
messageBus.sendMessage(createIdentifyResponse(identifyRequest, PILLAR1_ID, pillar1DestinationId));
-
+
OperationEvent event2 = testEventHandler.waitForEvent();
- assertEquals(event2.getEventType(), OperationEventType.COMPONENT_IDENTIFIED);
+ assertEquals(OperationEventType.COMPONENT_IDENTIFIED, event2.getEventType());
assertEquals(event2.getCollectionID(), collectionID);
-
+
MessageResponse identifyResponse2 = createIdentifyResponse(identifyRequest, PILLAR2_ID, pillar2DestinationId);
identifyResponse2.getResponseInfo().setResponseCode(ResponseCode.IDENTIFICATION_NEGATIVE);
messageBus.sendMessage(identifyResponse2);
-
+
OperationEvent event3 = testEventHandler.waitForEvent();
- assertEquals(event3.getEventType(), OperationEventType.COMPONENT_FAILED);
+ assertEquals(OperationEventType.COMPONENT_FAILED, event3.getEventType());
assertEquals(event3.getCollectionID(), collectionID);
-
+
OperationEvent event4 = testEventHandler.waitForEvent();
- assertEquals(event4.getEventType(), OperationEventType.IDENTIFICATION_COMPLETE);
+ assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, event4.getEventType());
assertEquals(event4.getCollectionID(), collectionID);
-
+
waitForRequest(pillar1Receiver);
-
+
OperationEvent event5 = testEventHandler.waitForEvent();
- assertEquals(event5.getEventType(), OperationEventType.REQUEST_SENT);
+ assertEquals(OperationEventType.REQUEST_SENT, event5.getEventType());
assertEquals(event5.getCollectionID(), collectionID);
addStep("Wait for 1 second", "An FAILED event should be received");
OperationEvent event6 = testEventHandler.waitForEvent();
- assertEquals(event6.getEventType(), OperationEventType.FAILED);
+ assertEquals(OperationEventType.FAILED, event6.getEventType());
assertEquals(event6.getCollectionID(), collectionID);
- }
+ }
@Test
@Tag("regressiontest")
@@ -301,19 +301,24 @@ public void conversationTimeoutTest() throws Exception {
addStep("Start the operation",
"A IDENTIFY_REQUEST_SENT event should be generated followed by a FAILED event after 100 ms.");
startOperation(testEventHandler);
- assertEquals(testEventHandler.waitForEvent().getEventType(), OperationEventType.IDENTIFY_REQUEST_SENT);
+ assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
assertNotNull(waitForIdentifyRequest());
- assertEquals(testEventHandler.waitForEvent().getEventType(), OperationEventType.FAILED);
+ assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
protected abstract MessageResponse createIdentifyResponse(MessageRequest identifyRequest, String from, String to);
+
protected abstract MessageResponse createFinalResponse(MessageRequest request, String from, String to);
protected abstract MessageRequest waitForIdentifyRequest();
+
protected abstract MessageRequest waitForRequest(MessageReceiver receiver);
+
protected abstract void checkNoRequestIsReceived(MessageReceiver receiver);
- /** Makes a default call to the client for the operation */
+ /**
+ * Makes a default call to the client for the operation
+ */
protected abstract void startOperation(TestEventHandler testEventHandler);
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
index e9d4d444c..87bef14a6 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
@@ -45,8 +45,8 @@ public void testNegativeResponse() {
throw new NegativeResponseException(errMsg, responseCode);
} catch (Exception e) {
Assertions.assertInstanceOf(NegativeResponseException.class, e);
- Assertions.assertEquals(e.getMessage(), errMsg);
- Assertions.assertEquals(((NegativeResponseException) e).getErrorCode(), responseCode);
+ Assertions.assertEquals(errMsg, e.getMessage());
+ Assertions.assertEquals(responseCode, ((NegativeResponseException) e).getErrorCode());
Assertions.assertNull(e.getCause());
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
index babb22b29..5fe3eb135 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
@@ -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
*
* Note that the normal way of creating client through the module factory would reuse components with settings from
* previous tests.
+ *
* @return A new DeleteFileClient(Wrapper).
*/
private DeleteFileClient createDeleteFileClient() {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
index 441a9c3e0..293cdb574 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
@@ -1,23 +1,23 @@
/*
* #%L
* Bitrepository Access Client
- *
+ *
* $Id$
* $HeadURL$
* %%
* Copyright (C) 2010 - 2011 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
*
+ * Note that the normal way of creating client through the module factory would reuse components with settings from
+ * previous tests.
+ *
+ * @return A new PutFileClient(Wrapper).
+ */
private PutFileClient createPutFileClient() {
return new PutFileClientTestWrapper(new ConversationBasedPutFileClient(
messageBus, conversationMediator, settingsForCUT, settingsForTestClient.getComponentID())
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
index 22e3fce80..17630a4ce 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
@@ -1,23 +1,23 @@
/*
* #%L
* Bitrepository Access Client
- *
+ *
* $Id: PutFileClientComponentTest.java 626 2011-12-09 13:23:52Z jolf $
* $HeadURL: https://sbforge.org/svn/bitrepository/bitrepository-reference/trunk/bitrepository-modifying-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java $
* %%
* Copyright (C) 2010 - 2011 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
*
* Note That no setup/teardown is possible in this test of external pillars, so tests need to be written
* to be invariant against the initial pillar state.
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public abstract class PillarIntegrationTest extends IntegrationTest {
- /** The path to the directory containing the integration test configuration files */
+ /**
+ * The path to the directory containing the integration test configuration files
+ */
protected static final String PATH_TO_CONFIG_DIR = System.getProperty(
"pillar.integrationtest.settings.path",
- "conf"); /** The path to the directory containing the integration test configuration files */
+ "conf");
+ /**
+ * The path to the directory containing the integration test configuration files
+ */
protected static final String PATH_TO_TESTPROPS_DIR = System.getProperty(
"pillar.integrationtest.testprops.path",
"testprops");
@@ -90,7 +95,7 @@ protected void initializeCUT() {
reloadMessageBus();
clientProvider = new ClientProvider(securityManager, settingsForTestClient, testEventManager);
pillarFileManager = new PillarFileManager(collectionID,
- getPillarID(), settingsForTestClient, clientProvider, testEventManager, httpServerConfiguration);
+ getPillarID(), settingsForTestClient, clientProvider, testEventManager, httpServerConfiguration);
clientEventHandler = new ClientEventLogger(testEventManager);
}
@@ -106,9 +111,9 @@ public void setupPillarIntegrationTest(TestInfo testInfo) {
@AfterAll
public void shutdownRealMessageBus() {
- if(!useEmbeddedMessageBus()) {
+ if (!useEmbeddedMessageBus()) {
MessageBusManager.clear();
- if(messageBus != null) {
+ if (messageBus != null) {
try {
messageBus.close();
} catch (JMSException e) {
@@ -118,17 +123,17 @@ public void shutdownRealMessageBus() {
}
}
}
-
+
@AfterEach
public void addFailureContextInfo() {
}
protected void setupRealMessageBus() {
- if(!useEmbeddedMessageBus()) {
+ if (!useEmbeddedMessageBus()) {
MessageBusManager.clear();
messageBus = MessageBusManager.getMessageBus(settingsForCUT, securityManager);
} else {
- MessageBusManager.injectCustomMessageBus(MessageBusManager.DEFAULT_MESSAGE_BUS, messageBus);
+ MessageBusManager.injectCustomMessageBus(MessageBusManager.DEFAULT_MESSAGE_BUS, messageBus);
}
}
@@ -150,6 +155,7 @@ public void initMessagebus() {
* The type of pillar (full or checksum) is baed on the test group used, eg. if the group is
* Direct replacement for the TestNG suite XML:
+ * This must be called exactly once, from the first test class's {@code @BeforeAll}.
+ */
+ public static void registerPillar(EmbeddedPillar pillar) {
+ synchronized (LOCK) {
+ if (embeddedPillar != null) {
+ throw new IllegalStateException("Pillar already registered");
+ }
+ embeddedPillar = pillar;
+
+ // Register shutdown hook to ensure pillar is stopped even if tests fail
+ if (!shutdownHookRegistered) {
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+ if (embeddedPillar != null) {
+ embeddedPillar.shutdown();
+ }
+ }, "pillar-shutdown"));
+ shutdownHookRegistered = true;
+ }
+ }
+ }
+
+ /**
+ * Returns {@code true} when the suite should use a checksum pillar.
+ *
+ * {@code testContext.getIncludedGroups().contains("checksumPillarTest")}.
+ */
+ public static boolean isChecksumPillar() {
+ String type = System.getProperty(PILLAR_TYPE_PROPERTY, CHECKSUM);
+ return CHECKSUM.equalsIgnoreCase(type);
+ }
+}
From 9a7f4639947c5a9099d92bb9c35c23da20bfcc48 Mon Sep 17 00:00:00 2001
From: Asger Askov Blekinge Direct replacement for the TestNG suite XML:
- * TestEventManager used to manage the event for the associated test. */
-
-
/** The constructor.
*/
public ClientEventLogger() {
@@ -272,9 +275,16 @@ public ClientEventLogger() {
@Override
public void handleEvent(OperationEvent event) {
- io.qameta.allure.Allure.step("Received event: " + event.getEventType(), () -> {
- io.qameta.allure.Allure.addAttachment("Event Details", event.toString());
- });
+ MapTimeMeasureComparator class.
*/
public class TimeMeasurementUtilsTest extends ExtendedTestCase {
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void testCompareMilliSeconds() {
addDescription("Test the comparison between TimeMeasure units.");
TimeMeasureTYPE referenceTime = new TimeMeasureTYPE();
@@ -61,7 +62,8 @@ public void testCompareMilliSeconds() {
" should be same as " + compareTime);
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void testCompareMilliSecondsToHours() {
addDescription("Test the comparison between milliseconds and hours.");
long millis = 7200000L;
@@ -87,7 +89,8 @@ public void testCompareMilliSecondsToHours() {
Assertions.assertEquals(TimeMeasurementUtils.getTimeMeasureInLong(referenceTime), millis);
}
- @Test @Tag("regressiontest" )
+ @Test
+ @Tag("regressiontest" )
public void testMaxValue() {
addDescription("Test the Maximum value");
TimeMeasureTYPE time = TimeMeasurementUtils.getMaximumTime();
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
index 086a09685..46da2f022 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
@@ -47,7 +47,8 @@
public class TimeUtilsTest extends ExtendedTestCase {
private static final ZonedDateTime BASE = Instant.EPOCH.atZone(ZoneOffset.UTC);
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void timeTester() throws Exception {
addDescription("Tests the TimeUtils. Pi days = 271433605 milliseconds");
addStep("Test that milliseconds can be converted into human readable seconds",
@@ -224,7 +225,8 @@ private void testHumanDifference(String expected, TemporalAmount... amounts) {
* formatted to depends on the default/system timezone. At some time the use of the old java Date
* api should be discontinued and the new Java Time api used instead.
*/
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void shortDateTest() {
DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.ROOT);
Date date = new Date(1360069129256L);
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java
index 4c9cdab62..8e8f23cd4 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java
@@ -49,10 +49,6 @@
* @IncludeTags("integration") // List your include tags here
* @ExcludeTags("slow") // List your exclude tags here
* @ExtendWith(GlobalSuiteExtension.class)
- * public class BitrepositoryTestSuite {
- * // No need for methods here; this just groups and extends
- * }
- * }
*
*/
@Suite
@@ -61,4 +57,3 @@
public class BitrepositoryTestSuite {
// No need for methods here; this just groups and extends
}
-
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
index ddef0ee6f..9628fb864 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
@@ -56,7 +56,8 @@
* message-xml, thereby also testing whether this is valid. *
*/
public class MessageCreationTest extends ExtendedTestCase {
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void messageCreationTest() throws Exception {
addDescription("Tests if we are able to create message objects from xml. The input XML is the example code " +
"defined in the message-xml, thereby also testing whether this is valid.");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
index 419e6f620..230c84592 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
@@ -93,7 +93,8 @@ public final void collectionFilterTest() throws Exception {
collectionReceiver.checkNoMessageIsReceived(IdentifyPillarsForDeleteFileRequest.class);
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public final void sendMessageToSpecificComponentTest() throws Exception {
addDescription("Test that message bus correct uses the 'to' header property to indicated that the message " +
"is meant for a specific component");
@@ -119,7 +120,8 @@ public void onMessage(Message message) {
assertEquals(receivedMessage.getStringProperty(ActiveMQMessageBus.MESSAGE_TO_KEY), receiverID);
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public final void toFilterTest() throws Exception {
addDescription("Test that message bus filters identify requests to other components, eg. ignores these.");
addStep("Send an identify request with a undefined 'To' header property, " +
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
index b7ba4d935..5ac70aba5 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
@@ -97,7 +97,8 @@ public final void twoListenersForTopicTest() throws Exception {
receiver2.waitForMessage(AlarmMessage.class);
}
- @Test @Tag("specificationonly" )
+ @Test
+ @Tag("specificationonly" )
public final void messageBusFailoverTest() {
addDescription("Verifies that we can switch to at second message bus " +
"in the middle of a conversation, if the connection is lost. " +
@@ -105,7 +106,8 @@ public final void messageBusFailoverTest() {
"message bus");
}
- @Test @Tag("specificationonly" )
+ @Test
+ @Tag("specificationonly" )
public final void messageBusReconnectTest() {
addDescription("Test whether we are able to reconnect to the message " +
"bus if the connection is lost");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java
index f2d37b578..29f0f8fd9 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java
@@ -165,7 +165,8 @@ public void specificMessagePools() {
verifyNoMoreInteractions(thirdStatusListener);
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void specificMessageNamePoolAndDefaultPool() {
addDescription("Tests it is possible to specify a pool for a specific message type, with a " +
"default pool for the remainder.");
@@ -231,7 +232,8 @@ public void specificMessageCategoryPoolAndDefaultPool() {
verifyNoMoreInteractions(thirdStatusListener);
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void specificCollectionPoolAndDefaultPool() {
addDescription("Tests it is possible to specify a pool for a specific collection, with a " +
"default pool for the remainder.");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java
index 63e69a045..9fae1523d 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java
@@ -70,7 +70,8 @@ public void initializeSettings() {
* Tests the amount of messages sent over a message bus, which is not placed locally.
* Requires sending at least five per second.
*/
- /* @Test @Tag("StressTest"} ) */
+ /* @Test
+ @Tag("StressTest"} ) */
public void SendLargeMessagesDistributed() throws Exception {
addDescription("Tests how many messages can be handled within a given timeframe.");
addStep("Define constants", "This should not be possible to fail.");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
index e36e5f91c..11719d7fc 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
@@ -70,7 +70,8 @@ public void initializeSettings() {
* Tests the amount of messages sent over a message bus, which is not placed locally.
* Require sending at least five per second.
*/
- /* @Test @Tag("StressTest"} ) */
+ /* @Test
+ @Tag("StressTest"} ) */
public void SendManyMessagesDistributed() {
addDescription("Tests how fast a given number of messages can be handled.");
addStep("Define constants", "This should not be possible to fail.");
@@ -118,7 +119,8 @@ public void SendManyMessagesDistributed() {
* Tests the amount of messages sent through a local messagebus.
* It should be at least 20 per second.
*/
- @Test @Tag("StressTest")
+ @Test
+ @Tag("StressTest")
public void SendManyMessagesLocally() throws Exception {
addDescription("Tests how many messages can be handled within a given timeframe.");
addStep("Define constants", "This should not be possible to fail.");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
index be20bdf14..9a5be20b9 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
@@ -82,17 +82,20 @@ public void negativeCertificateRetrievalTest() throws Exception {
assertEquals(positiveCertificate, certificateFromStore);
}
- //@Test @Tag("regressiontest"})
+ //@Test
+// @Tag("regressiontest"})
public void certificatePermissionCheckTest() {
addDescription("Tests that a certificate only allows for the expected permission.");
}
- //@Test @Tag("regressiontest"})
+ //@Test
+// @Tag("regressiontest"})
public void unknownCertificatePermissionCheckTest() {
addDescription("Tests that a unknown certificate results in expected refusal.");
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void certificateFingerprintTest() throws Exception {
addDescription("Tests that a certificate fingerprint can correctly be retrieved for a signer.");
addFixture("Create signer to lookup fingerprint");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
index 1bf4a7b2a..e8213e75f 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
@@ -80,7 +80,8 @@ private void setupSecurityManager(Settings settings) {
SecurityTestConstants.getComponentID());
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void operationAuthorizationBehaviourTest() throws Exception {
addDescription("Tests that a signature only allows the correct requests.");
@@ -176,7 +177,8 @@ public void positiveSigningAuthenticationRoundtripTest() throws Exception {
}
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void negativeSigningAuthenticationRoundtripUnkonwnCertificateTest() throws Exception {
addDescription("Tests that a roundtrip of signing a request and afterwards authenticating it fails due to " +
"a unknown certificate.");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
index 94bda84d8..bb4760f14 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
@@ -29,7 +29,8 @@
public class MessageAuthenticationExceptionTest extends ExtendedTestCase {
- @Test @Tag("regressiontest" )
+ @Test
+ @Tag("regressiontest" )
public void testMessageAuthenticationException() throws Exception {
addDescription("Test the instantiation of the exception");
addStep("Setup", "");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
index 4ba44cb01..1bdc7c793 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
@@ -29,7 +29,8 @@
public class OperationAuthorizationExceptionTest extends ExtendedTestCase {
- @Test @Tag("regressiontest" )
+ @Test
+ @Tag("regressiontest" )
public void testOperationAuthorizationException() throws Exception {
addDescription("Test the instantiation of the exception");
addStep("Setup", "");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
index b1f5c00ef..86147f76c 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
@@ -29,7 +29,8 @@
public class PermissionStoreExceptionTest extends ExtendedTestCase {
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void testPermissionStoreException() throws Exception {
addDescription("Test the instantiation of the exception");
addStep("Setup", "");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
index 55f18cbb0..ed0e54f1e 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
@@ -28,7 +28,8 @@
public class SecurityExceptionTest extends ExtendedTestCase {
- @Test @Tag("regressiontest" )
+ @Test
+ @Tag("regressiontest" )
public void testSecurityException() throws Exception {
addDescription("Test the instantiation of the exception");
addStep("Setup", "");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
index c2e261603..a06608e2c 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
@@ -29,7 +29,8 @@
public class UnregisteredPermissionTest extends ExtendedTestCase {
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void testUnregisteredPermissionException() throws Exception {
addDescription("Test the instantiation of the exception");
addStep("Setup", "");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java
index 53907d9a5..967db37f2 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java
@@ -69,7 +69,8 @@ public void testIdentificationResponse() {
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void testProgressResponse() {
addDescription("Tests isPositiveProgressResponse method in the message utility class.");
MessageResponse response = new MessageResponse();
diff --git a/bitrepository-core/src/test/java/org/bitrepository/settings/SettingsProviderTest.java b/bitrepository-core/src/test/java/org/bitrepository/settings/SettingsProviderTest.java
index c9d24ccb7..84513c872 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/settings/SettingsProviderTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/settings/SettingsProviderTest.java
@@ -42,7 +42,8 @@ public void componentIDTest() {
Assertions.assertEquals(settings.getComponentID(), myComponentID);
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void reloadTest() {
String myComponentID = "TestComponentID";
SettingsProvider settingsLoader =
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityWorkflowSchedulerTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityWorkflowSchedulerTest.java
index 45c118b73..bb8a2f59e 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityWorkflowSchedulerTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityWorkflowSchedulerTest.java
@@ -44,7 +44,8 @@
// settings = TestSettingsProvider.reloadSettings("IntegrityWorkflowSchedulerUnderTest");
// }
//
-// @Test @Tag("regressiontest", "integritytest"})
+// @Test
+// @Tag("regressiontest", "integritytest"})
// public void testSchedulerContainingWorkflows() {
// addDescription("Test that schedulers call all workflow at the given intervals.");
// addStep("Setup a scheduler and validate initial state", "No errors and no workflows");
@@ -70,7 +71,8 @@
// Assertions.assertFalse(scheduler.removeWorkflow(testWorkflow.getPrimitiveName()));
// }
//
-// @Test @Tag("regressiontest", "integrationtest"})
+// @Test
+// @Tag("regressiontest", "integrationtest"})
// public void schedulerTester() throws Exception {
// addDescription("Tests that the scheduler is able make calls to the collector at given intervals.");
// addStep("Setup the variables and such.", "Should not be able to fail here.");
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java
index 8204fc08b..1450ba9df 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java
@@ -93,14 +93,20 @@ protected void customizeSettings() {
settings.getRepositorySettings().getCollections().getCollection().add(extraCollection);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest")
+ @Tag("databasetest")
+ @Tag("integritytest")
public void instantiationTest() throws Exception {
addDescription("Testing the connection to the integrity database.");
IntegrityDAO cache = createDAO();
Assertions.assertNotNull(cache);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest")
+ @Tag("databasetest")
+ @Tag("integritytest")
public void reinitialiseDatabaseTest() throws Exception {
addDescription("Testing the connection to the integrity database.");
addStep("Setup manually.", "Should be created.");
@@ -124,7 +130,8 @@ public void reinitialiseDatabaseTest() throws Exception {
cache = new DerbyIntegrityDAO(newdm.getConnector());
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void initialStateExtractionTest() throws Exception {
addDescription("Tests the initial state of the IntegrityModel. Should not contain any data.");
IntegrityDAO cache = createDAO();
@@ -291,7 +298,8 @@ public void testDeletingEntry() throws Exception {
Assertions.assertEquals(fileinfos.size(), 2);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testDeletingNonExistingEntry() throws Exception {
addDescription("Tests the deletion of an nonexisting FileID entry.");
IntegrityDAO cache = createDAO();
@@ -319,7 +327,8 @@ public void testDeletingNonExistingEntry() throws Exception {
Assertions.assertEquals(fileinfos.size(), 2);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testFindOrphanFiles() throws Exception {
addDescription("Tests the ability to find orphan files.");
IntegrityDAO cache = createDAO();
@@ -349,7 +358,8 @@ public void testFindOrphanFiles() throws Exception {
Assertions.assertEquals(orphanFilesPillar2.size(), 1);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testFindInconsistentChecksum() throws Exception {
addDescription("Testing the localization of inconsistent checksums");
IntegrityDAO cache = createDAO();
@@ -385,7 +395,8 @@ public void testFindInconsistentChecksum() throws Exception {
Assertions.assertEquals(filesWithChecksumError, Arrays.asList(BAD_FILE_ID_1, BAD_FILE_ID_2));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testNoChecksums() throws Exception {
addDescription("Testing the checksum validation, when no checksums exists.");
IntegrityDAO cache = createDAO();
@@ -402,7 +413,8 @@ public void testNoChecksums() throws Exception {
Assertions.assertEquals(filesWithChecksumError, Collections.emptyList());
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testMissingChecksums() throws Exception {
addDescription("Testing the checksum validation, when only one pillar has a checksum for a file.");
IntegrityDAO cache = createDAO();
@@ -427,7 +439,8 @@ public void testMissingChecksums() throws Exception {
Assertions.assertEquals(fileWithMissingChecksumPillar2, Collections.singletonList(TEST_FILE_ID));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testMissingChecksumsChecksumNotUpdated() throws Exception {
addDescription("Testing the checksum validation, when only one pillar has a checksum for a file.");
IntegrityDAO cache = createDAO();
@@ -470,7 +483,8 @@ public void testMissingChecksumsChecksumNotUpdated() throws Exception {
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testOutdatedChecksums() throws Exception {
addDescription("Testing the checksum validation, when only one pillar has a checksum for a file.");
IntegrityDAO cache = createDAO();
@@ -501,7 +515,8 @@ public void testOutdatedChecksums() throws Exception {
Assertions.assertEquals(fileWithOutdatedChecksumPillar2, Collections.singletonList(TEST_FILE_ID));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testExtractingAllKnownFilesForPillars() throws Exception {
addDescription("Tests that known files can be extracted for specific pillars.");
IntegrityDAO cache = createDAO();
@@ -535,7 +550,8 @@ public void testExtractingAllKnownFilesForPillars() throws Exception {
Assertions.assertTrue(fileIDs.isEmpty());
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testExtractingAllKnownFilesForPillarsLimits() throws Exception {
addDescription("Tests the limits for extracting files for specific pillars.");
IntegrityDAO cache = createDAO();
@@ -557,7 +573,8 @@ public void testExtractingAllKnownFilesForPillarsLimits() throws Exception {
Assertions.assertTrue(fileIDs.contains(file2));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testExtractingAllMissingFiles() throws Exception {
addDescription("Tests that missing files can be extracted.");
IntegrityDAO cache = createDAO();
@@ -582,7 +599,8 @@ public void testExtractingAllMissingFiles() throws Exception {
Assertions.assertEquals(missingFiles, Collections.singletonList(file2));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testExtractingAllMissingFilesForPillarsLimits() throws Exception {
addDescription("Tests the limits for extracting missing files for specific pillars.");
IntegrityDAO cache = createDAO();
@@ -607,7 +625,8 @@ public void testExtractingAllMissingFilesForPillarsLimits() throws Exception {
Assertions.assertTrue(fileIDs.contains(file3));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testGetLatestFileDateEntryForCollection() throws Exception {
addDescription("Tests that checksum date entries can be retrieved and manipulated.");
IntegrityDAO cache = createDAO();
@@ -639,7 +658,8 @@ public void testGetLatestFileDateEntryForCollection() throws Exception {
Assertions.assertNull(cache.getLatestFileDate(TEST_COLLECTIONID, TEST_PILLAR_2));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testGetLatestChecksumDateEntryForCollection() throws Exception {
addDescription("Tests that checksum date entries can be retrieved and manipulated.");
IntegrityDAO cache = createDAO();
@@ -661,7 +681,8 @@ public void testGetLatestChecksumDateEntryForCollection() throws Exception {
Assertions.assertNull(cache.getLatestChecksumDate(TEST_COLLECTIONID, TEST_PILLAR_2));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testExtractCollectionFileSize() throws Exception {
addDescription("Tests that the accumulated size of the collection can be extracted");
IntegrityDAO cache = createDAO();
@@ -693,7 +714,8 @@ public void testExtractCollectionFileSize() throws Exception {
Assertions.assertEquals(cache.getCollectionSize(TEST_COLLECTIONID), collectionSize);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testGetFileIDAtIndex() throws Exception {
addDescription("Tests that a fileID at a given index can be extracted.");
IntegrityDAO cache = createDAO();
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java
index d16bbe660..3d6decba5 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java
@@ -84,7 +84,8 @@ protected void customizeSettings() {
settings.getRepositorySettings().getCollections().getCollection().add(extraCollection);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testAddCollectionSuccess() {
addDescription("Tests that a new collection can be added to the integrity database");
String newCollectionID = "new-collectionid";
@@ -107,7 +108,8 @@ public void testAddCollectionSuccess() {
assertTrue(collections.contains(newCollectionID));
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testAddExistingCollection() {
addDescription("Tests that an existing collectionID cannot be added to the integrity database.");
DatabaseManager dm = new IntegrityDatabaseManager(
@@ -161,7 +163,8 @@ public void testRemoveNonExistingCollection() {
assertTrue(collections.contains(EXTRA_COLLECTION));
}
- /*@Test @Tag("regressiontest", "databasetest", "integritytest"})
+ /*@Test
+ @Tag("regressiontest", "databasetest", "integritytest"})
public void testRemoveExistingCollection() {
addDescription("Tests the removal of an existing collection and references to it in the integrity database");
DatabaseManager dm = new IntegrityDatabaseManager(
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java
index c817b1257..ba9d00f5e 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java
@@ -79,7 +79,8 @@ protected void customizeSettings() {
settings.getRepositorySettings().getCollections().getCollection().add(c0);
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void instantiationTest() {
addDescription("Tests that the connection can be instantaited.");
IntegrityDatabase integrityCache = new IntegrityDatabase(settings);
@@ -125,7 +126,8 @@ public void initialStateExtractionTest() {
Assertions.assertTrue(metrics.isEmpty());
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testIngestOfFileIDsData() {
addDescription("Tests the ingesting of file ids data");
IntegrityModel model = new IntegrityDatabase(settings);
@@ -146,7 +148,8 @@ public void testIngestOfFileIDsData() {
}
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testIngestOfChecksumsData() {
addDescription("Tests the ingesting of checksums data");
IntegrityModel model = new IntegrityDatabase(settings);
@@ -166,7 +169,8 @@ public void testIngestOfChecksumsData() {
}
}
- @Test @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("databasetest") @Tag("integritytest")
public void testDeletingEntry() {
addDescription("Tests the deletion of an FileID entry.");
IntegrityModel model = new IntegrityDatabase(settings);
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java
index 9e22727d4..d2cc04c77 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java
@@ -89,7 +89,8 @@ public void testCollectorGetFileIDs() throws Exception {
verifyNoMoreInteractions(eventHandler);
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testCollectorGetChecksums() throws Exception {
addDescription("Tests that the collector calls the GetChecksumsClient");
addStep("Define variables", "No errors");
@@ -124,7 +125,8 @@ public void testCollectorGetChecksums() throws Exception {
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testCollectorGetFile() throws Exception {
addDescription("Tests that the collector calls the GetFileClient");
addStep("Define variables", "No errors");
@@ -152,7 +154,8 @@ public void testCollectorGetFile() throws Exception {
verifyNoMoreInteractions(eventHandler);
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testCollectorPutFile() throws Exception {
addDescription("Tests that the collector calls the PutFileClient");
addStep("Define variables", "No errors");
@@ -183,7 +186,8 @@ public void testCollectorPutFile() throws Exception {
verifyNoMoreInteractions(eventHandler);
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testCollectorHandleChecksumClientFailures() throws Exception {
addDescription("Test that the IntegrityInformationCollector works as a fault-barrier.");
addStep("Setup variables for the test", "Should be OK");
@@ -205,7 +209,8 @@ public void testCollectorHandleChecksumClientFailures() throws Exception {
collector.getChecksums(collectionID, Arrays.asList(pillarID), csType, null, auditTrailInformation, contributorQueries, null);
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testCollectorHandleGetFileIDsClientFailures() throws Exception {
addDescription("Test that the IntegrityInformationCollector works as a fault-barrier.");
addStep("Setup variables for the test", "Should be OK");
@@ -224,7 +229,8 @@ public void testCollectorHandleGetFileIDsClientFailures() throws Exception {
collector.getFileIDs(collectionID, Arrays.asList(pillarID), auditTrailInformation, contributorQueries, null);
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testCollectorHandleGetFileClientFailures() throws Exception {
addDescription("Test that the IntegrityInformationCollector works as a fault-barrier.");
addStep("Define variables", "No errors");
@@ -244,7 +250,8 @@ public void testCollectorHandleGetFileClientFailures() throws Exception {
collector.getFile(collectionID, fileId, uploadUrl, eventHandler, auditTrailInformation);
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testCollectorHandlePutFileClientFailures() throws Exception {
addDescription("Test that the IntegrityInformationCollector works as a fault-barrier.");
addStep("Define variables", "No errors");
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java
index 459308129..9b245849f 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java
@@ -146,7 +146,8 @@ public void testMissingChecksumAndStep() throws Exception {
}
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testMissingChecksumForFirstGetChecksums() throws WorkflowAbortedException {
addDescription("Test that checksums are set to missing, when not found during GetChecksum.");
addStep("Ingest file to database", "");
@@ -191,7 +192,8 @@ public void testMissingChecksumForFirstGetChecksums() throws WorkflowAbortedExce
assertEquals(missingChecksumsPillar2.get(0), TEST_FILE_1);
}
- @Test @Tag("regressiontest") @Tag("integritytest")
+ @Test
+ @Tag("regressiontest") @Tag("integritytest")
public void testMissingChecksumDuringSecondIngest() throws WorkflowAbortedException {
addDescription("Test that checksums are set to missing, when not found during GetChecksum, "
+ "even though they have been found before.");
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java
index ba3159b28..818d379a7 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java
@@ -49,7 +49,8 @@ public void deletedFilesTest() throws Exception {
reporter.generateReport();
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void noIntegrityIssuesTest() {
addDescription("Verifies that missing files are reported correctly");
@@ -61,7 +62,8 @@ public void noIntegrityIssuesTest() {
assertEquals(expectedReport, reporter.generateSummaryOfReport());
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void missingFilesTest() throws Exception {
addDescription("Verifies that missing files are reported correctly");
@@ -112,7 +114,8 @@ public void checksumIssuesTest() throws Exception {
assertEquals(expectedReport, reporter.generateSummaryOfReport());
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void missingChecksumTest() throws Exception {
addDescription("Verifies that missing checksums are reported correctly");
@@ -138,7 +141,8 @@ public void missingChecksumTest() throws Exception {
}
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void obsoleteChecksumTest() throws Exception {
addDescription("Verifies that obsolete checksums are reported correctly");
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityContributorsTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityContributorsTest.java
index f443dfc2f..4bf64dbc9 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityContributorsTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityContributorsTest.java
@@ -37,7 +37,8 @@ public class IntegrityContributorsTest {
private final static String PILLAR1 = "pillar1";
private final static String PILLAR2 = "pillar2";
- @Test @Tag("regressiontest")
+ @Test
+ @Tag("regressiontest")
public void testConstructor() {
IntegrityContributors ic = new IntegrityContributors(Arrays.asList(PILLAR1, PILLAR2), 3);
SetGetFileClient adding test event logging and functionality for handling blocking calls.
*/
public class GetChecksumsClientTestWrapper implements GetChecksumsClient {
- private GetChecksumsClient getChecksumsClientInstance;
- private TestEventManager testEventManager;
+ private final GetChecksumsClient getChecksumsClientInstance;
+ private final TestEventManager testEventManager;
public GetChecksumsClientTestWrapper(GetChecksumsClient createGetChecksumsClient,
TestEventManager testEventManager) {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
index fce2bdc70..3eb9c8523 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
@@ -43,7 +43,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import java.math.BigInteger;
@@ -69,11 +68,9 @@ public void setUpFactory() throws DatatypeConfigurationException {
@Test
@Tag("regressiontest")
public void verifyGetFileClientFromFactory() {
- Assertions.assertTrue(AccessComponentFactory.getInstance().createGetFileClient(
- settingsForCUT, securityManager, settingsForTestClient.getComponentID())
- instanceof ConversationBasedGetFileClient,
- "The default GetFileClient from the Access factory should be of the type '" +
- ConversationBasedGetFileClient.class.getName() + "'.");
+ Assertions.assertInstanceOf(ConversationBasedGetFileClient.class, AccessComponentFactory.getInstance().createGetFileClient(
+ settingsForCUT, securityManager, settingsForTestClient.getComponentID()), "The default GetFileClient from the Access factory should be of the type '" +
+ ConversationBasedGetFileClient.class.getName() + "'.");
}
@Test
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientTestWrapper.java
index 7b1bdf662..f22d8eeca 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientTestWrapper.java
@@ -34,8 +34,8 @@
* Wraps the GetFileClient adding test event logging and functionality for handling blocking calls.
*/
public class GetFileClientTestWrapper implements GetFileClient {
- private GetFileClient createGetFileClient;
- private TestEventManager testEventManager;
+ private final GetFileClient createGetFileClient;
+ private final TestEventManager testEventManager;
public GetFileClientTestWrapper(GetFileClient createGetFileClient,
TestEventManager testEventManager) {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
index e88bf24e2..bc94be755 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
@@ -51,7 +51,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.bind.JAXBException;
import java.math.BigInteger;
import java.net.URL;
@@ -80,10 +79,9 @@ public void setUp() throws JAXBException {
@Test
@Tag("regressiontest")
public void verifyGetFileIDsClientFromFactory() throws Exception {
- Assertions.assertTrue(AccessComponentFactory.getInstance().createGetFileIDsClient(settingsForCUT, securityManager,
- settingsForTestClient.getComponentID()) instanceof ConversationBasedGetFileIDsClient,
- "The default GetFileClient from the Access factory should be of the type '" +
- ConversationBasedGetFileIDsClient.class.getName() + "'.");
+ Assertions.assertInstanceOf(ConversationBasedGetFileIDsClient.class, AccessComponentFactory.getInstance().createGetFileIDsClient(settingsForCUT, securityManager,
+ settingsForTestClient.getComponentID()), "The default GetFileClient from the Access factory should be of the type '" +
+ ConversationBasedGetFileIDsClient.class.getName() + "'.");
}
@Test
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientTestWrapper.java
index 20e2811c1..352e181ca 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientTestWrapper.java
@@ -55,8 +55,7 @@ public void getFileIDs(String collectionID, ContributorQuery[] contributorQuerie
URL addressForResult, EventHandler eventHandler) {
eventManager.addStimuli("Calling getFileIDs(" +
(contributorQueries == null ? "null" : Arrays.asList(contributorQueries)) +
- ", " + fileID + ", " +
- "" + addressForResult + ", "
+ ", " + fileID + ", " + addressForResult + ", "
+ eventHandler + ")");
client.getFileIDs(collectionID, contributorQueries, fileID, addressForResult, eventHandler);
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
index aecfcc948..52b3858ed 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
@@ -41,7 +41,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.datatype.DatatypeFactory;
import java.util.List;
@@ -68,11 +67,9 @@ public void beforeMethodSetup() {
@Test
@Tag("regressiontest")
public void verifyGetStatusClientFromFactory() {
- Assertions.assertTrue(AccessComponentFactory.getInstance().createGetStatusClient(
- settingsForCUT, securityManager, settingsForTestClient.getComponentID())
- instanceof ConversationBasedGetStatusClient,
- "The default GetStatusClient from the Access factory should be of the type '" +
- ConversationBasedGetStatusClient.class.getName() + "'.");
+ Assertions.assertInstanceOf(ConversationBasedGetStatusClient.class, AccessComponentFactory.getInstance().createGetStatusClient(
+ settingsForCUT, securityManager, settingsForTestClient.getComponentID()), "The default GetStatusClient from the Access factory should be of the type '" +
+ ConversationBasedGetStatusClient.class.getName() + "'.");
}
@Test
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java
index 61413eaee..a57405324 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientTestWrapper.java
@@ -25,8 +25,8 @@
import org.jaccept.TestEventManager;
public class GetStatusClientTestWrapper implements GetStatusClient {
- private GetStatusClient getStatusClient;
- private TestEventManager testEventManager;
+ private final GetStatusClient getStatusClient;
+ private final TestEventManager testEventManager;
public GetStatusClientTestWrapper(GetStatusClient getStatusClient,
TestEventManager testEventManager) {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
index faa95cda9..bb9ec8719 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
@@ -31,7 +31,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/conversation/mediator/ConversationMediatorTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/conversation/mediator/ConversationMediatorTest.java
index 5a4428378..3cccff5a9 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/conversation/mediator/ConversationMediatorTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/conversation/mediator/ConversationMediatorTest.java
@@ -59,9 +59,9 @@ public void messagedelegationTest() {
@SuppressWarnings("unused")
private class ConversationStub extends StateBasedConversation {
private boolean hasStarted = false;
- private boolean hasFailed = false;
- private boolean hasEnded = false;
- private Object result = null;
+ private final boolean hasFailed = false;
+ private final boolean hasEnded = false;
+ private final Object result = null;
public ConversationStub() {
super(null);
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
index c10060f29..e9d4d444c 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
@@ -44,7 +44,7 @@ public void testNegativeResponse() {
try {
throw new NegativeResponseException(errMsg, responseCode);
} catch (Exception e) {
- Assertions.assertTrue(e instanceof NegativeResponseException);
+ Assertions.assertInstanceOf(NegativeResponseException.class, e);
Assertions.assertEquals(e.getMessage(), errMsg);
Assertions.assertEquals(((NegativeResponseException) e).getErrorCode(), responseCode);
Assertions.assertNull(e.getCause());
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
index 516620475..babb22b29 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
@@ -42,7 +42,7 @@ public void testUnexpectedResponse() throws Exception {
try {
throw new UnexpectedResponseException(errMsg);
} catch(Exception e) {
- Assertions.assertTrue(e instanceof UnexpectedResponseException);
+ Assertions.assertInstanceOf(UnexpectedResponseException.class, e);
Assertions.assertEquals(e.getMessage(), errMsg);
Assertions.assertNull(e.getCause());
}
@@ -51,10 +51,10 @@ public void testUnexpectedResponse() throws Exception {
try {
throw new UnexpectedResponseException(errMsg, new IllegalArgumentException(causeMsg));
} catch(Exception e) {
- Assertions.assertTrue(e instanceof UnexpectedResponseException);
+ Assertions.assertInstanceOf(UnexpectedResponseException.class, e);
Assertions.assertEquals(e.getMessage(), errMsg);
Assertions.assertNotNull(e.getCause());
- Assertions.assertTrue(e.getCause() instanceof IllegalArgumentException);
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e.getCause());
Assertions.assertEquals(e.getCause().getMessage(), causeMsg);
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
index d386d5445..2c854816d 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
@@ -46,7 +46,7 @@ public void argumentsTesterUnknownArgument() throws Exception {
CommandLineArgumentsHandler clah = new CommandLineArgumentsHandler();
addStep("Validate arguments without any options.", "Ok, when no arguments, but fails when arguments given.");
- clah.parseArguments(new String[0]);
+ clah.parseArguments();
clah.parseArguments("-Xunknown...");
});
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java
index 23ff85903..e5e4ee130 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java
@@ -26,7 +26,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import java.util.Date;
import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java
index d92d46a66..e33e81d12 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java
@@ -26,7 +26,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import java.util.Date;
import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java
index a72ffd6bb..075430613 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java
@@ -26,7 +26,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import java.util.Date;
import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java
index 1ec9cce1d..ef8d6b391 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java
@@ -26,7 +26,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import java.util.Date;
import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java
index 986eab2c2..98eca1b25 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java
@@ -26,9 +26,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
-import java.util.Date;
-
import static org.junit.jupiter.api.Assertions.assertThrows;
public class PutFileCmdTest extends DefaultFixtureClientTest {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java
index 0b0e1c647..40f459e7f 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java
@@ -26,7 +26,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import java.util.Date;
import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
index 990e8b143..2ccd37898 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
@@ -51,7 +51,7 @@ public void setup() {
@Tag("regressiontest")
public void testDefaultChecksumSpec() throws Exception {
addDescription("Test that the default checksum is retrieved when no arguments are given.");
- cmdHandler.parseArguments(new String[]{});
+ cmdHandler.parseArguments();
ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
assertEquals(type.name(), settingsForCUT.getRepositorySettings().getProtocolSettings().getDefaultChecksumType());
}
@@ -60,7 +60,7 @@ public void testDefaultChecksumSpec() throws Exception {
@Tag("regressiontest")
public void testDefaultChecksumSpecWithSaltArgument() throws Exception {
addDescription("Test that the HMAC version of default checksum is retrieved when the salt arguments are given.");
- cmdHandler.parseArguments(new String[]{"-" + Constants.REQUEST_CHECKSUM_SALT_ARG + "0110"});
+ cmdHandler.parseArguments("-" + Constants.REQUEST_CHECKSUM_SALT_ARG + "0110");
ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
assertEquals(type.name(), "HMAC_" + settingsForCUT.getRepositorySettings().getProtocolSettings().getDefaultChecksumType());
}
@@ -70,7 +70,7 @@ public void testDefaultChecksumSpecWithSaltArgument() throws Exception {
public void testNonSaltChecksumSpecWithoutSaltArgument() throws Exception {
addDescription("Test that a non-salt checksum type is retrieved when it is given as argument, and no salt arguments are given.");
ChecksumType enteredType = ChecksumType.SHA384;
- cmdHandler.parseArguments(new String[]{"-" + Constants.REQUEST_CHECKSUM_TYPE_ARG + enteredType});
+ cmdHandler.parseArguments("-" + Constants.REQUEST_CHECKSUM_TYPE_ARG + enteredType);
ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
assertEquals(type, enteredType);
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
index e26cbbc52..da011c51d 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
@@ -46,7 +46,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.datatype.DatatypeFactory;
import java.nio.charset.StandardCharsets;
@@ -68,7 +67,7 @@ public void verifyDeleteClientFromFactory() {
"It should be an instance of SimplePutFileClient");
DeleteFileClient dfc = ModifyComponentFactory.getInstance().retrieveDeleteFileClient(
settingsForCUT, securityManager, settingsForTestClient.getComponentID());
- Assertions.assertTrue(dfc instanceof ConversationBasedDeleteFileClient, "The DeleteFileClient '" + dfc
+ Assertions.assertInstanceOf(ConversationBasedDeleteFileClient.class, dfc, "The DeleteFileClient '" + dfc
+ "' should be instance of '" + ConversationBasedDeleteFileClient.class.getName() + "'");
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java
index 25b7ab2a4..c59a41fee 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientTestWrapper.java
@@ -34,9 +34,9 @@
*/
public class DeleteFileClientTestWrapper implements DeleteFileClient {
/** The PutClient to wrap. */
- private DeleteFileClient wrappedDeleteClient;
+ private final DeleteFileClient wrappedDeleteClient;
/** The manager to monitor the operations.*/
- private TestEventManager testEventManager;
+ private final TestEventManager testEventManager;
/**
* Constructor.
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
index afeb0ed3d..441a9c3e0 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
@@ -45,7 +45,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.datatype.DatatypeFactory;
import java.math.BigInteger;
import java.util.concurrent.TimeUnit;
@@ -71,7 +70,7 @@ public void verifyPutClientFromFactory() {
"It should be an instance of SimplePutFileClient");
PutFileClient pfc = ModifyComponentFactory.getInstance().retrievePutClient(
settingsForCUT, securityManager, settingsForTestClient.getComponentID());
- Assertions.assertTrue(pfc instanceof ConversationBasedPutFileClient, "The PutFileClient '" + pfc + "' should be instance of '"
+ Assertions.assertInstanceOf(ConversationBasedPutFileClient.class, pfc, "The PutFileClient '" + pfc + "' should be instance of '"
+ ConversationBasedPutFileClient.class.getName() + "'");
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java
index 7866467aa..3dab15541 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientTestWrapper.java
@@ -35,8 +35,8 @@
* Wrapper class for a PutFileClient adding test event logging.
*/
public class PutFileClientTestWrapper implements PutFileClient {
- private PutFileClient wrappedPutClient;
- private TestEventManager testEventManager;
+ private final PutFileClient wrappedPutClient;
+ private final TestEventManager testEventManager;
/**
* Constructor.
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
index 01a26586d..22e3fce80 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
@@ -46,7 +46,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import java.net.URL;
@@ -76,7 +75,7 @@ public void verifyReplaceFileClientFromFactory() {
"It should be an instance of ConversationBasedReplaceFileClient");
ReplaceFileClient rfc = ModifyComponentFactory.getInstance().retrieveReplaceFileClient(
settingsForCUT, securityManager, settingsForTestClient.getComponentID());
- Assertions.assertTrue(rfc instanceof ConversationBasedReplaceFileClient, "The ReplaceFileClient '" + rfc
+ Assertions.assertInstanceOf(ConversationBasedReplaceFileClient.class, rfc, "The ReplaceFileClient '" + rfc
+ "' should be instance of '" + ConversationBasedReplaceFileClient.class.getName() + "'");
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java
index 65e1d6360..a7a92a208 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientTestWrapper.java
@@ -36,9 +36,9 @@
*/
public class ReplaceFileClientTestWrapper implements ReplaceFileClient {
/** The PutClient to wrap. */
- private ReplaceFileClient wrappedReplaceClient;
+ private final ReplaceFileClient wrappedReplaceClient;
/** The manager to monitor the operations.*/
- private TestEventManager testEventManager;
+ private final TestEventManager testEventManager;
/**
* @param putClientInstance The instance to wrap and monitor.
diff --git a/bitrepository-core/src/main/java/org/bitrepository/common/JaxbHelper.java b/bitrepository-core/src/main/java/org/bitrepository/common/JaxbHelper.java
index 5f1aaaeed..bd3992cbd 100644
--- a/bitrepository-core/src/main/java/org/bitrepository/common/JaxbHelper.java
+++ b/bitrepository-core/src/main/java/org/bitrepository/common/JaxbHelper.java
@@ -43,7 +43,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
-import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
@@ -121,11 +120,7 @@ public String serializeToXml(Object object) throws JAXBException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JAXBContext.newInstance(object.getClass()).createMarshaller().marshal(object, baos);
String baosContent;
- try {
- baosContent = baos.toString(StandardCharsets.UTF_8.name());
- } catch (UnsupportedEncodingException e) {
- throw new AssertionError("UTF-8 not supported");
- }
+ baosContent = baos.toString(StandardCharsets.UTF_8);
return baosContent;
}
diff --git a/bitrepository-core/src/main/java/org/bitrepository/common/utils/CountAndTimeUnit.java b/bitrepository-core/src/main/java/org/bitrepository/common/utils/CountAndTimeUnit.java
index 44dd707e3..c88f8065d 100644
--- a/bitrepository-core/src/main/java/org/bitrepository/common/utils/CountAndTimeUnit.java
+++ b/bitrepository-core/src/main/java/org/bitrepository/common/utils/CountAndTimeUnit.java
@@ -1,6 +1,6 @@
package org.bitrepository.common.utils;
-import java.util.*;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
public class CountAndTimeUnit {
diff --git a/bitrepository-core/src/main/java/org/bitrepository/common/utils/TimeUtils.java b/bitrepository-core/src/main/java/org/bitrepository/common/utils/TimeUtils.java
index 487dbc114..1970e9c01 100644
--- a/bitrepository-core/src/main/java/org/bitrepository/common/utils/TimeUtils.java
+++ b/bitrepository-core/src/main/java/org/bitrepository/common/utils/TimeUtils.java
@@ -234,25 +234,25 @@ public static String durationToHuman(Duration dur) {
}
if (dur.toDays() > 0) {
- parts.add("" + dur.toDays() + "d");
+ parts.add(dur.toDays() + "d");
}
if (dur.toHoursPart() > 0) {
- parts.add("" + dur.toHoursPart() + "h");
+ parts.add(dur.toHoursPart() + "h");
}
if (dur.toMinutesPart() > 0) {
- parts.add("" + dur.toMinutesPart() + "m");
+ parts.add(dur.toMinutesPart() + "m");
}
if (dur.toSecondsPart() > 0) {
- parts.add("" + dur.toSecondsPart() + "s");
+ parts.add(dur.toSecondsPart() + "s");
}
if (dur.toNanosPart() > 0) {
// If the fraction of second is a whole number of millis, print as such; otherwise print only as nanos
Duration fraction = Duration.ofNanos(dur.getNano());
Duration remainderAfterMillis = fraction.minusMillis(fraction.toMillisPart());
if (remainderAfterMillis.isZero()) {
- parts.add("" + fraction.toMillisPart() + " ms");
+ parts.add(fraction.toMillisPart() + " ms");
} else {
- parts.add("" + fraction.toNanosPart() + " ns");
+ parts.add(fraction.toNanosPart() + " ns");
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
index b72c79cd5..f5380743b 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
@@ -26,10 +26,9 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
public class ArgumentValidatorTest extends ExtendedTestCase {
@Test
@@ -141,7 +140,7 @@ public void testArgumentValidatorCollection() throws Exception {
} catch (IllegalArgumentException e) {
// expected
}
- ArgumentValidator.checkNotNullOrEmpty(Arrays.asList("NO FAILURE"), "No exception expected.");
+ ArgumentValidator.checkNotNullOrEmpty(List.of("NO FAILURE"), "No exception expected.");
}
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/TestLogger.java b/bitrepository-core/src/test/java/org/bitrepository/common/TestLogger.java
index 870ac393f..bdd77fd1b 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/TestLogger.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/TestLogger.java
@@ -28,7 +28,7 @@
import org.slf4j.LoggerFactory;
public class TestLogger {
- private Logger log;
+ private final Logger log;
public TestLogger(Class> logHandle) {
log = LoggerFactory.getLogger(logHandle);
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
index f92e9285c..40c6abbe5 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
@@ -41,7 +41,7 @@ public void testUnableToFinish() throws Exception {
try {
throw new UnableToFinishException(errMsg);
} catch(Exception e) {
- Assertions.assertTrue(e instanceof UnableToFinishException);
+ Assertions.assertInstanceOf(UnableToFinishException.class, e);
Assertions.assertEquals(e.getMessage(), errMsg);
Assertions.assertNull(e.getCause());
}
@@ -50,10 +50,10 @@ public void testUnableToFinish() throws Exception {
try {
throw new UnableToFinishException(errMsg, new IllegalArgumentException(causeMsg));
} catch(Exception e) {
- Assertions.assertTrue(e instanceof UnableToFinishException);
+ Assertions.assertInstanceOf(UnableToFinishException.class, e);
Assertions.assertEquals(e.getMessage(), errMsg);
Assertions.assertNotNull(e.getCause());
- Assertions.assertTrue(e.getCause() instanceof IllegalArgumentException);
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e.getCause());
Assertions.assertEquals(e.getCause().getMessage(), causeMsg);
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
index d2febcbb2..cfab4cd64 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
@@ -46,14 +46,14 @@ public void streamTester() throws Exception {
StreamUtils.copyInputStreamToOutputStream(null, out);
Assertions.fail("Should throw an exception here.");
} catch (Exception e) {
- Assertions.assertTrue(e instanceof IllegalArgumentException);
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e);
}
try {
StreamUtils.copyInputStreamToOutputStream(in, null);
Assertions.fail("Should throw an exception here.");
} catch (Exception e) {
- Assertions.assertTrue(e instanceof IllegalArgumentException);
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e);
}
addStep("Test copying the input stream to the output stream.", "Should contain the same data.");
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
index c5ec3d38a..5ef29f1e3 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
@@ -31,7 +31,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import java.math.BigInteger;
/**
@@ -58,7 +57,7 @@ public void testCompareMilliSeconds() {
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) == 0, referenceTime +
+ Assertions.assertEquals(0, TimeMeasurementUtils.compare(referenceTime, compareTime), referenceTime +
" should be same as " + compareTime);
}
@@ -83,7 +82,7 @@ public void testCompareMilliSecondsToHours() {
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) == 0, referenceTime +
+ Assertions.assertEquals(0, TimeMeasurementUtils.compare(referenceTime, compareTime), referenceTime +
" should be same as " + compareTime);
Assertions.assertEquals(TimeMeasurementUtils.getTimeMeasureInLong(referenceTime), millis);
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
index 46da2f022..0cd3d16d3 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
@@ -26,7 +26,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Duration;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
index 8d0178f6d..4eb622367 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
@@ -8,7 +8,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import java.math.BigInteger;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java
index 8e8f23cd4..d2fb08bc1 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/BitrepositoryTestSuite.java
@@ -1,13 +1,12 @@
package org.bitrepository.protocol;
import org.bitrepository.protocol.bus.ActiveMQMessageBusTest;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.suite.api.ExcludeTags;
import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.bitrepository.protocol.GlobalSuiteExtension;
/**
* BitrepositoryTestSuite is a JUnit 5 suite class that groups and configures multiple test classes
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
index 886419ac8..58615077b 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
@@ -14,7 +14,9 @@
import org.bitrepository.protocol.security.DummySecurityManager;
import org.bitrepository.protocol.security.SecurityManager;
import org.jaccept.TestEventManager;
-import org.junit.jupiter.api.extension.*;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
import javax.jms.JMSException;
import java.net.MalformedURLException;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
index e6f5bf797..77b09db56 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
@@ -49,7 +49,6 @@
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.junit.jupiter.api.extension.TestWatcher;
import org.slf4j.LoggerFactory;
import javax.jms.JMSException;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
index 230c84592..098485d1e 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
@@ -66,7 +66,7 @@ public final void collectionFilterTest() throws Exception {
"eg. this identify requests should be handled by everybody.",
"Verify that the message bus accepts this message.");
String myCollectionID = "MyCollection";
- messageBus.setCollectionFilter(Arrays.asList(new String[]{myCollectionID}));
+ messageBus.setCollectionFilter(Arrays.asList(myCollectionID));
RawMessagebus rawMessagebus = new RawMessagebus(
settingsForTestClient.getMessageBusConfiguration(),
securityManager);
@@ -127,7 +127,7 @@ public final void toFilterTest() throws Exception {
addStep("Send an identify request with a undefined 'To' header property, " +
"eg. this identify requests should be handled by all components.",
"Verify that the identify request bus accepts this identify request.");
- messageBus.setComponentFilter(Arrays.asList(new String[]{ settingsForTestClient.getComponentID() }));
+ messageBus.setComponentFilter(Arrays.asList(settingsForTestClient.getComponentID()));
RawMessagebus rawMessagebus = new RawMessagebus(
settingsForTestClient.getMessageBusConfiguration(),
securityManager);
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
index 5ac70aba5..32a1f1a02 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
@@ -27,13 +27,12 @@
import org.bitrepository.bitrepositorymessages.AlarmMessage;
import org.bitrepository.protocol.IntegrationTest;
import org.bitrepository.protocol.message.ExampleMessageFactory;
-import org.bitrepository.protocol.messagebus.MessageBusManager;
import org.jaccept.TestEventManager;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
+import java.util.List;
/**
* Class for testing the interface with the message bus.
@@ -50,8 +49,8 @@ protected void registerMessageReceivers() {
@AfterEach
public void tearDown() {
- messageBus.setComponentFilter(Arrays.asList(new String[]{}));
- messageBus.setCollectionFilter(Arrays.asList(new String[]{}));
+ messageBus.setComponentFilter(List.of());
+ messageBus.setCollectionFilter(List.of());
}
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/LocalActiveMQBroker.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/LocalActiveMQBroker.java
index 124499168..0648f9aba 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/LocalActiveMQBroker.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/LocalActiveMQBroker.java
@@ -32,7 +32,7 @@
public class LocalActiveMQBroker {
private final Logger log = LoggerFactory.getLogger(getClass());
- private BrokerService broker;
+ private final BrokerService broker;
public LocalActiveMQBroker(MessageBusConfiguration configuration) {
broker = new BrokerService();
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java
index 278c48654..530e29914 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MessageReceiver.java
@@ -171,7 +171,7 @@ public " +
- "
");
+ "The pillar under test should make a response with the following elements: " +
+ "
");
IdentifyPillarsForPutFileRequest identifyRequest = msgFactory.createIdentifyPillarsForPutFileRequest(
NON_DEFAULT_FILE_ID, 0L);
messageBus.sendMessage(identifyRequest);
@@ -94,7 +94,7 @@ public void identificationTestForChecksumPillar() {
addDescription("Verifies the normal behaviour for putFile identification for a checksum pillar");
addStep("Sending a putFile identification.",
"The pillar under test should make a response with the correct elements. The only different from a " +
- "full pillar is that the checksum pillar will respond with the default checksum spec.");
+ "full pillar is that the checksum pillar will respond with the default checksum spec.");
IdentifyPillarsForPutFileRequest identifyRequest = msgFactory.createIdentifyPillarsForPutFileRequest(
NON_DEFAULT_FILE_ID, 0L);
messageBus.sendMessage(identifyRequest);
@@ -108,18 +108,19 @@ public void identificationTestForChecksumPillar() {
assertEquals(receivedIdentifyResponse.getPillarChecksumSpec().getChecksumType(),
ChecksumUtils.getDefault(settingsForCUT).getChecksumType());
assertEquals(receivedIdentifyResponse.getPillarID(), getPillarID());
- assertEquals(receivedIdentifyResponse.getResponseInfo().getResponseCode(),
- ResponseCode.IDENTIFICATION_POSITIVE);
+ assertEquals(ResponseCode.IDENTIFICATION_POSITIVE,
+ receivedIdentifyResponse.getResponseInfo().getResponseCode());
assertEquals(receivedIdentifyResponse.getDestination(), identifyRequest.getReplyTo());
}
@Test
- @Tag(PillarTestGroups.FULL_PILLAR_TEST) @Tag(PillarTestGroups.CHECKSUM_PILLAR_TEST)
+ @Tag(PillarTestGroups.FULL_PILLAR_TEST)
+ @Tag(PillarTestGroups.CHECKSUM_PILLAR_TEST)
public void fileExistsTest() {
addDescription("Verifies the exists of a file with the same ID is handled correctly. " +
"This means that a checksum for the existing file is returned, enabling the client to continue with " +
"the put operation for the pillars not yet containing the file. The client can easily " +
- "implement idempotent behaviour based on this response." );
+ "implement idempotent behaviour based on this response.");
addStep("Sending a putFile identification for a file already in the pillar.",
"The pillar under test should send a DUPLICATE_FILE_FAILURE response with the (default type) checksum " +
"of the existing file.");
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java
index 9184c1b68..84fb4f16e 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java
@@ -1,23 +1,23 @@
/*
* #%L
* Bitrepository Reference Pillar
- *
+ *
* $Id: PutFileOnReferencePillarTest.java 589 2011-12-01 15:34:42Z jolf $
* $HeadURL: https://sbforge.org/svn/bitrepository/bitrepository-reference/trunk/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/PutFileOnReferencePillarTest.java $
* %%
* Copyright (C) 2010 - 2011 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
* checksumPillarTest a checksum pillar is started, else a normal 'full' reference pillar is started.
* TestEventManager used to manage the event for the associated test. */
+ /**
+ * The TestEventManager used to manage the event for the associated test.
+ */
private final TestEventManager testEventManager;
- /** The constructor.
+ /**
+ * The constructor.
*
* @param testEventManager The TestEventManager used to manage the event for the associated test.
*/
@@ -273,7 +288,7 @@ public ClientEventLogger(TestEventManager testEventManager) {
@Override
public void handleEvent(OperationEvent event) {
- testEventManager.addResult("Received event: "+ event);
+ testEventManager.addResult("Received event: " + event);
}
}
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
index 58615077b..1838231cb 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
@@ -88,7 +88,9 @@ protected void registerMessageReceivers() {
protected void addReceiver(MessageReceiver receiver) {
receiverManager.addReceiver(receiver);
}
- protected void initializeCUT() {}
+
+ protected void initializeCUT() {
+ }
/**
* Purges all messages from the receivers.
@@ -100,7 +102,8 @@ protected void clearReceivers() {
/**
* May be overridden by specific tests wishing to do stuff. Remember to call super if this is overridden.
*/
- protected void shutdownCUT() {}
+ protected void shutdownCUT() {
+ }
/**
* Initializes the settings. Will postfix the alarm and collection topics with '-${user.name}
@@ -121,7 +124,7 @@ protected Settings loadSettings(String componentID) {
return TestSettingsProvider.reloadSettings(componentID);
}
- private void makeUserSpecificSettings(Settings settings) {
+ protected void makeUserSpecificSettings(Settings settings) {
settings.getRepositorySettings().getProtocolSettings()
.setCollectionDestination(settings.getCollectionDestination() + getTopicPostfix());
settings.getRepositorySettings().getProtocolSettings().setAlarmDestination(settings.getAlarmDestination() + getTopicPostfix());
From f9b322f0be3b82b2717dec943a3c42dc4032681b Mon Sep 17 00:00:00 2001
From: kaah super.registerReceivers() when overriding
- */
- protected void registerMessageReceivers() {
- alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination(), testEventManager);
- addReceiver(alarmReceiver);
- }
-
- protected void addReceiver(MessageReceiver receiver) {
- receiverManager.addReceiver(receiver);
- }
- protected void initializeCUT() {}
-
- /**
- * Purges all messages from the receivers.
- */
- protected void clearReceivers() {
- receiverManager.clearMessagesInReceivers();
- }
-
- /**
- * May be overridden by specific tests wishing to do stuff. Remember to call super if this is overridden.
- */
- protected void shutdownCUT() {}
-
- /**
- * Initializes the settings. Will postfix the alarm and collection topics with '-${user.name}
- */
- protected void setupSettings() {
- settingsForCUT = loadSettings(getComponentID());
- makeUserSpecificSettings(settingsForCUT);
- SettingsUtils.initialize(settingsForCUT);
-
- alarmDestinationID = settingsForCUT.getRepositorySettings().getProtocolSettings().getAlarmDestination();
-
- settingsForTestClient = loadSettings(testMethodName);
- makeUserSpecificSettings(settingsForTestClient);
- }
-
-
protected Settings loadSettings(String componentID) {
return TestSettingsProvider.reloadSettings(componentID);
}
- private void makeUserSpecificSettings(Settings settings) {
+ protected void makeUserSpecificSettings(Settings settings) {
settings.getRepositorySettings().getProtocolSettings()
.setCollectionDestination(settings.getCollectionDestination() + getTopicPostfix());
settings.getRepositorySettings().getProtocolSettings().setAlarmDestination(settings.getAlarmDestination() + getTopicPostfix());
}
- /**
- * Indicated whether an embedded active MQ should be started and used
- */
- public boolean useEmbeddedMessageBus() {
- return System.getProperty("useEmbeddedMessageBus", "true").equals("true");
+ protected String getTopicPostfix() {
+ return "-" + System.getProperty("user.name");
}
- /**
- * Indicated whether an embedded http server should be started and used
- */
- public boolean useEmbeddedHttpServer() {
- return System.getProperty("useEmbeddedHttpServer", "false").equals("true");
+ protected String getComponentID() {
+ return getClass().getSimpleName();
+ }
+
+ protected SecurityManager createSecurityManager() {
+ return new DummySecurityManager();
}
/**
@@ -152,10 +108,7 @@ protected void setupMessageBus() {
}
}
- /**
- * Shutdown the message bus.
- */
- private void teardownMessageBus() {
+ protected void teardownMessageBus() {
MessageBusManager.clear();
if (messageBus != null) {
try {
@@ -185,26 +138,11 @@ protected void teardownHttpServer() {
}
}
- /**
- * Returns the postfix string to use when accessing user specific topics, which is the mechanism we use in the
- * bit repository tests.
- *
- * @return The string to postfix all topix names with.
- */
- protected String getTopicPostfix() {
- return "-" + System.getProperty("user.name");
- }
-
- protected String getComponentID() {
- return getClass().getSimpleName();
- }
-
- protected String createDate() {
- return Long.toString(System.currentTimeMillis());
+ public boolean useEmbeddedMessageBus() {
+ return System.getProperty("useEmbeddedMessageBus", "true").equals("true");
}
- protected SecurityManager createSecurityManager() {
- return new DummySecurityManager();
+ public boolean useEmbeddedHttpServer() {
+ return System.getProperty("useEmbeddedHttpServer", "false").equals("true");
}
-
}
\ No newline at end of file
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java
index a35c04498..e41ba24ac 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java
@@ -1,23 +1,23 @@
/*
* #%L
* Bitmagasin integrationstest
- *
+ *
* $Id$
* $HeadURL$
* %%
* Copyright (C) 2010 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
* " +
+ "The pillar should send a final response with the following elements:
");
IdentifyPillarsForPutFileRequest identifyRequest = msgFactory.createIdentifyPillarsForPutFileRequest(
- NON_DEFAULT_FILE_ID, 0L);
+ nonDefaultFileId, 0L);
messageBus.sendMessage(identifyRequest);
IdentifyPillarsForPutFileResponse receivedIdentifyResponse = clientReceiver.waitForMessage(
@@ -96,7 +96,7 @@ public void identificationTestForChecksumPillar() {
"The pillar under test should make a response with the correct elements. The only different from a " +
"full pillar is that the checksum pillar will respond with the default checksum spec.");
IdentifyPillarsForPutFileRequest identifyRequest = msgFactory.createIdentifyPillarsForPutFileRequest(
- NON_DEFAULT_FILE_ID, 0L);
+ nonDefaultFileId, 0L);
messageBus.sendMessage(identifyRequest);
IdentifyPillarsForPutFileResponse receivedIdentifyResponse = clientReceiver.waitForMessage(
@@ -125,7 +125,7 @@ public void fileExistsTest() {
"The pillar under test should send a DUPLICATE_FILE_FAILURE response with the (default type) checksum " +
"of the existing file.");
IdentifyPillarsForPutFileRequest identifyRequest = msgFactory.createIdentifyPillarsForPutFileRequest(
- DEFAULT_FILE_ID, 0L);
+ defaultFileId, 0L);
messageBus.sendMessage(identifyRequest);
IdentifyPillarsForPutFileResponse receivedIdentifyResponse = clientReceiver.waitForMessage(
@@ -137,7 +137,7 @@ public void fileExistsTest() {
@Override
protected MessageRequest createRequest() {
return msgFactory.createIdentifyPillarsForPutFileRequest(
- NON_DEFAULT_FILE_ID, 0L);
+ nonDefaultFileId, 0L);
}
@Override
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
index 85e951baa..87e9a8731 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
@@ -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
* " +
"
");
@@ -160,7 +160,7 @@ public void getMissingFileTest() {
}
@Test
- @Tag(PillarTestGroups.FULL_PILLAR_TEST )
+ @Tag(PillarTestGroups.FULL_PILLAR_TEST)
public void missingCollectionIDTest() {
addDescription("Verifies the a missing collectionID in the request is rejected");
addStep("Sending a request without a collectionID.",
@@ -188,7 +188,7 @@ public void otherCollectionTest() {
}
protected MessageRequest createRequest() {
- return msgFactory.createGetFileRequest(testFileURL.toExternalForm(), DEFAULT_FILE_ID);
+ return msgFactory.createGetFileRequest(testFileURL.toExternalForm(), defaultFileId);
}
protected MessageResponse receiveResponse() {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java
index 4d754208c..d0c23f7b6 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java
@@ -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
* " +
+ "The pillar should send a final response with the following elements:
");
- PutFileRequest putRequest = (PutFileRequest)createRequest();
+ PutFileRequest putRequest = (PutFileRequest) createRequest();
messageBus.sendMessage(putRequest);
- PutFileProgressResponse progressResponse = clientReceiver.waitForMessage(PutFileProgressResponse.class,
+ PutFileProgressResponse progressResponse = clientReceiver.waitForMessage(PutFileProgressResponse.class,
getOperationTimeout(), TimeUnit.SECONDS);
assertNotNull(progressResponse);
assertEquals(progressResponse.getCorrelationID(), putRequest.getCorrelationID(),
@@ -172,7 +172,7 @@ public void putFileOperationAcceptedProgressTest() {
@Override
protected MessageRequest createRequest() {
return msgFactory.createPutFileRequest(TestFileHelper.getDefaultFileChecksum(), null,
- DEFAULT_DOWNLOAD_FILE_ADDRESS, NON_DEFAULT_FILE_ID, DEFAULT_FILE_SIZE);
+ defaultDownloadFileAddress, nonDefaultFileId, DEFAULT_FILE_SIZE);
}
@Override
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java
index 2ba43d525..238808f3a 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java
@@ -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
* " +
"
");
PutFileRequest putRequest = msgFactory.createPutFileRequest(
- TestFileHelper.getDefaultFileChecksum(), null, DEFAULT_DOWNLOAD_FILE_ADDRESS, testSpecificFileID,
+ TestFileHelper.getDefaultFileChecksum(), null, defaultDownloadFileAddress, testSpecificFileID,
DEFAULT_FILE_SIZE);
messageBus.sendMessage(putRequest);
@@ -112,7 +112,7 @@ public void putFileWithMD5ReturnChecksumTest() {
"The pillar should send a final response with the ChecksumRequestForNewFile elements containing the MD5 " +
"checksum for the supplied file.");
PutFileRequest putRequest = msgFactory.createPutFileRequest(
- TestFileHelper.getDefaultFileChecksum(), null, DEFAULT_DOWNLOAD_FILE_ADDRESS, testSpecificFileID,
+ TestFileHelper.getDefaultFileChecksum(), null, defaultDownloadFileAddress, testSpecificFileID,
DEFAULT_FILE_SIZE);
putRequest.setChecksumRequestForNewFile(ChecksumUtils.getDefault(settingsForTestClient));
messageBus.sendMessage(putRequest);
@@ -139,13 +139,13 @@ public void putFileOperationAcceptedProgressTest() {
"
* {@code
* @Suite
- * @SelectClasses({IntegrationTest.class}) // List your test classes here
- * @SelectPackages("org.bitrepository.protocol") // List your test packages here
- * @IncludeTags("integration") // List your include tags here
- * @ExcludeTags("slow") // List your exclude tags here
+ * @SelectClasses({IntegrationTest.class}) // List your test classes here
+ * @SelectPackages("org.bitrepository.protocol") // List your test packages here
+ * @IncludeTags("integration") // List your include tags here
+ * @ExcludeTags("slow") // List your exclude tags here
* @ExtendWith(GlobalSuiteExtension.class)
*
*/
@Suite
-@SelectClasses({IntegrationTest.class, ActiveMQMessageBusTest.class}) // List your test classes here
+//@SelectClasses({IntegrationTest.class, ActiveMQMessageBusTest.class}) // List your test classes here
+@SelectPackages("org.bitrepository.protocol")
+@IncludeTags("regressiontest")
@ExtendWith(GlobalSuiteExtension.class)
public class BitrepositoryTestSuite {
// No need for methods here; this just groups and extends
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
index 1f3b0a60a..81e8353ec 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
@@ -1,5 +1,7 @@
package org.bitrepository.pillar;
+import org.bitrepository.pillar.integration.func.deletefile.DeleteFileRequestIT;
+import org.bitrepository.pillar.integration.func.getchecksums.GetChecksumQueryTest;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.suite.api.ExcludeTags;
import org.junit.platform.suite.api.IncludeTags;
@@ -43,10 +45,10 @@
*
* {@code
* @Suite
- * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
- * @SelectPackages("org.bitrepository.pillar") // List your test packages here
- * @IncludeTags("integration") // List your include tags here
- * @ExcludeTags("slow") // List your exclude tags here
+ * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
+ * @SelectPackages("org.bitrepository.pillar") // List your test packages here
+ * @IncludeTags("integration") // List your include tags here
+ * @ExcludeTags("slow") // List your exclude tags here
* @ExtendWith(GlobalSuiteExtension.class)
* public class BitrepositoryTestSuite {
* // No need for methods here; this just groups and extends
@@ -57,7 +59,8 @@
@Suite
@SuiteDisplayName("Full Pillar Acceptance Test")
// Use SelectPackages with the exact base package
-@SelectPackages("org.bitrepository.pillar.integration.func")
+@SelectPackages("org.bitrepository.pillar.integration")
+@SelectClasses({DeleteFileRequestIT.class, GetChecksumQueryTest.class})
// For debugging: Comment out the Tag filter to see if it finds ANY tests in that package
// @IncludeTags(PillarTestGroups.FULL_PILLAR_TEST)
public class BitrepositoryPillarTestSuite {
From f215c8612c2f3102b1696582442fc714653de1d0 Mon Sep 17 00:00:00 2001
From: kaah
* {@code
* @Suite
- * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
- * @SelectPackages("org.bitrepository.pillar") // List your test packages here
- * @IncludeTags("integration") // List your include tags here
- * @ExcludeTags("slow") // List your exclude tags here
+ * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
+ * @SelectPackages("org.bitrepository.pillar") // List your test packages here
+ * @IncludeTags("integration") // List your include tags here
+ * @ExcludeTags("slow") // List your exclude tags here
* @ExtendWith(GlobalSuiteExtension.class)
* public class BitrepositoryTestSuite {
* // No need for methods here; this just groups and extends
@@ -56,9 +57,11 @@
*/
@Suite
@SuiteDisplayName("Checksum Pillar Acceptance Test")
-// Select the package(s) where the tests are located
-@SelectPackages("org.bitrepository.pillar.integration.func")
-// Filter to only run methods that have the specific @Tag
-@IncludeTags(PillarTestGroups.CHECKSUM_PILLAR_TEST)
+@SelectPackages({
+ "org.bitrepository.pillar.messagehandling",
+ "org.bitrepository.pillar.integration"
+})
+@IncludeTags({/*"regressiontest", */PillarTestGroups.CHECKSUM_PILLAR_TEST})
+@ExtendWith(PillarSuiteExtension.class)
public class BitrepositoryChecksumPillarTestSuite {
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
index 81e8353ec..663e37dc8 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
@@ -1,7 +1,6 @@
package org.bitrepository.pillar;
-import org.bitrepository.pillar.integration.func.deletefile.DeleteFileRequestIT;
-import org.bitrepository.pillar.integration.func.getchecksums.GetChecksumQueryTest;
+import org.bitrepository.pillar.integration.PillarSuiteExtension;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.suite.api.ExcludeTags;
import org.junit.platform.suite.api.IncludeTags;
@@ -58,10 +57,11 @@
*/
@Suite
@SuiteDisplayName("Full Pillar Acceptance Test")
-// Use SelectPackages with the exact base package
-@SelectPackages("org.bitrepository.pillar.integration")
-@SelectClasses({DeleteFileRequestIT.class, GetChecksumQueryTest.class})
-// For debugging: Comment out the Tag filter to see if it finds ANY tests in that package
-// @IncludeTags(PillarTestGroups.FULL_PILLAR_TEST)
+@SelectPackages({
+ "org.bitrepository.pillar.messagehandling",
+ "org.bitrepository.pillar.integration"
+})
+@IncludeTags({"regressiontest", PillarTestGroups.CHECKSUM_PILLAR_TEST})
+@ExtendWith(PillarSuiteExtension.class)
public class BitrepositoryPillarTestSuite {
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/ChecksumPillarTestSuite.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/ChecksumPillarTestSuite.java
new file mode 100644
index 000000000..395ddeded
--- /dev/null
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/ChecksumPillarTestSuite.java
@@ -0,0 +1,52 @@
+package org.bitrepository.pillar.integration;
+
+import org.bitrepository.pillar.PillarTestGroups;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.platform.suite.api.IncludeTags;
+import org.junit.platform.suite.api.SelectPackages;
+import org.junit.platform.suite.api.Suite;
+import org.junit.platform.suite.api.SuiteDisplayName;
+
+/**
+ * JUnit 5 suite entry-point for the Checksum Pillar acceptance tests.
+ *
+ * {@code
+ *
+ *
+ * How to run
+ *
+ *
+ *
+ * Pillar type
+ * The system property {@code bitrepository.pillar.type} tells {@link PillarSuiteExtension}
+ * whether to start a checksum or reference pillar. This suite defaults to {@code checksum}.
+ * If you need a reference-pillar suite, create a sibling class and set the property to
+ * {@code reference}.
+ */
+@Suite
+@SuiteDisplayName("Checksum Pillar Acceptance Test")
+@SelectPackages({
+ "org.bitrepository.pillar.messagehandling",
+ "org.bitrepository.pillar.integration"
+})
+@IncludeTags({"regressiontest", PillarTestGroups.CHECKSUM_PILLAR_TEST})
+@ExtendWith(PillarSuiteExtension.class)
+public class ChecksumPillarTestSuite {
+ // Suite classes are purely declarative – no code here.
+}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarSuiteExtension.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarSuiteExtension.java
new file mode 100644
index 000000000..a678fbd16
--- /dev/null
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarSuiteExtension.java
@@ -0,0 +1,77 @@
+package org.bitrepository.pillar.integration;
+
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class PillarSuiteExtension implements BeforeAllCallback {
+
+ /**
+ * System property that selects the pillar type.
+ */
+ public static final String PILLAR_TYPE_PROPERTY = "bitrepository.pillar.type";
+
+ private static final String CHECKSUM = "checksum";
+
+ /**
+ * The pillar instance (null until first test class registers it).
+ */
+ private static volatile EmbeddedPillar embeddedPillar = null;
+
+ /**
+ * Guard to ensure shutdown hook is only registered once.
+ */
+ private static volatile boolean shutdownHookRegistered = false;
+
+ /**
+ * Lock for synchronized access.
+ */
+ private static final Object LOCK = new Object();
+
+ @Override
+ public void beforeAll(ExtensionContext context) {
+ // Extension hook – currently unused; registration happens via static method.
+ }
+
+ /**
+ * Returns {@code true} if a pillar has already been started.
+ * {@link PillarIntegrationTest} calls this to decide whether to start a new one.
+ */
+ public static boolean isPillarAlreadyStarted() {
+ return embeddedPillar != null;
+ }
+
+ /**
+ * Registers the given {@link EmbeddedPillar} and ensures it will be shut down
+ * when the JVM exits.
+ *
+ * {@code
- *
- *
- * How to run
- *
- *
- *
- * Pillar type
- * The system property {@code bitrepository.pillar.type} tells {@link PillarSuiteExtension}
- * whether to start a checksum or reference pillar. This suite defaults to {@code checksum}.
- * If you need a reference-pillar suite, create a sibling class and set the property to
- * {@code reference}.
- */
-@Suite
-@SuiteDisplayName("Checksum Pillar Acceptance Test")
-@SelectPackages({
- "org.bitrepository.pillar.messagehandling",
- "org.bitrepository.pillar.integration"
-})
-@IncludeTags({"regressiontest", PillarTestGroups.CHECKSUM_PILLAR_TEST})
-@ExtendWith(PillarSuiteExtension.class)
-public class ChecksumPillarTestSuite {
- // Suite classes are purely declarative – no code here.
-}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
index f89831f42..e9f2d40c0 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
@@ -51,8 +51,12 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.TestReporter;
+import org.junit.platform.engine.ExecutionRequest;
+import org.junit.platform.suite.api.AfterSuite;
import javax.jms.JMSException;
import java.io.IOException;
@@ -66,21 +70,16 @@
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public abstract class PillarIntegrationTest extends IntegrationTest {
- /**
- * The path to the directory containing the integration test configuration files
- */
+ /** The path to the directory containing the integration test configuration files */
protected static final String PATH_TO_CONFIG_DIR = System.getProperty(
"pillar.integrationtest.settings.path",
- "conf");
- /**
- * The path to the directory containing the integration test configuration files
- */
+ "conf"); /** The path to the directory containing the integration test configuration files */
protected static final String PATH_TO_TESTPROPS_DIR = System.getProperty(
"pillar.integrationtest.testprops.path",
"testprops");
public static final String TEST_CONFIGURATION_FILE_NAME = "pillar-integration-test.properties";
protected static PillarIntegrationTestConfiguration testConfiguration;
- protected EmbeddedPillar embeddedPillar;
+ private EmbeddedPillar embeddedPillar;
protected PillarFileManager pillarFileManager;
protected static ClientProvider clientProvider;
@@ -99,21 +98,30 @@ protected void initializeCUT() {
clientEventHandler = new ClientEventLogger(testEventManager);
}
+ @Override
@BeforeAll
- public void setupPillarIntegrationTest(TestInfo testInfo) {
+ public void initializeSuite(TestInfo testInfo) {
if (testConfiguration == null) {
testConfiguration = new PillarIntegrationTestConfiguration(PATH_TO_TESTPROPS_DIR + "/" + TEST_CONFIGURATION_FILE_NAME);
}
+ super.initializeSuite(testInfo);
+
+ setupRealMessageBus();
+
- super.initMessagebus();
startEmbeddedPillar(testInfo);
+ reloadMessageBus();
+ clientProvider = new ClientProvider(securityManager, settingsForTestClient, testEventManager);
+ nonDefaultCollectionId = settingsForTestClient.getCollections().get(1).getID();
+ irrelevantCollectionId = settingsForTestClient.getCollections().get(2).getID();
+ putDefaultFile();
}
@AfterAll
public void shutdownRealMessageBus() {
- if (!useEmbeddedMessageBus()) {
+ if(!useEmbeddedMessageBus()) {
MessageBusManager.clear();
- if (messageBus != null) {
+ if(messageBus != null) {
try {
messageBus.close();
} catch (JMSException e) {
@@ -124,25 +132,32 @@ public void shutdownRealMessageBus() {
}
}
+ @AfterSuite
+ @Override
+ public void shutdownSuite() {
+ stopEmbeddedReferencePillar();
+ super.shutdownSuite();
+ }
+
@AfterEach
- public void addFailureContextInfo() {
+ public void addFailureContextInfo(TestInfo result) {
}
protected void setupRealMessageBus() {
- if (!useEmbeddedMessageBus()) {
+ if(!useEmbeddedMessageBus()) {
MessageBusManager.clear();
messageBus = MessageBusManager.getMessageBus(settingsForCUT, securityManager);
} else {
+ setupMessageBus();
MessageBusManager.injectCustomMessageBus(MessageBusManager.DEFAULT_MESSAGE_BUS, messageBus);
}
}
-
- @Override
- protected void setupMessageBus() {
- //Shortcircuit this so the messagebus is NOT INITIALISED BEFORE THE CONFIGURATION
- //super.setupMessageBus();
- setupRealMessageBus();
- }
+//
+// @Override
+// protected void setupMessageBus() {
+// //Shortcircuit this so the messagebus is NOT INITIALISED BEFORE THE CONFIGURATION
+// super.setupMessageBus();
+// }
@Override
public void initMessagebus() {
@@ -155,12 +170,13 @@ public void initMessagebus() {
* The type of pillar (full or checksum) is baed on the test group used, eg. if the group is
* checksumPillarTest a checksum pillar is started, else a normal 'full' reference pillar is started.
*
TestEventManager used to manage the event for the associated test.
- */
+ /** The TestEventManager used to manage the event for the associated test. */
private final TestEventManager testEventManager;
- /**
- * The constructor.
+ /** The constructor.
*
* @param testEventManager The TestEventManager used to manage the event for the associated test.
*/
@@ -286,7 +295,7 @@ public ClientEventLogger(TestEventManager testEventManager) {
@Override
public void handleEvent(OperationEvent event) {
- testEventManager.addResult("Received event: " + event);
+ testEventManager.addResult("Received event: "+ event);
}
}
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarSuiteExtension.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarSuiteExtension.java
deleted file mode 100644
index a678fbd16..000000000
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarSuiteExtension.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.bitrepository.pillar.integration;
-
-import org.junit.jupiter.api.extension.BeforeAllCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-
-public class PillarSuiteExtension implements BeforeAllCallback {
-
- /**
- * System property that selects the pillar type.
- */
- public static final String PILLAR_TYPE_PROPERTY = "bitrepository.pillar.type";
-
- private static final String CHECKSUM = "checksum";
-
- /**
- * The pillar instance (null until first test class registers it).
- */
- private static volatile EmbeddedPillar embeddedPillar = null;
-
- /**
- * Guard to ensure shutdown hook is only registered once.
- */
- private static volatile boolean shutdownHookRegistered = false;
-
- /**
- * Lock for synchronized access.
- */
- private static final Object LOCK = new Object();
-
- @Override
- public void beforeAll(ExtensionContext context) {
- // Extension hook – currently unused; registration happens via static method.
- }
-
- /**
- * Returns {@code true} if a pillar has already been started.
- * {@link PillarIntegrationTest} calls this to decide whether to start a new one.
- */
- public static boolean isPillarAlreadyStarted() {
- return embeddedPillar != null;
- }
-
- /**
- * Registers the given {@link EmbeddedPillar} and ensures it will be shut down
- * when the JVM exits.
- *
- * This must be called exactly once, from the first test class's {@code @BeforeAll}. - */ - public static void registerPillar(EmbeddedPillar pillar) { - synchronized (LOCK) { - if (embeddedPillar != null) { - throw new IllegalStateException("Pillar already registered"); - } - embeddedPillar = pillar; - - // Register shutdown hook to ensure pillar is stopped even if tests fail - if (!shutdownHookRegistered) { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - if (embeddedPillar != null) { - embeddedPillar.shutdown(); - } - }, "pillar-shutdown")); - shutdownHookRegistered = true; - } - } - } - - /** - * Returns {@code true} when the suite should use a checksum pillar. - *
- * {@code testContext.getIncludedGroups().contains("checksumPillarTest")}.
- */
- public static boolean isChecksumPillar() {
- String type = System.getProperty(PILLAR_TYPE_PROPERTY, CHECKSUM);
- return CHECKSUM.equalsIgnoreCase(type);
- }
-}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java
index ab5f91c1b..cafcf6862 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java
@@ -60,7 +60,7 @@ public void missingCollectionIDTest() {
public void otherCollectionTest() {
addDescription("Verifies identification works correctly for a second collection defined for pillar");
addStep("Sending a identify request with a non-default collectionID (not the first collection) " +
- "the pillar is part of",
+ "the pillar is part of",
"The pillar under test should make a positive response");
MessageRequest request = createRequest();
request.setCollectionID(nonDefaultCollectionId);
@@ -69,10 +69,7 @@ public void otherCollectionTest() {
}
protected abstract MessageRequest createRequest();
-
protected abstract MessageResponse receiveResponse();
-
protected abstract void assertPositivResponseIsReceived();
-
protected abstract void assertNoResponseIsReceived();
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java
index c07bdce80..3e251d73c 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/PillarFunctionTest.java
@@ -38,9 +38,7 @@ public abstract class PillarFunctionTest extends PillarIntegrationTest {
protected static final Long DEFAULT_FILE_SIZE = 10L;
protected PutFileMessageFactory msgFactory;
protected String testSpecificFileID;
- /**
- * Used for receiving responses from the pillar
- */
+ /** Used for receiving responses from the pillar */
protected MessageReceiver clientReceiver;
@BeforeEach
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
index 012542586..b609a1ba0 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
@@ -35,7 +35,8 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-
+@Tag(PillarTestGroups.FULL_PILLAR_TEST)
+@Tag(PillarTestGroups.CHECKSUM_PILLAR_TEST)
public class GetAuditTrailsTest extends PillarFunctionTest {
@Override
protected void initializeCUT() {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
deleted file mode 100644
index 1838231cb..000000000
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/protocol/GlobalSuiteExtension.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package org.bitrepository.protocol;
-
-import org.bitrepository.common.settings.Settings;
-import org.bitrepository.common.settings.TestSettingsProvider;
-import org.bitrepository.common.utils.SettingsUtils;
-import org.bitrepository.common.utils.TestFileHelper;
-import org.bitrepository.protocol.bus.LocalActiveMQBroker;
-import org.bitrepository.protocol.bus.MessageReceiver;
-import org.bitrepository.protocol.fileexchange.HttpServerConfiguration;
-import org.bitrepository.protocol.http.EmbeddedHttpServer;
-import org.bitrepository.protocol.messagebus.MessageBus;
-import org.bitrepository.protocol.messagebus.MessageBusManager;
-import org.bitrepository.protocol.messagebus.SimpleMessageBus;
-import org.bitrepository.protocol.security.DummySecurityManager;
-import org.bitrepository.protocol.security.SecurityManager;
-import org.jaccept.TestEventManager;
-import org.junit.jupiter.api.extension.AfterAllCallback;
-import org.junit.jupiter.api.extension.BeforeAllCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-
-import javax.jms.JMSException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class GlobalSuiteExtension implements BeforeAllCallback, AfterAllCallback {
-
- private static boolean initialized = false;
- protected static TestEventManager testEventManager = TestEventManager.getInstance();
- public static LocalActiveMQBroker broker;
- public static EmbeddedHttpServer server;
- public static HttpServerConfiguration httpServerConfiguration;
- public static MessageBus messageBus;
- private MessageReceiverManager receiverManager;
- protected static String alarmDestinationID;
- protected static MessageReceiver alarmReceiver;
- protected static SecurityManager securityManager;
- protected static Settings settingsForCUT;
- protected static Settings settingsForTestClient;
- protected static String collectionID;
- protected String NON_DEFAULT_FILE_ID;
- protected static String DEFAULT_FILE_ID;
- protected static URL DEFAULT_FILE_URL;
- protected static String DEFAULT_DOWNLOAD_FILE_ADDRESS;
- protected static String DEFAULT_UPLOAD_FILE_ADDRESS;
- protected String DEFAULT_AUDIT_INFORMATION;
- protected String testMethodName;
-
- @Override
- public void beforeAll(ExtensionContext context) {
- if (!initialized) {
- initialized = true;
- settingsForCUT = loadSettings(getComponentID());
- settingsForTestClient = loadSettings("TestSuiteInitialiser");
- makeUserSpecificSettings(settingsForCUT);
- makeUserSpecificSettings(settingsForTestClient);
- httpServerConfiguration = new HttpServerConfiguration(settingsForTestClient.getReferenceSettings().getFileExchangeSettings());
- collectionID = settingsForTestClient.getCollections().get(0).getID();
-
- securityManager = createSecurityManager();
- DEFAULT_FILE_ID = "DefaultFile";
- try {
- DEFAULT_FILE_URL = httpServerConfiguration.getURL(TestFileHelper.DEFAULT_FILE_ID);
- DEFAULT_DOWNLOAD_FILE_ADDRESS = DEFAULT_FILE_URL.toExternalForm();
- DEFAULT_UPLOAD_FILE_ADDRESS = DEFAULT_FILE_URL.toExternalForm() + "-" + DEFAULT_FILE_ID;
- } catch (MalformedURLException e) {
- throw new RuntimeException("Never happens", e);
- }
- }
- }
-
- @Override
- public void afterAll(ExtensionContext context) {
- if (initialized) {
- teardownMessageBus();
- teardownHttpServer();
- }
- }
-
- /**
- * May be extended by subclasses needing to have their receivers managed. Remember to still call
- * super.registerReceivers() when overriding
- */
- protected void registerMessageReceivers() {
- alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination(), testEventManager);
- addReceiver(alarmReceiver);
- }
-
- protected void addReceiver(MessageReceiver receiver) {
- receiverManager.addReceiver(receiver);
- }
-
- protected void initializeCUT() {
- }
-
- /**
- * Purges all messages from the receivers.
- */
- protected void clearReceivers() {
- receiverManager.clearMessagesInReceivers();
- }
-
- /**
- * May be overridden by specific tests wishing to do stuff. Remember to call super if this is overridden.
- */
- protected void shutdownCUT() {
- }
-
- /**
- * Initializes the settings. Will postfix the alarm and collection topics with '-${user.name}
- */
- protected void setupSettings() {
- settingsForCUT = loadSettings(getComponentID());
- makeUserSpecificSettings(settingsForCUT);
- SettingsUtils.initialize(settingsForCUT);
-
- alarmDestinationID = settingsForCUT.getRepositorySettings().getProtocolSettings().getAlarmDestination();
-
- settingsForTestClient = loadSettings(testMethodName);
- makeUserSpecificSettings(settingsForTestClient);
- }
-
-
- protected Settings loadSettings(String componentID) {
- return TestSettingsProvider.reloadSettings(componentID);
- }
-
- protected void makeUserSpecificSettings(Settings settings) {
- settings.getRepositorySettings().getProtocolSettings()
- .setCollectionDestination(settings.getCollectionDestination() + getTopicPostfix());
- settings.getRepositorySettings().getProtocolSettings().setAlarmDestination(settings.getAlarmDestination() + getTopicPostfix());
- }
-
- /**
- * Indicated whether an embedded active MQ should be started and used
- */
- public boolean useEmbeddedMessageBus() {
- return System.getProperty("useEmbeddedMessageBus", "true").equals("true");
- }
-
- /**
- * Indicated whether an embedded http server should be started and used
- */
- public boolean useEmbeddedHttpServer() {
- return System.getProperty("useEmbeddedHttpServer", "false").equals("true");
- }
-
- /**
- * Hooks up the message bus.
- */
- protected void setupMessageBus() {
- if (useEmbeddedMessageBus()) {
- if (messageBus == null) {
- messageBus = new SimpleMessageBus();
- }
- }
- }
-
- /**
- * Shutdown the message bus.
- */
- private void teardownMessageBus() {
- MessageBusManager.clear();
- if (messageBus != null) {
- try {
- messageBus.close();
- messageBus = null;
- } catch (JMSException e) {
- throw new RuntimeException(e);
- }
- }
-
- if (broker != null) {
- try {
- broker.stop();
- broker = null;
- } catch (Exception e) {
- // No reason to pollute the test output with this
- }
- }
- }
-
- /**
- * Shutdown the embedded http server if any.
- */
- protected void teardownHttpServer() {
- if (useEmbeddedHttpServer()) {
- server.stop();
- }
- }
-
- /**
- * Returns the postfix string to use when accessing user specific topics, which is the mechanism we use in the
- * bit repository tests.
- *
- * @return The string to postfix all topix names with.
- */
- protected String getTopicPostfix() {
- return "-" + System.getProperty("user.name");
- }
-
- protected String getComponentID() {
- return getClass().getSimpleName();
- }
-
- protected String createDate() {
- return Long.toString(System.currentTimeMillis());
- }
-
- protected SecurityManager createSecurityManager() {
- return new DummySecurityManager();
- }
-
-}
\ No newline at end of file
diff --git a/bitrepository-reference-pillar/src/test/resources/conf/ReferenceSettings.xml b/bitrepository-reference-pillar/src/test/resources/conf/ReferenceSettings.xml
index c828809f9..a74e730df 100644
--- a/bitrepository-reference-pillar/src/test/resources/conf/ReferenceSettings.xml
+++ b/bitrepository-reference-pillar/src/test/resources/conf/ReferenceSettings.xml
@@ -26,36 +26,38 @@
- * Note That no setup/teardown is possible in this test of external pillars, so tests need to be written + * Note that no setup/teardown is possible in this test of external pillars, so tests need to be written * to be invariant against the initial pillar state. */ @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ExtendWith(ExtentedTestInfoParameterResolver.class) public abstract class PillarIntegrationTest extends IntegrationTest { - /** The path to the directory containing the integration test configuration files */ + /** + * The path to the directory containing the integration test configuration files + */ protected static final String PATH_TO_CONFIG_DIR = System.getProperty( "pillar.integrationtest.settings.path", - "conf"); /** The path to the directory containing the integration test configuration files */ + "conf"); + /** + * The path to the directory containing the integration test configuration files + */ protected static final String PATH_TO_TESTPROPS_DIR = System.getProperty( "pillar.integrationtest.testprops.path", "testprops"); @@ -98,6 +104,20 @@ protected void initializeCUT() { clientEventHandler = new ClientEventLogger(testEventManager); } + /** + * Initializes the test suite environment. + *
+ * This method is annotated with {@link BeforeAll} and is responsible for: + *
+ * This method checks if an embedded message bus is NOT being used before attempting to close and clear + * the message bus manager. + */ @AfterAll public void shutdownRealMessageBus() { - if(!useEmbeddedMessageBus()) { + if (!useEmbeddedMessageBus()) { MessageBusManager.clear(); - if(messageBus != null) { + if (messageBus != null) { try { messageBus.close(); } catch (JMSException e) { @@ -132,6 +158,11 @@ public void shutdownRealMessageBus() { } } + /** + * Performs teardown operations for the entire suite. + *
+ * This includes stopping the embedded reference pillar and calling the superclass's shutdown method. + */ @AfterSuite @Override public void shutdownSuite() { @@ -139,25 +170,27 @@ public void shutdownSuite() { super.shutdownSuite(); } + /** + * Adds context information to the test result in case of failure. + *
+ * This method is called after each test execution. Currently, it provides an empty implementation
+ * intended to be overridden or populated for debugging purposes.
+ *
+ * @param result Information about the executed test.
+ */
@AfterEach
public void addFailureContextInfo(TestInfo result) {
}
protected void setupRealMessageBus() {
- if(!useEmbeddedMessageBus()) {
+ if (!useEmbeddedMessageBus()) {
MessageBusManager.clear();
messageBus = MessageBusManager.getMessageBus(settingsForCUT, securityManager);
} else {
- setupMessageBus();
+ messageBus = new SimpleMessageBus();
MessageBusManager.injectCustomMessageBus(MessageBusManager.DEFAULT_MESSAGE_BUS, messageBus);
}
}
-//
-// @Override
-// protected void setupMessageBus() {
-// //Shortcircuit this so the messagebus is NOT INITIALISED BEFORE THE CONFIGURATION
-// super.setupMessageBus();
-// }
@Override
public void initMessagebus() {
@@ -170,6 +203,7 @@ public void initMessagebus() {
* The type of pillar (full or checksum) is baed on the test group used, eg. if the group is
* checksumPillarTest a checksum pillar is started, else a normal 'full' reference pillar is started.
*
TestEventManager used to manage the event for the associated test. */
+ /**
+ * The TestEventManager used to manage the event for the associated test.
+ */
private final TestEventManager testEventManager;
- /** The constructor.
+ /**
+ * The constructor.
*
* @param testEventManager The TestEventManager used to manage the event for the associated test.
*/
@@ -295,7 +338,7 @@ public ClientEventLogger(TestEventManager testEventManager) {
@Override
public void handleEvent(OperationEvent event) {
- testEventManager.addResult("Received event: "+ event);
+ testEventManager.addResult("Received event: " + event);
}
}
}
From 6274dd66e83c98eca824b40c55fbf2685c015a38 Mon Sep 17 00:00:00 2001
From: kaah super.registerReceivers() when overriding
*/
- @Step("Register message receivers")
protected void registerMessageReceivers() {
alarmReceiver = new MessageReceiver(settingsForCUT.getAlarmDestination());
addReceiver(alarmReceiver);
@@ -138,24 +117,14 @@ protected void addReceiver(MessageReceiver receiver) {
receiverManager.addReceiver(receiver);
}
- @BeforeAll
public void initMessagebus() {
- Allure.step("Initialize message bus", () -> {
- initializationMethod();
- setupMessageBus();
- });
- if (System.getProperty("enableLogStatus", "false").equals("true")) {
- LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
- StatusPrinter.print(lc);
- }
+ setupMessageBus();
}
- @AfterAll
+ @AfterSuite
public void shutdownSuite() {
- Allure.step("Shutdown test suite", () -> {
- teardownMessageBus();
- teardownHttpServer();
- });
+ teardownMessageBus();
+ teardownHttpServer();
}
/**
@@ -164,8 +133,6 @@ public void shutdownSuite() {
@BeforeEach
public final void beforeMethod(TestInfo testInfo) {
testMethodName = testInfo.getTestMethod().get().getName();
-
- Allure.step("Setup test: " + testMethodName, () -> {
setupSettings();
nonDefaultFileId = TestFileHelper.createUniquePrefix(testMethodName);
defaultAuditInformation = testMethodName;
@@ -175,13 +142,14 @@ public final void beforeMethod(TestInfo testInfo) {
messageBus.setComponentFilter(List.of());
receiverManager.startListeners();
initializeCUT();
- });
+ }
- protected void initializeCUT() {}
+
+ protected void initializeCUT() {
+ }
@AfterEach
public final void afterMethod() {
- Allure.step("Teardown test: " + testMethodName, () -> {
if (receiverManager != null) {
receiverManager.stopListeners();
}
@@ -189,7 +157,6 @@ public final void afterMethod() {
afterMethodVerification();
}
shutdownCUT();
- });
}
@@ -197,7 +164,6 @@ public final void afterMethod() {
* May be used by specific tests for general verification when the test method has finished. Will only be run
* if the test has passed (so far).
*/
- @Step("Verify no messages remain in receivers")
protected void afterMethodVerification() {
receiverManager.checkNoMessagesRemainInReceivers();
}
@@ -205,7 +171,6 @@ protected void afterMethodVerification() {
/**
* Purges all messages from the receivers.
*/
- @Step("Clear all receivers")
protected void clearReceivers() {
receiverManager.clearMessagesInReceivers();
}
@@ -213,12 +178,12 @@ protected void clearReceivers() {
/**
* May be overridden by specific tests wishing to do stuff. Remember to call super if this is overridden.
*/
- protected void shutdownCUT() {}
+ protected void shutdownCUT() {
+ }
/**
* Initializes the settings. Will postfix the alarm and collection topics with '-${user.name}
*/
- @Step("Setup settings")
protected void setupSettings() {
settingsForCUT = loadSettings(getComponentID());
makeUserSpecificSettings(settingsForCUT);
@@ -277,13 +242,14 @@ protected void setupMessageBus() {
* Shutdown the message bus.
*/
private void teardownMessageBus() {
- try {
- if (messageBus != null) {MessageBusManager.clear();
+ MessageBusManager.clear();
+ if (messageBus != null) {
+ try {
messageBus.close();
messageBus = null;
+ } catch (JMSException e) {
+ throw new RuntimeException(e);
}
- } catch (JMSException e) {
- throw new RuntimeException(e);
}
if (broker != null) {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
index 7d3939fb0..c0bedae8f 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
@@ -37,6 +37,8 @@
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
index 49b4ce2e6..08fe4f101 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
@@ -1,23 +1,23 @@
/*
* #%L
* Bitmagasin integrationstest
- *
+ *
* $Id$
* $HeadURL$
* %%
* Copyright (C) 2010 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
* checksumPillarTest a checksum pillar is started, else a normal 'full' reference pillar is started.
*
*
- * @param testInfo
+ * @param testInfo The suite info containing the pillar type.
*/
protected void startEmbeddedPillar(SuiteInfo testInfo) {
if (testConfiguration.useEmbeddedPillar()) {
@@ -304,8 +299,7 @@ protected void putDefaultFile() {
try (InputStream fis = getClass().getClassLoader().getResourceAsStream("default-test-file.txt")) {
fe.putFile(fis, defaultFileUrl);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new RuntimeException("Failed to upload default test file", e);
}
@@ -325,7 +319,12 @@ protected void putDefaultFile() {
*/
public class ClientEventLogger implements EventHandler {
- /** The constructor.
+ /**
+ * The TestEventManager used to manage the event for the associated test.
+ */
+
+ /**
+ * The constructor.
*/
public ClientEventLogger() {
super();
@@ -333,16 +332,9 @@ public ClientEventLogger() {
@Override
public void handleEvent(OperationEvent event) {
- MapTimeMeasureComparator class.
*/
@@ -43,21 +52,21 @@ public void testCompareMilliSeconds() {
addDescription("Test the comparison between TimeMeasure units.");
TimeMeasureTYPE referenceTime = new TimeMeasureTYPE();
referenceTime.setTimeMeasureValue(new BigInteger("2"));
- referenceTime.setTimeMeasureUnit(TimeMeasureUnit.MILLISECONDS);
+ referenceTime.setTimeMeasureUnit(MILLISECONDS);
TimeMeasureTYPE compareTime = new TimeMeasureTYPE();
compareTime.setTimeMeasureValue(new BigInteger("3"));
- compareTime.setTimeMeasureUnit(TimeMeasureUnit.MILLISECONDS);
+ compareTime.setTimeMeasureUnit(MILLISECONDS);
- Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
+ assertTrue(compare(referenceTime, compareTime) < 0, referenceTime +
" should be smaller than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("1"));
- Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
+ assertTrue(compare(referenceTime, compareTime) > 0, referenceTime +
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- Assertions.assertEquals(0, TimeMeasurementUtils.compare(referenceTime, compareTime), referenceTime +
+ assertEquals(0, compare(referenceTime, compareTime), referenceTime +
" should be same as " + compareTime);
}
@@ -67,39 +76,39 @@ public void testCompareMilliSecondsToHours() {
addDescription("Test the comparison between milliseconds and hours.");
long millis = 7200000L;
TimeMeasureTYPE referenceTime = new TimeMeasureTYPE();
- referenceTime.setTimeMeasureValue(BigInteger.valueOf(millis));
- referenceTime.setTimeMeasureUnit(TimeMeasureUnit.MILLISECONDS);
+ referenceTime.setTimeMeasureValue(valueOf(millis));
+ referenceTime.setTimeMeasureUnit(MILLISECONDS);
TimeMeasureTYPE compareTime = new TimeMeasureTYPE();
compareTime.setTimeMeasureValue(new BigInteger("3"));
- compareTime.setTimeMeasureUnit(TimeMeasureUnit.HOURS);
+ compareTime.setTimeMeasureUnit(HOURS);
- Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
+ assertTrue(compare(referenceTime, compareTime) < 0, referenceTime +
" should be smaller than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("1"));
- Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
+ assertTrue(compare(referenceTime, compareTime) > 0, referenceTime +
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- Assertions.assertEquals(0, TimeMeasurementUtils.compare(referenceTime, compareTime), referenceTime +
+ assertEquals(0, compare(referenceTime, compareTime), referenceTime +
" should be same as " + compareTime);
- Assertions.assertEquals(millis, TimeMeasurementUtils.getTimeMeasureInLong(referenceTime));
+ assertEquals(millis, getTimeMeasureInLong(referenceTime));
}
@Test
@Tag("regressiontest")
public void testMaxValue() {
addDescription("Test the Maximum value");
- TimeMeasureTYPE time = TimeMeasurementUtils.getMaximumTime();
- Assertions.assertEquals(Long.MAX_VALUE, time.getTimeMeasureValue().longValue());
- Assertions.assertEquals(TimeMeasureUnit.HOURS, time.getTimeMeasureUnit());
-
- TimeMeasureTYPE time2 = TimeMeasurementUtils.getTimeMeasurementFromMilliseconds(
- BigInteger.valueOf(Long.MAX_VALUE));
- time2.setTimeMeasureUnit(TimeMeasureUnit.HOURS);
- Assertions.assertEquals(0, TimeMeasurementUtils.compare(time, time2));
+ TimeMeasureTYPE time = getMaximumTime();
+ assertEquals(MAX_VALUE, time.getTimeMeasureValue().longValue());
+ assertEquals(HOURS, time.getTimeMeasureUnit());
+
+ TimeMeasureTYPE time2 = getTimeMeasurementFromMilliseconds(
+ valueOf(MAX_VALUE));
+ time2.setTimeMeasureUnit(HOURS);
+ assertEquals(0, compare(time, time2));
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
index 42d23f0e0..cf58fb19d 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
@@ -34,13 +34,41 @@
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
-import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAmount;
import java.util.Date;
-import java.util.Locale;
import java.util.concurrent.TimeUnit;
+import static java.lang.Long.MAX_VALUE;
+import static java.time.Duration.ZERO;
+import static java.time.Duration.ofDays;
+import static java.time.Duration.ofHours;
+import static java.time.Duration.ofMillis;
+import static java.time.Duration.ofMinutes;
+import static java.time.Duration.ofNanos;
+import static java.time.Duration.ofSeconds;
+import static java.time.Duration.parse;
+import static java.time.Period.of;
+import static java.time.Period.ofMonths;
+import static java.time.Period.ofYears;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.HOURS;
+import static java.time.temporal.ChronoUnit.MICROS;
+import static java.time.temporal.ChronoUnit.MINUTES;
+import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.SECONDS;
+import static java.time.temporal.ChronoUnit.YEARS;
+import static java.util.Locale.ROOT;
+import static java.util.concurrent.TimeUnit.MICROSECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.bitrepository.common.utils.TimeUtils.durationToCountAndTimeUnit;
+import static org.bitrepository.common.utils.TimeUtils.durationToHuman;
+import static org.bitrepository.common.utils.TimeUtils.durationToHumanUsingEstimates;
+import static org.bitrepository.common.utils.TimeUtils.humanDifference;
+import static org.bitrepository.common.utils.TimeUtils.millisecondsToHuman;
+import static org.bitrepository.common.utils.TimeUtils.shortDate;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TimeUtilsTest extends ExtendedTestCase {
@@ -86,18 +114,18 @@ public void timeTester() throws Exception {
@Test
@Tag("regressiontest")
public void printsHumanDuration() {
- assertEquals("1y", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.YEARS.getDuration()));
- assertEquals("1m", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.MONTHS.getDuration()));
- assertEquals("1d", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.DAYS.getDuration()));
- assertEquals("1h", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.HOURS.getDuration()));
- assertEquals("1m", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.MINUTES.getDuration()));
+ assertEquals("1y", durationToHumanUsingEstimates(YEARS.getDuration()));
+ assertEquals("1m", durationToHumanUsingEstimates(MONTHS.getDuration()));
+ assertEquals("1d", durationToHumanUsingEstimates(DAYS.getDuration()));
+ assertEquals("1h", durationToHumanUsingEstimates(HOURS.getDuration()));
+ assertEquals("1m", durationToHumanUsingEstimates(MINUTES.getDuration()));
// Don’t print seconds
- assertEquals("0m", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.SECONDS.getDuration()));
- assertEquals("2h 3m", TimeUtils.durationToHumanUsingEstimates(Duration.parse("PT2H3M5S")));
+ assertEquals("0m", durationToHumanUsingEstimates(SECONDS.getDuration()));
+ assertEquals("2h 3m", durationToHumanUsingEstimates(parse("PT2H3M5S")));
addStep("Test the limits of what the method handles", "0m and 500y respectively");
- assertEquals("0m", TimeUtils.durationToHumanUsingEstimates(Duration.ZERO));
- assertEquals("500y", TimeUtils.durationToHumanUsingEstimates(Duration.ofHours(4_382_910)));
+ assertEquals("0m", durationToHumanUsingEstimates(ZERO));
+ assertEquals("500y", durationToHumanUsingEstimates(ofHours(4_382_910)));
}
@Test
@@ -105,7 +133,7 @@ public void printsHumanDuration() {
public void zeroIntervalTest() throws Exception {
addDescription("Verifies that a 0 ms interval is represented correctly");
addStep("Call millisecondsToHuman with 0 ms", "The output should be '0 ms'");
- String zeroTimeString = TimeUtils.millisecondsToHuman(0);
+ String zeroTimeString = millisecondsToHuman(0);
assertEquals(" 0 ms", zeroTimeString);
}
@@ -114,23 +142,23 @@ public void zeroIntervalTest() throws Exception {
public void durationsPrintHumanly() {
addDescription("Tests durationToHuman()");
- assertTrue(TimeUtils.durationToHuman(Duration.ZERO).contains("0"),
+ assertTrue(durationToHuman(ZERO).contains("0"),
"Zero duration should contain a 0 digit");
- assertEquals("2d", TimeUtils.durationToHuman(Duration.ofDays(2)));
- assertEquals("3h", TimeUtils.durationToHuman(Duration.ofHours(3)));
- assertEquals("5m", TimeUtils.durationToHuman(Duration.ofMinutes(5)));
- assertEquals("7s", TimeUtils.durationToHuman(Duration.ofSeconds(7)));
- assertEquals("11 ms", TimeUtils.durationToHuman(Duration.ofMillis(11)));
- assertEquals("13 ns", TimeUtils.durationToHuman(Duration.ofNanos(13)));
+ assertEquals("2d", durationToHuman(ofDays(2)));
+ assertEquals("3h", durationToHuman(ofHours(3)));
+ assertEquals("5m", durationToHuman(ofMinutes(5)));
+ assertEquals("7s", durationToHuman(ofSeconds(7)));
+ assertEquals("11 ms", durationToHuman(ofMillis(11)));
+ assertEquals("13 ns", durationToHuman(ofNanos(13)));
// When there are nanoseconds, don't print millis
- assertEquals("999999937 ns", TimeUtils.durationToHuman(Duration.ofNanos(999_999_937)));
+ assertEquals("999999937 ns", durationToHuman(ofNanos(999_999_937)));
- assertEquals("minus 2d", TimeUtils.durationToHuman(Duration.ofDays(-2)));
- assertEquals("minus 13 ns", TimeUtils.durationToHuman(Duration.ofNanos(-13)));
+ assertEquals("minus 2d", durationToHuman(ofDays(-2)));
+ assertEquals("minus 13 ns", durationToHuman(ofNanos(-13)));
- Duration allUnits = Duration.parse("P3DT5H7M11.013000017S");
- assertEquals("3d 5h 7m 11s 13000017 ns", TimeUtils.durationToHuman(allUnits));
+ Duration allUnits = parse("P3DT5H7M11.013000017S");
+ assertEquals("3d 5h 7m 11s 13000017 ns", durationToHuman(allUnits));
}
@Test
@@ -140,37 +168,37 @@ public void differencesPrintHumanly() {
" similar human readable strings to those from millisecondsToHuman()");
addStep("Call humanDifference() with same time twice", "The output should be '0m'");
- String zeroTimeString = TimeUtils.humanDifference(BASE, BASE);
+ String zeroTimeString = humanDifference(BASE, BASE);
assertEquals("0m", zeroTimeString);
addStep("Call humanDifference() with a difference obtained from a Duration",
"Expect corresponding readable output");
// Don’t print seconds
- testHumanDifference("0m", Duration.ofSeconds(1));
- testHumanDifference("1m", Duration.ofMinutes(1));
- testHumanDifference("1h", Duration.ofHours(1));
- testHumanDifference("2h 3m", Duration.parse("PT2H3M5.000000007S"));
+ testHumanDifference("0m", ofSeconds(1));
+ testHumanDifference("1m", ofMinutes(1));
+ testHumanDifference("1h", ofHours(1));
+ testHumanDifference("2h 3m", parse("PT2H3M5.000000007S"));
addStep("Call humanDifference() with a difference obtained from a Period",
"Expect corresponding readable output");
testHumanDifference("1d", Period.ofDays(1));
- testHumanDifference("1m", Period.ofMonths(1));
- testHumanDifference("1y", Period.ofYears(1));
- testHumanDifference("2y 3m 5d", Period.of(2, 3, 5));
+ testHumanDifference("1m", ofMonths(1));
+ testHumanDifference("1y", ofYears(1));
+ testHumanDifference("2y 3m 5d", of(2, 3, 5));
addStep("Call humanDifference() with a difference obtained from a combo of a Period and a Duration",
"Expect corresponding readable output");
testHumanDifference("3y 5m 7d",
- Period.of(3, 5, 7), Duration.parse("PT11H13M17.023S"));
+ of(3, 5, 7), parse("PT11H13M17.023S"));
testHumanDifference("2m 7d 11h",
- Period.of(0, 2, 7), Duration.parse("PT11H13M17.023S"));
- testHumanDifference("1d 11h 13m", Period.ofDays(1), Duration.parse("PT11H13M17.023S"));
+ of(0, 2, 7), parse("PT11H13M17.023S"));
+ testHumanDifference("1d 11h 13m", Period.ofDays(1), parse("PT11H13M17.023S"));
addStep("Call humanDifference()" +
" with dates that are 2 days apart but times that cause the diff to be less than 2 full days",
"Expect output 1d something");
ZoneId testZoneId = ZoneId.of("Europe/Vienna");
- String oneDaySomethingString = TimeUtils.humanDifference(
+ String oneDaySomethingString = humanDifference(
ZonedDateTime.of(2021, 1, 31,
12, 0, 0, 0, testZoneId),
ZonedDateTime.of(2021, 2, 2,
@@ -215,7 +243,7 @@ private void testHumanDifference(String expected, TemporalAmount... amounts) {
for (TemporalAmount amount : amounts) {
end = end.plus(amount);
}
- String differenceString = TimeUtils.humanDifference(BASE, end);
+ String differenceString = humanDifference(BASE, end);
assertEquals(expected, differenceString);
}
@@ -227,10 +255,10 @@ private void testHumanDifference(String expected, TemporalAmount... amounts) {
@Test
@Tag("regressiontest")
public void shortDateTest() {
- DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.ROOT);
+ DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm", ROOT);
Date date = new Date(1360069129256L);
- String shortDateString = TimeUtils.shortDate(date);
- Assertions.assertEquals(shortDateString, formatter.format(date));
+ String shortDateString = shortDate(date);
+ assertEquals(formatter.format(date), shortDateString);
}
@Test
@@ -245,29 +273,18 @@ public void rejectsNegativeDuration() {
@Test
@Tag("regressiontest")
public void convertsDurationToCountAndTimeUnit() {
- CountAndTimeUnit expectedZero = TimeUtils.durationToCountAndTimeUnit(Duration.ZERO);
- Assertions.assertEquals(0, expectedZero.getCount());
- Assertions.assertNotNull(expectedZero.getUnit());
+ CountAndTimeUnit expectedZero = durationToCountAndTimeUnit(ZERO);
+ assertEquals(0, expectedZero.getCount());
+ assertNotNull(expectedZero.getUnit());
- Assertions.assertEquals(new CountAndTimeUnit(1, TimeUnit.NANOSECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(1)));
- Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.NANOSECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(Long.MAX_VALUE)));
- Assertions.assertEquals(
- new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.MICROSECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.of(Long.MAX_VALUE / 1000 + 1, ChronoUnit.MICROS)));
- Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.MICROSECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.of(Long.MAX_VALUE, ChronoUnit.MICROS)));
- Assertions.assertEquals(
- new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.MILLISECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.ofMillis(Long.MAX_VALUE / 1000 + 1)));
- Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.MILLISECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.ofMillis(Long.MAX_VALUE)));
- Assertions.assertEquals(
- new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.SECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MAX_VALUE / 1000 + 1)));
- Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.SECONDS),
- TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MAX_VALUE)));
+ assertEquals(new CountAndTimeUnit(1, NANOSECONDS), durationToCountAndTimeUnit(ofNanos(1)));
+ assertEquals(new CountAndTimeUnit(MAX_VALUE, NANOSECONDS), durationToCountAndTimeUnit(ofNanos(MAX_VALUE)));
+ assertEquals(new CountAndTimeUnit(MAX_VALUE / 1000 + 1, MICROSECONDS), durationToCountAndTimeUnit(Duration.of(MAX_VALUE / 1000 + 1, MICROS)));
+ assertEquals(new CountAndTimeUnit(MAX_VALUE, MICROSECONDS), durationToCountAndTimeUnit(Duration.of(MAX_VALUE, MICROS)));
+ assertEquals(new CountAndTimeUnit(MAX_VALUE / 1000 + 1, MILLISECONDS), durationToCountAndTimeUnit(ofMillis(MAX_VALUE / 1000 + 1)));
+ assertEquals(new CountAndTimeUnit(MAX_VALUE, MILLISECONDS), durationToCountAndTimeUnit(ofMillis(MAX_VALUE)));
+ assertEquals(new CountAndTimeUnit(MAX_VALUE / 1000 + 1, TimeUnit.SECONDS), durationToCountAndTimeUnit(ofSeconds(MAX_VALUE / 1000 + 1)));
+ assertEquals(new CountAndTimeUnit(MAX_VALUE, TimeUnit.SECONDS), durationToCountAndTimeUnit(ofSeconds(MAX_VALUE)));
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
index e53389247..e395ccfb6 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
@@ -1,7 +1,6 @@
package org.bitrepository.common.utils;
import org.bitrepository.bitrepositoryelements.TimeMeasureTYPE;
-import org.bitrepository.bitrepositoryelements.TimeMeasureUnit;
import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -13,6 +12,20 @@
import java.math.BigInteger;
import java.time.Duration;
+import static java.math.BigInteger.ONE;
+import static java.math.BigInteger.valueOf;
+import static java.time.Duration.ZERO;
+import static java.time.Duration.ofDays;
+import static java.time.Duration.ofHours;
+import static java.time.Duration.ofMinutes;
+import static java.time.Duration.ofNanos;
+import static java.time.Duration.ofSeconds;
+import static org.bitrepository.bitrepositoryelements.TimeMeasureUnit.HOURS;
+import static org.bitrepository.bitrepositoryelements.TimeMeasureUnit.MILLISECONDS;
+import static org.bitrepository.common.utils.XmlUtils.xmlDurationToDuration;
+import static org.bitrepository.common.utils.XmlUtils.xmlDurationToMilliseconds;
+import static org.bitrepository.common.utils.XmlUtils.xmlDurationToTimeMeasure;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class XmlUtilsTest extends ExtendedTestCase {
@@ -38,52 +51,42 @@ public void testXmlDurationToDuration() {
addDescription("Tests xmlDurationToDuration in sunshine scenario cases");
addStep("Durations of 0 of some time unit", "Duration.ZERO");
- Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("P0Y")));
- Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("P0M")));
- Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("P0D")));
- Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("PT0H")));
- Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("PT0M")));
- Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("PT0S")));
- Assertions.assertEquals(Duration.ZERO,
- XmlUtils.xmlDurationToDuration(factory.newDuration("PT0.0000S")));
+ assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("P0Y")));
+ assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("P0M")));
+ assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("P0D")));
+ assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0H")));
+ assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0M")));
+ assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0S")));
+ assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0.0000S")));
addStep("Test correct and precise conversion",
"Hours, minutes and seconds are converted with full precision");
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3S")),
- Duration.ofSeconds(3));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.3S")),
- Duration.ofSeconds(3, 300_000_000));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.000000003S")),
- Duration.ofSeconds(3, 3));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.123456789S")),
- Duration.ofSeconds(3, 123_456_789));
+ assertEquals(ofSeconds(3), xmlDurationToDuration(factory.newDuration("PT3S")));
+ assertEquals(ofSeconds(3, 300_000_000), xmlDurationToDuration(factory.newDuration("PT3.3S")));
+ assertEquals(ofSeconds(3, 3), xmlDurationToDuration(factory.newDuration("PT3.000000003S")));
+ assertEquals(ofSeconds(3, 123_456_789), xmlDurationToDuration(factory.newDuration("PT3.123456789S")));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT4M")),
- Duration.ofMinutes(4));
+ assertEquals(ofMinutes(4), xmlDurationToDuration(factory.newDuration("PT4M")));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT5H")),
- Duration.ofHours(5));
+ assertEquals(ofHours(5), xmlDurationToDuration(factory.newDuration("PT5H")));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("PT6H7M8.9S")),
- Duration.ofHours(6).plusMinutes(7).plusSeconds(8).plusMillis(900));
+ assertEquals(ofHours(6).plusMinutes(7).plusSeconds(8).plusMillis(900), xmlDurationToDuration(factory.newDuration("PT6H7M8.9S")));
addStep("Test approximate conversion",
"Days, months and years are converted using estimated factors");
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P2D")),
- Duration.ofDays(2));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("P3DT4M")),
- Duration.ofDays(3).plusMinutes(4));
+ assertEquals(ofDays(2), xmlDurationToDuration(factory.newDuration("P2D")));
+ assertEquals(ofDays(3).plusMinutes(4), xmlDurationToDuration(factory.newDuration("P3DT4M")));
// We require a month to be between 28 and 31 days exclusive
- Duration minMonthLengthExclusive = Duration.ofDays(28);
- Duration maxMonthLengthExclusive = Duration.ofDays(31);
- Duration convertedMonth = XmlUtils.xmlDurationToDuration(factory.newDuration("P1M"));
+ Duration minMonthLengthExclusive = ofDays(28);
+ Duration maxMonthLengthExclusive = ofDays(31);
+ Duration convertedMonth = xmlDurationToDuration(factory.newDuration("P1M"));
assertBetweenExclusive(convertedMonth, minMonthLengthExclusive, maxMonthLengthExclusive);
// Two years is between 730 and 731 days
- Duration minTwoYearsLengthExclusive = Duration.ofDays(2 * 365);
- Duration maxTwoYearsLengthExclusive = Duration.ofDays(2 * 365 + 1);
- Duration convertedTwoYears = XmlUtils.xmlDurationToDuration(factory.newDuration("P2Y"));
+ Duration minTwoYearsLengthExclusive = ofDays(2 * 365);
+ Duration maxTwoYearsLengthExclusive = ofDays(2 * 365 + 1);
+ Duration convertedTwoYears = xmlDurationToDuration(factory.newDuration("P2Y"));
assertBetweenExclusive(convertedTwoYears, minTwoYearsLengthExclusive, maxTwoYearsLengthExclusive);
}
@@ -93,25 +96,21 @@ public void testNegativeXmlDurationToDuration() {
// WorkflowInterval may be negative (meaning don’t run automatically)
addDescription("Tests that xmlDurationToDuration() accepts a negative duration and converts it correctly");
addStep("Negative XML durations", "Corresponding negative java.time durations");
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT3S")),
- Duration.ofSeconds(-3));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT0.000001S")),
- Duration.ofNanos(-1000));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-PT24H")),
- Duration.ofHours(-24));
- Assertions.assertEquals(XmlUtils.xmlDurationToDuration(factory.newDuration("-P1D")),
- Duration.ofDays(-1));
+ assertEquals(ofSeconds(-3), xmlDurationToDuration(factory.newDuration("-PT3S")));
+ assertEquals(ofNanos(-1000), xmlDurationToDuration(factory.newDuration("-PT0.000001S")));
+ assertEquals(ofHours(-24), xmlDurationToDuration(factory.newDuration("-PT24H")));
+ assertEquals(ofDays(-1), xmlDurationToDuration(factory.newDuration("-P1D")));
// We require minus 1 month to be between -31 and -28 days exclusive
- Duration minNegativeMonthLengthExclusive = Duration.ofDays(-31);
- Duration maxNegativeMonthLengthExclusive = Duration.ofDays(-28);
- Duration convertedMinusOneMonth = XmlUtils.xmlDurationToDuration(factory.newDuration("-P1M"));
+ Duration minNegativeMonthLengthExclusive = ofDays(-31);
+ Duration maxNegativeMonthLengthExclusive = ofDays(-28);
+ Duration convertedMinusOneMonth = xmlDurationToDuration(factory.newDuration("-P1M"));
assertBetweenExclusive(convertedMinusOneMonth, minNegativeMonthLengthExclusive, maxNegativeMonthLengthExclusive);
// Minus 1 year is between -366 and -365 days
- Duration minMinusOneYearLengthExclusive = Duration.ofDays(-366);
- Duration maxMinusOneYearLengthExclusive = Duration.ofDays(-365);
- Duration convertedMinusOneYears = XmlUtils.xmlDurationToDuration(factory.newDuration("-P1Y"));
+ Duration minMinusOneYearLengthExclusive = ofDays(-366);
+ Duration maxMinusOneYearLengthExclusive = ofDays(-365);
+ Duration convertedMinusOneYears = xmlDurationToDuration(factory.newDuration("-P1Y"));
assertBetweenExclusive(convertedMinusOneYears, minMinusOneYearLengthExclusive, maxMinusOneYearLengthExclusive);
}
@@ -137,36 +136,35 @@ public void testXmlDurationToMilliseconds() {
addStep("Test correct and precise conversion",
"Hours, minutes and seconds are converted with full precision");
- Assertions.assertEquals(1, XmlUtils.xmlDurationToMilliseconds(factory.newDuration(1)));
- Assertions.assertEquals(1000, XmlUtils.xmlDurationToMilliseconds(factory.newDuration(1000)));
+ assertEquals(1, xmlDurationToMilliseconds(factory.newDuration(1)));
+ assertEquals(1000, xmlDurationToMilliseconds(factory.newDuration(1000)));
- Assertions.assertEquals(1, XmlUtils.xmlDurationToMilliseconds(factory.newDuration("PT0.001S")));
- Assertions.assertEquals(1, XmlUtils.xmlDurationToMilliseconds(factory.newDuration("PT0.001999S")));
- Assertions.assertEquals(2000, XmlUtils.xmlDurationToMilliseconds(factory.newDuration("PT2S")));
+ assertEquals(1, xmlDurationToMilliseconds(factory.newDuration("PT0.001S")));
+ assertEquals(1, xmlDurationToMilliseconds(factory.newDuration("PT0.001999S")));
+ assertEquals(2000, xmlDurationToMilliseconds(factory.newDuration("PT2S")));
}
@Test
@Tag("regressiontest")
public void testNegativeXmlDurationToMilliseconds() {
- Assertions.assertEquals(-1000, XmlUtils.xmlDurationToMilliseconds(factory.newDuration("-PT1S")));
+ assertEquals(-1000, xmlDurationToMilliseconds(factory.newDuration("-PT1S")));
}
@Test
@Tag("regressiontest")
public void convertsToTimeMeasure() {
- TimeMeasureTYPE shortTimeMeasure = XmlUtils.xmlDurationToTimeMeasure(factory.newDuration(1));
- Assertions.assertEquals(TimeMeasureUnit.MILLISECONDS, shortTimeMeasure.getTimeMeasureUnit());
- Assertions.assertEquals(BigInteger.ONE, shortTimeMeasure.getTimeMeasureValue());
+ TimeMeasureTYPE shortTimeMeasure = xmlDurationToTimeMeasure(factory.newDuration(1));
+ assertEquals(MILLISECONDS, shortTimeMeasure.getTimeMeasureUnit());
+ assertEquals(ONE, shortTimeMeasure.getTimeMeasureValue());
long hours = 2_562_047_788_015L;
- TimeMeasureTYPE longTimeMeasure = XmlUtils.xmlDurationToTimeMeasure(factory.newDurationDayTime(
- true, BigInteger.ZERO, BigInteger.valueOf(hours), BigInteger.ZERO, BigInteger.ZERO));
- if (longTimeMeasure.getTimeMeasureUnit() == TimeMeasureUnit.HOURS) {
- Assertions.assertEquals(longTimeMeasure.getTimeMeasureValue(), BigInteger.valueOf(hours));
+ TimeMeasureTYPE longTimeMeasure = xmlDurationToTimeMeasure(factory.newDurationDayTime(
+ true, BigInteger.ZERO, valueOf(hours), BigInteger.ZERO, BigInteger.ZERO));
+ if (longTimeMeasure.getTimeMeasureUnit() == HOURS) {
+ assertEquals(valueOf(hours), longTimeMeasure.getTimeMeasureValue());
} else {
- Assertions.assertEquals(TimeMeasureUnit.MILLISECONDS, longTimeMeasure.getTimeMeasureUnit());
- Assertions.assertEquals(longTimeMeasure.getTimeMeasureValue(),
- BigInteger.valueOf(Duration.ofHours(hours).toMillis()));
+ assertEquals(MILLISECONDS, longTimeMeasure.getTimeMeasureUnit());
+ assertEquals(valueOf(ofHours(hours).toMillis()), longTimeMeasure.getTimeMeasureValue());
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
index 95e072e20..333cf88e2 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
@@ -35,8 +35,10 @@
import java.util.Arrays;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.TimeUnit;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.bitrepository.protocol.activemq.ActiveMQMessageBus.MESSAGE_TO_KEY;
+import static org.bitrepository.protocol.message.ExampleMessageFactory.createMessage;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -112,12 +114,12 @@ public void onMessage(Message message) {
}
});
IdentifyPillarsForDeleteFileRequest messageToSend =
- ExampleMessageFactory.createMessage(IdentifyPillarsForDeleteFileRequest.class);
+ createMessage(IdentifyPillarsForDeleteFileRequest.class);
messageToSend.setDestination(settingsForTestClient.getCollectionDestination());
messageToSend.setTo(receiverID);
messageBus.sendMessage(messageToSend);
- Message receivedMessage = messageList.poll(3, TimeUnit.SECONDS);
- assertEquals(receiverID, receivedMessage.getStringProperty(ActiveMQMessageBus.MESSAGE_TO_KEY));
+ Message receivedMessage = messageList.poll(3, SECONDS);
+ assertEquals(receiverID, receivedMessage.getStringProperty(MESSAGE_TO_KEY));
}
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java
index 9e69ba012..98d52f634 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java
@@ -29,7 +29,6 @@
import org.bitrepository.protocol.IntegrationTest;
import org.bitrepository.protocol.MessageContext;
import org.bitrepository.protocol.ProtocolComponentFactory;
-import org.bitrepository.protocol.message.ExampleMessageFactory;
import org.bitrepository.protocol.messagebus.MessageListener;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
@@ -40,6 +39,10 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.bitrepository.protocol.message.ExampleMessageFactory.createMessage;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* Class for testing the interface with the message bus.
*/
@@ -70,7 +73,7 @@ protected void setupMessageBus() {
public final void manyTheadsBeforeFinish() throws Exception {
addDescription("Tests whether it is possible to start the handling of many threads simultaneously.");
IdentifyPillarsForGetFileRequest content =
- ExampleMessageFactory.createMessage(IdentifyPillarsForGetFileRequest.class);
+ createMessage(IdentifyPillarsForGetFileRequest.class);
listener = new MultiMessageListener();
messageBus.addListener("BusActivityTest", listener);
content.setDestination("BusActivityTest");
@@ -79,8 +82,8 @@ public final void manyTheadsBeforeFinish() throws Exception {
for (int i = 0; i < threadCount; i++) {
messageBus.sendMessage(content);
}
- Assertions.assertEquals(FINISH, finishQueue.poll(TIME_FOR_WAIT, TimeUnit.MILLISECONDS));
- Assertions.assertEquals(threadCount, count);
+ assertEquals(FINISH, finishQueue.poll(TIME_FOR_WAIT, MILLISECONDS));
+ assertEquals(threadCount, count);
}
@AfterEach
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/fileexchange/LocalFileExchangeTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/fileexchange/LocalFileExchangeTest.java
index 4275a4804..601cc3464 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/fileexchange/LocalFileExchangeTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/fileexchange/LocalFileExchangeTest.java
@@ -20,12 +20,17 @@
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
-import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import static java.net.URLEncoder.encode;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class LocalFileExchangeTest extends ExtendedTestCase {
final static String BASE_FILE_EXCHANGE_DIR = "target/fileexchange/";
@@ -56,9 +61,9 @@ public void getUrlTest() throws MalformedURLException {
URL expectedUrl = new URL("file:" + basedir.getAbsolutePath() + "/" + testFile);
URL actualUrl = exchange.getURL(testFile);
- Assertions.assertEquals(actualUrl, expectedUrl);
+ assertEquals(expectedUrl, actualUrl);
File actualFile = new File(actualUrl.getFile());
- Assertions.assertFalse(actualFile.exists());
+ assertFalse(actualFile.exists());
}
/**
@@ -74,15 +79,15 @@ public void putFileByFileContainingHashTest() throws Exception {
File testFile = createTestFile(testFileLocation, testFileContent);
File basedir = new File(BASE_FILE_EXCHANGE_DIR);
- URL expectedUrl = new URL("file:" + basedir.getAbsolutePath() + "/" + URLEncoder.encode(testFileName,
- StandardCharsets.UTF_8));
+ URL expectedUrl = new URL("file:" + basedir.getAbsolutePath() + "/" + encode(testFileName,
+ UTF_8));
URL fileExchangeUrl = exchange.putFile(testFile);
- Assertions.assertEquals(fileExchangeUrl, expectedUrl);
+ assertEquals(expectedUrl, fileExchangeUrl);
File actualFile = new File(fileExchangeUrl.toURI());
- Assertions.assertTrue(actualFile.exists());
+ assertTrue(actualFile.exists());
String fileExchangeContent = readTestFileContent(actualFile);
- Assertions.assertEquals(testFileContent, fileExchangeContent);
+ assertEquals(testFileContent, fileExchangeContent);
actualFile.delete();
}
@@ -97,12 +102,12 @@ public void putFileByFileTest() throws IOException {
URL expectedUrl = new URL("file:" + basedir.getAbsolutePath() + "/" + testFileName);
URL fileExchangeUrl = exchange.putFile(testFile);
- Assertions.assertEquals(fileExchangeUrl, expectedUrl);
+ assertEquals(expectedUrl, fileExchangeUrl);
File actualFile = new File(fileExchangeUrl.getFile());
- Assertions.assertTrue(actualFile.exists());
+ assertTrue(actualFile.exists());
String fileExchangeContent = readTestFileContent(actualFile);
- Assertions.assertEquals(testFileContent, fileExchangeContent);
+ assertEquals(testFileContent, fileExchangeContent);
actualFile.delete();
}
@@ -111,13 +116,13 @@ public void putFileByStreamTest() throws IOException {
String testFileName = "putFileByStreamTestFile";
String testFileContent = "lorem ipsum2";
- InputStream is = new ByteArrayInputStream(testFileContent.getBytes(StandardCharsets.UTF_8));
+ InputStream is = new ByteArrayInputStream(testFileContent.getBytes(UTF_8));
URL fileExchangeUrl = exchange.getURL(testFileName);
exchange.putFile(is, fileExchangeUrl);
File fileExchangeFile = new File(fileExchangeUrl.getFile());
String fileExchangeContent = readTestFileContent(fileExchangeFile);
- Assertions.assertEquals(testFileContent, fileExchangeContent);
+ assertEquals(testFileContent, fileExchangeContent);
fileExchangeFile.delete();
}
@@ -131,8 +136,8 @@ public void getFileByInputStreamTest() throws IOException {
URL testFileUrl = testFile.toURI().toURL();
InputStream is = exchange.getFile(testFileUrl);
- String fileContent = IOUtils.toString(is, StandardCharsets.UTF_8);
- Assertions.assertEquals(testFileContent, fileContent);
+ String fileContent = IOUtils.toString(is, UTF_8);
+ assertEquals(testFileContent, fileContent);
}
@Test
@@ -147,7 +152,7 @@ public void getFileByOutputStreamTest() throws IOException {
OutputStream os = new ByteArrayOutputStream();
exchange.getFile(os, testFileUrl);
- Assertions.assertEquals(testFileContent, os.toString());
+ assertEquals(testFileContent, os.toString());
}
@Test
@@ -164,7 +169,7 @@ public void getFileByAddressTest() throws IOException {
exchange.getFile(destination, testFileUrl.toString());
String destinationContent = readTestFileContent(destination);
- Assertions.assertEquals(testFileContent, destinationContent);
+ assertEquals(testFileContent, destinationContent);
}
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java
index ecc0bc3e2..3370a90ed 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java
@@ -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
*
@@ -215,11 +221,11 @@ public void testListeners(MessageBusConfiguration conf, SecurityManager security
try {
addStep("Initialise the message listeners.", "Should be created and connected to the message bus.");
for (int i = 0; i < NUMBER_OF_LISTENERS; i++) {
- Settings listenerSettings = TestSettingsProvider.getSettings(getClass().getSimpleName());
+ Settings listenerSettings = getSettings(getClass().getSimpleName());
try {
- java.lang.reflect.Field field = Settings.class.getDeclaredField("componentID");
+ Field field = Settings.class.getDeclaredField("componentID");
field.setAccessible(true);
- field.set(listenerSettings, getClass().getSimpleName() + "-Listener-" + i + "-" + System.nanoTime());
+ field.set(listenerSettings, getClass().getSimpleName() + "-Listener-" + i + "-" + nanoTime());
} catch (Exception e) {
throw new RuntimeException("Failed to set componentID", e);
}
@@ -265,12 +271,11 @@ public void testListeners(MessageBusConfiguration conf, SecurityManager security
addStep("Verifying the amount of message sent '" + idReached + "' has been received by all '"
+ NUMBER_OF_LISTENERS + "' listeners", "Should be the same amount for each listener, and the same "
+ "amount as the correlation ID of the message");
- Assertions.assertEquals(messageReceived, idReached * NUMBER_OF_LISTENERS,
- "Reached message Id " + idReached + " thus each message of the " + NUMBER_OF_LISTENERS + " listener "
- + "should have received " + idReached + " message, though they have received "
- + messageReceived + " message all together.");
+ assertEquals(idReached * NUMBER_OF_LISTENERS, messageReceived, "Reached message Id " + idReached + " thus each message of the " + NUMBER_OF_LISTENERS + " listener "
+ + "should have received " + idReached + " message, though they have received "
+ + messageReceived + " message all together.");
for (NotificationMessageListener listener : listeners) {
- Assertions.assertTrue((listener.getCount() == idReached),
+ assertTrue((listener.getCount() == idReached),
"Should have received " + idReached + " messages, but has received "
+ listener.getCount());
}
@@ -303,6 +308,7 @@ public void testListeners(MessageBusConfiguration conf, SecurityManager security
/**
* Finds a free port on the localhost.
+ *
* @return A free port number.
* @throws IOException If an I/O error occurs.
*/
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
index 143e33699..e93c5ffcf 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
@@ -37,6 +37,18 @@
import java.security.Security;
import java.security.cert.X509Certificate;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.security.Security.addProvider;
+import static org.bitrepository.protocol.security.SecurityModuleConstants.defaultEncodingType;
+import static org.bitrepository.protocol.security.SecurityTestConstants.getTestData;
+import static org.bitrepository.protocol.security.TestCertProvider.getPositiveCertSignature;
+import static org.bitrepository.protocol.security.TestCertProvider.loadNegativeCert;
+import static org.bitrepository.protocol.security.TestCertProvider.loadPositiveCert;
+import static org.bouncycastle.util.encoders.Base64.decode;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
public class CertificateIDTest extends ExtendedTestCase {
@Test
@@ -44,21 +56,21 @@ public class CertificateIDTest extends ExtendedTestCase {
public void positiveCertificateIdentificationTest() throws Exception {
addDescription("Tests that a certificate can be identified based on the correct signature.");
addStep("Create CertificateID object based on the certificate used to sign the data", "CertificateID object not null");
- Security.addProvider(new BouncyCastleProvider());
+ addProvider(new BouncyCastleProvider());
- X509Certificate myCertificate = TestCertProvider.loadPositiveCert();
+ X509Certificate myCertificate = loadPositiveCert();
CertificateID certificateIDfromCertificate =
new CertificateID(myCertificate.getIssuerX500Principal(), myCertificate.getSerialNumber());
addStep("Create CertificateID object based on signature", "Certificate object not null");
- byte[] decodeSig = Base64.decode(TestCertProvider.getPositiveCertSignature().getBytes(StandardCharsets.UTF_8));
+ byte[] decodeSig = decode(getPositiveCertSignature().getBytes(UTF_8));
CMSSignedData s = new CMSSignedData(new CMSProcessableByteArray(
- SecurityTestConstants.getTestData().getBytes(SecurityModuleConstants.defaultEncodingType)), decodeSig);
+ getTestData().getBytes(defaultEncodingType)), decodeSig);
SignerInformation signer = s.getSignerInfos().getSigners().iterator().next();
CertificateID certificateIDFromSignature = new CertificateID(signer.getSID().getIssuer(), signer.getSID().getSerialNumber());
addStep("Assert that the two CertificateID objects are equal", "Assert succeeds");
- Assertions.assertEquals(certificateIDfromCertificate, certificateIDFromSignature);
+ assertEquals(certificateIDFromSignature, certificateIDfromCertificate);
}
@Test
@@ -88,51 +100,51 @@ public void negativeCertificateIdentificationTest() throws Exception {
public void equalTest() throws Exception {
addDescription("Tests the equality of CertificateIDs");
addStep("Setup", "");
- Security.addProvider(new BouncyCastleProvider());
+ addProvider(new BouncyCastleProvider());
- X509Certificate myCertificate = TestCertProvider.loadNegativeCert();
+ X509Certificate myCertificate = loadNegativeCert();
X500Principal issuer = myCertificate.getIssuerX500Principal();
BigInteger serial = myCertificate.getSerialNumber();
CertificateID certificateID1 = new CertificateID(issuer, serial);
addStep("Validate the content of the certificateID", "Should be same as x509Certificate");
- Assertions.assertEquals(certificateID1.getIssuer(), issuer);
- Assertions.assertEquals(certificateID1.getSerial(), serial);
+ assertEquals(issuer, certificateID1.getIssuer());
+ assertEquals(serial, certificateID1.getSerial());
addStep("Test whether it equals it self", "should give positive result");
- Assertions.assertEquals(certificateID1, certificateID1);
+ assertEquals(certificateID1, certificateID1);
addStep("Test with a null as argument", "Should give negative result");
- Assertions.assertNotEquals(null, certificateID1);
+ assertNotEquals(null, certificateID1);
addStep("Test with another class", "Should give negative result");
- Assertions.assertNotEquals(new Object(), certificateID1);
+ assertNotEquals(new Object(), certificateID1);
addStep("Test with same issuer but no serial", "Should give negative result");
- Assertions.assertNotEquals(new CertificateID(issuer, null), certificateID1);
+ assertNotEquals(new CertificateID(issuer, null), certificateID1);
addStep("Test with same serial but no issuer", "Should give negative result");
- Assertions.assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID1);
+ assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID1);
addStep("Test the positive case, with both the issuer and serial ", "Should give positive result");
- Assertions.assertEquals(new CertificateID(issuer, serial), certificateID1);
+ assertEquals(certificateID1, new CertificateID(issuer, serial));
addStep("Setup an empty certificate", "");
CertificateID certificateID2 = new CertificateID((X500Principal) null, null);
addStep("Test empty certificate against issuer but no serial", "Should give negative result");
- Assertions.assertNotEquals(new CertificateID(issuer, null), certificateID2);
+ assertNotEquals(new CertificateID(issuer, null), certificateID2);
addStep("Test empty certificate against serial but no issuer", "Should give negative result");
- Assertions.assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID2);
+ assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID2);
addStep("Test empty certificate against serial and issuer", "Should give negative result");
- Assertions.assertNotEquals(new CertificateID(issuer, serial), certificateID2);
+ assertNotEquals(new CertificateID(issuer, serial), certificateID2);
addStep("Test the positive case, with neither issuer nor serial", "Should give positive result");
- Assertions.assertEquals(new CertificateID((X500Principal) null, null), certificateID2);
+ assertEquals(new CertificateID((X500Principal) null, null), certificateID2);
addStep("Check the hash codes for the two certificate", "Should not be the same");
- Assertions.assertTrue(certificateID1.hashCode() != certificateID2.hashCode());
+ assertTrue(certificateID1.hashCode() != certificateID2.hashCode());
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
index 9a5be20b9..2bfe1360a 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
@@ -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
*
@@ -220,7 +215,7 @@ public void testListeners(MessageBusConfiguration conf, SecurityManager security
try {
addStep("Initialise the message listeners.", "Should be created and connected to the message bus.");
for (int i = 0; i < NUMBER_OF_LISTENERS; i++) {
- Settings listenerSettings = getSettings(getClass().getSimpleName());
+ Settings listenerSettings = TestSettingsProvider.getSettings(getClass().getSimpleName());
listenerSettings.getRepositorySettings().getProtocolSettings().setMessageBusConfiguration(conf);
listeners.add(new NotificationMessageListener(listenerSettings, securityManager));
}
@@ -262,11 +257,12 @@ public void testListeners(MessageBusConfiguration conf, SecurityManager security
addStep("Verifying the amount of message sent '" + idReached + "' has been received by all '"
+ NUMBER_OF_LISTENERS + "' listeners", "Should be the same amount for each listener, and the same "
+ "amount as the correlation ID of the message");
- assertEquals(idReached * NUMBER_OF_LISTENERS, messageReceived, "Reached message Id " + idReached + " thus each message of the " + NUMBER_OF_LISTENERS + " listener "
+ Assertions.assertEquals(idReached * NUMBER_OF_LISTENERS, messageReceived, "Reached message Id " + idReached + " thus" +
+ " each message of the " + NUMBER_OF_LISTENERS + " listener "
+ "should have received " + idReached + " message, though they have received "
+ messageReceived + " message all together.");
for (NotificationMessageListener listener : listeners) {
- assertTrue((listener.getCount() == idReached),
+ Assertions.assertTrue((listener.getCount() == idReached),
"Should have received " + idReached + " messages, but has received "
+ listener.getCount());
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
index e93c5ffcf..695179009 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
@@ -37,18 +37,6 @@
import java.security.Security;
import java.security.cert.X509Certificate;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.security.Security.addProvider;
-import static org.bitrepository.protocol.security.SecurityModuleConstants.defaultEncodingType;
-import static org.bitrepository.protocol.security.SecurityTestConstants.getTestData;
-import static org.bitrepository.protocol.security.TestCertProvider.getPositiveCertSignature;
-import static org.bitrepository.protocol.security.TestCertProvider.loadNegativeCert;
-import static org.bitrepository.protocol.security.TestCertProvider.loadPositiveCert;
-import static org.bouncycastle.util.encoders.Base64.decode;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
public class CertificateIDTest extends ExtendedTestCase {
@Test
@@ -56,21 +44,21 @@ public class CertificateIDTest extends ExtendedTestCase {
public void positiveCertificateIdentificationTest() throws Exception {
addDescription("Tests that a certificate can be identified based on the correct signature.");
addStep("Create CertificateID object based on the certificate used to sign the data", "CertificateID object not null");
- addProvider(new BouncyCastleProvider());
+ Security.addProvider(new BouncyCastleProvider());
- X509Certificate myCertificate = loadPositiveCert();
+ X509Certificate myCertificate = TestCertProvider.loadPositiveCert();
CertificateID certificateIDfromCertificate =
new CertificateID(myCertificate.getIssuerX500Principal(), myCertificate.getSerialNumber());
addStep("Create CertificateID object based on signature", "Certificate object not null");
- byte[] decodeSig = decode(getPositiveCertSignature().getBytes(UTF_8));
+ byte[] decodeSig = Base64.decode(TestCertProvider.getPositiveCertSignature().getBytes(StandardCharsets.UTF_8));
CMSSignedData s = new CMSSignedData(new CMSProcessableByteArray(
- getTestData().getBytes(defaultEncodingType)), decodeSig);
+ SecurityTestConstants.getTestData().getBytes(SecurityModuleConstants.defaultEncodingType)), decodeSig);
SignerInformation signer = s.getSignerInfos().getSigners().iterator().next();
CertificateID certificateIDFromSignature = new CertificateID(signer.getSID().getIssuer(), signer.getSID().getSerialNumber());
addStep("Assert that the two CertificateID objects are equal", "Assert succeeds");
- assertEquals(certificateIDFromSignature, certificateIDfromCertificate);
+ Assertions.assertEquals(certificateIDFromSignature, certificateIDfromCertificate);
}
@Test
@@ -100,51 +88,51 @@ public void negativeCertificateIdentificationTest() throws Exception {
public void equalTest() throws Exception {
addDescription("Tests the equality of CertificateIDs");
addStep("Setup", "");
- addProvider(new BouncyCastleProvider());
+ Security.addProvider(new BouncyCastleProvider());
- X509Certificate myCertificate = loadNegativeCert();
+ X509Certificate myCertificate = TestCertProvider.loadNegativeCert();
X500Principal issuer = myCertificate.getIssuerX500Principal();
BigInteger serial = myCertificate.getSerialNumber();
CertificateID certificateID1 = new CertificateID(issuer, serial);
addStep("Validate the content of the certificateID", "Should be same as x509Certificate");
- assertEquals(issuer, certificateID1.getIssuer());
- assertEquals(serial, certificateID1.getSerial());
+ Assertions.assertEquals(issuer, certificateID1.getIssuer());
+ Assertions.assertEquals(serial, certificateID1.getSerial());
addStep("Test whether it equals it self", "should give positive result");
- assertEquals(certificateID1, certificateID1);
+ Assertions.assertEquals(certificateID1, certificateID1);
addStep("Test with a null as argument", "Should give negative result");
- assertNotEquals(null, certificateID1);
+ Assertions.assertNotEquals(null, certificateID1);
addStep("Test with another class", "Should give negative result");
- assertNotEquals(new Object(), certificateID1);
+ Assertions.assertNotEquals(new Object(), certificateID1);
addStep("Test with same issuer but no serial", "Should give negative result");
- assertNotEquals(new CertificateID(issuer, null), certificateID1);
+ Assertions.assertNotEquals(new CertificateID(issuer, null), certificateID1);
addStep("Test with same serial but no issuer", "Should give negative result");
- assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID1);
+ Assertions.assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID1);
addStep("Test the positive case, with both the issuer and serial ", "Should give positive result");
- assertEquals(certificateID1, new CertificateID(issuer, serial));
+ Assertions.assertEquals(certificateID1, new CertificateID(issuer, serial));
addStep("Setup an empty certificate", "");
CertificateID certificateID2 = new CertificateID((X500Principal) null, null);
addStep("Test empty certificate against issuer but no serial", "Should give negative result");
- assertNotEquals(new CertificateID(issuer, null), certificateID2);
+ Assertions.assertNotEquals(new CertificateID(issuer, null), certificateID2);
addStep("Test empty certificate against serial but no issuer", "Should give negative result");
- assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID2);
+ Assertions.assertNotEquals(new CertificateID((X500Principal) null, serial), certificateID2);
addStep("Test empty certificate against serial and issuer", "Should give negative result");
- assertNotEquals(new CertificateID(issuer, serial), certificateID2);
+ Assertions.assertNotEquals(new CertificateID(issuer, serial), certificateID2);
addStep("Test the positive case, with neither issuer nor serial", "Should give positive result");
- assertEquals(new CertificateID((X500Principal) null, null), certificateID2);
+ Assertions.assertEquals(new CertificateID((X500Principal) null, null), certificateID2);
addStep("Check the hash codes for the two certificate", "Should not be the same");
- assertTrue(certificateID1.hashCode() != certificateID2.hashCode());
+ Assertions.assertTrue(certificateID1.hashCode() != certificateID2.hashCode());
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
index 2bfe1360a..79790ccbf 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
@@ -25,7 +25,9 @@
import org.bouncycastle.cms.CMSSignedData;
import org.bouncycastle.cms.SignerId;
import org.bouncycastle.cms.SignerInformation;
+import org.bouncycastle.util.encoders.Base64;
import org.jaccept.structure.ExtendedTestCase;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -33,13 +35,6 @@
import java.math.BigInteger;
import java.security.cert.X509Certificate;
-import static org.bitrepository.protocol.security.SecurityModuleConstants.defaultEncodingType;
-import static org.bitrepository.protocol.security.SecurityTestConstants.getTestData;
-import static org.bitrepository.protocol.security.TestCertProvider.getFingerprintForPositiveCert;
-import static org.bitrepository.protocol.security.TestCertProvider.getPositiveCertSignature;
-import static org.bitrepository.protocol.security.TestCertProvider.loadPositiveCert;
-import static org.bouncycastle.util.encoders.Base64.decode;
-import static org.junit.jupiter.api.Assertions.assertEquals;
public class PermissionStoreTest extends ExtendedTestCase {
private static final String componentID = "TEST";
@@ -57,14 +52,14 @@ public void positiveCertificateRetrievalTest() throws Exception {
addDescription("Tests that a certificate can be retrieved based on the correct signerId.");
addStep("Create signer to lookup certificate", "No exceptions");
byte[] decodeSig =
- decode(getPositiveCertSignature().getBytes(defaultEncodingType));
+ Base64.decode(TestCertProvider.getPositiveCertSignature().getBytes(SecurityModuleConstants.defaultEncodingType));
CMSSignedData s = new CMSSignedData(new CMSProcessableByteArray(
- getTestData().getBytes(defaultEncodingType)), decodeSig);
+ SecurityTestConstants.getTestData().getBytes(SecurityModuleConstants.defaultEncodingType)), decodeSig);
SignerInformation signer = s.getSignerInfos().getSigners().iterator().next();
addStep("Lookup certificate based on signerId", "No exceptions");
X509Certificate certificateFromStore = permissionStore.getCertificate(signer.getSID());
- X509Certificate positiveCertificate = loadPositiveCert();
- assertEquals(certificateFromStore, positiveCertificate);
+ X509Certificate positiveCertificate = TestCertProvider.loadPositiveCert();
+ Assertions.assertEquals(certificateFromStore, positiveCertificate);
}
@Test
@@ -73,9 +68,9 @@ public void negativeCertificateRetrievalTest() throws Exception {
addDescription("Tests that a certificate cannot be retrieved based on the wrong signerId.");
addStep("Create signer and modify its ID so lookup will fail", "No exceptions");
byte[] decodeSig =
- decode(getPositiveCertSignature().getBytes(defaultEncodingType));
+ Base64.decode(TestCertProvider.getPositiveCertSignature().getBytes(SecurityModuleConstants.defaultEncodingType));
CMSSignedData s = new CMSSignedData(new CMSProcessableByteArray(
- getTestData().getBytes(defaultEncodingType)), decodeSig);
+ SecurityTestConstants.getTestData().getBytes(SecurityModuleConstants.defaultEncodingType)), decodeSig);
SignerInformation signer = s.getSignerInfos().getSigners().iterator().next();
SignerId signerId = signer.getSID();
BigInteger serial = signerId.getSerialNumber();
@@ -83,8 +78,8 @@ public void negativeCertificateRetrievalTest() throws Exception {
signerId = new SignerId(signerId.getIssuer(), serial);
addStep("Lookup certificate based on signerId", "No exceptions");
X509Certificate certificateFromStore = permissionStore.getCertificate(signerId);
- X509Certificate positiveCertificate = loadPositiveCert();
- assertEquals(certificateFromStore, positiveCertificate);
+ X509Certificate positiveCertificate = TestCertProvider.loadPositiveCert();
+ Assertions.assertEquals(certificateFromStore, positiveCertificate);
}
//@Test
@@ -105,15 +100,15 @@ public void certificateFingerprintTest() throws Exception {
addDescription("Tests that a certificate fingerprint can correctly be retrieved for a signer.");
addFixture("Create signer to lookup fingerprint");
byte[] decodeSig =
- decode(getPositiveCertSignature().getBytes(defaultEncodingType));
+ Base64.decode(TestCertProvider.getPositiveCertSignature().getBytes(SecurityModuleConstants.defaultEncodingType));
CMSSignedData s = new CMSSignedData(new CMSProcessableByteArray(
- getTestData().getBytes(defaultEncodingType)), decodeSig);
+ SecurityTestConstants.getTestData().getBytes(SecurityModuleConstants.defaultEncodingType)), decodeSig);
SignerInformation signer = s.getSignerInfos().getSigners().iterator().next();
addStep("Lookup fingerprint based on signerId", "The correct finger print should be returned with openssl" +
"used to generate reference finger print");
String certificateFingerprintFromStore = permissionStore.getCertificateFingerprint(signer.getSID());
- String referenceCertificateFingerprint = getFingerprintForPositiveCert();
- assertEquals(certificateFingerprintFromStore, referenceCertificateFingerprint);
+ String referenceCertificateFingerprint = TestCertProvider.getFingerprintForPositiveCert();
+ Assertions.assertEquals(certificateFingerprintFromStore, referenceCertificateFingerprint);
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
index c9ef2846c..163754fe8 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
@@ -48,11 +48,6 @@
import java.nio.charset.StandardCharsets;
import java.util.List;
-import static org.bitrepository.protocol.security.SecurityTestConstants.getTestData;
-import static org.bitrepository.protocol.security.TestCertProvider.getPositiveCertSignature;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
-
public class SecurityManagerTest extends ExtendedTestCase {
private final Logger log = LoggerFactory.getLogger(getClass());
private org.bitrepository.protocol.security.SecurityManager securityManager;
@@ -88,7 +83,7 @@ public void operationAuthorizationBehaviourTest() throws Exception {
addDescription("Tests that a signature only allows the correct requests.");
List JUnit 5 Annotations Used: Options in a JUnit 5 Suite: Example Usage:TestEventManager used to manage the event for the associated test. */
+ /**
+ * The TestEventManager used to manage the event for the associated test.
+ */
private final TestEventManager testEventManager;
- /** The queue used to store the received operation events. */
+ /**
+ * The queue used to store the received operation events.
+ */
private final BlockingQueueTestEventManager used to manage the event for the associated test.
*/
public TestEventHandler(TestEventManager testEventManager) {
@@ -57,13 +66,14 @@ public TestEventHandler(TestEventManager testEventManager) {
@Override
public void handleEvent(OperationEvent event) {
- testEventManager.addResult("Received event: "+ event);
+ testEventManager.addResult("Received event: " + event);
eventQueue.add(event);
}
/**
* Wait for an event for the DEFAULT_WAIT_SECONDS amount of time.
- * @return The next event if any, else null
+ *
+ * @return The next event if any, else null
*/
public OperationEvent waitForEvent() throws InterruptedException {
return waitForEvent(DEFAULT_WAIT_SECONDS, TimeUnit.SECONDS);
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
index 37497ceb6..87bef14a6 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
@@ -24,13 +24,10 @@
import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.client.exceptions.NegativeResponseException;
import org.jaccept.structure.ExtendedTestCase;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
public class NegativeResponseExceptionTest extends ExtendedTestCase {
@@ -47,10 +44,10 @@ public void testNegativeResponse() {
try {
throw new NegativeResponseException(errMsg, responseCode);
} catch (Exception e) {
- assertInstanceOf(NegativeResponseException.class, e);
- assertEquals(errMsg, e.getMessage());
- assertEquals(responseCode, ((NegativeResponseException) e).getErrorCode());
- assertNull(e.getCause());
+ Assertions.assertInstanceOf(NegativeResponseException.class, e);
+ Assertions.assertEquals(errMsg, e.getMessage());
+ Assertions.assertEquals(responseCode, ((NegativeResponseException) e).getErrorCode());
+ Assertions.assertNull(e.getCause());
}
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
index 525351b4d..5fe3eb135 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
@@ -23,14 +23,10 @@
import org.bitrepository.client.exceptions.UnexpectedResponseException;
import org.jaccept.structure.ExtendedTestCase;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
public class UnexpectedResponseExceptionTest extends ExtendedTestCase {
@@ -46,20 +42,20 @@ public void testUnexpectedResponse() throws Exception {
try {
throw new UnexpectedResponseException(errMsg);
} catch (Exception e) {
- assertInstanceOf(UnexpectedResponseException.class, e);
- assertEquals(errMsg, e.getMessage());
- assertNull(e.getCause());
+ Assertions.assertInstanceOf(UnexpectedResponseException.class, e);
+ Assertions.assertEquals(errMsg, e.getMessage());
+ Assertions.assertNull(e.getCause());
}
addStep("Throw the exception with an embedded exception", "The embedded exception should be the same.");
try {
throw new UnexpectedResponseException(errMsg, new IllegalArgumentException(causeMsg));
} catch (Exception e) {
- assertInstanceOf(UnexpectedResponseException.class, e);
- assertEquals(errMsg, e.getMessage());
- assertNotNull(e.getCause());
- assertInstanceOf(IllegalArgumentException.class, e.getCause());
- assertEquals(causeMsg, e.getCause().getMessage());
+ Assertions.assertInstanceOf(UnexpectedResponseException.class, e);
+ Assertions.assertEquals(errMsg, e.getMessage());
+ Assertions.assertNotNull(e.getCause());
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e.getCause());
+ Assertions.assertEquals(causeMsg, e.getCause().getMessage());
}
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
index 7b0b5a4fa..7ad0ca2e1 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
@@ -26,20 +26,12 @@
import org.bitrepository.client.DefaultFixtureClientTest;
import org.bitrepository.commandline.Constants;
import org.bitrepository.commandline.output.OutputHandler;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.HMAC_SHA256;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.SHA384;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.SHA512;
-import static org.bitrepository.commandline.Constants.REQUEST_CHECKSUM_SALT_ARG;
-import static org.bitrepository.commandline.Constants.REQUEST_CHECKSUM_TYPE_ARG;
-import static org.bitrepository.commandline.utils.ChecksumExtractionUtils.extractChecksumType;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.mock;
public class ChecksumExtractionUtilsTest extends DefaultFixtureClientTest {
CommandLineArgumentsHandler cmdHandler;
@@ -50,7 +42,7 @@ public void setup() {
cmdHandler = new CommandLineArgumentsHandler();
cmdHandler.addOption(new Option(Constants.REQUEST_CHECKSUM_SALT_ARG, Constants.HAS_ARGUMENT, ""));
cmdHandler.addOption(new Option(Constants.REQUEST_CHECKSUM_TYPE_ARG, Constants.HAS_ARGUMENT, ""));
- output = mock(OutputHandler.class);
+ output = Mockito.mock(OutputHandler.class);
}
@Test
@@ -58,27 +50,27 @@ public void setup() {
public void testDefaultChecksumSpec() throws Exception {
addDescription("Test that the default checksum is retrieved when no arguments are given.");
cmdHandler.parseArguments();
- ChecksumType type = extractChecksumType(cmdHandler, settingsForCUT, output);
- assertEquals(settingsForCUT.getRepositorySettings().getProtocolSettings().getDefaultChecksumType(), type.name());
+ ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
+ Assertions.assertEquals(settingsForCUT.getRepositorySettings().getProtocolSettings().getDefaultChecksumType(), type.name());
}
@Test
@Tag("regressiontest")
public void testDefaultChecksumSpecWithSaltArgument() throws Exception {
addDescription("Test that the HMAC version of default checksum is retrieved when the salt arguments are given.");
- cmdHandler.parseArguments("-" + REQUEST_CHECKSUM_SALT_ARG + "0110");
- ChecksumType type = extractChecksumType(cmdHandler, settingsForCUT, output);
- assertEquals("HMAC_" + settingsForCUT.getRepositorySettings().getProtocolSettings().getDefaultChecksumType(), type.name());
+ cmdHandler.parseArguments("-" + Constants.REQUEST_CHECKSUM_SALT_ARG + "0110");
+ ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
+ Assertions.assertEquals("HMAC_" + settingsForCUT.getRepositorySettings().getProtocolSettings().getDefaultChecksumType(), type.name());
}
@Test
@Tag("regressiontest")
public void testNonSaltChecksumSpecWithoutSaltArgument() throws Exception {
addDescription("Test that a non-salt checksum type is retrieved when it is given as argument, and no salt arguments are given.");
- ChecksumType enteredType = SHA384;
- cmdHandler.parseArguments("-" + REQUEST_CHECKSUM_TYPE_ARG + enteredType);
- ChecksumType type = extractChecksumType(cmdHandler, settingsForCUT, output);
- assertEquals(enteredType, type);
+ ChecksumType enteredType = ChecksumType.SHA384;
+ cmdHandler.parseArguments("-" + Constants.REQUEST_CHECKSUM_TYPE_ARG + enteredType);
+ ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
+ Assertions.assertEquals(enteredType, type);
}
@Test
@@ -86,12 +78,12 @@ public void testNonSaltChecksumSpecWithoutSaltArgument() throws Exception {
public void testNonSaltChecksumSpecWithSaltArgument() throws Exception {
addDescription("Test that a salt checksum type is retrieved even though a non-salt checksum algorithm it is given as argument, "
+ "but a salt argument also is given.");
- ChecksumType enteredType = SHA512;
- cmdHandler.parseArguments("-" + REQUEST_CHECKSUM_TYPE_ARG + enteredType,
- "-" + REQUEST_CHECKSUM_SALT_ARG + "0110");
- ChecksumType type = extractChecksumType(cmdHandler, settingsForCUT, output);
- assertNotEquals(enteredType, type);
- assertEquals("HMAC_" + enteredType.name(), type.name());
+ ChecksumType enteredType = ChecksumType.SHA512;
+ cmdHandler.parseArguments("-" + Constants.REQUEST_CHECKSUM_TYPE_ARG + enteredType,
+ "-" + Constants.REQUEST_CHECKSUM_SALT_ARG + "0110");
+ ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
+ Assertions.assertNotEquals(enteredType, type);
+ Assertions.assertEquals("HMAC_" + enteredType.name(), type.name());
}
@Test
@@ -99,12 +91,12 @@ public void testNonSaltChecksumSpecWithSaltArgument() throws Exception {
public void testSaltChecksumSpecWithoutSaltArgument() throws Exception {
addDescription("Test that a non-salt checksum type is retrieved even though a salt checksum algorithm it is given as argument, "
+ "but no salt argument also is given.");
- ChecksumType enteredType = HMAC_SHA256;
- cmdHandler.parseArguments("-" + REQUEST_CHECKSUM_TYPE_ARG + enteredType);
- ChecksumType type = extractChecksumType(cmdHandler, settingsForCUT, output);
- assertNotEquals(enteredType, type);
- assertTrue(enteredType.name().contains("HMAC"));
- assertEquals(enteredType.name().replace("HMAC_", ""), type.name());
+ ChecksumType enteredType = ChecksumType.HMAC_SHA256;
+ cmdHandler.parseArguments("-" + Constants.REQUEST_CHECKSUM_TYPE_ARG + enteredType);
+ ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
+ Assertions.assertNotEquals(enteredType, type);
+ Assertions.assertTrue(enteredType.name().contains("HMAC"));
+ Assertions.assertEquals(enteredType.name().replace("HMAC_", ""), type.name());
}
@Test
@@ -112,10 +104,10 @@ public void testSaltChecksumSpecWithoutSaltArgument() throws Exception {
public void testSaltChecksumSpecWithSaltArgument() throws Exception {
addDescription("Test that a salt checksum type is retrieved when the salt checksum algorithm it is given as argument, "
+ "and a salt argument also is given.");
- ChecksumType enteredType = HMAC_SHA256;
- cmdHandler.parseArguments("-" + REQUEST_CHECKSUM_TYPE_ARG + enteredType,
- "-" + REQUEST_CHECKSUM_SALT_ARG + "0110");
- ChecksumType type = extractChecksumType(cmdHandler, settingsForCUT, output);
- assertEquals(enteredType, type);
+ ChecksumType enteredType = ChecksumType.HMAC_SHA256;
+ cmdHandler.parseArguments("-" + Constants.REQUEST_CHECKSUM_TYPE_ARG + enteredType,
+ "-" + Constants.REQUEST_CHECKSUM_SALT_ARG + "0110");
+ ChecksumType type = ChecksumExtractionUtils.extractChecksumType(cmdHandler, settingsForCUT, output);
+ Assertions.assertEquals(enteredType, type);
}
}
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
index e82b4f457..cdfe20f14 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
@@ -26,6 +26,8 @@
import org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE;
import org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE;
+import org.bitrepository.bitrepositoryelements.ChecksumType;
+import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.bitrepositoryelements.ResponseInfo;
import org.bitrepository.bitrepositorymessages.DeleteFileFinalResponse;
import org.bitrepository.bitrepositorymessages.DeleteFileProgressResponse;
@@ -35,6 +37,9 @@
import org.bitrepository.client.DefaultFixtureClientTest;
import org.bitrepository.client.TestEventHandler;
import org.bitrepository.client.eventhandler.OperationEvent.OperationEventType;
+import org.bitrepository.common.utils.Base16Utils;
+import org.bitrepository.common.utils.CalendarUtils;
+import org.bitrepository.common.utils.TestFileHelper;
import org.bitrepository.modify.ModifyComponentFactory;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -42,30 +47,7 @@
import org.junit.jupiter.api.Test;
import javax.xml.datatype.DatatypeFactory;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.MD5;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.SHA1;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.FAILURE;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.FILE_NOT_FOUND_FAILURE;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.IDENTIFICATION_NEGATIVE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_FAILED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_IDENTIFIED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.FAILED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFICATION_COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFY_TIMEOUT;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.PROGRESS;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.REQUEST_SENT;
-import static org.bitrepository.common.utils.Base16Utils.encodeBase16;
-import static org.bitrepository.common.utils.CalendarUtils.getEpoch;
-import static org.bitrepository.common.utils.TestFileHelper.getDefaultFileChecksum;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.nio.charset.StandardCharsets;
public class DeleteFileClientComponentTest extends DefaultFixtureClientTest {
private TestDeleteFileMessageFactory messageFactory;
@@ -102,14 +84,14 @@ public void deleteClientTester() throws Exception {
String checksum = "123checksum321";
ChecksumSpecTYPE checksumForPillar = new ChecksumSpecTYPE();
- checksumForPillar.setChecksumType(MD5);
+ checksumForPillar.setChecksumType(ChecksumType.MD5);
ChecksumDataForFileTYPE checksumData = new ChecksumDataForFileTYPE();
checksumData.setChecksumSpec(checksumForPillar);
- checksumData.setChecksumValue(checksum.getBytes(UTF_8));
- checksumData.setCalculationTimestamp(getEpoch());
+ checksumData.setChecksumValue(checksum.getBytes(StandardCharsets.UTF_8));
+ checksumData.setCalculationTimestamp(CalendarUtils.getEpoch());
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
addStep("Request a file to be deleted on all pillars (which means only the default pillar).",
"A IdentifyPillarsForDeleteFileRequest should be sent to the pillar.");
@@ -119,14 +101,14 @@ public void deleteClientTester() throws Exception {
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForDeleteFileRequest.class);
- assertEquals(collectionID, receivedIdentifyRequestMessage.getCollectionID());
- assertNotNull(receivedIdentifyRequestMessage.getCorrelationID());
- assertEquals(settingsForCUT.getReceiverDestinationID(), receivedIdentifyRequestMessage.getReplyTo());
- assertEquals(DEFAULT_FILE_ID, receivedIdentifyRequestMessage.getFileID());
- assertEquals(settingsForTestClient.getComponentID(), receivedIdentifyRequestMessage.getFrom());
- assertEquals(settingsForTestClient.getCollectionDestination(), receivedIdentifyRequestMessage.getDestination());
+ Assertions.assertEquals(collectionID, receivedIdentifyRequestMessage.getCollectionID());
+ Assertions.assertNotNull(receivedIdentifyRequestMessage.getCorrelationID());
+ Assertions.assertEquals(settingsForCUT.getReceiverDestinationID(), receivedIdentifyRequestMessage.getReplyTo());
+ Assertions.assertEquals(DEFAULT_FILE_ID, receivedIdentifyRequestMessage.getFileID());
+ Assertions.assertEquals(settingsForTestClient.getComponentID(), receivedIdentifyRequestMessage.getFrom());
+ Assertions.assertEquals(settingsForTestClient.getCollectionDestination(), receivedIdentifyRequestMessage.getDestination());
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client receive the response, identify the pillar and send the request.");
@@ -136,26 +118,26 @@ public void deleteClientTester() throws Exception {
PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
messageBus.sendMessage(identifyResponse);
receivedDeleteFileRequest = pillar1Receiver.waitForMessage(DeleteFileRequest.class);
- assertEquals(collectionID, receivedDeleteFileRequest.getCollectionID());
- assertEquals(receivedIdentifyRequestMessage.getCorrelationID(), receivedDeleteFileRequest.getCorrelationID());
- assertEquals(settingsForCUT.getReceiverDestinationID(), receivedDeleteFileRequest.getReplyTo());
- assertEquals(DEFAULT_FILE_ID, receivedDeleteFileRequest.getFileID());
- assertEquals(settingsForTestClient.getComponentID(), receivedDeleteFileRequest.getFrom());
- assertEquals(pillar1DestinationId, receivedDeleteFileRequest.getDestination());
+ Assertions.assertEquals(collectionID, receivedDeleteFileRequest.getCollectionID());
+ Assertions.assertEquals(receivedIdentifyRequestMessage.getCorrelationID(), receivedDeleteFileRequest.getCorrelationID());
+ Assertions.assertEquals(settingsForCUT.getReceiverDestinationID(), receivedDeleteFileRequest.getReplyTo());
+ Assertions.assertEquals(DEFAULT_FILE_ID, receivedDeleteFileRequest.getFileID());
+ Assertions.assertEquals(settingsForTestClient.getComponentID(), receivedDeleteFileRequest.getFrom());
+ Assertions.assertEquals(pillar1DestinationId, receivedDeleteFileRequest.getDestination());
addStep("Validate the steps of the DeleteClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("The pillar sends a progress response to the DeleteClient.", "Should be caught by the event handler.");
DeleteFileProgressResponse deleteFileProgressResponse = messageFactory.createDeleteFileProgressResponse(
receivedDeleteFileRequest, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(deleteFileProgressResponse);
- assertEquals(PROGRESS, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.PROGRESS, testEventHandler.waitForEvent().getEventType());
addStep("Send a final response message to the DeleteClient.",
"Should be caught by the event handler. First a PartiallyComplete, then a Complete.");
@@ -164,11 +146,11 @@ public void deleteClientTester() throws Exception {
messageBus.sendMessage(deleteFileFinalResponse);
for (int i = 1; i < 2 * settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
OperationEventType eventType = testEventHandler.waitForEvent().getEventType();
- assertTrue((eventType == COMPONENT_COMPLETE)
- || (eventType == PROGRESS),
+ Assertions.assertTrue((eventType == OperationEventType.COMPONENT_COMPLETE)
+ || (eventType == OperationEventType.PROGRESS),
"Expected either PartiallyComplete or Progress, but was: " + eventType);
}
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -182,27 +164,27 @@ public void fileAlreadyDeletedFromPillar() throws Exception {
addStep("Request a file to be deleted on pillar1.",
"A IdentifyPillarsForDeleteFileRequest should be sent " +
"and a IDENTIFY_REQUEST_SENT event should be generated.");
- deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, getDefaultFileChecksum(), null, testEventHandler, null);
+ deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, TestFileHelper.getDefaultFileChecksum(), null, testEventHandler, null);
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForDeleteFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a identify response from Pillar1 with a missing file response.",
"The client should generate a COMPONENT_IDENTIFIED, a COMPONENT_COMPLETE and " +
"an IDENTIFICATION_COMPLETE event.");
IdentifyPillarsForDeleteFileResponse identifyResponse = messageFactory.createIdentifyPillarsForDeleteFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
- identifyResponse.getResponseInfo().setResponseCode(FILE_NOT_FOUND_FAILURE);
+ identifyResponse.getResponseInfo().setResponseCode(ResponseCode.FILE_NOT_FOUND_FAILURE);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
addStep("The client should then continue to the performing phase and finish immediately as the pillar " +
"has already had the file removed apparently .",
"The client should generate a COMPLETE event.");
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
addStep("Send a identify response from Pillar2", "The response should be ignored");
testEventHandler.verifyNoEventsAreReceived();
@@ -224,14 +206,14 @@ public void deleteClientIdentificationTimeout() throws Exception {
String checksum = "123checksum321";
ChecksumSpecTYPE checksumForPillar = new ChecksumSpecTYPE();
- checksumForPillar.setChecksumType(MD5);
+ checksumForPillar.setChecksumType(ChecksumType.MD5);
ChecksumDataForFileTYPE checksumData = new ChecksumDataForFileTYPE();
checksumData.setChecksumSpec(checksumForPillar);
- checksumData.setChecksumValue(checksum.getBytes(UTF_8));
- checksumData.setCalculationTimestamp(getEpoch());
+ checksumData.setChecksumValue(checksum.getBytes(StandardCharsets.UTF_8));
+ checksumData.setCalculationTimestamp(CalendarUtils.getEpoch());
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
addStep("Request a file to be deleted on the default pillar.",
"A IdentifyPillarsForDeleteFileRequest should be sent to the pillar.");
@@ -239,13 +221,13 @@ public void deleteClientIdentificationTimeout() throws Exception {
testEventHandler, null);
collectionReceiver.waitForMessage(IdentifyPillarsForDeleteFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Do not respond. Just await the timeout.",
"Should make send a Failure event to the event handler.");
- assertEquals(IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -264,14 +246,14 @@ public void deleteClientOperationTimeout() throws Exception {
String checksum = "123checksum321";
ChecksumSpecTYPE checksumForPillar = new ChecksumSpecTYPE();
- checksumForPillar.setChecksumType(MD5);
+ checksumForPillar.setChecksumType(ChecksumType.MD5);
ChecksumDataForFileTYPE checksumData = new ChecksumDataForFileTYPE();
checksumData.setChecksumSpec(checksumForPillar);
- checksumData.setChecksumValue(checksum.getBytes(UTF_8));
- checksumData.setCalculationTimestamp(getEpoch());
+ checksumData.setChecksumValue(checksum.getBytes(StandardCharsets.UTF_8));
+ checksumData.setCalculationTimestamp(CalendarUtils.getEpoch());
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
addStep("Request a file to be deleted on the default pillar.",
"A IdentifyPillarsForDeleteFileRequest should be sent to the pillar.");
@@ -279,7 +261,7 @@ public void deleteClientOperationTimeout() throws Exception {
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForDeleteFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client receive the response, identify the pillar and send the request.");
@@ -292,14 +274,14 @@ public void deleteClientOperationTimeout() throws Exception {
addStep("Validate the steps of the DeleteClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Do not respond. Just await the timeout.",
"Should make send a Failure event to the event handler.");
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -315,14 +297,14 @@ public void deleteClientPillarFailedDuringPerform() throws Exception {
String checksum = "123checksum321";
ChecksumSpecTYPE checksumForPillar = new ChecksumSpecTYPE();
- checksumForPillar.setChecksumType(MD5);
+ checksumForPillar.setChecksumType(ChecksumType.MD5);
ChecksumDataForFileTYPE checksumData = new ChecksumDataForFileTYPE();
checksumData.setChecksumSpec(checksumForPillar);
- checksumData.setChecksumValue(checksum.getBytes(UTF_8));
- checksumData.setCalculationTimestamp(getEpoch());
+ checksumData.setChecksumValue(checksum.getBytes(StandardCharsets.UTF_8));
+ checksumData.setCalculationTimestamp(CalendarUtils.getEpoch());
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
addStep("Request a file to be deleted on the default pillar.",
"A IdentifyPillarsForDeleteFileRequest should be sent to the pillar.");
@@ -330,7 +312,7 @@ public void deleteClientPillarFailedDuringPerform() throws Exception {
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForDeleteFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client receive the response, identify the pillar and send the request.");
@@ -343,22 +325,22 @@ public void deleteClientPillarFailedDuringPerform() throws Exception {
addStep("Validate the steps of the DeleteClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a failed response message to the DeleteClient.",
"Should be caught by the event handler. First a COMPONENT_FAILED, then a COMPLETE.");
DeleteFileFinalResponse deleteFileFinalResponse = messageFactory.createDeleteFileFinalResponse(
receivedDeleteFileRequest, PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
ResponseInfo ri = new ResponseInfo();
- ri.setResponseCode(FAILURE);
+ ri.setResponseCode(ResponseCode.FAILURE);
ri.setResponseText("Verifying that a failure can be understood!");
deleteFileFinalResponse.setResponseInfo(ri);
messageBus.sendMessage(deleteFileFinalResponse);
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -371,7 +353,7 @@ public void deleteClientSpecifiedPillarFailedDuringIdentification() throws Excep
addStep("Request a file to be deleted on the pillar1.",
"A IdentifyPillarsForDeleteFileRequest should be sent.");
deleteClient.deleteFile(collectionID,
- DEFAULT_FILE_ID, PILLAR1_ID, getDefaultFileChecksum(), null, testEventHandler, null);
+ DEFAULT_FILE_ID, PILLAR1_ID, TestFileHelper.getDefaultFileChecksum(), null, testEventHandler, null);
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForDeleteFileRequest.class);
@@ -382,12 +364,12 @@ public void deleteClientSpecifiedPillarFailedDuringIdentification() throws Excep
IdentifyPillarsForDeleteFileResponse identifyResponse
= messageFactory.createIdentifyPillarsForDeleteFileResponse(receivedIdentifyRequestMessage,
PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
- identifyResponse.getResponseInfo().setResponseCode(IDENTIFICATION_NEGATIVE);
+ identifyResponse.getResponseInfo().setResponseCode(ResponseCode.IDENTIFICATION_NEGATIVE);
messageBus.sendMessage(identifyResponse);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -400,8 +382,8 @@ public void deleteClientOtherPillarFailedDuringIdentification() throws Exception
addStep("Request a file to be deleted on the pillar1.",
"A IdentifyPillarsForDeleteFileRequest should be sent and a IDENTIFY_REQUEST_SENT event should be generated.");
deleteClient.deleteFile(collectionID,
- DEFAULT_FILE_ID, PILLAR1_ID, getDefaultFileChecksum(), null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ DEFAULT_FILE_ID, PILLAR1_ID, TestFileHelper.getDefaultFileChecksum(), null, testEventHandler, null);
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForDeleteFileRequest.class);
@@ -411,7 +393,7 @@ public void deleteClientOtherPillarFailedDuringIdentification() throws Exception
IdentifyPillarsForDeleteFileResponse identifyResponse
= messageFactory.createIdentifyPillarsForDeleteFileResponse(receivedIdentifyRequestMessage,
PILLAR2_ID, pillar2DestinationId, DEFAULT_FILE_ID);
- identifyResponse.getResponseInfo().setResponseCode(IDENTIFICATION_NEGATIVE);
+ identifyResponse.getResponseInfo().setResponseCode(ResponseCode.IDENTIFICATION_NEGATIVE);
messageBus.sendMessage(identifyResponse);
testEventHandler.verifyNoEventsAreReceived();
@@ -422,17 +404,17 @@ public void deleteClientOtherPillarFailedDuringIdentification() throws Exception
messageFactory.createIdentifyPillarsForDeleteFileResponse(receivedIdentifyRequestMessage,
PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
messageBus.sendMessage(identifyResponse2);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
DeleteFileRequest receivedDeleteFileRequest = pillar1Receiver.waitForMessage(DeleteFileRequest.class);
addStep("Send a final response message from pillar 1 to the DeleteClient.",
"Should produce a COMPONENT_COMPLETE event followed by a COMPLETE event.");
messageBus.sendMessage(messageFactory.createDeleteFileFinalResponse(
receivedDeleteFileRequest, PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID));
- assertEquals(COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -444,9 +426,9 @@ public void deleteOnChecksumPillar() throws Exception {
addStep("Request a file to be deleted on the pillar1.",
"A IdentifyPillarsForDeleteFileRequest should be sent and a IDENTIFY_REQUEST_SENT event should be generated.");
- deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, getDefaultFileChecksum(),
+ deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, TestFileHelper.getDefaultFileChecksum(),
null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForDeleteFileRequest.class);
@@ -467,13 +449,13 @@ public void deleteOnChecksumPillar() throws Exception {
= messageFactory.createIdentifyPillarsForDeleteFileResponse(receivedIdentifyRequestMessage,
PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
ChecksumSpecTYPE checksumSpecTYPEFromPillar = new ChecksumSpecTYPE();
- checksumSpecTYPEFromPillar.setChecksumType(MD5);
+ checksumSpecTYPEFromPillar.setChecksumType(ChecksumType.MD5);
identifyResponse.setPillarChecksumSpec(checksumSpecTYPEFromPillar);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
- assertNotNull(pillar1Receiver.waitForMessage(DeleteFileRequest.class));
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertNotNull(pillar1Receiver.waitForMessage(DeleteFileRequest.class));
pillar2Receiver.checkNoMessageIsReceived(DeleteFileRequest.class);
}
@@ -490,10 +472,10 @@ public void deleteOnChecksumPillarWithDefaultReturnChecksumType() throws Excepti
"A IdentifyPillarsForDeleteFileRequest should be sent and a IDENTIFY_REQUEST_SENT event should be " +
"generated.");
ChecksumSpecTYPE checksumSpecTYPE = new ChecksumSpecTYPE();
- checksumSpecTYPE.setChecksumType(MD5);
- deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, getDefaultFileChecksum(),
+ checksumSpecTYPE.setChecksumType(ChecksumType.MD5);
+ deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, TestFileHelper.getDefaultFileChecksum(),
checksumSpecTYPE, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForDeleteFileRequest.class);
@@ -506,14 +488,14 @@ public void deleteOnChecksumPillarWithDefaultReturnChecksumType() throws Excepti
= messageFactory.createIdentifyPillarsForDeleteFileResponse(receivedIdentifyRequestMessage,
PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
ChecksumSpecTYPE checksumSpecTYPEFromPillar = new ChecksumSpecTYPE();
- checksumSpecTYPEFromPillar.setChecksumType(MD5);
+ checksumSpecTYPEFromPillar.setChecksumType(ChecksumType.MD5);
identifyResponse.setPillarChecksumSpec(checksumSpecTYPEFromPillar);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
DeleteFileRequest receivedPutFileRequest1 = pillar1Receiver.waitForMessage(DeleteFileRequest.class);
- assertEquals(checksumSpecTYPE, receivedPutFileRequest1.getChecksumRequestForExistingFile());
+ Assertions.assertEquals(checksumSpecTYPE, receivedPutFileRequest1.getChecksumRequestForExistingFile());
}
@Test
@@ -528,11 +510,11 @@ public void deleteOnChecksumPillarWithSaltedReturnChecksumType() throws Exceptio
"A IdentifyPillarsForDeleteFileRequest should be sent and a IDENTIFY_REQUEST_SENT event should be " +
"generated.");
ChecksumSpecTYPE checksumSpecTYPE = new ChecksumSpecTYPE();
- checksumSpecTYPE.setChecksumType(MD5);
- checksumSpecTYPE.setChecksumSalt(encodeBase16("aa"));
- deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, getDefaultFileChecksum(),
+ checksumSpecTYPE.setChecksumType(ChecksumType.MD5);
+ checksumSpecTYPE.setChecksumSalt(Base16Utils.encodeBase16("aa"));
+ deleteClient.deleteFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, TestFileHelper.getDefaultFileChecksum(),
checksumSpecTYPE, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForDeleteFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForDeleteFileRequest.class);
@@ -544,14 +526,14 @@ public void deleteOnChecksumPillarWithSaltedReturnChecksumType() throws Exceptio
= messageFactory.createIdentifyPillarsForDeleteFileResponse(receivedIdentifyRequestMessage,
PILLAR1_ID, pillar1DestinationId, DEFAULT_FILE_ID);
ChecksumSpecTYPE checksumSpecTYPEFromPillar = new ChecksumSpecTYPE();
- checksumSpecTYPEFromPillar.setChecksumType(MD5);
+ checksumSpecTYPEFromPillar.setChecksumType(ChecksumType.MD5);
identifyResponse.setPillarChecksumSpec(checksumSpecTYPEFromPillar);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
DeleteFileRequest receivedPutFileRequest1 = pillar1Receiver.waitForMessage(DeleteFileRequest.class);
- assertNull(receivedPutFileRequest1.getChecksumRequestForExistingFile());
+ Assertions.assertNull(receivedPutFileRequest1.getChecksumRequestForExistingFile());
}
/**
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
index cff4a7147..f905fd786 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
@@ -26,6 +26,8 @@
import org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE;
import org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE;
+import org.bitrepository.bitrepositoryelements.ChecksumType;
+import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.bitrepositoryelements.ResponseInfo;
import org.bitrepository.bitrepositorymessages.IdentifyPillarsForPutFileRequest;
import org.bitrepository.bitrepositorymessages.IdentifyPillarsForPutFileResponse;
@@ -35,6 +37,8 @@
import org.bitrepository.client.DefaultFixtureClientTest;
import org.bitrepository.client.TestEventHandler;
import org.bitrepository.client.eventhandler.OperationEvent.OperationEventType;
+import org.bitrepository.common.utils.Base16Utils;
+import org.bitrepository.common.utils.TestFileHelper;
import org.bitrepository.modify.ModifyComponentFactory;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -42,31 +46,8 @@
import org.junit.jupiter.api.Test;
import javax.xml.datatype.DatatypeFactory;
-
-import static java.math.BigInteger.valueOf;
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.HMAC_MD5;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.MD5;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.DUPLICATE_FILE_FAILURE;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.FAILURE;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.FILE_TRANSFER_FAILURE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_FAILED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_IDENTIFIED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.FAILED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFICATION_COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFY_TIMEOUT;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.PROGRESS;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.REQUEST_SENT;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.WARNING;
-import static org.bitrepository.common.utils.Base16Utils.encodeBase16;
-import static org.bitrepository.common.utils.TestFileHelper.getDefaultFileChecksum;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.math.BigInteger;
+import java.util.concurrent.TimeUnit;
public class PutFileClientComponentTest extends DefaultFixtureClientTest {
@@ -112,13 +93,13 @@ public void normalPutFile() throws Exception {
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
- assertEquals(collectionID, receivedIdentifyRequestMessage.getCollectionID());
- assertNotNull(receivedIdentifyRequestMessage.getCorrelationID());
- assertEquals(settingsForCUT.getReceiverDestinationID(), receivedIdentifyRequestMessage.getReplyTo());
- assertEquals(DEFAULT_FILE_ID, receivedIdentifyRequestMessage.getFileID());
- assertEquals(settingsForTestClient.getComponentID(), receivedIdentifyRequestMessage.getFrom());
- assertEquals(settingsForTestClient.getCollectionDestination(), receivedIdentifyRequestMessage.getDestination());
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(collectionID, receivedIdentifyRequestMessage.getCollectionID());
+ Assertions.assertNotNull(receivedIdentifyRequestMessage.getCorrelationID());
+ Assertions.assertEquals(settingsForCUT.getReceiverDestinationID(), receivedIdentifyRequestMessage.getReplyTo());
+ Assertions.assertEquals(DEFAULT_FILE_ID, receivedIdentifyRequestMessage.getFileID());
+ Assertions.assertEquals(settingsForTestClient.getComponentID(), receivedIdentifyRequestMessage.getFrom());
+ Assertions.assertEquals(settingsForTestClient.getCollectionDestination(), receivedIdentifyRequestMessage.getDestination());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client should then send the actual PutFileRequest.");
@@ -126,26 +107,26 @@ public void normalPutFile() throws Exception {
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
PutFileRequest receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class, 10,
- SECONDS);
- assertEquals(collectionID, receivedPutFileRequest.getCollectionID());
- assertEquals(receivedIdentifyRequestMessage.getCorrelationID(), receivedPutFileRequest.getCorrelationID());
- assertEquals(settingsForCUT.getReceiverDestinationID(), receivedPutFileRequest.getReplyTo());
- assertEquals(DEFAULT_FILE_ID, receivedPutFileRequest.getFileID());
- assertEquals(settingsForTestClient.getComponentID(), receivedPutFileRequest.getFrom());
- assertEquals(pillar1DestinationId, receivedPutFileRequest.getDestination());
+ TimeUnit.SECONDS);
+ Assertions.assertEquals(collectionID, receivedPutFileRequest.getCollectionID());
+ Assertions.assertEquals(receivedIdentifyRequestMessage.getCorrelationID(), receivedPutFileRequest.getCorrelationID());
+ Assertions.assertEquals(settingsForCUT.getReceiverDestinationID(), receivedPutFileRequest.getReplyTo());
+ Assertions.assertEquals(DEFAULT_FILE_ID, receivedPutFileRequest.getFileID());
+ Assertions.assertEquals(settingsForTestClient.getComponentID(), receivedPutFileRequest.getFrom());
+ Assertions.assertEquals(pillar1DestinationId, receivedPutFileRequest.getDestination());
addStep("Validate the steps of the PutClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("The pillar sends a progress response to the PutClient.", "Should be caught by the event handler.");
PutFileProgressResponse putFileProgressResponse = messageFactory.createPutFileProgressResponse(
receivedPutFileRequest, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(putFileProgressResponse);
- assertEquals(PROGRESS, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.PROGRESS, testEventHandler.waitForEvent().getEventType());
addStep("Send a final response message to the PutClient.",
"Should be caught by the event handler. First a PartiallyComplete, then a Complete.");
@@ -154,11 +135,11 @@ public void normalPutFile() throws Exception {
messageBus.sendMessage(putFileFinalResponse);
for (int i = 1; i < 2 * settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
OperationEventType eventType = testEventHandler.waitForEvent().getEventType();
- assertTrue((eventType == COMPONENT_COMPLETE)
- || (eventType == PROGRESS),
+ Assertions.assertTrue((eventType == OperationEventType.COMPONENT_COMPLETE)
+ || (eventType == OperationEventType.PROGRESS),
"Expected either PartiallyComplete or Progress, but was: " + eventType);
}
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -176,15 +157,15 @@ public void noPillarsResponding() throws Exception {
"An identification request should be dispatched.");
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0, null,
null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
addStep("Do not respond. Just await the timeout.",
"An IDENTIFY_TIMEOUT event should be generate, followed by a FAILED event.");
- assertEquals(IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -206,7 +187,7 @@ public void onePillarRespondingWithPartialPutAllowed() throws Exception {
"A identification request should be dispatched.");
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0, null,
null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
@@ -215,17 +196,17 @@ public void onePillarRespondingWithPartialPutAllowed() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
addStep("Await the timeout.", "An IDENTIFY_TIMEOUT events, a COMPONENT_FAILED " +
"event for the non-responding pillar and an IDENTIFICATION_COMPLETE event should be generated.");
- assertEquals(IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
addStep("The client should proceed to send a putFileOperation request to the responding pillar.",
"A REQUEST_SENT event should be generated and a PutFileRequest should be received on the pillar.");
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class);
addStep("Send a pillar complete event",
@@ -233,8 +214,8 @@ public void onePillarRespondingWithPartialPutAllowed() throws Exception {
PutFileFinalResponse putFileFinalResponse = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(putFileFinalResponse);
- assertEquals(COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -254,7 +235,7 @@ public void onePillarRespondingWithPartialPutDisallowed() throws Exception {
"A identification request should be dispatched.");
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0, null,
null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
@@ -263,14 +244,14 @@ public void onePillarRespondingWithPartialPutDisallowed() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
addStep("Await the timeout.", "An IDENTIFY_TIMEOUT event ,COMPONENT_FAILED " +
"event for the non-responding pillar, an IDENTIFICATION_COMPLETE and " +
"lastly a OperationEventType.FAILED event should be generated.");
- assertEquals(IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@@ -294,26 +275,26 @@ public void putClientOperationTimeout() throws Exception {
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client should then send the actual PutFileRequest.");
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory
.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
- pillar1Receiver.waitForMessage(PutFileRequest.class, 10, SECONDS);
+ pillar1Receiver.waitForMessage(PutFileRequest.class, 10, TimeUnit.SECONDS);
addStep("Validate the steps of the PutClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Do not respond. Just await the timeout.",
"Should make send a Failure event to the eventhandler.");
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -336,33 +317,33 @@ public void putClientPillarOperationFailed() throws Exception {
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send pillar response.", "The client should then send the actual PutFileRequest.");
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
- PutFileRequest receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class, 10, SECONDS);
+ PutFileRequest receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class, 10, TimeUnit.SECONDS);
addStep("Validate the steps of the PutClient by going through the events.",
"Should be 'PillarIdentified', 'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a failed response message to the PutClient.",
"Should be caught by the event handler. First a PillarFailed, then a Complete.");
PutFileFinalResponse putFileFinalResponse = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR1_ID, pillar1DestinationId);
ResponseInfo ri = new ResponseInfo();
- ri.setResponseCode(FAILURE);
+ ri.setResponseCode(ResponseCode.FAILURE);
ri.setResponseText("Verifying that a failure can be understood!");
putFileFinalResponse.setResponseInfo(ri);
messageBus.sendMessage(putFileFinalResponse);
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -381,22 +362,22 @@ public void fileExistsOnPillarNoChecksumFromPillar() throws Exception {
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a DUPLICATE_FILE_FAILURE response without a checksum.",
"The client should generate the following events:'"
- + COMPONENT_FAILED + "', '"
- + FAILED + "'");
+ + OperationEventType.COMPONENT_FAILED + "', '"
+ + OperationEventType.FAILED + "'");
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
ResponseInfo ri = new ResponseInfo();
- ri.setResponseCode(DUPLICATE_FILE_FAILURE);
+ ri.setResponseCode(ResponseCode.DUPLICATE_FILE_FAILURE);
ri.setResponseText("Testing the handling of 'DUPLICATE FILE' identification.");
identifyResponse.setResponseInfo(ri);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -410,32 +391,32 @@ public void fileExistsOnPillarDifferentChecksumFromPillar() throws Exception {
addStep("Call putFile.",
"A IdentifyPillarsForGetFileRequest will be sent to the pillar and a " +
"IDENTIFY_REQUEST_SENT should be generated.");
- ChecksumDataForFileTYPE csClientData = getDefaultFileChecksum();
- csClientData.setChecksumValue(encodeBase16("ba"));
+ ChecksumDataForFileTYPE csClientData = TestFileHelper.getDefaultFileChecksum();
+ csClientData.setChecksumValue(Base16Utils.encodeBase16("ba"));
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0,
csClientData, null, testEventHandler, "TEST-AUDIT-TRAIL");
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a DUPLICATE_FILE_FAILURE response with a random checksum.",
"The client should generate the following events:'"
- + COMPONENT_FAILED + "', '"
- + FAILED + "'");
+ + OperationEventType.COMPONENT_FAILED + "', '"
+ + OperationEventType.FAILED + "'");
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
ResponseInfo ri = new ResponseInfo();
- ri.setResponseCode(DUPLICATE_FILE_FAILURE);
+ ri.setResponseCode(ResponseCode.DUPLICATE_FILE_FAILURE);
ri.setResponseText("Testing the handling of 'DUPLICATE FILE' identification.");
identifyResponse.setResponseInfo(ri);
- ChecksumDataForFileTYPE csPillarData = getDefaultFileChecksum();
- csPillarData.setChecksumValue(encodeBase16("aa"));
+ ChecksumDataForFileTYPE csPillarData = TestFileHelper.getDefaultFileChecksum();
+ csPillarData.setChecksumValue(Base16Utils.encodeBase16("aa"));
identifyResponse.setChecksumDataForExistingFile(csPillarData);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -449,40 +430,40 @@ public void sameFileExistsOnOnePillar() throws Exception {
addStep("Call putFile.",
"A IdentifyPillarsForGetFileRequest will be sent to the pillar and a " +
"IDENTIFY_REQUEST_SENT should be generated.");
- ChecksumDataForFileTYPE csClientData = getDefaultFileChecksum();
+ ChecksumDataForFileTYPE csClientData = TestFileHelper.getDefaultFileChecksum();
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0,
csClientData, null, testEventHandler, "TEST-AUDIT-TRAIL");
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a DUPLICATE_FILE_FAILURE response with a checksum equal to the one supplied to the client.",
"The client should generate the following events:'"
- + COMPONENT_COMPLETE);
+ + OperationEventType.COMPONENT_COMPLETE);
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
ResponseInfo ri = new ResponseInfo();
- ri.setResponseCode(DUPLICATE_FILE_FAILURE);
+ ri.setResponseCode(ResponseCode.DUPLICATE_FILE_FAILURE);
ri.setResponseText("Testing the handling of 'DUPLICATE FILE' identification.");
identifyResponse.setResponseInfo(ri);
- ChecksumDataForFileTYPE csPillarData = getDefaultFileChecksum();
+ ChecksumDataForFileTYPE csPillarData = TestFileHelper.getDefaultFileChecksum();
identifyResponse.setChecksumDataForExistingFile(csPillarData);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
addStep("Send an identification response from the second pillar.",
"An COMPONENT_IDENTIFIED OperationEventType.IDENTIFICATION_COMPLETE and a event should be generate.");
IdentifyPillarsForPutFileResponse identifyResponse2 = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR2_ID, pillar2DestinationId);
messageBus.sendMessage(identifyResponse2);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
addStep("The client should proceed to send a putFileOperation request to the second pillar.",
"A REQUEST_SENT event should be generated and a PutFileRequest should be received on the pillar.");
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest = pillar2Receiver.waitForMessage(PutFileRequest.class);
addStep("Send a pillar complete event",
@@ -490,8 +471,8 @@ public void sameFileExistsOnOnePillar() throws Exception {
PutFileFinalResponse putFileFinalResponse = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR2_ID, pillar1DestinationId);
messageBus.sendMessage(putFileFinalResponse);
- assertEquals(COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -510,25 +491,25 @@ public void fileExistsOnPillarChecksumFromPillarNoClientChecksum() throws Except
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a DUPLICATE_FILE_FAILURE response with a random checksum.",
"The client should generate the following events:'"
- + COMPONENT_FAILED + "', '"
- + FAILED + "'");
+ + OperationEventType.COMPONENT_FAILED + "', '"
+ + OperationEventType.FAILED + "'");
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
ResponseInfo ri = new ResponseInfo();
- ri.setResponseCode(DUPLICATE_FILE_FAILURE);
+ ri.setResponseCode(ResponseCode.DUPLICATE_FILE_FAILURE);
ri.setResponseText("Testing the handling of 'DUPLICATE FILE' identification.");
identifyResponse.setResponseInfo(ri);
- ChecksumDataForFileTYPE csData = getDefaultFileChecksum();
- csData.setChecksumValue(encodeBase16("aa"));
+ ChecksumDataForFileTYPE csData = TestFileHelper.getDefaultFileChecksum();
+ csData.setChecksumValue(Base16Utils.encodeBase16("aa"));
identifyResponse.setChecksumDataForExistingFile(csData);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -547,14 +528,14 @@ public void saltedReturnChecksumsWithChecksumPillar() throws Exception {
"A IdentifyPillarsForGetFileRequest will be sent to the pillar and a " +
"IDENTIFY_REQUEST_SENT should be generated.");
ChecksumSpecTYPE checksumSpecTYPE = new ChecksumSpecTYPE();
- checksumSpecTYPE.setChecksumType(HMAC_MD5);
- checksumSpecTYPE.setChecksumSalt(encodeBase16("aa"));
+ checksumSpecTYPE.setChecksumType(ChecksumType.HMAC_MD5);
+ checksumSpecTYPE.setChecksumSalt(Base16Utils.encodeBase16("aa"));
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0,
null, checksumSpecTYPE, testEventHandler, "TEST-AUDIT-TRAIL");
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send an identification response with a PillarChecksumSpec element set, indicating that this is a " +
"checksum pillar.",
@@ -562,10 +543,10 @@ public void saltedReturnChecksumsWithChecksumPillar() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
ChecksumSpecTYPE checksumSpecTYPEFromPillar = new ChecksumSpecTYPE();
- checksumSpecTYPEFromPillar.setChecksumType(MD5);
+ checksumSpecTYPEFromPillar.setChecksumType(ChecksumType.MD5);
identifyResponse.setPillarChecksumSpec(checksumSpecTYPEFromPillar);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
addStep("Send an normal identification response from pillar2.",
"An COMPONENT_IDENTIFIED event should be generate followed by an IDENTIFICATION_COMPLETE and a " +
@@ -575,15 +556,15 @@ public void saltedReturnChecksumsWithChecksumPillar() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse2 = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR2_ID, pillar2DestinationId);
messageBus.sendMessage(identifyResponse2);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest1 = pillar1Receiver.waitForMessage(PutFileRequest.class);
- assertNull(receivedPutFileRequest1.getChecksumRequestForNewFile());
+ Assertions.assertNull(receivedPutFileRequest1.getChecksumRequestForNewFile());
PutFileRequest receivedPutFileRequest2 =
pillar2Receiver.waitForMessage(PutFileRequest.class);
- assertEquals(checksumSpecTYPE, receivedPutFileRequest2.getChecksumRequestForNewFile());
+ Assertions.assertEquals(checksumSpecTYPE, receivedPutFileRequest2.getChecksumRequestForNewFile());
}
@@ -600,13 +581,13 @@ public void defaultReturnChecksumsWithChecksumPillar() throws Exception {
"A IdentifyPillarsForGetFileRequest will be sent to the pillar and a " +
"IDENTIFY_REQUEST_SENT should be generated.");
ChecksumSpecTYPE checksumSpecTYPE = new ChecksumSpecTYPE();
- checksumSpecTYPE.setChecksumType(MD5);
+ checksumSpecTYPE.setChecksumType(ChecksumType.MD5);
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0,
null, checksumSpecTYPE, testEventHandler, "TEST-AUDIT-TRAIL");
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send an identification response with a PillarChecksumSpec element set, indicating that this is a " +
"checksum pillar.",
@@ -614,10 +595,10 @@ public void defaultReturnChecksumsWithChecksumPillar() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
ChecksumSpecTYPE checksumSpecTYPEFromPillar = new ChecksumSpecTYPE();
- checksumSpecTYPEFromPillar.setChecksumType(MD5);
+ checksumSpecTYPEFromPillar.setChecksumType(ChecksumType.MD5);
identifyResponse.setPillarChecksumSpec(checksumSpecTYPEFromPillar);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
addStep("Send an normal identification response from pillar2.",
"An COMPONENT_IDENTIFIED event should be generate followed by an IDENTIFICATION_COMPLETE and a " +
@@ -627,16 +608,16 @@ public void defaultReturnChecksumsWithChecksumPillar() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse2 = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR2_ID, pillar2DestinationId);
messageBus.sendMessage(identifyResponse2);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest1 =
pillar1Receiver.waitForMessage(PutFileRequest.class);
- assertEquals(checksumSpecTYPE, receivedPutFileRequest1.getChecksumRequestForNewFile());
+ Assertions.assertEquals(checksumSpecTYPE, receivedPutFileRequest1.getChecksumRequestForNewFile());
PutFileRequest receivedPutFileRequest2 =
pillar2Receiver.waitForMessage(PutFileRequest.class);
- assertEquals(checksumSpecTYPE, receivedPutFileRequest2.getChecksumRequestForNewFile());
+ Assertions.assertEquals(checksumSpecTYPE, receivedPutFileRequest2.getChecksumRequestForNewFile());
}
@Test
@@ -656,7 +637,7 @@ public void noReturnChecksumsWithChecksumPillar() throws Exception {
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForPutFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send an identification response with a PillarChecksumSpec element set, indicating that this is a " +
"checksum pillar.",
@@ -664,10 +645,10 @@ public void noReturnChecksumsWithChecksumPillar() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
ChecksumSpecTYPE checksumSpecTYPEFromPillar = new ChecksumSpecTYPE();
- checksumSpecTYPEFromPillar.setChecksumType(MD5);
+ checksumSpecTYPEFromPillar.setChecksumType(ChecksumType.MD5);
identifyResponse.setPillarChecksumSpec(checksumSpecTYPEFromPillar);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
addStep("Send an normal identification response from pillar2.",
"An COMPONENT_IDENTIFIED event should be generate followed by an IDENTIFICATION_COMPLETE and a " +
@@ -676,14 +657,14 @@ public void noReturnChecksumsWithChecksumPillar() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse2 = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR2_ID, pillar2DestinationId);
messageBus.sendMessage(identifyResponse2);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest1 = pillar1Receiver.waitForMessage(PutFileRequest.class);
- assertNull(receivedPutFileRequest1.getChecksumRequestForNewFile());
+ Assertions.assertNull(receivedPutFileRequest1.getChecksumRequestForNewFile());
PutFileRequest receivedPutFileRequest2 = pillar2Receiver.waitForMessage(PutFileRequest.class);
- assertNull(receivedPutFileRequest2.getChecksumRequestForNewFile());
+ Assertions.assertNull(receivedPutFileRequest2.getChecksumRequestForNewFile());
}
@Test
@@ -694,7 +675,7 @@ public void onePillarPutRetrySuccess() throws Exception {
addDescription("Tests the handling of a failed transmission when retry is allowed");
addFixture("Sets the identification timeout to 3 sec, allow two retries and only register one pillar.");
- settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(valueOf(2));
+ settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(BigInteger.valueOf(2));
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
@@ -704,7 +685,7 @@ public void onePillarPutRetrySuccess() throws Exception {
"A identification request should be dispatched.");
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0, null,
null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
@@ -713,21 +694,21 @@ public void onePillarPutRetrySuccess() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
addStep("The client should proceed to send a putFileOperation request to the responding pillar.",
"A REQUEST_SENT event should be generated and a PutFileRequest should be received on the pillar.");
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class);
addStep("Send a PutFileFinalResponse indicating a FILE_TRANSFER_FAILURE",
"The client should emit a warning event and generate new PutFileRequest for the pillar");
PutFileFinalResponse putFileFinalResponse = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR1_ID, pillar1DestinationId);
- putFileFinalResponse.getResponseInfo().setResponseCode(FILE_TRANSFER_FAILURE);
+ putFileFinalResponse.getResponseInfo().setResponseCode(ResponseCode.FILE_TRANSFER_FAILURE);
messageBus.sendMessage(putFileFinalResponse);
- assertEquals(WARNING, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.WARNING, testEventHandler.waitForEvent().getEventType());
addStep("A new PutFileRequest is send, pillar responds with success", "The client generates " +
"a COMPONENT_COMPLETE, followed by a COMPLETE event.");
@@ -735,8 +716,8 @@ public void onePillarPutRetrySuccess() throws Exception {
PutFileFinalResponse putFileFinalResponse2 = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest2, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(putFileFinalResponse2);
- assertEquals(COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -748,7 +729,7 @@ public void onePillarPutRetryFailure() throws Exception {
"is only attempted the maximum allowed attempts");
addFixture("Sets the identification timeout to 3 sec, allow two retries and only register one pillar.");
- settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(valueOf(2));
+ settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(BigInteger.valueOf(2));
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
@@ -758,7 +739,7 @@ public void onePillarPutRetryFailure() throws Exception {
"A identification request should be dispatched.");
putClient.putFile(collectionID, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0, null,
null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
@@ -767,40 +748,40 @@ public void onePillarPutRetryFailure() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
addStep("The client should proceed to send a putFileOperation request to the responding pillar.",
"A REQUEST_SENT event should be generated and a PutFileRequest should be received on the pillar.");
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class);
addStep("Send a PutFileFinalResponse indicating a FILE_TRANSFER_FAILURE",
"The client should emit a warning event and generate new PutFileRequest for the pillar");
PutFileFinalResponse putFileFinalResponse = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR1_ID, pillar1DestinationId);
- putFileFinalResponse.getResponseInfo().setResponseCode(FILE_TRANSFER_FAILURE);
+ putFileFinalResponse.getResponseInfo().setResponseCode(ResponseCode.FILE_TRANSFER_FAILURE);
messageBus.sendMessage(putFileFinalResponse);
- assertEquals(WARNING, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.WARNING, testEventHandler.waitForEvent().getEventType());
addStep("Send a PutFileFinalResponse indicating a FILE_TRANSFER_FAILURE for the second put attempt",
"The client should emit a warning event and generate new PutFileRequest for the pillar");
receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class);
putFileFinalResponse = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR1_ID, pillar1DestinationId);
- putFileFinalResponse.getResponseInfo().setResponseCode(FILE_TRANSFER_FAILURE);
+ putFileFinalResponse.getResponseInfo().setResponseCode(ResponseCode.FILE_TRANSFER_FAILURE);
messageBus.sendMessage(putFileFinalResponse);
- assertEquals(WARNING, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.WARNING, testEventHandler.waitForEvent().getEventType());
addStep("Send a PutFileFinalResponse indicating a FILE_TRANSFER_FAILURE for the third put attempt",
"The client should emit a COMPONENT_FAILED event and fail the put operation");
receivedPutFileRequest = pillar1Receiver.waitForMessage(PutFileRequest.class);
putFileFinalResponse = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR1_ID, pillar1DestinationId);
- putFileFinalResponse.getResponseInfo().setResponseCode(FILE_TRANSFER_FAILURE);
+ putFileFinalResponse.getResponseInfo().setResponseCode(ResponseCode.FILE_TRANSFER_FAILURE);
messageBus.sendMessage(putFileFinalResponse);
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -812,7 +793,7 @@ public void putToOtherCollection() throws Exception {
addFixture("Sets the identification timeout to 3 sec, allow two retries and only register one pillar.");
addFixture("Configure collection1 to contain both pillars and collection 2 to only contain pillar2");
- settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(valueOf(2));
+ settingsForCUT.getReferenceSettings().getClientSettings().setOperationRetryCount(BigInteger.valueOf(2));
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().clear();
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR1_ID);
settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().add(PILLAR2_ID);
@@ -826,10 +807,10 @@ public void putToOtherCollection() throws Exception {
"A identification request should be dispatched.");
putClient.putFile(otherCollection, httpServerConfiguration.getURL(DEFAULT_FILE_ID), DEFAULT_FILE_ID, 0, null,
null, testEventHandler, null);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
IdentifyPillarsForPutFileRequest receivedIdentifyRequestMessage =
collectionReceiver.waitForMessage(IdentifyPillarsForPutFileRequest.class);
- assertEquals(otherCollection, receivedIdentifyRequestMessage.getCollectionID());
+ Assertions.assertEquals(otherCollection, receivedIdentifyRequestMessage.getCollectionID());
addStep("Send an identification response from pillar2.",
"An COMPONENT_IDENTIFIED event should be generated followed by an IDENTIFICATION_COMPLETE" +
@@ -837,19 +818,19 @@ public void putToOtherCollection() throws Exception {
IdentifyPillarsForPutFileResponse identifyResponse = messageFactory.createIdentifyPillarsForPutFileResponse(
receivedIdentifyRequestMessage, PILLAR2_ID, pillar2DestinationId);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
PutFileRequest receivedPutFileRequest = pillar2Receiver.waitForMessage(PutFileRequest.class);
- assertEquals(otherCollection, receivedPutFileRequest.getCollectionID());
+ Assertions.assertEquals(otherCollection, receivedPutFileRequest.getCollectionID());
addStep("Send a put complete event from the pillar", "The client generates " +
"a COMPONENT_COMPLETE, followed by a COMPLETE event.");
PutFileFinalResponse putFileFinalResponse1 = messageFactory.createPutFileFinalResponse(
receivedPutFileRequest, PILLAR2_ID, pillar2DestinationId);
messageBus.sendMessage(putFileFinalResponse1);
- assertEquals(COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPONENT_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
}
/**
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
index fa5ce923b..7b80fb103 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
@@ -26,6 +26,8 @@
import org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE;
import org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE;
+import org.bitrepository.bitrepositoryelements.ChecksumType;
+import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.bitrepositoryelements.ResponseInfo;
import org.bitrepository.bitrepositorymessages.IdentifyPillarsForReplaceFileRequest;
import org.bitrepository.bitrepositorymessages.IdentifyPillarsForReplaceFileResponse;
@@ -34,7 +36,9 @@
import org.bitrepository.bitrepositorymessages.ReplaceFileRequest;
import org.bitrepository.client.DefaultFixtureClientTest;
import org.bitrepository.client.TestEventHandler;
+import org.bitrepository.client.eventhandler.OperationEvent;
import org.bitrepository.client.eventhandler.OperationEvent.OperationEventType;
+import org.bitrepository.common.utils.Base16Utils;
import org.bitrepository.common.utils.CalendarUtils;
import org.bitrepository.common.utils.ChecksumUtils;
import org.bitrepository.modify.ModifyComponentFactory;
@@ -48,24 +52,6 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.MD5;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.SHA1;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.FAILURE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_FAILED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.COMPONENT_IDENTIFIED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.FAILED;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFICATION_COMPLETE;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.IDENTIFY_TIMEOUT;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.PROGRESS;
-import static org.bitrepository.client.eventhandler.OperationEvent.OperationEventType.REQUEST_SENT;
-import static org.bitrepository.common.utils.Base16Utils.encodeBase16;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public class ReplaceFileClientComponentTest extends DefaultFixtureClientTest {
private ChecksumSpecTYPE DEFAULT_CHECKSUM_SPEC;
@@ -107,7 +93,7 @@ public void replaceClientTester() throws Exception {
TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
URL address = httpServerConfiguration.getURL(DEFAULT_FILE_ID);
@@ -119,13 +105,13 @@ public void replaceClientTester() throws Exception {
IdentifyPillarsForReplaceFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForReplaceFileRequest.class);
- assertEquals(collectionID, receivedIdentifyRequestMessage.getCollectionID());
- assertNotNull(receivedIdentifyRequestMessage.getCorrelationID());
- assertEquals(settingsForCUT.getReceiverDestinationID(), receivedIdentifyRequestMessage.getReplyTo());
- assertEquals(DEFAULT_FILE_ID, receivedIdentifyRequestMessage.getFileID());
- assertEquals(settingsForTestClient.getComponentID(), receivedIdentifyRequestMessage.getFrom());
- assertEquals(settingsForTestClient.getCollectionDestination(), receivedIdentifyRequestMessage.getDestination());
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(collectionID, receivedIdentifyRequestMessage.getCollectionID());
+ Assertions.assertNotNull(receivedIdentifyRequestMessage.getCorrelationID());
+ Assertions.assertEquals(settingsForCUT.getReceiverDestinationID(), receivedIdentifyRequestMessage.getReplyTo());
+ Assertions.assertEquals(DEFAULT_FILE_ID, receivedIdentifyRequestMessage.getFileID());
+ Assertions.assertEquals(settingsForTestClient.getComponentID(), receivedIdentifyRequestMessage.getFrom());
+ Assertions.assertEquals(settingsForTestClient.getCollectionDestination(), receivedIdentifyRequestMessage.getDestination());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client receive the response, identify the pillar and send the " +
"request.");
@@ -136,26 +122,26 @@ public void replaceClientTester() throws Exception {
PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
receivedReplaceFileRequest = pillar1Receiver.waitForMessage(ReplaceFileRequest.class);
- assertEquals(collectionID, receivedReplaceFileRequest.getCollectionID());
- assertEquals(receivedIdentifyRequestMessage.getCorrelationID(), receivedReplaceFileRequest.getCorrelationID());
- assertEquals(settingsForCUT.getReceiverDestinationID(), receivedReplaceFileRequest.getReplyTo());
- assertEquals(DEFAULT_FILE_ID, receivedReplaceFileRequest.getFileID());
- assertEquals(settingsForTestClient.getComponentID(), receivedReplaceFileRequest.getFrom());
- assertEquals(pillar1DestinationId, receivedReplaceFileRequest.getDestination());
+ Assertions.assertEquals(collectionID, receivedReplaceFileRequest.getCollectionID());
+ Assertions.assertEquals(receivedIdentifyRequestMessage.getCorrelationID(), receivedReplaceFileRequest.getCorrelationID());
+ Assertions.assertEquals(settingsForCUT.getReceiverDestinationID(), receivedReplaceFileRequest.getReplyTo());
+ Assertions.assertEquals(DEFAULT_FILE_ID, receivedReplaceFileRequest.getFileID());
+ Assertions.assertEquals(settingsForTestClient.getComponentID(), receivedReplaceFileRequest.getFrom());
+ Assertions.assertEquals(pillar1DestinationId, receivedReplaceFileRequest.getDestination());
addStep("Validate the steps of the ReplaceClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("The pillar sends a progress response to the ReplaceClient.", "Should be caught by the event handler.");
ReplaceFileProgressResponse putFileProgressResponse = messageFactory.createReplaceFileProgressResponse(
receivedReplaceFileRequest, PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(putFileProgressResponse);
- assertEquals(PROGRESS, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.PROGRESS, testEventHandler.waitForEvent().getEventType());
addStep("Send a final response message to the ReplaceClient.",
"Should be caught by the event handler. First a PillarComplete, then a Complete.");
@@ -164,11 +150,11 @@ public void replaceClientTester() throws Exception {
messageBus.sendMessage(replaceFileFinalResponse);
for (int i = 1; i < 2 * settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
OperationEventType eventType = testEventHandler.waitForEvent().getEventType();
- assertTrue((eventType == COMPONENT_COMPLETE)
- || (eventType == PROGRESS),
+ Assertions.assertTrue((eventType == OperationEvent.OperationEventType.COMPONENT_COMPLETE)
+ || (eventType == OperationEvent.OperationEventType.PROGRESS),
"Expected either PartiallyComplete or Progress, but was: " + eventType);
}
- assertEquals(COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.COMPLETE, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -184,7 +170,7 @@ public void replaceClientIdentificationTimeout() throws Exception {
TestEventHandler testEventHandler = new TestEventHandler(testEventManager);
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
URL address = httpServerConfiguration.getURL(DEFAULT_FILE_ID);
@@ -195,13 +181,13 @@ public void replaceClientIdentificationTimeout() throws Exception {
address, 10, DEFAULT_NEW_CHECKSUM_DATA, checksumRequest, testEventHandler, null);
collectionReceiver.waitForMessage(IdentifyPillarsForReplaceFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Do not respond. Just await the timeout.",
"Should make send a Failure event to the eventhandler.");
- assertEquals(IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFY_TIMEOUT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -218,7 +204,7 @@ public void replaceClientOperationTimeout() throws Exception {
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
URL address = httpServerConfiguration.getURL(DEFAULT_FILE_ID);
@@ -230,7 +216,7 @@ public void replaceClientOperationTimeout() throws Exception {
IdentifyPillarsForReplaceFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForReplaceFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client receive the response, identify the pillar and send the " +
"request.");
@@ -239,19 +225,19 @@ public void replaceClientOperationTimeout() throws Exception {
messageFactory.createIdentifyPillarsForReplaceFileResponse(receivedIdentifyRequestMessage,
PILLAR1_ID, pillar1DestinationId);
messageBus.sendMessage(identifyResponse);
- assertNotNull(pillar1Receiver.waitForMessage(ReplaceFileRequest.class));
+ Assertions.assertNotNull(pillar1Receiver.waitForMessage(ReplaceFileRequest.class));
addStep("Validate the steps of the ReplaceClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Do not respond. Just await the timeout.",
"Should make send a Failure event to the eventhandler.");
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -266,7 +252,7 @@ public void replaceClientPillarFailed() throws Exception {
ReplaceFileClient replaceClient = createReplaceFileClient();
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(SHA1);
+ checksumRequest.setChecksumType(ChecksumType.SHA1);
URL address = httpServerConfiguration.getURL(DEFAULT_FILE_ID);
@@ -278,7 +264,7 @@ public void replaceClientPillarFailed() throws Exception {
IdentifyPillarsForReplaceFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForReplaceFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Make response for the pillar.", "The client receive the response, identify the pillar and send the " +
"request.");
@@ -293,22 +279,22 @@ public void replaceClientPillarFailed() throws Exception {
addStep("Validate the steps of the ReplaceClient by going through the events.", "Should be 'PillarIdentified', "
+ "'PillarSelected' and 'RequestSent'");
for (int i = 0; i < settingsForCUT.getRepositorySettings().getCollections().getCollection().get(0).getPillarIDs().getPillarID().size(); i++) {
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
}
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send a failed response message to the ReplaceClient.",
"Should be caught by the event handler. First a PillarFailed, then a Complete.");
ReplaceFileFinalResponse replaceFileFinalResponse = messageFactory.createReplaceFileFinalResponse(
receivedReplaceFileRequest, PILLAR1_ID, pillar1DestinationId, DEFAULT_NEW_CHECKSUM_DATA);
ResponseInfo ri = new ResponseInfo();
- ri.setResponseCode(FAILURE);
+ ri.setResponseCode(ResponseCode.FAILURE);
ri.setResponseText("Verifying that a failure can be understood!");
replaceFileFinalResponse.setResponseInfo(ri);
messageBus.sendMessage(replaceFileFinalResponse);
- assertEquals(COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
- assertEquals(FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.COMPONENT_FAILED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.FAILED, testEventHandler.waitForEvent().getEventType());
}
@Test
@@ -324,15 +310,15 @@ public void saltedReturnChecksumsForNewFileWithChecksumPillar() throws Exception
"A IdentifyPillarsForGetFileRequest will be sent to the pillar and a " +
"IDENTIFY_REQUEST_SENT should be generated.");
ChecksumSpecTYPE checksumRequest = new ChecksumSpecTYPE();
- checksumRequest.setChecksumType(MD5);
- checksumRequest.setChecksumSalt(encodeBase16("aa"));
+ checksumRequest.setChecksumType(ChecksumType.MD5);
+ checksumRequest.setChecksumSalt(Base16Utils.encodeBase16("aa"));
replaceClient.replaceFile(collectionID, DEFAULT_FILE_ID, PILLAR1_ID, DEFAULT_OLD_CHECKSUM_DATA, null,
httpServerConfiguration.getURL(DEFAULT_FILE_ID), 0, DEFAULT_NEW_CHECKSUM_DATA, checksumRequest, testEventHandler,
null);
IdentifyPillarsForReplaceFileRequest receivedIdentifyRequestMessage = collectionReceiver.waitForMessage(
IdentifyPillarsForReplaceFileRequest.class);
- assertEquals(IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFY_REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
addStep("Send an identification response with a PillarChecksumSpec element set, indicating that this is a " +
"checksum pillar.",
@@ -344,11 +330,11 @@ public void saltedReturnChecksumsForNewFileWithChecksumPillar() throws Exception
PILLAR1_ID, pillar1DestinationId);
markAsChecksumPillarResponse(identifyResponse);
messageBus.sendMessage(identifyResponse);
- assertEquals(COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
- assertEquals(IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
- assertEquals(REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.COMPONENT_IDENTIFIED, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.IDENTIFICATION_COMPLETE, testEventHandler.waitForEvent().getEventType());
+ Assertions.assertEquals(OperationEvent.OperationEventType.REQUEST_SENT, testEventHandler.waitForEvent().getEventType());
ReplaceFileRequest receivedReplaceFileRequest1 = pillar1Receiver.waitForMessage(ReplaceFileRequest.class);
- assertNull(receivedReplaceFileRequest1.getChecksumRequestForNewFile());
+ Assertions.assertNull(receivedReplaceFileRequest1.getChecksumRequestForNewFile());
}
/**
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
index 27b983853..6cade7fe5 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
@@ -23,14 +23,10 @@
import org.bitrepository.common.exceptions.UnableToFinishException;
import org.jaccept.structure.ExtendedTestCase;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
public class UnableToFinishExceptionTest extends ExtendedTestCase {
@Test
@@ -45,20 +41,20 @@ public void testUnableToFinish() throws Exception {
try {
throw new UnableToFinishException(errMsg);
} catch (Exception e) {
- assertInstanceOf(UnableToFinishException.class, e);
- assertEquals(errMsg, e.getMessage());
- assertNull(e.getCause());
+ Assertions.assertInstanceOf(UnableToFinishException.class, e);
+ Assertions.assertEquals(errMsg, e.getMessage());
+ Assertions.assertNull(e.getCause());
}
addStep("Throw the exception with an embedded exception", "The embedded exception should be the same.");
try {
throw new UnableToFinishException(errMsg, new IllegalArgumentException(causeMsg));
} catch (Exception e) {
- assertInstanceOf(UnableToFinishException.class, e);
- assertEquals(errMsg, e.getMessage());
- assertNotNull(e.getCause());
- assertInstanceOf(IllegalArgumentException.class, e.getCause());
- assertEquals(causeMsg, e.getCause().getMessage());
+ Assertions.assertInstanceOf(UnableToFinishException.class, e);
+ Assertions.assertEquals(errMsg, e.getMessage());
+ Assertions.assertNotNull(e.getCause());
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e.getCause());
+ Assertions.assertEquals(causeMsg, e.getCause().getMessage());
}
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
index 1729d449f..840080a62 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
@@ -8,12 +8,9 @@
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
-import static java.math.BigInteger.valueOf;
-import static java.time.Duration.ofMillis;
-import static java.time.Duration.ofMinutes;
-import static org.bitrepository.common.settings.Settings.getDurationFromXmlDurationOrMillis;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
+import java.math.BigInteger;
+import java.time.Duration;
+import org.junit.jupiter.api.Assertions;
public class SettingsTest extends ExtendedTestCase {
@@ -27,7 +24,7 @@ public void setUpFactory() throws DatatypeConfigurationException {
@Test
@Tag("regressiontest")
public void getDurationFromXmlDurationOrMillisRequiresOneNonNullArg() {
- assertThrows(NullPointerException.class, () -> {
+ Assertions.assertThrows(NullPointerException.class, () -> {
addDescription("Tests that getDurationFromXmlDurationOrMillis() fails when given two nulls");
addStep("null and null", "NPE");
@@ -41,15 +38,15 @@ public void testGetDurationFromXmlDurationOrMillis() {
addDescription("Tests conversions and selection by getDurationFromXmlDurationOrMillis()");
addStep("null and some milliseconds", "Duration of millis");
- assertEquals(ofMillis(54321), getDurationFromXmlDurationOrMillis(null, valueOf(54321)));
+ Assertions.assertEquals(Duration.ofMillis(54321), Settings.getDurationFromXmlDurationOrMillis(null, BigInteger.valueOf(54321)));
addStep("XML duration and null", "XML duration converted");
- assertEquals(ofMinutes(7), getDurationFromXmlDurationOrMillis(
+ Assertions.assertEquals(Duration.ofMinutes(7), Settings.getDurationFromXmlDurationOrMillis(
factory.newDuration("PT7M"), null));
addStep("Conflicting XML duration and millis", "XML duration should be preferred");
- assertEquals(ofMinutes(2), getDurationFromXmlDurationOrMillis(
- factory.newDuration("PT2M"), valueOf(13)));
+ Assertions.assertEquals(Duration.ofMinutes(2), Settings.getDurationFromXmlDurationOrMillis(
+ factory.newDuration("PT2M"), BigInteger.valueOf(13)));
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java
index 4cf9ea3d7..3cbbb627c 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/Base16UtilsTest.java
@@ -27,10 +27,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.common.utils.Base16Utils.decodeBase16;
-import static org.bitrepository.common.utils.Base16Utils.encodeBase16;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
/**
* Utility class for handling encoding and decoding of base64 bytes.
*/
@@ -44,12 +40,12 @@ public class Base16UtilsTest extends ExtendedTestCase {
public void encodeChecksum() throws Exception {
addDescription("Validating the encoding of the checksums.");
addStep("Encode the checksum and validate", "It should match the precalculated constant.");
- byte[] encodedChecksum = encodeBase16(DECODED_CHECKSUM);
+ byte[] encodedChecksum = Base16Utils.encodeBase16(DECODED_CHECKSUM);
- assertEquals(ENCODED_CHECKSUM.length, encodedChecksum.length, "The size of the encoded checksum differs from the expected.");
+ Assertions.assertEquals(ENCODED_CHECKSUM.length, encodedChecksum.length, "The size of the encoded checksum differs from the expected.");
for (int i = 0; i < encodedChecksum.length; i++) {
- assertEquals(ENCODED_CHECKSUM[i], encodedChecksum[i]);
+ Assertions.assertEquals(ENCODED_CHECKSUM[i], encodedChecksum[i]);
}
}
@@ -58,8 +54,8 @@ public void encodeChecksum() throws Exception {
public void decodeChecksum() {
addDescription("Validating the decoding of the checksums.");
addStep("Decode the checksum and validate.", "It should match the precalculated constant.");
- String decodedChecksum = decodeBase16(ENCODED_CHECKSUM);
- assertEquals(DECODED_CHECKSUM, decodedChecksum);
+ String decodedChecksum = Base16Utils.decodeBase16(ENCODED_CHECKSUM);
+ Assertions.assertEquals(DECODED_CHECKSUM, decodedChecksum);
}
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java
index b217b331e..ab94530cf 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/CalendarUtilsTest.java
@@ -24,28 +24,15 @@
import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
import javax.xml.datatype.XMLGregorianCalendar;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.Date;
-
-import static java.lang.System.currentTimeMillis;
-import static java.lang.System.out;
-import static java.time.ZoneId.of;
-import static java.util.Locale.ROOT;
-import static java.util.TimeZone.getTimeZone;
-import static org.bitrepository.common.utils.CalendarUtils.convertFromXMLGregorianCalendar;
-import static org.bitrepository.common.utils.CalendarUtils.getEpoch;
-import static org.bitrepository.common.utils.CalendarUtils.getFromMillis;
-import static org.bitrepository.common.utils.CalendarUtils.getInstance;
-import static org.bitrepository.common.utils.CalendarUtils.getNow;
-import static org.bitrepository.common.utils.CalendarUtils.getTimeZoneDisplayName;
-import static org.bitrepository.common.utils.CalendarUtils.getXmlGregorianCalendar;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.util.Locale;
+import java.util.TimeZone;
public class CalendarUtilsTest extends ExtendedTestCase {
long DATE_IN_MILLIS = 123456789L;
@@ -56,100 +43,100 @@ public void calendarTester() throws Exception {
addDescription("Test the calendar utility class");
addStep("Test the convertion of a date", "Should be the same date.");
Date date = new Date(DATE_IN_MILLIS);
- XMLGregorianCalendar calendar = getXmlGregorianCalendar(date);
- assertEquals(DATE_IN_MILLIS, calendar.toGregorianCalendar().getTimeInMillis());
+ XMLGregorianCalendar calendar = CalendarUtils.getXmlGregorianCalendar(date);
+ Assertions.assertEquals(DATE_IN_MILLIS, calendar.toGregorianCalendar().getTimeInMillis());
addStep("Test that a 'null' date is equivalent to epoch", "Should be date '0'");
- calendar = getXmlGregorianCalendar((Date) null);
- assertEquals(0, calendar.toGregorianCalendar().getTimeInMillis());
+ calendar = CalendarUtils.getXmlGregorianCalendar((Date) null);
+ Assertions.assertEquals(0, calendar.toGregorianCalendar().getTimeInMillis());
addStep("Test epoch", "Should be date '0'");
- calendar = getEpoch();
- assertEquals(0, calendar.toGregorianCalendar().getTimeInMillis());
+ calendar = CalendarUtils.getEpoch();
+ Assertions.assertEquals(0, calendar.toGregorianCalendar().getTimeInMillis());
addStep("Test that a given time in millis is extractable in millis", "Should be same value");
- calendar = getFromMillis(DATE_IN_MILLIS);
- assertEquals(DATE_IN_MILLIS, calendar.toGregorianCalendar().getTimeInMillis());
+ calendar = CalendarUtils.getFromMillis(DATE_IN_MILLIS);
+ Assertions.assertEquals(DATE_IN_MILLIS, calendar.toGregorianCalendar().getTimeInMillis());
addStep("Test the 'getNow' function", "Should give a value very close to System.currentTimeInMillis");
- long beforeNow = currentTimeMillis();
- calendar = getNow();
- long afterNow = currentTimeMillis();
- assertTrue(calendar.toGregorianCalendar().getTimeInMillis() <= afterNow);
- assertTrue(calendar.toGregorianCalendar().getTimeInMillis() >= beforeNow);
+ long beforeNow = System.currentTimeMillis();
+ calendar = CalendarUtils.getNow();
+ long afterNow = System.currentTimeMillis();
+ Assertions.assertTrue(calendar.toGregorianCalendar().getTimeInMillis() <= afterNow);
+ Assertions.assertTrue(calendar.toGregorianCalendar().getTimeInMillis() >= beforeNow);
addStep("Test the reverse conversion, from XMLCalendar to Date", "Should give the same value");
- date = convertFromXMLGregorianCalendar(calendar);
- assertTrue(date.getTime() <= afterNow);
- assertTrue(date.getTime() >= beforeNow);
- assertEquals(calendar.toGregorianCalendar().getTimeInMillis(), date.getTime());
+ date = CalendarUtils.convertFromXMLGregorianCalendar(calendar);
+ Assertions.assertTrue(date.getTime() <= afterNow);
+ Assertions.assertTrue(date.getTime() >= beforeNow);
+ Assertions.assertEquals(calendar.toGregorianCalendar().getTimeInMillis(), date.getTime());
}
@Test
public void displaysNiceTimeZoneId() {
addDescription("Test that the time zone ID logged is human readable (for example Europe/Copenhagen)");
- ZoneId zoneId = of("Europe/Copenhagen");
- String displayName = getTimeZoneDisplayName(getTimeZone(zoneId));
- assertEquals("Europe/Copenhagen", displayName);
+ ZoneId zoneId = ZoneId.of("Europe/Copenhagen");
+ String displayName = CalendarUtils.getTimeZoneDisplayName(TimeZone.getTimeZone(zoneId));
+ Assertions.assertEquals("Europe/Copenhagen", displayName);
}
@Test
@Tag("regressiontest")
public void startDateTest() throws ParseException {
addDescription("Test that the start date is considered as localtime and converted into UTC.");
- CalendarUtils cu = getInstance(getTimeZone("Europe/Copenhagen"));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", ROOT);
+ CalendarUtils cu = CalendarUtils.getInstance(TimeZone.getTimeZone("Europe/Copenhagen"));
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT);
Date expectedStartOfDay = sdf.parse("2015-02-25T23:00:00.000Z");
Date parsedStartOfDay = cu.makeStartDateObject("2015/02/26");
- assertEquals(expectedStartOfDay, parsedStartOfDay);
+ Assertions.assertEquals(expectedStartOfDay, parsedStartOfDay);
}
@Test
@Tag("regressiontest")
public void endDateTest() throws ParseException {
addDescription("Test that the end date is considered as localtime and converted into UTC.");
- CalendarUtils cu = getInstance(getTimeZone("Europe/Copenhagen"));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", ROOT);
+ CalendarUtils cu = CalendarUtils.getInstance(TimeZone.getTimeZone("Europe/Copenhagen"));
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT);
Date expectedStartOfDay = sdf.parse("2015-02-26T22:59:59.999Z");
Date parsedStartOfDay = cu.makeEndDateObject("2015/02/26");
- assertEquals(expectedStartOfDay, parsedStartOfDay);
+ Assertions.assertEquals(expectedStartOfDay, parsedStartOfDay);
}
@Test
@Tag("regressiontest")
public void endDateRolloverTest() throws ParseException {
addDescription("Test that the end date is correctly rolls over a year and month change.");
- CalendarUtils cu = getInstance(getTimeZone("Europe/Copenhagen"));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", ROOT);
+ CalendarUtils cu = CalendarUtils.getInstance(TimeZone.getTimeZone("Europe/Copenhagen"));
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT);
Date expectedStartOfDay = sdf.parse("2016-01-01T22:59:59.999Z");
Date parsedStartOfDay = cu.makeEndDateObject("2015/12/32");
- assertEquals(expectedStartOfDay, parsedStartOfDay);
+ Assertions.assertEquals(expectedStartOfDay, parsedStartOfDay);
}
@Test
@Tag("regressiontest")
public void testBeginningOfDay() throws ParseException {
addDescription("Tests that the time is converted to the beginning of the day localtime, not UTC");
- CalendarUtils cu = getInstance(getTimeZone("Europe/Copenhagen"));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", ROOT);
+ CalendarUtils cu = CalendarUtils.getInstance(TimeZone.getTimeZone("Europe/Copenhagen"));
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT);
Date expectedStartOfDayInUTC = sdf.parse("2016-01-31T23:00:00.000Z");
- out.println("expectedStartOfDayInUTC parsed: " + expectedStartOfDayInUTC.getTime());
+ System.out.println("expectedStartOfDayInUTC parsed: " + expectedStartOfDayInUTC.getTime());
Date parsedStartOfDay = cu.makeStartDateObject("2016/02/01");
- assertEquals(expectedStartOfDayInUTC, parsedStartOfDay);
+ Assertions.assertEquals(expectedStartOfDayInUTC, parsedStartOfDay);
}
@Test
@Tag("regressiontest")
public void testEndOfDay() throws ParseException {
addDescription("Tests that the time is converted to the beginning of the day localtime, not UTC");
- CalendarUtils cu = getInstance(getTimeZone("Europe/Copenhagen"));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", ROOT);
+ CalendarUtils cu = CalendarUtils.getInstance(TimeZone.getTimeZone("Europe/Copenhagen"));
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT);
Date expectedEndOfDayInUTC = sdf.parse("2016-02-01T22:59:59.999Z");
Date parsedEndOfDay = cu.makeEndDateObject("2016/02/01");
- assertEquals(expectedEndOfDayInUTC, parsedEndOfDay);
+ Assertions.assertEquals(expectedEndOfDayInUTC, parsedEndOfDay);
}
@Test
@@ -157,14 +144,14 @@ public void testEndOfDay() throws ParseException {
public void testSummerWinterTimeChange() {
addDescription("Test that the interval between start and end date on a summertime to "
+ "wintertime change is 25 hours (-1 millisecond).");
- CalendarUtils cu = getInstance(getTimeZone("Europe/Copenhagen"));
+ CalendarUtils cu = CalendarUtils.getInstance(TimeZone.getTimeZone("Europe/Copenhagen"));
Date startDate = cu.makeStartDateObject("2015/10/25");
- assertNotNull(startDate);
+ Assertions.assertNotNull(startDate);
Date endDate = cu.makeEndDateObject("2015/10/25");
- assertNotNull(endDate);
+ Assertions.assertNotNull(endDate);
long MS_PER_HOUR = 1000 * 60 * 60;
long expectedIntervalLength = (MS_PER_HOUR * 25) - 1;
- assertEquals(expectedIntervalLength, endDate.getTime() - startDate.getTime());
+ Assertions.assertEquals(expectedIntervalLength, endDate.getTime() - startDate.getTime());
}
@Test
@@ -172,14 +159,14 @@ public void testSummerWinterTimeChange() {
public void testWinterSummerTimeChange() {
addDescription("Test that the interval between start and end date on a wintertime to "
+ "summertime change is 23 hours (-1 millisecond).");
- CalendarUtils cu = getInstance(getTimeZone("Europe/Copenhagen"));
+ CalendarUtils cu = CalendarUtils.getInstance(TimeZone.getTimeZone("Europe/Copenhagen"));
Date startDate = cu.makeStartDateObject("2016/03/27");
- assertNotNull(startDate);
+ Assertions.assertNotNull(startDate);
Date endDate = cu.makeEndDateObject("2016/03/27");
- assertNotNull(endDate);
+ Assertions.assertNotNull(endDate);
long MS_PER_HOUR = 1000 * 60 * 60;
long expectedIntervalLength = (MS_PER_HOUR * 23) - 1;
- assertEquals(expectedIntervalLength, endDate.getTime() - startDate.getTime());
+ Assertions.assertEquals(expectedIntervalLength, endDate.getTime() - startDate.getTime());
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java
index d89042868..22f44078d 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ChecksumUtilsTest.java
@@ -35,22 +35,10 @@
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.HMAC_MD5;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.HMAC_SHA1;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.HMAC_SHA256;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.MD5;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.SHA1;
-import static org.bitrepository.bitrepositoryelements.ChecksumType.SHA256;
-import static org.bitrepository.common.settings.TestSettingsProvider.reloadSettings;
-import static org.bitrepository.common.utils.ChecksumUtils.generateChecksum;
-import static org.bitrepository.common.utils.ChecksumUtils.getDefault;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
+import org.bitrepository.common.settings.TestSettingsProvider;
public class ChecksumUtilsTest extends ExtendedTestCase {
@Test
@@ -61,43 +49,43 @@ public void calculateHmacChecksums() throws Exception {
+ "http://en.wikipedia.org/wiki/HMAC#Examples_of_HMAC_.28MD5.2C_SHA1.2C_SHA256_.29");
addStep("Setup variables.", "Should be OK");
ChecksumSpecTYPE csHmacMD5 = new ChecksumSpecTYPE();
- csHmacMD5.setChecksumType(HMAC_MD5);
+ csHmacMD5.setChecksumType(ChecksumType.HMAC_MD5);
csHmacMD5.setChecksumSalt(new byte[]{0});
ChecksumSpecTYPE csHmacSHA1 = new ChecksumSpecTYPE();
- csHmacSHA1.setChecksumType(HMAC_SHA1);
+ csHmacSHA1.setChecksumType(ChecksumType.HMAC_SHA1);
csHmacSHA1.setChecksumSalt(new byte[]{0});
ChecksumSpecTYPE csHmacSHA256 = new ChecksumSpecTYPE();
- csHmacSHA256.setChecksumType(HMAC_SHA256);
+ csHmacSHA256.setChecksumType(ChecksumType.HMAC_SHA256);
csHmacSHA256.setChecksumSalt(new byte[]{0});
addStep("Test with no text and no key for HMAC_MD5, HMAC_SHA1, and HMAC_SHA256",
"Should give expected results.");
InputStream data1 = new ByteArrayInputStream(new byte[0]);
- assertEquals("74e6f7298a9c2d168935f58c001bad88", generateChecksum(data1, csHmacMD5));
- assertEquals("fbdb1d1b18aa6c08324b7d64b71fb76370690e1d", generateChecksum(data1, csHmacSHA1));
- assertEquals("b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad", generateChecksum(data1, csHmacSHA256));
+ Assertions.assertEquals("74e6f7298a9c2d168935f58c001bad88", ChecksumUtils.generateChecksum(data1, csHmacMD5));
+ Assertions.assertEquals("fbdb1d1b18aa6c08324b7d64b71fb76370690e1d", ChecksumUtils.generateChecksum(data1, csHmacSHA1));
+ Assertions.assertEquals("b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad", ChecksumUtils.generateChecksum(data1, csHmacSHA256));
String message = "The quick brown fox jumps over the lazy dog";
- InputStream data2 = new ByteArrayInputStream(message.getBytes(UTF_8));
+ InputStream data2 = new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8));
String key = "key";
- csHmacMD5.setChecksumSalt(key.getBytes(UTF_8));
- csHmacSHA1.setChecksumSalt(key.getBytes(UTF_8));
- csHmacSHA256.setChecksumSalt(key.getBytes(UTF_8));
+ csHmacMD5.setChecksumSalt(key.getBytes(StandardCharsets.UTF_8));
+ csHmacSHA1.setChecksumSalt(key.getBytes(StandardCharsets.UTF_8));
+ csHmacSHA256.setChecksumSalt(key.getBytes(StandardCharsets.UTF_8));
addStep("Test with the text '" + message + "' and key '" + key + "' for MD5, SHA1, and SHA256",
"Should give expected results.");
- assertEquals("80070713463e7749b90c2dc24911e275", generateChecksum(data2, csHmacMD5));
+ Assertions.assertEquals("80070713463e7749b90c2dc24911e275", ChecksumUtils.generateChecksum(data2, csHmacMD5));
data2.reset();
- assertEquals("de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9", generateChecksum(data2, csHmacSHA1));
+ Assertions.assertEquals("de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9", ChecksumUtils.generateChecksum(data2, csHmacSHA1));
data2.reset();
- assertEquals("f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8", generateChecksum(data2, csHmacSHA256));
+ Assertions.assertEquals("f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8", ChecksumUtils.generateChecksum(data2, csHmacSHA256));
data2.reset();
addStep("Try calculating HMAC with a null salt", "Should throw NoSuchAlgorithmException");
csHmacMD5.setChecksumSalt(null);
try {
- generateChecksum(data2, csHmacMD5);
- fail("Should throw an IllegalArgumentException here!");
+ ChecksumUtils.generateChecksum(data2, csHmacMD5);
+ Assertions.fail("Should throw an IllegalArgumentException here!");
} catch (IllegalArgumentException e) {
// expected
}
@@ -110,34 +98,34 @@ public void calculateDigestChecksums() throws Exception {
+ "correctly calculate the checksums.");
addStep("Setup variables.", "Should be OK");
ChecksumSpecTYPE csMD5 = new ChecksumSpecTYPE();
- csMD5.setChecksumType(MD5);
+ csMD5.setChecksumType(ChecksumType.MD5);
ChecksumSpecTYPE csSHA1 = new ChecksumSpecTYPE();
- csSHA1.setChecksumType(SHA1);
+ csSHA1.setChecksumType(ChecksumType.SHA1);
ChecksumSpecTYPE csSHA256 = new ChecksumSpecTYPE();
- csSHA256.setChecksumType(SHA256);
+ csSHA256.setChecksumType(ChecksumType.SHA256);
addStep("Test with no text and no key for MD5, SHA1, and SHA256",
"Should give expected results.");
InputStream data1 = new ByteArrayInputStream(new byte[0]);
- assertEquals("d41d8cd98f00b204e9800998ecf8427e", generateChecksum(data1, csMD5));
- assertEquals("da39a3ee5e6b4b0d3255bfef95601890afd80709", generateChecksum(data1, csSHA1));
- assertEquals("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", generateChecksum(data1, csSHA256));
+ Assertions.assertEquals("d41d8cd98f00b204e9800998ecf8427e", ChecksumUtils.generateChecksum(data1, csMD5));
+ Assertions.assertEquals("da39a3ee5e6b4b0d3255bfef95601890afd80709", ChecksumUtils.generateChecksum(data1, csSHA1));
+ Assertions.assertEquals("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ChecksumUtils.generateChecksum(data1, csSHA256));
addStep("Test with text ", "Should giver different checksums");
String message = "The quick brown fox jumps over the lazy dog";
- InputStream data2 = new ByteArrayInputStream(message.getBytes(UTF_8));
- assertEquals("9e107d9d372bb6826bd81d3542a419d6", generateChecksum(data2, csMD5));
+ InputStream data2 = new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8));
+ Assertions.assertEquals("9e107d9d372bb6826bd81d3542a419d6", ChecksumUtils.generateChecksum(data2, csMD5));
data2.reset();
- assertEquals("2fd4e1c67a2d28fced849ee1bb76e7391b93eb12", generateChecksum(data2, csSHA1));
+ Assertions.assertEquals("2fd4e1c67a2d28fced849ee1bb76e7391b93eb12", ChecksumUtils.generateChecksum(data2, csSHA1));
data2.reset();
- assertEquals("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592", generateChecksum(data2, csSHA256));
+ Assertions.assertEquals("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592", ChecksumUtils.generateChecksum(data2, csSHA256));
data2.reset();
addStep("add a salt to the checksum", "Should throw an exception");
- csMD5.setChecksumSalt("key".getBytes(UTF_8));
+ csMD5.setChecksumSalt("key".getBytes(StandardCharsets.UTF_8));
try {
- generateChecksum(data1, csMD5);
- fail("Should throw an IllegalArgumentException here!");
+ ChecksumUtils.generateChecksum(data1, csMD5);
+ Assertions.fail("Should throw an IllegalArgumentException here!");
} catch (IllegalArgumentException e) {
// expected
}
@@ -149,20 +137,20 @@ public void testChecksumOnFile() throws Exception {
addDescription("Test the checksum calculation on a file");
addStep("Setup", "");
ChecksumSpecTYPE csMD5 = new ChecksumSpecTYPE();
- csMD5.setChecksumType(MD5);
+ csMD5.setChecksumType(ChecksumType.MD5);
File testFile = new File("src/test/resources/test-files/default-test-file.txt");
- assertTrue(testFile.isFile());
+ Assertions.assertTrue(testFile.isFile());
addStep("Calculate the checksum of the file with the different ways of defining the MD5 without salt",
"Same result from each");
- String cs1 = generateChecksum(testFile, csMD5);
- String cs2 = generateChecksum(testFile, MD5);
- String cs3 = generateChecksum(testFile, MD5, null);
+ String cs1 = ChecksumUtils.generateChecksum(testFile, csMD5);
+ String cs2 = ChecksumUtils.generateChecksum(testFile, ChecksumType.MD5);
+ String cs3 = ChecksumUtils.generateChecksum(testFile, ChecksumType.MD5, null);
- assertEquals(cs2, cs1);
- assertEquals(cs3, cs1);
- assertEquals(cs3, cs2);
+ Assertions.assertEquals(cs2, cs1);
+ Assertions.assertEquals(cs3, cs1);
+ Assertions.assertEquals(cs3, cs2);
}
@@ -266,11 +254,11 @@ private void validateMessageDigest(ChecksumType algorithmType) throws NoSuchAlgo
public void testDefaultChecksum() throws Exception {
addDescription("Test the extraction of the default checksum from settings.");
addStep("Setup the settings", "Loading the test settings");
- Settings settings = reloadSettings("ChecksumUtils");
+ Settings settings = TestSettingsProvider.reloadSettings("ChecksumUtils");
addStep("Use utils to extract default checksum spec", "Should be the one defined in Settings.");
- ChecksumSpecTYPE csType = getDefault(settings);
- assertEquals(settings.getRepositorySettings().getProtocolSettings().getDefaultChecksumType(), csType.getChecksumType().name());
- assertNull(csType.getChecksumSalt(), "Should not contain any salt.");
+ ChecksumSpecTYPE csType = ChecksumUtils.getDefault(settings);
+ Assertions.assertEquals(settings.getRepositorySettings().getProtocolSettings().getDefaultChecksumType(), csType.getChecksumType().name());
+ Assertions.assertNull(csType.getChecksumSalt(), "Should not contain any salt.");
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java
index 1835eb8d2..9974d3309 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileIDUtilsTest.java
@@ -23,16 +23,10 @@
import org.bitrepository.bitrepositoryelements.FileIDs;
import org.jaccept.structure.ExtendedTestCase;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.common.utils.FileIDsUtils.getAllFileIDs;
-import static org.bitrepository.common.utils.FileIDsUtils.getSpecificFileIDs;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
public class FileIDUtilsTest extends ExtendedTestCase {
String FILE_ID = "Test-File-Id";
@@ -41,15 +35,15 @@ public class FileIDUtilsTest extends ExtendedTestCase {
public void fileIDsTest() throws Exception {
addDescription("Test the utility class for generating FileIDs");
addStep("Test 'all file ids'", "is only AllFileIDs");
- FileIDs allFileIDs = getAllFileIDs();
- assertTrue(allFileIDs.isSetAllFileIDs());
- assertFalse(allFileIDs.isSetFileID());
- assertNull(allFileIDs.getFileID());
+ FileIDs allFileIDs = FileIDsUtils.getAllFileIDs();
+ Assertions.assertTrue(allFileIDs.isSetAllFileIDs());
+ Assertions.assertFalse(allFileIDs.isSetFileID());
+ Assertions.assertNull(allFileIDs.getFileID());
addStep("Test a specific file id", "Should not be AllFileIDs");
- FileIDs specificFileIDs = getSpecificFileIDs(FILE_ID);
- assertFalse(specificFileIDs.isSetAllFileIDs());
- assertTrue(specificFileIDs.isSetFileID());
- assertEquals(FILE_ID, specificFileIDs.getFileID());
+ FileIDs specificFileIDs = FileIDsUtils.getSpecificFileIDs(FILE_ID);
+ Assertions.assertFalse(specificFileIDs.isSetAllFileIDs());
+ Assertions.assertTrue(specificFileIDs.isSetFileID());
+ Assertions.assertEquals(FILE_ID, specificFileIDs.getFileID());
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java
index 088f56c80..61cdd8ea0 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/FileUtilsTest.java
@@ -30,17 +30,7 @@
import org.junit.jupiter.api.Test;
import java.io.File;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.bitrepository.common.utils.FileUtils.delete;
-import static org.bitrepository.common.utils.FileUtils.retrieveDirectory;
-import static org.bitrepository.common.utils.FileUtils.retrieveSubDirectory;
-import static org.bitrepository.common.utils.FileUtils.unzip;
-import static org.bitrepository.common.utils.FileUtils.writeStreamToFile;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
+import java.nio.charset.StandardCharsets;
public class FileUtilsTest extends ExtendedTestCase {
String DIR = "test-directory";
@@ -71,20 +61,20 @@ public void createDirectoryTester() throws Exception {
addDescription("Test the ability to create directories.");
addStep("Test the ability to create a directory", "Should be created by utility.");
File dir = new File(DIR);
- assertFalse(dir.exists());
- File madeDir = retrieveDirectory(DIR);
- assertTrue(madeDir.exists());
- assertTrue(madeDir.isDirectory());
- assertTrue(dir.isDirectory());
- assertEquals(madeDir.getAbsolutePath(), dir.getAbsolutePath());
+ Assertions.assertFalse(dir.exists());
+ File madeDir = FileUtils.retrieveDirectory(DIR);
+ Assertions.assertTrue(madeDir.exists());
+ Assertions.assertTrue(madeDir.isDirectory());
+ Assertions.assertTrue(dir.isDirectory());
+ Assertions.assertEquals(madeDir.getAbsolutePath(), dir.getAbsolutePath());
addStep("Test error scenarios, when the directory path is a file", "Should throw exception");
File testFile = new File(dir, TEST_FILE_NAME);
- assertTrue(testFile.createNewFile());
+ Assertions.assertTrue(testFile.createNewFile());
try {
- retrieveDirectory(testFile.getPath());
- fail("Should throw an exception");
+ FileUtils.retrieveDirectory(testFile.getPath());
+ Assertions.fail("Should throw an exception");
} catch (IllegalArgumentException e) {
// expected
}
@@ -95,32 +85,32 @@ public void createDirectoryTester() throws Exception {
public void createSubDirectoryTester() throws Exception {
addDescription("Test the ability to create sub directories.");
addStep("Test the ability to create sub-directories", "Should be created by utility");
- File dir = retrieveDirectory(DIR);
+ File dir = FileUtils.retrieveDirectory(DIR);
File subdir = new File(dir, SUB_DIR);
- assertFalse(subdir.exists());
- File madeSubdir = retrieveSubDirectory(dir, SUB_DIR);
- assertTrue(madeSubdir.exists());
- assertTrue(madeSubdir.isDirectory());
- assertTrue(subdir.isDirectory());
- assertEquals(madeSubdir.getAbsolutePath(), subdir.getAbsolutePath());
+ Assertions.assertFalse(subdir.exists());
+ File madeSubdir = FileUtils.retrieveSubDirectory(dir, SUB_DIR);
+ Assertions.assertTrue(madeSubdir.exists());
+ Assertions.assertTrue(madeSubdir.isDirectory());
+ Assertions.assertTrue(subdir.isDirectory());
+ Assertions.assertEquals(madeSubdir.getAbsolutePath(), subdir.getAbsolutePath());
addStep("Test that it fails if the 'directory' is actually a file", "Throws exception");
File testFile = new File(dir, TEST_FILE_NAME);
- assertTrue(testFile.createNewFile());
+ Assertions.assertTrue(testFile.createNewFile());
try {
- retrieveSubDirectory(testFile, SUB_DIR);
- fail("Should throw an exception");
+ FileUtils.retrieveSubDirectory(testFile, SUB_DIR);
+ Assertions.fail("Should throw an exception");
} catch (IllegalArgumentException e) {
// expected
}
addStep("Test that it fails, if the parent directory does not allow writing", "Throws exception");
- delete(subdir);
+ FileUtils.delete(subdir);
try {
dir.setWritable(false);
- retrieveSubDirectory(dir, SUB_DIR);
- fail("Should throw an exception");
+ FileUtils.retrieveSubDirectory(dir, SUB_DIR);
+ Assertions.fail("Should throw an exception");
} catch (IllegalStateException e) {
// expected
} finally {
@@ -189,15 +179,15 @@ public void moveFileTester() throws Exception {
public void writeInputstreamTester() throws Exception {
addDescription("Test writing an inputstream to a file.");
addStep("Setup", "");
- File dir = retrieveDirectory(DIR);
+ File dir = FileUtils.retrieveDirectory(DIR);
File testFile = new File(dir, TEST_FILE_NAME);
- assertFalse(testFile.exists());
- ByteArrayInputStream in = new ByteArrayInputStream(DATA.getBytes(UTF_8));
+ Assertions.assertFalse(testFile.exists());
+ ByteArrayInputStream in = new ByteArrayInputStream(DATA.getBytes(StandardCharsets.UTF_8));
addStep("Write the input stream to the file", "The file should exist and have same size as the data.");
- writeStreamToFile(in, testFile);
- assertTrue(testFile.exists());
- assertEquals(DATA.length(), testFile.length());
+ FileUtils.writeStreamToFile(in, testFile);
+ Assertions.assertTrue(testFile.exists());
+ Assertions.assertEquals(DATA.length(), testFile.length());
}
@Test
@@ -205,14 +195,14 @@ public void writeInputstreamTester() throws Exception {
public void unzipFileTester() throws Exception {
addDescription("Test unzipping a file.");
addStep("Setup", "");
- File dir = retrieveDirectory(DIR);
+ File dir = FileUtils.retrieveDirectory(DIR);
File zipFile = new File("src/test/resources/test-files/test.jar");
- assertTrue(zipFile.isFile(), zipFile.getAbsolutePath());
- assertEquals(0, dir.listFiles().length);
+ Assertions.assertTrue(zipFile.isFile(), zipFile.getAbsolutePath());
+ Assertions.assertEquals(0, dir.listFiles().length);
addStep("Unzip the zipfile to the directory", "Should place a file and a directory inside the dir");
- unzip(zipFile, dir);
- assertEquals(2, dir.listFiles().length);
+ FileUtils.unzip(zipFile, dir);
+ Assertions.assertEquals(2, dir.listFiles().length);
}
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java
index a9492c40e..3f20050fe 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/ResponseInfoUtilsTest.java
@@ -22,16 +22,12 @@
package org.bitrepository.common.utils;
import org.bitrepository.bitrepositoryelements.ResponseInfo;
+import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.jaccept.structure.ExtendedTestCase;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.IDENTIFICATION_POSITIVE;
-import static org.bitrepository.bitrepositoryelements.ResponseCode.OPERATION_ACCEPTED_PROGRESS;
-import static org.bitrepository.common.utils.ResponseInfoUtils.getInitialProgressResponse;
-import static org.bitrepository.common.utils.ResponseInfoUtils.getPositiveIdentification;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
public class ResponseInfoUtilsTest extends ExtendedTestCase {
@Test
@@ -39,12 +35,12 @@ public class ResponseInfoUtilsTest extends ExtendedTestCase {
public void responseInfoTester() throws Exception {
addDescription("Test the response info.");
addStep("Validate the positive identification response", "Should be 'IDENTIFICATION_POSITIVE'");
- ResponseInfo ri = getPositiveIdentification();
- assertEquals(IDENTIFICATION_POSITIVE, ri.getResponseCode());
+ ResponseInfo ri = ResponseInfoUtils.getPositiveIdentification();
+ Assertions.assertEquals(ResponseCode.IDENTIFICATION_POSITIVE, ri.getResponseCode());
addStep("Validate the Progress response", "Should be 'OPERATION_ACCEPTED_PROGRESS'");
- ri = getInitialProgressResponse();
- assertEquals(OPERATION_ACCEPTED_PROGRESS, ri.getResponseCode());
+ ri = ResponseInfoUtils.getInitialProgressResponse();
+ Assertions.assertEquals(ResponseCode.OPERATION_ACCEPTED_PROGRESS, ri.getResponseCode());
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
index 9486ed53b..f68a123ca 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/StreamUtilsTest.java
@@ -25,14 +25,10 @@
import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
import java.io.ByteArrayOutputStream;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.bitrepository.common.utils.StreamUtils.copyInputStreamToOutputStream;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import static org.junit.jupiter.api.Assertions.fail;
+import java.nio.charset.StandardCharsets;
public class StreamUtilsTest extends ExtendedTestCase {
String DATA = "The data for the streams.";
@@ -43,27 +39,27 @@ public void streamTester() throws Exception {
addDescription("Tests the SteamUtils class.");
addStep("Setup variables", "");
ByteArrayOutputStream out = new ByteArrayOutputStream();
- ByteArrayInputStream in = new ByteArrayInputStream(DATA.getBytes(UTF_8));
+ ByteArrayInputStream in = new ByteArrayInputStream(DATA.getBytes(StandardCharsets.UTF_8));
addStep("Test with null arguments", "Should throw exceptions");
try {
- copyInputStreamToOutputStream(null, out);
- fail("Should throw an exception here.");
+ StreamUtils.copyInputStreamToOutputStream(null, out);
+ Assertions.fail("Should throw an exception here.");
} catch (Exception e) {
- assertInstanceOf(IllegalArgumentException.class, e);
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e);
}
try {
- copyInputStreamToOutputStream(in, null);
- fail("Should throw an exception here.");
+ StreamUtils.copyInputStreamToOutputStream(in, null);
+ Assertions.fail("Should throw an exception here.");
} catch (Exception e) {
- assertInstanceOf(IllegalArgumentException.class, e);
+ Assertions.assertInstanceOf(IllegalArgumentException.class, e);
}
addStep("Test copying the input stream to the output stream.", "Should contain the same data.");
- copyInputStreamToOutputStream(in, out);
+ StreamUtils.copyInputStreamToOutputStream(in, out);
- assertEquals(DATA, out.toString(UTF_8));
+ Assertions.assertEquals(DATA, out.toString(StandardCharsets.UTF_8));
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
index dbc92417f..0fc14dcfe 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeMeasurementUtilsTest.java
@@ -26,22 +26,13 @@
import org.bitrepository.bitrepositoryelements.TimeMeasureTYPE;
import org.jaccept.structure.ExtendedTestCase;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
+import org.bitrepository.bitrepositoryelements.TimeMeasureUnit;
import java.math.BigInteger;
-import static java.lang.Long.MAX_VALUE;
-import static java.math.BigInteger.valueOf;
-import static org.bitrepository.bitrepositoryelements.TimeMeasureUnit.HOURS;
-import static org.bitrepository.bitrepositoryelements.TimeMeasureUnit.MILLISECONDS;
-import static org.bitrepository.common.utils.TimeMeasurementUtils.compare;
-import static org.bitrepository.common.utils.TimeMeasurementUtils.getMaximumTime;
-import static org.bitrepository.common.utils.TimeMeasurementUtils.getTimeMeasureInLong;
-import static org.bitrepository.common.utils.TimeMeasurementUtils.getTimeMeasurementFromMilliseconds;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
/**
* Tests the TimeMeasureComparator class.
*/
@@ -52,21 +43,21 @@ public void testCompareMilliSeconds() {
addDescription("Test the comparison between TimeMeasure units.");
TimeMeasureTYPE referenceTime = new TimeMeasureTYPE();
referenceTime.setTimeMeasureValue(new BigInteger("2"));
- referenceTime.setTimeMeasureUnit(MILLISECONDS);
+ referenceTime.setTimeMeasureUnit(TimeMeasureUnit.MILLISECONDS);
TimeMeasureTYPE compareTime = new TimeMeasureTYPE();
compareTime.setTimeMeasureValue(new BigInteger("3"));
- compareTime.setTimeMeasureUnit(MILLISECONDS);
+ compareTime.setTimeMeasureUnit(TimeMeasureUnit.MILLISECONDS);
- assertTrue(compare(referenceTime, compareTime) < 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
" should be smaller than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("1"));
- assertTrue(compare(referenceTime, compareTime) > 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- assertEquals(0, compare(referenceTime, compareTime), referenceTime +
+ Assertions.assertEquals(0, TimeMeasurementUtils.compare(referenceTime, compareTime), referenceTime +
" should be same as " + compareTime);
}
@@ -76,39 +67,39 @@ public void testCompareMilliSecondsToHours() {
addDescription("Test the comparison between milliseconds and hours.");
long millis = 7200000L;
TimeMeasureTYPE referenceTime = new TimeMeasureTYPE();
- referenceTime.setTimeMeasureValue(valueOf(millis));
- referenceTime.setTimeMeasureUnit(MILLISECONDS);
+ referenceTime.setTimeMeasureValue(BigInteger.valueOf(millis));
+ referenceTime.setTimeMeasureUnit(TimeMeasureUnit.MILLISECONDS);
TimeMeasureTYPE compareTime = new TimeMeasureTYPE();
compareTime.setTimeMeasureValue(new BigInteger("3"));
- compareTime.setTimeMeasureUnit(HOURS);
+ compareTime.setTimeMeasureUnit(TimeMeasureUnit.HOURS);
- assertTrue(compare(referenceTime, compareTime) < 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) < 0, referenceTime +
" should be smaller than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("1"));
- assertTrue(compare(referenceTime, compareTime) > 0, referenceTime +
+ Assertions.assertTrue(TimeMeasurementUtils.compare(referenceTime, compareTime) > 0, referenceTime +
" should be larger than " + compareTime);
compareTime.setTimeMeasureValue(new BigInteger("2"));
- assertEquals(0, compare(referenceTime, compareTime), referenceTime +
+ Assertions.assertEquals(0, TimeMeasurementUtils.compare(referenceTime, compareTime), referenceTime +
" should be same as " + compareTime);
- assertEquals(millis, getTimeMeasureInLong(referenceTime));
+ Assertions.assertEquals(millis, TimeMeasurementUtils.getTimeMeasureInLong(referenceTime));
}
@Test
@Tag("regressiontest")
public void testMaxValue() {
addDescription("Test the Maximum value");
- TimeMeasureTYPE time = getMaximumTime();
- assertEquals(MAX_VALUE, time.getTimeMeasureValue().longValue());
- assertEquals(HOURS, time.getTimeMeasureUnit());
-
- TimeMeasureTYPE time2 = getTimeMeasurementFromMilliseconds(
- valueOf(MAX_VALUE));
- time2.setTimeMeasureUnit(HOURS);
- assertEquals(0, compare(time, time2));
+ TimeMeasureTYPE time = TimeMeasurementUtils.getMaximumTime();
+ Assertions.assertEquals(Long.MAX_VALUE, time.getTimeMeasureValue().longValue());
+ Assertions.assertEquals(TimeMeasureUnit.HOURS, time.getTimeMeasureUnit());
+
+ TimeMeasureTYPE time2 = TimeMeasurementUtils.getTimeMeasurementFromMilliseconds(
+ BigInteger.valueOf(Long.MAX_VALUE));
+ time2.setTimeMeasureUnit(TimeMeasureUnit.HOURS);
+ Assertions.assertEquals(0, TimeMeasurementUtils.compare(time, time2));
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
index cf58fb19d..134df6e18 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
@@ -34,42 +34,12 @@
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAmount;
import java.util.Date;
+import java.util.Locale;
import java.util.concurrent.TimeUnit;
-import static java.lang.Long.MAX_VALUE;
-import static java.time.Duration.ZERO;
-import static java.time.Duration.ofDays;
-import static java.time.Duration.ofHours;
-import static java.time.Duration.ofMillis;
-import static java.time.Duration.ofMinutes;
-import static java.time.Duration.ofNanos;
-import static java.time.Duration.ofSeconds;
-import static java.time.Duration.parse;
-import static java.time.Period.of;
-import static java.time.Period.ofMonths;
-import static java.time.Period.ofYears;
-import static java.time.temporal.ChronoUnit.DAYS;
-import static java.time.temporal.ChronoUnit.HOURS;
-import static java.time.temporal.ChronoUnit.MICROS;
-import static java.time.temporal.ChronoUnit.MINUTES;
-import static java.time.temporal.ChronoUnit.MONTHS;
-import static java.time.temporal.ChronoUnit.SECONDS;
-import static java.time.temporal.ChronoUnit.YEARS;
-import static java.util.Locale.ROOT;
-import static java.util.concurrent.TimeUnit.MICROSECONDS;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static org.bitrepository.common.utils.TimeUtils.durationToCountAndTimeUnit;
-import static org.bitrepository.common.utils.TimeUtils.durationToHuman;
-import static org.bitrepository.common.utils.TimeUtils.durationToHumanUsingEstimates;
-import static org.bitrepository.common.utils.TimeUtils.humanDifference;
-import static org.bitrepository.common.utils.TimeUtils.millisecondsToHuman;
-import static org.bitrepository.common.utils.TimeUtils.shortDate;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public class TimeUtilsTest extends ExtendedTestCase {
private static final ZonedDateTime BASE = Instant.EPOCH.atZone(ZoneOffset.UTC);
@@ -83,49 +53,49 @@ public void timeTester() throws Exception {
long millis = 271433605;
String millisInSec = TimeUtils.millisecondsToSeconds(millis % 60000);
String expectedSec = "53s";
- assertTrue(millisInSec.startsWith(expectedSec));
+ Assertions.assertTrue(millisInSec.startsWith(expectedSec));
addStep("Test that milliseconds can be converted into human readable minutes.",
"Pi days % hours");
String millisInMin = TimeUtils.millisecondsToMinutes(millis % 3600000);
String expectedMin = "23m";
- assertTrue(millisInMin.startsWith(expectedMin));
+ Assertions.assertTrue(millisInMin.startsWith(expectedMin));
addStep("Test that milliseconds can be converted into human readable hours.",
"Pi days % days");
String millisInHour = TimeUtils.millisecondsToHours(millis % (3600000 * 24));
String expectedHours = "3h";
- assertTrue(millisInHour.startsWith(expectedHours));
+ Assertions.assertTrue(millisInHour.startsWith(expectedHours));
addStep("Test that milliseconds can be converted into human readable minutes.",
"Pi days");
String millisInDay = TimeUtils.millisecondsToDays(millis);
String expectedDays = "3d";
- assertTrue(millisInDay.startsWith(expectedDays));
+ Assertions.assertTrue(millisInDay.startsWith(expectedDays));
addStep("Test the human readable output.", "");
String human = TimeUtils.millisecondsToHuman(millis);
- assertTrue(human.contains(expectedSec), human);
- assertTrue(human.contains(expectedMin), human);
- assertTrue(human.contains(expectedHours), human);
- assertTrue(human.contains(expectedDays), human);
+ Assertions.assertTrue(human.contains(expectedSec), human);
+ Assertions.assertTrue(human.contains(expectedMin), human);
+ Assertions.assertTrue(human.contains(expectedHours), human);
+ Assertions.assertTrue(human.contains(expectedDays), human);
}
@Test
@Tag("regressiontest")
public void printsHumanDuration() {
- assertEquals("1y", durationToHumanUsingEstimates(YEARS.getDuration()));
- assertEquals("1m", durationToHumanUsingEstimates(MONTHS.getDuration()));
- assertEquals("1d", durationToHumanUsingEstimates(DAYS.getDuration()));
- assertEquals("1h", durationToHumanUsingEstimates(HOURS.getDuration()));
- assertEquals("1m", durationToHumanUsingEstimates(MINUTES.getDuration()));
+ Assertions.assertEquals("1y", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.YEARS.getDuration()));
+ Assertions.assertEquals("1m", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.MONTHS.getDuration()));
+ Assertions.assertEquals("1d", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.DAYS.getDuration()));
+ Assertions.assertEquals("1h", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.HOURS.getDuration()));
+ Assertions.assertEquals("1m", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.MINUTES.getDuration()));
// Don’t print seconds
- assertEquals("0m", durationToHumanUsingEstimates(SECONDS.getDuration()));
- assertEquals("2h 3m", durationToHumanUsingEstimates(parse("PT2H3M5S")));
+ Assertions.assertEquals("0m", TimeUtils.durationToHumanUsingEstimates(ChronoUnit.SECONDS.getDuration()));
+ Assertions.assertEquals("2h 3m", TimeUtils.durationToHumanUsingEstimates(Duration.parse("PT2H3M5S")));
addStep("Test the limits of what the method handles", "0m and 500y respectively");
- assertEquals("0m", durationToHumanUsingEstimates(ZERO));
- assertEquals("500y", durationToHumanUsingEstimates(ofHours(4_382_910)));
+ Assertions.assertEquals("0m", TimeUtils.durationToHumanUsingEstimates(Duration.ZERO));
+ Assertions.assertEquals("500y", TimeUtils.durationToHumanUsingEstimates(Duration.ofHours(4_382_910)));
}
@Test
@@ -133,8 +103,8 @@ public void printsHumanDuration() {
public void zeroIntervalTest() throws Exception {
addDescription("Verifies that a 0 ms interval is represented correctly");
addStep("Call millisecondsToHuman with 0 ms", "The output should be '0 ms'");
- String zeroTimeString = millisecondsToHuman(0);
- assertEquals(" 0 ms", zeroTimeString);
+ String zeroTimeString = TimeUtils.millisecondsToHuman(0);
+ Assertions.assertEquals(" 0 ms", zeroTimeString);
}
@Test
@@ -142,23 +112,23 @@ public void zeroIntervalTest() throws Exception {
public void durationsPrintHumanly() {
addDescription("Tests durationToHuman()");
- assertTrue(durationToHuman(ZERO).contains("0"),
+ Assertions.assertTrue(TimeUtils.durationToHuman(Duration.ZERO).contains("0"),
"Zero duration should contain a 0 digit");
- assertEquals("2d", durationToHuman(ofDays(2)));
- assertEquals("3h", durationToHuman(ofHours(3)));
- assertEquals("5m", durationToHuman(ofMinutes(5)));
- assertEquals("7s", durationToHuman(ofSeconds(7)));
- assertEquals("11 ms", durationToHuman(ofMillis(11)));
- assertEquals("13 ns", durationToHuman(ofNanos(13)));
+ Assertions.assertEquals("2d", TimeUtils.durationToHuman(Duration.ofDays(2)));
+ Assertions.assertEquals("3h", TimeUtils.durationToHuman(Duration.ofHours(3)));
+ Assertions.assertEquals("5m", TimeUtils.durationToHuman(Duration.ofMinutes(5)));
+ Assertions.assertEquals("7s", TimeUtils.durationToHuman(Duration.ofSeconds(7)));
+ Assertions.assertEquals("11 ms", TimeUtils.durationToHuman(Duration.ofMillis(11)));
+ Assertions.assertEquals("13 ns", TimeUtils.durationToHuman(Duration.ofNanos(13)));
// When there are nanoseconds, don't print millis
- assertEquals("999999937 ns", durationToHuman(ofNanos(999_999_937)));
+ Assertions.assertEquals("999999937 ns", TimeUtils.durationToHuman(Duration.ofNanos(999_999_937)));
- assertEquals("minus 2d", durationToHuman(ofDays(-2)));
- assertEquals("minus 13 ns", durationToHuman(ofNanos(-13)));
+ Assertions.assertEquals("minus 2d", TimeUtils.durationToHuman(Duration.ofDays(-2)));
+ Assertions.assertEquals("minus 13 ns", TimeUtils.durationToHuman(Duration.ofNanos(-13)));
- Duration allUnits = parse("P3DT5H7M11.013000017S");
- assertEquals("3d 5h 7m 11s 13000017 ns", durationToHuman(allUnits));
+ Duration allUnits = Duration.parse("P3DT5H7M11.013000017S");
+ Assertions.assertEquals("3d 5h 7m 11s 13000017 ns", TimeUtils.durationToHuman(allUnits));
}
@Test
@@ -168,42 +138,42 @@ public void differencesPrintHumanly() {
" similar human readable strings to those from millisecondsToHuman()");
addStep("Call humanDifference() with same time twice", "The output should be '0m'");
- String zeroTimeString = humanDifference(BASE, BASE);
- assertEquals("0m", zeroTimeString);
+ String zeroTimeString = TimeUtils.humanDifference(BASE, BASE);
+ Assertions.assertEquals("0m", zeroTimeString);
addStep("Call humanDifference() with a difference obtained from a Duration",
"Expect corresponding readable output");
// Don’t print seconds
- testHumanDifference("0m", ofSeconds(1));
- testHumanDifference("1m", ofMinutes(1));
- testHumanDifference("1h", ofHours(1));
- testHumanDifference("2h 3m", parse("PT2H3M5.000000007S"));
+ testHumanDifference("0m", Duration.ofSeconds(1));
+ testHumanDifference("1m", Duration.ofMinutes(1));
+ testHumanDifference("1h", Duration.ofHours(1));
+ testHumanDifference("2h 3m", Duration.parse("PT2H3M5.000000007S"));
addStep("Call humanDifference() with a difference obtained from a Period",
"Expect corresponding readable output");
testHumanDifference("1d", Period.ofDays(1));
- testHumanDifference("1m", ofMonths(1));
- testHumanDifference("1y", ofYears(1));
- testHumanDifference("2y 3m 5d", of(2, 3, 5));
+ testHumanDifference("1m", Period.ofMonths(1));
+ testHumanDifference("1y", Period.ofYears(1));
+ testHumanDifference("2y 3m 5d", Period.of(2, 3, 5));
addStep("Call humanDifference() with a difference obtained from a combo of a Period and a Duration",
"Expect corresponding readable output");
testHumanDifference("3y 5m 7d",
- of(3, 5, 7), parse("PT11H13M17.023S"));
+ Period.of(3, 5, 7), Duration.parse("PT11H13M17.023S"));
testHumanDifference("2m 7d 11h",
- of(0, 2, 7), parse("PT11H13M17.023S"));
- testHumanDifference("1d 11h 13m", Period.ofDays(1), parse("PT11H13M17.023S"));
+ Period.of(0, 2, 7), Duration.parse("PT11H13M17.023S"));
+ testHumanDifference("1d 11h 13m", Period.ofDays(1), Duration.parse("PT11H13M17.023S"));
addStep("Call humanDifference()" +
" with dates that are 2 days apart but times that cause the diff to be less than 2 full days",
"Expect output 1d something");
ZoneId testZoneId = ZoneId.of("Europe/Vienna");
- String oneDaySomethingString = humanDifference(
+ String oneDaySomethingString = TimeUtils.humanDifference(
ZonedDateTime.of(2021, 1, 31,
12, 0, 0, 0, testZoneId),
ZonedDateTime.of(2021, 2, 2,
11, 59, 29, 0, testZoneId));
- assertEquals("1d 23h 59m", oneDaySomethingString);
+ Assertions.assertEquals("1d 23h 59m", oneDaySomethingString);
}
@Test
@@ -243,8 +213,8 @@ private void testHumanDifference(String expected, TemporalAmount... amounts) {
for (TemporalAmount amount : amounts) {
end = end.plus(amount);
}
- String differenceString = humanDifference(BASE, end);
- assertEquals(expected, differenceString);
+ String differenceString = TimeUtils.humanDifference(BASE, end);
+ Assertions.assertEquals(expected, differenceString);
}
/*
@@ -255,10 +225,10 @@ private void testHumanDifference(String expected, TemporalAmount... amounts) {
@Test
@Tag("regressiontest")
public void shortDateTest() {
- DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm", ROOT);
+ DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.ROOT);
Date date = new Date(1360069129256L);
- String shortDateString = shortDate(date);
- assertEquals(formatter.format(date), shortDateString);
+ String shortDateString = TimeUtils.shortDate(date);
+ Assertions.assertEquals(formatter.format(date), shortDateString);
}
@Test
@@ -273,18 +243,18 @@ public void rejectsNegativeDuration() {
@Test
@Tag("regressiontest")
public void convertsDurationToCountAndTimeUnit() {
- CountAndTimeUnit expectedZero = durationToCountAndTimeUnit(ZERO);
- assertEquals(0, expectedZero.getCount());
- assertNotNull(expectedZero.getUnit());
+ CountAndTimeUnit expectedZero = TimeUtils.durationToCountAndTimeUnit(Duration.ZERO);
+ Assertions.assertEquals(0, expectedZero.getCount());
+ Assertions.assertNotNull(expectedZero.getUnit());
- assertEquals(new CountAndTimeUnit(1, NANOSECONDS), durationToCountAndTimeUnit(ofNanos(1)));
- assertEquals(new CountAndTimeUnit(MAX_VALUE, NANOSECONDS), durationToCountAndTimeUnit(ofNanos(MAX_VALUE)));
- assertEquals(new CountAndTimeUnit(MAX_VALUE / 1000 + 1, MICROSECONDS), durationToCountAndTimeUnit(Duration.of(MAX_VALUE / 1000 + 1, MICROS)));
- assertEquals(new CountAndTimeUnit(MAX_VALUE, MICROSECONDS), durationToCountAndTimeUnit(Duration.of(MAX_VALUE, MICROS)));
- assertEquals(new CountAndTimeUnit(MAX_VALUE / 1000 + 1, MILLISECONDS), durationToCountAndTimeUnit(ofMillis(MAX_VALUE / 1000 + 1)));
- assertEquals(new CountAndTimeUnit(MAX_VALUE, MILLISECONDS), durationToCountAndTimeUnit(ofMillis(MAX_VALUE)));
- assertEquals(new CountAndTimeUnit(MAX_VALUE / 1000 + 1, TimeUnit.SECONDS), durationToCountAndTimeUnit(ofSeconds(MAX_VALUE / 1000 + 1)));
- assertEquals(new CountAndTimeUnit(MAX_VALUE, TimeUnit.SECONDS), durationToCountAndTimeUnit(ofSeconds(MAX_VALUE)));
+ Assertions.assertEquals(new CountAndTimeUnit(1, TimeUnit.NANOSECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(1)));
+ Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.NANOSECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.ofNanos(Long.MAX_VALUE)));
+ Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.MICROSECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.of(Long.MAX_VALUE / 1000 + 1, ChronoUnit.MICROS)));
+ Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.MICROSECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.of(Long.MAX_VALUE, ChronoUnit.MICROS)));
+ Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.MILLISECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.ofMillis(Long.MAX_VALUE / 1000 + 1)));
+ Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.MILLISECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.ofMillis(Long.MAX_VALUE)));
+ Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE / 1000 + 1, TimeUnit.SECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MAX_VALUE / 1000 + 1)));
+ Assertions.assertEquals(new CountAndTimeUnit(Long.MAX_VALUE, TimeUnit.SECONDS), TimeUtils.durationToCountAndTimeUnit(Duration.ofSeconds(Long.MAX_VALUE)));
}
}
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
index e395ccfb6..6f27771ad 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
@@ -1,6 +1,7 @@
package org.bitrepository.common.utils;
import org.bitrepository.bitrepositoryelements.TimeMeasureTYPE;
+import org.bitrepository.bitrepositoryelements.TimeMeasureUnit;
import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -12,21 +13,6 @@
import java.math.BigInteger;
import java.time.Duration;
-import static java.math.BigInteger.ONE;
-import static java.math.BigInteger.valueOf;
-import static java.time.Duration.ZERO;
-import static java.time.Duration.ofDays;
-import static java.time.Duration.ofHours;
-import static java.time.Duration.ofMinutes;
-import static java.time.Duration.ofNanos;
-import static java.time.Duration.ofSeconds;
-import static org.bitrepository.bitrepositoryelements.TimeMeasureUnit.HOURS;
-import static org.bitrepository.bitrepositoryelements.TimeMeasureUnit.MILLISECONDS;
-import static org.bitrepository.common.utils.XmlUtils.xmlDurationToDuration;
-import static org.bitrepository.common.utils.XmlUtils.xmlDurationToMilliseconds;
-import static org.bitrepository.common.utils.XmlUtils.xmlDurationToTimeMeasure;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
public class XmlUtilsTest extends ExtendedTestCase {
@@ -40,7 +26,7 @@ public void setUpFactory() throws DatatypeConfigurationException {
@Test
@Tag("regressiontest")
public void negativeDurationIsRejected() {
- assertThrows(IllegalArgumentException.class, () -> {
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
XmlUtils.validateNonNegative(factory.newDuration("-PT0.00001S"));
});
}
@@ -51,42 +37,42 @@ public void testXmlDurationToDuration() {
addDescription("Tests xmlDurationToDuration in sunshine scenario cases");
addStep("Durations of 0 of some time unit", "Duration.ZERO");
- assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("P0Y")));
- assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("P0M")));
- assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("P0D")));
- assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0H")));
- assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0M")));
- assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0S")));
- assertEquals(ZERO, xmlDurationToDuration(factory.newDuration("PT0.0000S")));
+ Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("P0Y")));
+ Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("P0M")));
+ Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("P0D")));
+ Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("PT0H")));
+ Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("PT0M")));
+ Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("PT0S")));
+ Assertions.assertEquals(Duration.ZERO, XmlUtils.xmlDurationToDuration(factory.newDuration("PT0.0000S")));
addStep("Test correct and precise conversion",
"Hours, minutes and seconds are converted with full precision");
- assertEquals(ofSeconds(3), xmlDurationToDuration(factory.newDuration("PT3S")));
- assertEquals(ofSeconds(3, 300_000_000), xmlDurationToDuration(factory.newDuration("PT3.3S")));
- assertEquals(ofSeconds(3, 3), xmlDurationToDuration(factory.newDuration("PT3.000000003S")));
- assertEquals(ofSeconds(3, 123_456_789), xmlDurationToDuration(factory.newDuration("PT3.123456789S")));
+ Assertions.assertEquals(Duration.ofSeconds(3), XmlUtils.xmlDurationToDuration(factory.newDuration("PT3S")));
+ Assertions.assertEquals(Duration.ofSeconds(3, 300_000_000), XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.3S")));
+ Assertions.assertEquals(Duration.ofSeconds(3, 3), XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.000000003S")));
+ Assertions.assertEquals(Duration.ofSeconds(3, 123_456_789), XmlUtils.xmlDurationToDuration(factory.newDuration("PT3.123456789S")));
- assertEquals(ofMinutes(4), xmlDurationToDuration(factory.newDuration("PT4M")));
+ Assertions.assertEquals(Duration.ofMinutes(4), XmlUtils.xmlDurationToDuration(factory.newDuration("PT4M")));
- assertEquals(ofHours(5), xmlDurationToDuration(factory.newDuration("PT5H")));
+ Assertions.assertEquals(Duration.ofHours(5), XmlUtils.xmlDurationToDuration(factory.newDuration("PT5H")));
- assertEquals(ofHours(6).plusMinutes(7).plusSeconds(8).plusMillis(900), xmlDurationToDuration(factory.newDuration("PT6H7M8.9S")));
+ Assertions.assertEquals(Duration.ofHours(6).plusMinutes(7).plusSeconds(8).plusMillis(900), XmlUtils.xmlDurationToDuration(factory.newDuration("PT6H7M8.9S")));
addStep("Test approximate conversion",
"Days, months and years are converted using estimated factors");
- assertEquals(ofDays(2), xmlDurationToDuration(factory.newDuration("P2D")));
- assertEquals(ofDays(3).plusMinutes(4), xmlDurationToDuration(factory.newDuration("P3DT4M")));
+ Assertions.assertEquals(Duration.ofDays(2), XmlUtils.xmlDurationToDuration(factory.newDuration("P2D")));
+ Assertions.assertEquals(Duration.ofDays(3).plusMinutes(4), XmlUtils.xmlDurationToDuration(factory.newDuration("P3DT4M")));
// We require a month to be between 28 and 31 days exclusive
- Duration minMonthLengthExclusive = ofDays(28);
- Duration maxMonthLengthExclusive = ofDays(31);
- Duration convertedMonth = xmlDurationToDuration(factory.newDuration("P1M"));
+ Duration minMonthLengthExclusive = Duration.ofDays(28);
+ Duration maxMonthLengthExclusive = Duration.ofDays(31);
+ Duration convertedMonth = XmlUtils.xmlDurationToDuration(factory.newDuration("P1M"));
assertBetweenExclusive(convertedMonth, minMonthLengthExclusive, maxMonthLengthExclusive);
// Two years is between 730 and 731 days
- Duration minTwoYearsLengthExclusive = ofDays(2 * 365);
- Duration maxTwoYearsLengthExclusive = ofDays(2 * 365 + 1);
- Duration convertedTwoYears = xmlDurationToDuration(factory.newDuration("P2Y"));
+ Duration minTwoYearsLengthExclusive = Duration.ofDays(2 * 365);
+ Duration maxTwoYearsLengthExclusive = Duration.ofDays(2 * 365 + 1);
+ Duration convertedTwoYears = XmlUtils.xmlDurationToDuration(factory.newDuration("P2Y"));
assertBetweenExclusive(convertedTwoYears, minTwoYearsLengthExclusive, maxTwoYearsLengthExclusive);
}
@@ -96,21 +82,21 @@ public void testNegativeXmlDurationToDuration() {
// WorkflowInterval may be negative (meaning don’t run automatically)
addDescription("Tests that xmlDurationToDuration() accepts a negative duration and converts it correctly");
addStep("Negative XML durations", "Corresponding negative java.time durations");
- assertEquals(ofSeconds(-3), xmlDurationToDuration(factory.newDuration("-PT3S")));
- assertEquals(ofNanos(-1000), xmlDurationToDuration(factory.newDuration("-PT0.000001S")));
- assertEquals(ofHours(-24), xmlDurationToDuration(factory.newDuration("-PT24H")));
- assertEquals(ofDays(-1), xmlDurationToDuration(factory.newDuration("-P1D")));
+ Assertions.assertEquals(Duration.ofSeconds(-3), XmlUtils.xmlDurationToDuration(factory.newDuration("-PT3S")));
+ Assertions.assertEquals(Duration.ofNanos(-1000), XmlUtils.xmlDurationToDuration(factory.newDuration("-PT0.000001S")));
+ Assertions.assertEquals(Duration.ofHours(-24), XmlUtils.xmlDurationToDuration(factory.newDuration("-PT24H")));
+ Assertions.assertEquals(Duration.ofDays(-1), XmlUtils.xmlDurationToDuration(factory.newDuration("-P1D")));
// We require minus 1 month to be between -31 and -28 days exclusive
- Duration minNegativeMonthLengthExclusive = ofDays(-31);
- Duration maxNegativeMonthLengthExclusive = ofDays(-28);
- Duration convertedMinusOneMonth = xmlDurationToDuration(factory.newDuration("-P1M"));
+ Duration minNegativeMonthLengthExclusive = Duration.ofDays(-31);
+ Duration maxNegativeMonthLengthExclusive = Duration.ofDays(-28);
+ Duration convertedMinusOneMonth = XmlUtils.xmlDurationToDuration(factory.newDuration("-P1M"));
assertBetweenExclusive(convertedMinusOneMonth, minNegativeMonthLengthExclusive, maxNegativeMonthLengthExclusive);
// Minus 1 year is between -366 and -365 days
- Duration minMinusOneYearLengthExclusive = ofDays(-366);
- Duration maxMinusOneYearLengthExclusive = ofDays(-365);
- Duration convertedMinusOneYears = xmlDurationToDuration(factory.newDuration("-P1Y"));
+ Duration minMinusOneYearLengthExclusive = Duration.ofDays(-366);
+ Duration maxMinusOneYearLengthExclusive = Duration.ofDays(-365);
+ Duration convertedMinusOneYears = XmlUtils.xmlDurationToDuration(factory.newDuration("-P1Y"));
assertBetweenExclusive(convertedMinusOneYears, minMinusOneYearLengthExclusive, maxMinusOneYearLengthExclusive);
}
@@ -122,7 +108,7 @@ private static
- *
- *
- *
- *
- *
- *
- * {@code
- * @Suite
- * @SelectClasses({IntegrationTest.class}) // List your test classes here
- * @SelectPackages("org.bitrepository.protocol") // List your test packages here
- * @IncludeTags("integration") // List your include tags here
- * @ExcludeTags("slow") // List your exclude tags here
- * @ExtendWith(GlobalSuiteExtension.class)
- *
+ * for the BitRepository project.
*/
@Suite
-//@SelectClasses({IntegrationTest.class, ActiveMQMessageBusTest.class}) // List your test classes here
@SelectPackages("org.bitrepository.protocol")
@IncludeTags("regressiontest")
public class BitrepositoryTestSuite {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
index a6a25982a..7bd6ef3f5 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/IntegrationTest.java
@@ -26,7 +26,7 @@
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.util.StatusPrinter;
-import org.bitrepository.ExtentedTestInfoParameterResolver;
+import org.bitrepository.ExtendedTestInfoParameterResolver;
import org.bitrepository.SuiteInfo;
import org.bitrepository.common.settings.Settings;
import org.bitrepository.common.settings.TestSettingsProvider;
@@ -44,12 +44,7 @@
import org.bitrepository.protocol.utils.TestWatcherExtension;
import org.jaccept.TestEventManager;
import org.jaccept.structure.ExtendedTestCase;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.TestInfo;
-import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.LoggerFactory;
@@ -60,7 +55,7 @@
import java.util.List;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@ExtendWith(ExtentedTestInfoParameterResolver.class)
+@ExtendWith(ExtendedTestInfoParameterResolver.class)
public abstract class IntegrationTest extends ExtendedTestCase {
protected static TestEventManager testEventManager = TestEventManager.getInstance();
public static LocalActiveMQBroker broker;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
index 4e0beadd0..09dff80cd 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
@@ -58,7 +58,7 @@ public void positiveCertificateIdentificationTest() throws Exception {
CertificateID certificateIDFromSignature = new CertificateID(signer.getSID().getIssuer(), signer.getSID().getSerialNumber());
addStep("Assert that the two CertificateID objects are equal", "Assert succeeds");
- Assertions.assertEquals(certificateIDFromSignature, certificateIDfromCertificate);
+ Assertions.assertEquals(certificateIDfromCertificate, certificateIDFromSignature);
}
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
index 163754fe8..b4941bd90 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
@@ -29,13 +29,7 @@
import org.bitrepository.protocol.security.exception.MessageAuthenticationException;
import org.bitrepository.protocol.security.exception.MessageSigningException;
import org.bitrepository.protocol.security.exception.OperationAuthorizationException;
-import org.bitrepository.settings.repositorysettings.Certificate;
-import org.bitrepository.settings.repositorysettings.Collection;
-import org.bitrepository.settings.repositorysettings.ComponentIDs;
-import org.bitrepository.settings.repositorysettings.Operation;
-import org.bitrepository.settings.repositorysettings.OperationPermission;
-import org.bitrepository.settings.repositorysettings.Permission;
-import org.bitrepository.settings.repositorysettings.PermissionSet;
+import org.bitrepository.settings.repositorysettings.*;
import org.bouncycastle.util.encoders.Base64;
import org.jaccept.structure.ExtendedTestCase;
import org.junit.jupiter.api.Assertions;
@@ -83,8 +77,8 @@ public void operationAuthorizationBehaviourTest() throws Exception {
addDescription("Tests that a signature only allows the correct requests.");
List
JUnit 5 Annotations Used:
- *Options in a JUnit 5 Suite:
- *Example Usage:
- *
- * {@code
- * @Suite
- * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
- * @SelectPackages("org.bitrepository.pillar") // List your test packages here
- * @IncludeTags("integration") // List your include tags here
- * @ExcludeTags("slow") // List your exclude tags here
- * @ExtendWith(GlobalSuiteExtension.class)
- * public class BitrepositoryTestSuite {
- * // No need for methods here; this just groups and extends
- * }
- * }
- *
+ * for the BitRepositoryPillar project.
*/
@Suite(failIfNoTests = true)
@SuiteDisplayName("Checksum Pillar Acceptance Test")
-@SelectPackages({
- "org.bitrepository.pillar.integration.func"
-})
+@SelectPackages({"org.bitrepository.pillar.integration.func"})
@IncludeTags({PillarTestGroups.CHECKSUM_PILLAR_TEST})
@IncludeClassNamePatterns(value = "^(Test.*|.+[.$]Test.*|.*Tests?|.*IT)$")
@ConfigurationParameter(key = "pillarType", value = "Checksum")
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPerformanceTestSuite.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPerformanceTestSuite.java
new file mode 100644
index 000000000..4470c5e62
--- /dev/null
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPerformanceTestSuite.java
@@ -0,0 +1,16 @@
+package org.bitrepository.pillar;
+
+import org.junit.platform.suite.api.*;
+
+/**
+ * BitrepositoryPerformanceTestSuite is a JUnit 5 suite class that groups and configures multiple test classes
+ * for the BitRepositoryPillar project.
+ */
+@Suite
+@SuiteDisplayName("Performance Test")
+@SelectPackages({"org.bitrepository.pillar.integration.perf"})
+@IncludeClassNamePatterns(value = "^(Test.*|.+[.$]Test.*|.*Tests?|.*IT)$")
+@IncludeTags("pillar-stress-test")
+@ConfigurationParameter(key = "pillarType", value = "File")
+public class BitrepositoryPerformanceTestSuite {
+}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
index ceb989f0f..4f0fef3a9 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/BitrepositoryPillarTestSuite.java
@@ -1,66 +1,14 @@
package org.bitrepository.pillar;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.junit.platform.suite.api.ConfigurationParameter;
-import org.junit.platform.suite.api.ExcludeTags;
-import org.junit.platform.suite.api.IncludeClassNamePatterns;
-import org.junit.platform.suite.api.IncludeTags;
-import org.junit.platform.suite.api.SelectClasses;
-import org.junit.platform.suite.api.SelectPackages;
-import org.junit.platform.suite.api.Suite;
-import org.junit.platform.suite.api.SuiteDisplayName;
+import org.junit.platform.suite.api.*;
/**
* BitrepositoryPillarTestSuite is a JUnit 5 suite class that groups and configures multiple test classes
- * for the BitRepositoryPillar project. This suite uses JUnit 5 annotations to select test classes, packages,
- * and tags, and extend the suite with custom extensions.
- *
- * JUnit 5 Annotations Used:
- *Options in a JUnit 5 Suite:
- *Example Usage:
- *
- * {@code
- * @Suite
- * @SelectClasses({BitrepositoryPillarTest.class}) // List your test classes here
- * @SelectPackages("org.bitrepository.pillar") // List your test packages here
- * @IncludeTags("integration") // List your include tags here
- * @ExcludeTags("slow") // List your exclude tags here
- * @ExtendWith(GlobalSuiteExtension.class)
- * public class BitrepositoryTestSuite {
- * // No need for methods here; this just groups and extends
- * }
- * }
- *
+ * for the BitRepositoryPillar project.
*/
@Suite
@SuiteDisplayName("Full Pillar Acceptance Test")
-@SelectPackages({
- "org.bitrepository.pillar.integration.func"
-})
+@SelectPackages({"org.bitrepository.pillar.integration.func"})
@IncludeClassNamePatterns(value = "^(Test.*|.+[.$]Test.*|.*Tests?|.*IT)$")
@IncludeTags({PillarTestGroups.FULL_PILLAR_TEST})
@ConfigurationParameter(key = "pillarType", value = "File")
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
index ea42f6c53..ab7c21f06 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
@@ -21,7 +21,7 @@
*/
package org.bitrepository.pillar.integration;
-import org.bitrepository.ExtentedTestInfoParameterResolver;
+import org.bitrepository.ExtendedTestInfoParameterResolver;
import org.bitrepository.SuiteInfo;
import org.bitrepository.client.conversation.mediator.CollectionBasedConversationMediator;
import org.bitrepository.client.conversation.mediator.ConversationMediatorManager;
@@ -40,21 +40,10 @@
import org.bitrepository.protocol.ProtocolComponentFactory;
import org.bitrepository.protocol.messagebus.MessageBusManager;
import org.bitrepository.protocol.messagebus.SimpleMessageBus;
-import org.bitrepository.protocol.security.BasicMessageAuthenticator;
-import org.bitrepository.protocol.security.BasicMessageSigner;
-import org.bitrepository.protocol.security.BasicOperationAuthorizer;
-import org.bitrepository.protocol.security.BasicSecurityManager;
-import org.bitrepository.protocol.security.MessageAuthenticator;
-import org.bitrepository.protocol.security.MessageSigner;
-import org.bitrepository.protocol.security.OperationAuthorizer;
-import org.bitrepository.protocol.security.PermissionStore;
+import org.bitrepository.protocol.security.*;
import org.bitrepository.protocol.security.SecurityManager;
import org.jaccept.TestEventManager;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.TestInfo;
-import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.suite.api.AfterSuite;
@@ -69,7 +58,7 @@
* to be invariant against the initial pillar state.
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@ExtendWith(ExtentedTestInfoParameterResolver.class)
+@ExtendWith(ExtendedTestInfoParameterResolver.class)
public abstract class PillarIntegrationTest extends IntegrationTest {
/**
* The path to the directory containing the integration test configuration files
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java
index b636c5c5d..29227bfb3 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java
@@ -3,24 +3,14 @@
import org.apache.commons.io.IOUtils;
import org.bitrepository.bitrepositoryelements.FilePart;
import org.bitrepository.bitrepositoryelements.ResponseCode;
-import org.bitrepository.bitrepositorymessages.GetFileFinalResponse;
-import org.bitrepository.bitrepositorymessages.GetFileRequest;
-import org.bitrepository.bitrepositorymessages.IdentifyPillarsForGetFileRequest;
-import org.bitrepository.bitrepositorymessages.IdentifyPillarsForGetFileResponse;
-import org.bitrepository.bitrepositorymessages.MessageRequest;
-import org.bitrepository.bitrepositorymessages.MessageResponse;
+import org.bitrepository.bitrepositorymessages.*;
import org.bitrepository.common.utils.TestFileHelper;
import org.bitrepository.pillar.PillarTestGroups;
import org.bitrepository.pillar.integration.func.PillarFunctionTest;
import org.bitrepository.pillar.messagefactories.GetFileMessageFactory;
import org.bitrepository.protocol.FileExchange;
import org.bitrepository.protocol.ProtocolComponentFactory;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,29 +68,38 @@ public void normalGetFileTest() throws IOException {
GetFileFinalResponse finalResponse = (GetFileFinalResponse) receiveResponse();
Assertions.assertNotNull(finalResponse);
- Assertions.assertEquals(getRequest.getCorrelationID(), finalResponse.getCorrelationID(), "Received unexpected " +
- "'CorrelationID' element.");
- Assertions.assertEquals(getRequest.getCollectionID(), finalResponse.getCollectionID(), "Received unexpected " +
- "'CollectionID' element.");
- Assertions.assertEquals(getPillarID(), finalResponse.getFrom(), "Received unexpected 'From' element.");
- Assertions.assertEquals(getRequest.getFrom(), finalResponse.getTo(), "Received unexpected 'To' element.");
- Assertions.assertEquals(getRequest.getReplyTo(), finalResponse.getDestination(), "Received unexpected 'Destination' " +
- "element.");
+ Assertions.assertEquals(getRequest.getCorrelationID(), finalResponse.getCorrelationID(),
+ "Received unexpected " +
+ "'CorrelationID' element.");
+ Assertions.assertEquals(getRequest.getCollectionID(), finalResponse.getCollectionID(),
+ "Received unexpected " +
+ "'CollectionID' element.");
+ Assertions.assertEquals(getPillarID(), finalResponse.getFrom(),
+ "Received unexpected 'From' element.");
+ Assertions.assertEquals(getRequest.getFrom(), finalResponse.getTo(),
+ "Received unexpected 'To' element.");
+ Assertions.assertEquals(getRequest.getReplyTo(), finalResponse.getDestination(),
+ "Received unexpected 'Destination' " +
+ "element.");
Assertions.assertNull(finalResponse.getFilePart(),
"Received unexpected 'FilePart' element.");
- Assertions.assertEquals(getRequest.getFileID(), finalResponse.getFileID(), "Received unexpected 'To' element.");
- Assertions.assertEquals(getRequest.getFileAddress(), finalResponse.getFileAddress(), "Received unexpected 'FileAddress' " +
- "element.");
- Assertions.assertEquals(getPillarID(), finalResponse.getPillarID(), "Received unexpected 'PillarID' element.");
- Assertions.assertEquals(ResponseCode.OPERATION_COMPLETED, finalResponse.getResponseInfo().getResponseCode(), "Received unexpected " +
- "'ResponseCode' element.");
+ Assertions.assertEquals(getRequest.getFileID(), finalResponse.getFileID(),
+ "Received unexpected 'To' element.");
+ Assertions.assertEquals(getRequest.getFileAddress(), finalResponse.getFileAddress(),
+ "Received unexpected 'FileAddress' " +
+ "element.");
+ Assertions.assertEquals(getPillarID(), finalResponse.getPillarID(),
+ "Received unexpected 'PillarID' element.");
+ Assertions.assertEquals(ResponseCode.OPERATION_COMPLETED, finalResponse.getResponseInfo().getResponseCode(),
+ "Received unexpected 'ResponseCode' element.");
try (InputStream localFileIS = TestFileHelper.getDefaultFile();
InputStream getFileIS = fe.getFile(testFileURL)) {
String localFileContent = IOUtils.toString(localFileIS, StandardCharsets.UTF_8);
String getFileContent = IOUtils.toString(getFileIS, StandardCharsets.UTF_8);
- Assertions.assertEquals(localFileContent, getFileContent, "Differing content between original file and file from " +
- "GetFileRequest");
+ Assertions.assertEquals(localFileContent, getFileContent,
+ "Differing content between original file and file from " +
+ "GetFileRequest");
}
}
@@ -121,7 +120,8 @@ public void getFileWithFilePartTest() throws IOException {
messageBus.sendMessage(getRequest);
GetFileFinalResponse finalResponse = (GetFileFinalResponse) receiveResponse();
- Assertions.assertEquals(getRequest.getFilePart(), finalResponse.getFilePart(), "Received unexpected 'FilePart' element.");
+ Assertions.assertEquals(getRequest.getFilePart(), finalResponse.getFilePart(),
+ "Received unexpected 'FilePart' element.");
try (InputStream localFileIS = TestFileHelper.getDefaultFile();
InputStream getFileIS = fe.getFile(testFileURL)) {
@@ -129,8 +129,8 @@ public void getFileWithFilePartTest() throws IOException {
localFileIS.skip(offsetAndLength);
localFileIS.read(localFilePartContent, 0, offsetAndLength);
String getFileContent = IOUtils.toString(getFileIS, StandardCharsets.UTF_8);
- Assertions.assertEquals(new String(localFilePartContent, StandardCharsets.UTF_8), getFileContent, "Differing content between original" +
- " file and file from GetFileRequest");
+ Assertions.assertEquals(new String(localFilePartContent, StandardCharsets.UTF_8), getFileContent,
+ "Differing content between original file and file from GetFileRequest");
}
}
@@ -146,8 +146,8 @@ public void getMissingFileTest() {
messageBus.sendMessage(getRequest);
GetFileFinalResponse finalResponse = (GetFileFinalResponse) receiveResponse();
- Assertions.assertEquals(ResponseCode.FILE_NOT_FOUND_FAILURE, finalResponse.getResponseInfo().getResponseCode(), "Received unexpected " +
- "'ResponseCode' element.");
+ Assertions.assertEquals(ResponseCode.FILE_NOT_FOUND_FAILURE, finalResponse.getResponseInfo().getResponseCode(),
+ "Received unexpected 'ResponseCode' element.");
}
@Test
@@ -161,7 +161,8 @@ public void missingCollectionIDTest() {
messageBus.sendMessage(request);
MessageResponse receivedResponse = receiveResponse();
- Assertions.assertEquals(ResponseCode.REQUEST_NOT_UNDERSTOOD_FAILURE, receivedResponse.getResponseInfo().getResponseCode());
+ Assertions.assertEquals(ResponseCode.REQUEST_NOT_UNDERSTOOD_FAILURE,
+ receivedResponse.getResponseInfo().getResponseCode());
}
@Test
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java
index 733da1e49..016b2f614 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java
@@ -60,9 +60,6 @@ public void normalGetStatusTest() {
Assertions.assertNotNull(finalResponse);
Assertions.assertEquals(ResponseCode.OPERATION_COMPLETED, finalResponse.getResponseInfo().getResponseCode());
Assertions.assertEquals(request.getCorrelationID(), finalResponse.getCorrelationID());
- Assertions.assertNotNull(finalResponse);
- Assertions.assertEquals(ResponseCode.OPERATION_COMPLETED, finalResponse.getResponseInfo().getResponseCode());
- Assertions.assertEquals(request.getCorrelationID(), finalResponse.getCorrelationID());
Assertions.assertEquals(getPillarID(), finalResponse.getFrom());
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java
index b429ddebf..e19b7ab71 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java
@@ -64,22 +64,26 @@ public void normalIdentificationTest() {
IdentifyPillarsForPutFileResponse receivedIdentifyResponse = clientReceiver.waitForMessage(
IdentifyPillarsForPutFileResponse.class);
- Assertions.assertEquals(identifyRequest.getCollectionID(), receivedIdentifyResponse.getCollectionID(), "Received " +
- "unexpected CollectionID");
- Assertions.assertEquals(identifyRequest.getCorrelationID(), receivedIdentifyResponse.getCorrelationID(), "Received " +
- "unexpected CorrelationID");
- Assertions.assertEquals(getPillarID(), receivedIdentifyResponse.getFrom(), "Received unexpected PillarID");
- Assertions.assertEquals(identifyRequest.getFrom(), receivedIdentifyResponse.getTo(), "Received unexpected 'To' element.");
+ Assertions.assertEquals(identifyRequest.getCollectionID(), receivedIdentifyResponse.getCollectionID(),
+ "Received unexpected CollectionID");
+ Assertions.assertEquals(identifyRequest.getCorrelationID(), receivedIdentifyResponse.getCorrelationID(),
+ "Received unexpected CorrelationID");
+ Assertions.assertEquals(getPillarID(), receivedIdentifyResponse.getFrom(),
+ "Received unexpected PillarID");
+ Assertions.assertEquals(identifyRequest.getFrom(), receivedIdentifyResponse.getTo(),
+ "Received unexpected 'To' element.");
Assertions.assertNull(receivedIdentifyResponse.getChecksumDataForExistingFile(),
"Received unexpected ChecksumDataForExistingFile");
Assertions.assertNull(receivedIdentifyResponse.getPillarChecksumSpec(),
"Received unexpected PillarChecksumSpec");
- Assertions.assertEquals(getPillarID(), receivedIdentifyResponse.getPillarID(), "Unexpected 'From' element in the " +
- "received response:\n" + receivedIdentifyResponse + "\n");
- Assertions.assertEquals(ResponseCode.IDENTIFICATION_POSITIVE, receivedIdentifyResponse.getResponseInfo().getResponseCode(), "Received" +
- " unexpected ResponseCode");
- Assertions.assertEquals(identifyRequest.getReplyTo(), receivedIdentifyResponse.getDestination(), "Received unexpected " +
- "ReplyTo");
+ Assertions.assertEquals(getPillarID(), receivedIdentifyResponse.getPillarID(),
+ "Unexpected 'From' element in the " +
+ "received response:\n" + receivedIdentifyResponse + "\n");
+ Assertions.assertEquals(ResponseCode.IDENTIFICATION_POSITIVE,
+ receivedIdentifyResponse.getResponseInfo().getResponseCode(),
+ "Received unexpected ResponseCode");
+ Assertions.assertEquals(identifyRequest.getReplyTo(), receivedIdentifyResponse.getDestination(),
+ "Received unexpected ReplyTo");
}
@Test
@@ -100,7 +104,8 @@ public void identificationTestForChecksumPillar() {
Assertions.assertEquals(getPillarID(), receivedIdentifyResponse.getFrom());
Assertions.assertNull(receivedIdentifyResponse.getChecksumDataForExistingFile());
Assertions.assertEquals(getPillarID(), receivedIdentifyResponse.getPillarID());
- Assertions.assertEquals(ResponseCode.IDENTIFICATION_POSITIVE, receivedIdentifyResponse.getResponseInfo().getResponseCode());
+ Assertions.assertEquals(ResponseCode.IDENTIFICATION_POSITIVE,
+ receivedIdentifyResponse.getResponseInfo().getResponseCode());
Assertions.assertEquals(identifyRequest.getReplyTo(), receivedIdentifyResponse.getDestination());
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
index ebb275371..07894ec8e 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
@@ -22,13 +22,7 @@
package org.bitrepository.pillar.integration.func.putfile;
import org.bitrepository.bitrepositoryelements.ResponseCode;
-import org.bitrepository.bitrepositorymessages.IdentifyPillarsForPutFileRequest;
-import org.bitrepository.bitrepositorymessages.IdentifyPillarsForPutFileResponse;
-import org.bitrepository.bitrepositorymessages.MessageRequest;
-import org.bitrepository.bitrepositorymessages.MessageResponse;
-import org.bitrepository.bitrepositorymessages.PutFileFinalResponse;
-import org.bitrepository.bitrepositorymessages.PutFileProgressResponse;
-import org.bitrepository.bitrepositorymessages.PutFileRequest;
+import org.bitrepository.bitrepositorymessages.*;
import org.bitrepository.common.utils.ChecksumUtils;
import org.bitrepository.common.utils.TestFileHelper;
import org.bitrepository.pillar.PillarTestGroups;
@@ -77,24 +71,30 @@ public void normalPutFileTest() {
PutFileFinalResponse finalResponse = (PutFileFinalResponse) receiveResponse();
Assertions.assertNotNull(finalResponse);
- Assertions.assertEquals(putRequest.getCorrelationID(), finalResponse.getCorrelationID(), "Received unexpected " +
- "'CorrelationID' element.");
- Assertions.assertEquals(putRequest.getCollectionID(), finalResponse.getCollectionID(), "Received unexpected " +
- "'CollectionID' element.");
- Assertions.assertEquals(getPillarID(), finalResponse.getFrom(), "Received unexpected 'From' element.");
- Assertions.assertEquals(putRequest.getFrom(), finalResponse.getTo(), "Received unexpected 'To' element.");
- Assertions.assertEquals(putRequest.getReplyTo(), finalResponse.getDestination(), "Received unexpected 'Destination' " +
- "element.");
+ Assertions.assertEquals(putRequest.getCorrelationID(), finalResponse.getCorrelationID(),
+ "Received unexpected " +
+ "'CorrelationID' element.");
+ Assertions.assertEquals(putRequest.getCollectionID(), finalResponse.getCollectionID(),
+ "Received unexpected " +
+ "'CollectionID' element.");
+ Assertions.assertEquals(getPillarID(), finalResponse.getFrom(),
+ "Received unexpected 'From' element.");
+ Assertions.assertEquals(putRequest.getFrom(), finalResponse.getTo(),
+ "Received unexpected 'To' element.");
+ Assertions.assertEquals(putRequest.getReplyTo(), finalResponse.getDestination(),
+ "Received unexpected 'Destination' element.");
Assertions.assertNull(finalResponse.getChecksumDataForExistingFile(),
"Received unexpected 'ChecksumDataForExistingFile' element.");
Assertions.assertNull(finalResponse.getChecksumDataForNewFile(),
"Received unexpected 'ChecksumDataForNewFile' element.");
- Assertions.assertEquals(putRequest.getFileID(), finalResponse.getFileID(), "Received unexpected 'To' element.");
- Assertions.assertEquals(putRequest.getFileAddress(), finalResponse.getFileAddress(), "Received unexpected 'FileAddress' " +
- "element.");
- Assertions.assertEquals(getPillarID(), finalResponse.getPillarID(), "Received unexpected 'PillarID' element.");
- Assertions.assertEquals(ResponseCode.OPERATION_COMPLETED, finalResponse.getResponseInfo().getResponseCode(), "Received unexpected " +
- "'ResponseCode' element.");
+ Assertions.assertEquals(putRequest.getFileID(), finalResponse.getFileID(),
+ "Received unexpected 'To' element.");
+ Assertions.assertEquals(putRequest.getFileAddress(), finalResponse.getFileAddress(),
+ "Received unexpected 'FileAddress' element.");
+ Assertions.assertEquals(getPillarID(), finalResponse.getPillarID(),
+ "Received unexpected 'PillarID' element.");
+ Assertions.assertEquals(ResponseCode.OPERATION_COMPLETED, finalResponse.getResponseInfo().getResponseCode(),
+ "Received unexpected 'ResponseCode' element.");
}
@Test
@@ -142,20 +142,25 @@ public void putFileOperationAcceptedProgressTest() {
PutFileProgressResponse progressResponse = clientReceiver.waitForMessage(PutFileProgressResponse.class,
getOperationTimeout(), TimeUnit.SECONDS);
Assertions.assertNotNull(progressResponse);
- Assertions.assertEquals(putRequest.getCorrelationID(), progressResponse.getCorrelationID(), "Received unexpected " +
- "'CorrelationID' element.");
- Assertions.assertEquals(putRequest.getCollectionID(), progressResponse.getCollectionID(), "Received unexpected " +
- "'CollectionID' element.");
- Assertions.assertEquals(getPillarID(), progressResponse.getFrom(), "Received unexpected 'From' element.");
- Assertions.assertEquals(putRequest.getFrom(), progressResponse.getTo(), "Received unexpected 'To' element.");
- Assertions.assertEquals(putRequest.getReplyTo(), progressResponse.getDestination(), "Received unexpected 'Destination' " +
- "element.");
- Assertions.assertEquals(getPillarID(), progressResponse.getPillarID(), "Received unexpected 'PillarID' element.");
- Assertions.assertEquals(putRequest.getFileID(), progressResponse.getFileID(), "Received unexpected 'FileID' element.");
- Assertions.assertEquals(putRequest.getFileAddress(), progressResponse.getFileAddress(), "Received unexpected " +
- "'FileAddress' element.");
- Assertions.assertEquals(ResponseCode.OPERATION_ACCEPTED_PROGRESS, progressResponse.getResponseInfo().getResponseCode(), "Received " +
- "unexpected 'ResponseCode' element.");
+ Assertions.assertEquals(putRequest.getCorrelationID(), progressResponse.getCorrelationID(),
+ "Received unexpected 'CorrelationID' element.");
+ Assertions.assertEquals(putRequest.getCollectionID(), progressResponse.getCollectionID(),
+ "Received unexpected 'CollectionID' element.");
+ Assertions.assertEquals(getPillarID(), progressResponse.getFrom(),
+ "Received unexpected 'From' element.");
+ Assertions.assertEquals(putRequest.getFrom(), progressResponse.getTo(),
+ "Received unexpected 'To' element.");
+ Assertions.assertEquals(putRequest.getReplyTo(), progressResponse.getDestination(),
+ "Received unexpected 'Destination' element.");
+ Assertions.assertEquals(getPillarID(), progressResponse.getPillarID(),
+ "Received unexpected 'PillarID' element.");
+ Assertions.assertEquals(putRequest.getFileID(), progressResponse.getFileID(),
+ "Received unexpected 'FileID' element.");
+ Assertions.assertEquals(putRequest.getFileAddress(), progressResponse.getFileAddress(),
+ "Received unexpected 'FileAddress' element.");
+ Assertions.assertEquals(ResponseCode.OPERATION_ACCEPTED_PROGRESS,
+ progressResponse.getResponseInfo().getResponseCode(),
+ "Received unexpected 'ResponseCode' element.");
}
@Override
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java
index 13b4bf761..208f87189 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java
@@ -101,7 +101,8 @@ public void parallelGetAuditTrails() throws Exception {
metrics.start();
addStep("Add " + NUMBER_OF_AUDITS + " files", "Not errors should occur");
EventHandler eventHandler = new EventHandlerForMetrics(metrics);
- for (int i = 0; i > NUMBER_OF_AUDITS; i++) {
+ for (int i = 0; i < NUMBER_OF_AUDITS; i++) {
+ System.out.println("Get audit trails stress test no:" + i);
auditTrailClient.getAuditTrails(collectionID,
null, null, null, eventHandler, "singleTreadedGetAuditTrails stress test");
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java
index 4a89e737f..0748027c4 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java
@@ -85,6 +85,7 @@ public void testWorkflowDoesNotRecalculateWhenNotNeeded() throws Exception {
workflow.start();
Date afterWorkflowDate = csCache.getCalculationDate(defaultFileId, collectionID);
- Assertions.assertEquals(afterWorkflowDate.getTime(), beforeWorkflowDate.getTime(), beforeWorkflowDate.getTime() + " == " + afterWorkflowDate.getTime());
+ Assertions.assertEquals(afterWorkflowDate.getTime(), beforeWorkflowDate.getTime(),
+ beforeWorkflowDate.getTime() + " == " + afterWorkflowDate.getTime());
}
}
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/PillarSettingsProviderTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/PillarSettingsProviderTest.java
index 0d029acc9..e07893d3c 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/PillarSettingsProviderTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/PillarSettingsProviderTest.java
@@ -40,7 +40,8 @@ public void componentIDTest() {
new PillarSettingsProvider(new XMLFileSettingsLoader(PATH_TO_TEST_SETTINGS),
null);
Settings settings = settingsLoader.getSettings();
- Assertions.assertEquals(settings.getComponentID(), settings.getReferenceSettings().getPillarSettings().getPillarID());
+ Assertions.assertEquals(settings.getComponentID(),
+ settings.getReferenceSettings().getPillarSettings().getPillarID());
String componentID = "testPillarID";
settingsLoader =
diff --git a/bitrepository-reference-pillar/src/test/resources/testprops/checksum-pillar-test.xml b/bitrepository-reference-pillar/src/test/resources/testprops/checksum-pillar-test.xml
deleted file mode 100644
index d0004fa8e..000000000
--- a/bitrepository-reference-pillar/src/test/resources/testprops/checksum-pillar-test.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-desiredNumberOfFiles are present on the pillar. Maintains a counter of
* how many files where found last time, based on the assumation that the number of files between calls will
* now decrease. If to few files are initially present, the remaining files are put to the pillar.
+ *
* @param desiredNumberOfFiles
*/
public void ensureNumberOfFilesOnPillar(int desiredNumberOfFiles, String newFileIDPrefix) {
@@ -108,7 +108,7 @@ public void addFilesToPillar(String collectionID, int numberOfFilesToAdd, String
// ToDo: This would be more precise if the client allowed put to a single pillar.
clientProvider.getPutClient().putFile(collectionID, httpServerConfiguration.getURL(TestFileHelper.DEFAULT_FILE_ID),
newFileID, 10L,
- TestFileHelper.getDefaultFileChecksum(), null, null, null);
+ TestFileHelper.getDefaultFileChecksum(), null, null, null);
} catch (Exception e) {
throw new RuntimeException("Failed to put file on pillar " + pillarID, e);
}
@@ -116,14 +116,14 @@ public void addFilesToPillar(String collectionID, int numberOfFilesToAdd, String
}
public ListTestEventManager used to manage the event for the associated test. */
@@ -46,9 +41,7 @@ public class TestEventHandler implements EventHandler {
/** The queue used to store the received operation events. */
private final BlockingQueueTestEventManager used to manage the event for the associated test. */
@@ -42,18 +43,6 @@ public MessageSenderStub() {
}
- /**
- * Check if we're inside an active test context
- */
- private boolean isTestRunning() {
- try {
- io.qameta.allure.Allure.getLifecycle().getCurrentTestCase();
- return true;
- } catch (IllegalStateException e) {
- return false;
- }
- }
-
@Override
public void sendMessage(Message content) {
if (isTestRunning()) {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailClientComponentTest.java
index 192fb25db..ae378a0f6 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailClientComponentTest.java
@@ -39,8 +39,8 @@
import javax.xml.datatype.DatatypeFactory;
import java.math.BigInteger;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Test the default AuditTrailClient.
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java
index fde6a42ca..66d2395f0 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getaudittrails/AuditTrailQueryTest.java
@@ -24,7 +24,7 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getchecksums/GetChecksumsClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getchecksums/GetChecksumsClientComponentTest.java
index 74d41be75..c362153e7 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getchecksums/GetChecksumsClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getchecksums/GetChecksumsClientComponentTest.java
@@ -61,7 +61,7 @@
import java.util.Date;
import java.util.LinkedList;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
/**
* Test class for the 'GetFileClient'.
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
index 1202066ca..6e03b0a31 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfile/GetFileClientComponentTest.java
@@ -47,7 +47,7 @@
import java.net.URL;
import static javax.xml.datatype.DatatypeFactory.newInstance;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
/**
* Test class for the 'GetFileClient'.
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
index 1bd895f18..06b4841ba 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getfileids/GetFileIDsClientComponentTest.java
@@ -45,7 +45,7 @@
import java.net.URL;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
/**
diff --git a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
index 4aa3504aa..bd03164a4 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/access/getstatus/GetStatusClientComponentTest.java
@@ -46,8 +46,8 @@
import javax.xml.datatype.DatatypeFactory;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class GetStatusClientComponentTest extends DefaultFixtureClientTest {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
index 9c4429d32..2ab476a9d 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/DefaultClientTest.java
@@ -34,7 +34,7 @@
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
/**
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/TestEventHandler.java b/bitrepository-client/src/test/java/org/bitrepository/client/TestEventHandler.java
index 493a8270f..33782355c 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/TestEventHandler.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/TestEventHandler.java
@@ -31,6 +31,7 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import static org.bitrepository.common.utils.AllureTestUtils.isTestRunning;
import static org.junit.jupiter.api.Assertions.assertNull;
/** Used to listen for operation event and store them for later retrieval by a test. */
@@ -51,18 +52,6 @@ public TestEventHandler() {
}
- /**
- * Check if we're inside an active test context
- */
- private boolean isTestRunning() {
- try {
- io.qameta.allure.Allure.getLifecycle().getCurrentTestCase();
- return true;
- } catch (IllegalStateException e) {
- return false;
- }
- }
-
@Override
public void handleEvent(OperationEvent event) {
if (isTestRunning()) {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
index f34afda9d..8ac26b5f0 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/NegativeResponseExceptionTest.java
@@ -27,8 +27,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class NegativeResponseExceptionTest {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
index 2244d6f54..00fc9bcc7 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/client/exception/UnexpectedResponseExceptionTest.java
@@ -26,8 +26,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class UnexpectedResponseExceptionTest {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
index 2d05e394e..015a701b9 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/CommandLineTest.java
@@ -26,8 +26,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java
index 7026879e5..e9ce5264c 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/DeleteFileCmdTest.java
@@ -30,8 +30,8 @@
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java
index a90552328..5c27c4f60 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetChecksumsCmdTest.java
@@ -30,7 +30,7 @@
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java
index a9a425147..461b6e2f7 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileCmdTest.java
@@ -30,7 +30,7 @@
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java
index dd9d2e2e6..2414d5b37 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/GetFileIDsCmdTest.java
@@ -30,7 +30,7 @@
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java
index 229650ebc..61b096f02 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/PutFileCmdTest.java
@@ -28,7 +28,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java
index d00f598f2..8ec0cf361 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/ReplaceFileCmdTest.java
@@ -30,8 +30,8 @@
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java b/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
index d761e5dc7..76b8153c5 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/commandline/utils/ChecksumExtractionUtilsTest.java
@@ -34,7 +34,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
@ExtendWith(SuiteInfoParameterResolver.class)
public class ChecksumExtractionUtilsTest extends DefaultFixtureClientTest {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
index 598f4f31c..a8903205e 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/deletefile/DeleteFileClientComponentTest.java
@@ -43,8 +43,8 @@
import javax.xml.datatype.DatatypeFactory;
import java.nio.charset.StandardCharsets;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class DeleteFileClientComponentTest extends DefaultFixtureClientTest {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
index 68eef0e18..0aa561fc6 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/putfile/PutFileClientComponentTest.java
@@ -41,7 +41,7 @@
import java.math.BigInteger;
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
@ExtendWith(SuiteInfoParameterResolver.class)
public class PutFileClientComponentTest extends DefaultFixtureClientTest {
diff --git a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
index 8f8083bc3..3c3cf32b3 100644
--- a/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
+++ b/bitrepository-client/src/test/java/org/bitrepository/modify/replacefile/ReplaceFileClientComponentTest.java
@@ -46,8 +46,8 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class ReplaceFileClientComponentTest extends DefaultFixtureClientTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
index 7d4e2fcde..8390d50a7 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/ArgumentValidatorTest.java
@@ -29,8 +29,8 @@
import java.util.HashSet;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class ArgumentValidatorTest {
@Test
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
index 40d9bb76c..e1b005990 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/exception/UnableToFinishExceptionTest.java
@@ -22,14 +22,13 @@
package org.bitrepository.common.exception;
import org.bitrepository.common.exceptions.UnableToFinishException;
-import org.bitrepository.protocol.utils.AllureTestUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class UnableToFinishExceptionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
index 25617f470..5acf51dbf 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/settings/SettingsTest.java
@@ -10,8 +10,8 @@
import java.math.BigInteger;
import java.time.Duration;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class SettingsTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/AllureEventLogger.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/AllureEventLogger.java
similarity index 95%
rename from bitrepository-core/src/test/java/org/bitrepository/protocol/utils/AllureEventLogger.java
rename to bitrepository-core/src/test/java/org/bitrepository/common/utils/AllureEventLogger.java
index 73922fca4..aa404c70b 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/AllureEventLogger.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/AllureEventLogger.java
@@ -1,8 +1,9 @@
-package org.bitrepository.protocol.utils;
+package org.bitrepository.common.utils;
import com.google.gson.Gson;
import io.qameta.allure.Allure;
import io.qameta.allure.model.Status;
+import org.bitrepository.protocol.utils.BitrepositoryEvent;
import java.time.Duration;
import java.time.Instant;
@@ -12,6 +13,8 @@
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
+import static org.bitrepository.common.utils.AllureTestUtils.isTestRunning;
+
public class AllureEventLogger {
private final ListTimeMeasureComparator class.
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
index a0e9cd3e7..461a355c0 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/TimeUtilsTest.java
@@ -34,8 +34,8 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
index 592405fc5..fee5631d2 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/common/utils/XmlUtilsTest.java
@@ -12,8 +12,8 @@
import java.math.BigInteger;
import java.time.Duration;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class XmlUtilsTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
index 7ed347e91..b581ff259 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/MessageCreationTest.java
@@ -48,8 +48,8 @@
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
index 3ad7d3417..fef8b1d64 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/ActiveMQMessageBusTest.java
@@ -38,8 +38,8 @@
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
index 457d5ebd7..83ec580b2 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/GeneralMessageBusTest.java
@@ -35,8 +35,8 @@
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Class for testing the interface with the message bus.
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java
index 186fc5b71..78ea30685 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/bus/MultiThreadedMessageBusTest.java
@@ -42,8 +42,8 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Class for testing the interface with the message bus.
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java
index 29976c5a9..acc776d05 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/http/HttpFileExchangeTest.java
@@ -33,8 +33,8 @@
import java.net.MalformedURLException;
import java.net.URL;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class HttpFileExchangeTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java
index a520a28b7..b4b2ea469 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/messagebus/ReceivedMessageHandlerTest.java
@@ -34,14 +34,13 @@
import java.math.BigInteger;
import java.util.Arrays;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addFixture;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addFixture;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
-import org.bitrepository.protocol.utils.AllureTestUtils;
public class ReceivedMessageHandlerTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusDelayTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusDelayTest.java
index 4c495d8f1..8d9ed5b17 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusDelayTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusDelayTest.java
@@ -43,8 +43,8 @@
import java.util.List;
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class MessageBusDelayTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfListenersStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfListenersStressTest.java
index 792c7783b..5f65e903f 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfListenersStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfListenersStressTest.java
@@ -50,8 +50,8 @@
import java.util.ArrayList;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Stress testing of the messagebus.
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java
index 8b30d5f15..1a16cc500 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusNumberOfMessagesStressTest.java
@@ -48,8 +48,8 @@
import java.net.ServerSocket;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Stress testing of the messagebus.
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java
index cfb3c4ddc..7225db63d 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusSizeOfMessageStressTest.java
@@ -45,14 +45,13 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import org.bitrepository.protocol.utils.AllureTestUtils;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Stress testing of the messagebus.
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
index ef14f62ab..6786c11a5 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/performancetest/MessageBusTimeToSendMessagesStressTest.java
@@ -47,8 +47,8 @@
import java.net.ServerSocket;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Stress testing of the messagebus.
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
index 347040f03..6976dd709 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/CertificateIDTest.java
@@ -36,8 +36,8 @@
import java.security.Security;
import java.security.cert.X509Certificate;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class CertificateIDTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
index ca621786f..fc5fc5602 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/PermissionStoreTest.java
@@ -34,7 +34,7 @@
import java.math.BigInteger;
import java.security.cert.X509Certificate;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
public class PermissionStoreTest {
private static final String componentID = "TEST";
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
index 4ab670be1..a26a02c3e 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/SecurityManagerTest.java
@@ -41,8 +41,8 @@
import java.nio.charset.StandardCharsets;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class SecurityManagerTest {
private final Logger log = LoggerFactory.getLogger(getClass());
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java
index 7ad9d17ed..5e82c48df 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/CertificateUseExceptionTest.java
@@ -25,8 +25,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class CertificateUseExceptionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
index fb206742d..433432f37 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageAuthenticationExceptionTest.java
@@ -25,8 +25,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class MessageAuthenticationExceptionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java
index 567947e74..1902463a3 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/MessageSignerExceptionTest.java
@@ -24,10 +24,9 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import org.bitrepository.protocol.utils.AllureTestUtils;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class MessageSignerExceptionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
index 2c03b1cf4..ab17d7006 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/OperationAuthorizationExceptionTest.java
@@ -25,8 +25,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class OperationAuthorizationExceptionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
index b36bedee0..b9240d9e8 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/PermissionStoreExceptionTest.java
@@ -25,8 +25,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class PermissionStoreExceptionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
index f3b9557a4..30a031f84 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/SecurityExceptionTest.java
@@ -25,8 +25,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class SecurityExceptionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
index 2104eb73d..729e531be 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/security/exception/UnregisteredPermissionTest.java
@@ -25,8 +25,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class UnregisteredPermissionTest {
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/ConfigLoaderTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/ConfigLoaderTest.java
index e26cd1c7e..e3f7b69e6 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/ConfigLoaderTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/ConfigLoaderTest.java
@@ -27,13 +27,12 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import org.bitrepository.protocol.utils.AllureTestUtils;
import java.io.File;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class ConfigLoaderTest {
String goodFilePath = "logback-test.xml";
diff --git a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java
index 34042500f..88e419d08 100644
--- a/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java
+++ b/bitrepository-core/src/test/java/org/bitrepository/protocol/utils/MessageUtilsTest.java
@@ -24,14 +24,13 @@
import org.bitrepository.bitrepositoryelements.ResponseCode;
import org.bitrepository.bitrepositoryelements.ResponseInfo;
import org.bitrepository.bitrepositorymessages.MessageResponse;
-import org.bitrepository.protocol.utils.AllureTestUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class MessageUtilsTest {
@Test
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityAlerterTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityAlerterTest.java
index 942b66af0..526a23753 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityAlerterTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/IntegrityAlerterTest.java
@@ -32,8 +32,8 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class IntegrityAlerterTest extends IntegrationTest {
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/FileInfoTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/FileInfoTest.java
index b00475f71..6b27aa35b 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/FileInfoTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/FileInfoTest.java
@@ -29,8 +29,8 @@
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.XMLGregorianCalendar;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class FileInfoTest {
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java
index ba7b0a6d3..087f008d7 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDAOTest.java
@@ -46,8 +46,8 @@
import java.text.SimpleDateFormat;
import java.util.*;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IntegrityDAOTest extends IntegrityDatabaseTestCase {
String TEST_PILLAR_1 = "MY-TEST-PILLAR-1";
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java
index 1ba3df8b1..6edb93dec 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDBToolsTest.java
@@ -43,8 +43,8 @@
import java.util.ArrayList;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java
index 5e7444f56..7bb6d6c96 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/cache/IntegrityDatabaseTest.java
@@ -44,8 +44,8 @@
import java.math.BigInteger;
import java.util.*;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IntegrityDatabaseTest extends IntegrityDatabaseTestCase {
AuditTrailManager auditManager;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/checking/MaxChecksumAgeProviderTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/checking/MaxChecksumAgeProviderTest.java
index 78cf87f7f..5fe36ad14 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/checking/MaxChecksumAgeProviderTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/checking/MaxChecksumAgeProviderTest.java
@@ -31,8 +31,8 @@
import javax.xml.datatype.DatatypeFactory;
import java.time.Duration;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class MaxChecksumAgeProviderTest {
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java
index ecf1587db..e5a2b22bb 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/collector/IntegrityInformationCollectorTest.java
@@ -38,8 +38,8 @@
import java.net.URL;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java
index d9bb39d56..6fd9560a0 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/integrationtest/MissingChecksumTests.java
@@ -62,8 +62,8 @@
import java.math.BigInteger;
import java.util.*;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class MissingChecksumTests {
private static final String PILLAR_1 = "pillar1";
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java
index 8089366e1..8aaac8070 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/reports/BasicIntegrityReporterTest.java
@@ -31,8 +31,8 @@
import java.io.File;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class BasicIntegrityReporterTest extends IntegrationTest {
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/stresstest/DatabaseStressTests.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/stresstest/DatabaseStressTests.java
index 5a7bd8e84..304f18be6 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/stresstest/DatabaseStressTests.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/stresstest/DatabaseStressTests.java
@@ -48,7 +48,7 @@
import java.math.BigInteger;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
public class DatabaseStressTests {
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityWorkflowManagerTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityWorkflowManagerTest.java
index 6729f6142..f7d32735a 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityWorkflowManagerTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/IntegrityWorkflowManagerTest.java
@@ -39,8 +39,8 @@
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/RepairMissingFilesWorkflowTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/RepairMissingFilesWorkflowTest.java
index 8f9e5249d..c623ced09 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/RepairMissingFilesWorkflowTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/RepairMissingFilesWorkflowTest.java
@@ -51,8 +51,8 @@
import java.util.Iterator;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/SaltedChecksumWorkflowTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/SaltedChecksumWorkflowTest.java
index 4341a9883..8d52c0142 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/SaltedChecksumWorkflowTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/SaltedChecksumWorkflowTest.java
@@ -45,8 +45,8 @@
import java.util.Arrays;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetChecksumForFileStepTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetChecksumForFileStepTest.java
index 757d397ed..7915a7ab0 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetChecksumForFileStepTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetChecksumForFileStepTest.java
@@ -42,8 +42,8 @@
import javax.xml.datatype.DatatypeConfigurationException;
import java.util.Arrays;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.ArgumentMatchers.*;
/**
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetFileStepTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetFileStepTest.java
index e5195fe37..843254f22 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetFileStepTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/GetFileStepTest.java
@@ -32,7 +32,7 @@
import java.net.URL;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/HandleChecksumValidationStepTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/HandleChecksumValidationStepTest.java
index f0df64984..7cff2c86c 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/HandleChecksumValidationStepTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/HandleChecksumValidationStepTest.java
@@ -49,8 +49,8 @@
import java.util.Date;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Performs the validation of the integrity for the checksums.
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/PutFileStepTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/PutFileStepTest.java
index 6c9221c82..7accc6ca5 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/PutFileStepTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/PutFileStepTest.java
@@ -33,7 +33,7 @@
import java.net.URL;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateChecksumsStepTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateChecksumsStepTest.java
index fcee25f4b..90b44e2a0 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateChecksumsStepTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateChecksumsStepTest.java
@@ -42,8 +42,8 @@
import java.util.HashSet;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
diff --git a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateFileIDsStepTest.java b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateFileIDsStepTest.java
index c3afe2b53..b090253da 100644
--- a/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateFileIDsStepTest.java
+++ b/bitrepository-integrity-service/src/test/java/org/bitrepository/integrityservice/workflow/step/UpdateFileIDsStepTest.java
@@ -45,8 +45,8 @@
import java.util.HashSet;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
diff --git a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/alarm/MonitorAlerterTest.java b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/alarm/MonitorAlerterTest.java
index 2c5d99615..8210501c5 100644
--- a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/alarm/MonitorAlerterTest.java
+++ b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/alarm/MonitorAlerterTest.java
@@ -41,8 +41,8 @@
import java.util.HashMap;
import java.util.Map;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class MonitorAlerterTest extends IntegrationTest {
diff --git a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusCollectorTest.java b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusCollectorTest.java
index 900de01d0..324a8d7cb 100644
--- a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusCollectorTest.java
+++ b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusCollectorTest.java
@@ -35,8 +35,8 @@
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class StatusCollectorTest {
diff --git a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusEventHandlerTest.java b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusEventHandlerTest.java
index e3e12c69e..de95185a5 100644
--- a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusEventHandlerTest.java
+++ b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/collector/StatusEventHandlerTest.java
@@ -29,8 +29,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class StatusEventHandlerTest {
diff --git a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/status/ComponentStatusStoreTest.java b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/status/ComponentStatusStoreTest.java
index 3393d9edc..a0d5e71cf 100644
--- a/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/status/ComponentStatusStoreTest.java
+++ b/bitrepository-monitoring-service/src/test/java/org/bitrepository/monitoringservice/status/ComponentStatusStoreTest.java
@@ -37,8 +37,8 @@
import java.util.Map;
import java.util.Set;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class ComponentStatusStoreTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/DefaultPillarTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/DefaultPillarTest.java
index 15422a636..9b9044d8a 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/DefaultPillarTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/DefaultPillarTest.java
@@ -47,7 +47,7 @@
import java.io.IOException;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addFixture;
+import static org.bitrepository.common.utils.AllureTestUtils.addFixture;
public abstract class DefaultPillarTest extends DefaultFixturePillarTest {
protected FileStore archives;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java
index 1c9fc99a8..bba7411a4 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MediatorTest.java
@@ -47,8 +47,8 @@
import java.util.List;
import java.util.UUID;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class MediatorTest extends DefaultFixturePillarTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MockedPillarTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MockedPillarTest.java
index 6f9711bec..5fb0a0528 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MockedPillarTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/MockedPillarTest.java
@@ -36,7 +36,7 @@
import org.bitrepository.service.audit.MockAuditManager;
import org.bitrepository.service.contributor.ResponseDispatcher;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addFixture;
+import static org.bitrepository.common.utils.AllureTestUtils.addFixture;
import static org.mockito.Mockito.mock;
public abstract class MockedPillarTest extends DefaultFixturePillarTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
index cb2de32a6..cb4bb91c9 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/PillarIntegrationTest.java
@@ -50,6 +50,8 @@
import java.io.IOException;
import java.io.InputStream;
+import static org.bitrepository.common.utils.AllureTestUtils.isTestRunning;
+
/**
* Super class for all tests which should test functionality on a single pillar.
*
@@ -324,22 +326,10 @@ public ClientEventLogger() {
super();
}
- /**
- * Check if we're inside an active test context
- */
- private boolean isTestRunning() {
- try {
- io.qameta.allure.Allure.getLifecycle().getCurrentTestCase();
- return true;
- } catch (IllegalStateException e) {
- return false;
- }
- }
-
@Override
public void handleEvent(OperationEvent event) {
if (!isTestRunning()) {
- return; // Skip Allure logging if no test is running
+ return;
}
io.qameta.allure.Allure.step("Received event: " + event.getEventType(), () -> {
io.qameta.allure.Allure.addAttachment("Event Details", event.toString());
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarIdentificationTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarIdentificationTest.java
index b88a74cb0..e144e35e2 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarIdentificationTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarIdentificationTest.java
@@ -30,8 +30,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public abstract class DefaultPillarIdentificationTest extends DefaultPillarMessagingTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java
index c57c82a72..e5f7a1068 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/DefaultPillarMessagingTest.java
@@ -30,8 +30,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Contains the tests for exploringa pillars handling of general messaging. The concrete class needs to
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/DeleteFileRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/DeleteFileRequestIT.java
index d62b50c4f..42b907688 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/DeleteFileRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/DeleteFileRequestIT.java
@@ -38,8 +38,8 @@
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class DeleteFileRequestIT extends DefaultPillarOperationTest {
protected DeleteFileMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/IdentifyPillarsForDeleteFileIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/IdentifyPillarsForDeleteFileIT.java
index 3b250f6a8..96cab29ef 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/IdentifyPillarsForDeleteFileIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/deletefile/IdentifyPillarsForDeleteFileIT.java
@@ -34,8 +34,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IdentifyPillarsForDeleteFileIT extends DefaultPillarIdentificationTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
index dd860ec0d..8a185817e 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getaudittrails/GetAuditTrailsTest.java
@@ -32,7 +32,7 @@
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumQueryTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumQueryTest.java
index 3785ceadb..21a79f8fb 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumQueryTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumQueryTest.java
@@ -35,7 +35,7 @@
import java.util.GregorianCalendar;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
public class GetChecksumQueryTest extends PillarFunctionTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumTest.java
index 6c27fca30..6a31c2aa3 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/GetChecksumTest.java
@@ -29,7 +29,7 @@
import org.bitrepository.common.utils.Base16Utils;
import org.bitrepository.pillar.PillarTestGroups;
import org.bitrepository.pillar.integration.func.PillarFunctionTest;
-import org.bitrepository.protocol.utils.AllureTestUtils;
+import org.bitrepository.common.utils.AllureTestUtils;
import org.junit.jupiter.api.*;
import java.util.List;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java
index e8f3c5131..546ca17a2 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getchecksums/IdentifyPillarsForGetChecksumsIT.java
@@ -38,8 +38,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IdentifyPillarsForGetChecksumsIT extends DefaultPillarIdentificationTest {
protected GetChecksumsMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java
index 0316df737..d4cdc48dd 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/GetFileRequestIT.java
@@ -21,8 +21,8 @@
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class GetFileRequestIT extends PillarFunctionTest {
private final Logger log = LoggerFactory.getLogger(this.getClass());
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java
index 3897190e9..739e8fc34 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfile/IdentifyPillarsForGetFileIT.java
@@ -31,8 +31,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
class IdentifyPillarsForGetFileIT extends PillarFunctionTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsQueryTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsQueryTest.java
index 0f14c5836..922c438f6 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsQueryTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsQueryTest.java
@@ -36,7 +36,7 @@
import java.util.GregorianCalendar;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.*;
+import static org.bitrepository.common.utils.AllureTestUtils.*;
public class GetFileIDsQueryTest extends PillarFunctionTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsTest.java
index 726cd961b..5bc2dfdf1 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/GetFileIDsTest.java
@@ -37,8 +37,8 @@
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class GetFileIDsTest extends DefaultPillarOperationTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/IdentifyPillarsForGetFileIDsIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/IdentifyPillarsForGetFileIDsIT.java
index 0b3f65244..033c63faa 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/IdentifyPillarsForGetFileIDsIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getfileids/IdentifyPillarsForGetFileIDsIT.java
@@ -36,8 +36,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IdentifyPillarsForGetFileIDsIT extends DefaultPillarIdentificationTest {
protected GetFileIDsMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java
index 56d6aa87d..3508e7e73 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/GetStatusRequestIT.java
@@ -33,8 +33,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class GetStatusRequestIT extends PillarFunctionTest {
protected GetStatusMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/IdentifyContributorsForGetStatusIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/IdentifyContributorsForGetStatusIT.java
index 08d18b096..df6e4322a 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/IdentifyContributorsForGetStatusIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/getstatus/IdentifyContributorsForGetStatusIT.java
@@ -33,8 +33,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IdentifyContributorsForGetStatusIT extends PillarFunctionTest {
protected GetStatusMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/multicollection/MultipleCollectionIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/multicollection/MultipleCollectionIT.java
index 2662085f9..0efbce437 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/multicollection/MultipleCollectionIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/multicollection/MultipleCollectionIT.java
@@ -34,8 +34,8 @@
import java.util.Collection;
import java.util.Collections;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class MultipleCollectionIT extends PillarIntegrationTest {
/**
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java
index c7af78f9d..9bd52e08c 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/IdentifyPillarsForPutFileIT.java
@@ -34,8 +34,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IdentifyPillarsForPutFileIT extends DefaultPillarIdentificationTest {
protected PutFileMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
index 0f936ae07..ef6446ac8 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/putfile/PutFileRequestIT.java
@@ -35,8 +35,8 @@
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class PutFileRequestIT extends DefaultPillarOperationTest {
protected PutFileMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java
index cba843e2e..f928c5639 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/IdentifyPillarsForReplaceFileIT.java
@@ -34,8 +34,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class IdentifyPillarsForReplaceFileIT extends DefaultPillarIdentificationTest {
protected ReplaceFileMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/ReplaceFileRequestIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/ReplaceFileRequestIT.java
index 7f7c03023..72057700f 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/ReplaceFileRequestIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/func/replacefile/ReplaceFileRequestIT.java
@@ -40,8 +40,8 @@
import java.util.concurrent.TimeUnit;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class ReplaceFileRequestIT extends DefaultPillarOperationTest {
protected ReplaceFileMessageFactory msgFactory;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java
index 9bf2627e6..aa8bc451c 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetAuditTrailsFileStressIT.java
@@ -36,8 +36,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class GetAuditTrailsFileStressIT extends PillarPerformanceTest {
protected AuditTrailClient auditTrailClient;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetFileStressIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetFileStressIT.java
index d28ad7b79..e2d86dc96 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetFileStressIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetFileStressIT.java
@@ -43,8 +43,8 @@
import java.nio.file.Path;
import java.nio.file.Paths;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class GetFileStressIT extends PillarPerformanceTest {
public static final String FOLDER_NAME = "src/test/resources";
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/PutFileStressIT.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/PutFileStressIT.java
index 0d53db6cd..071c25373 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/PutFileStressIT.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/PutFileStressIT.java
@@ -35,8 +35,8 @@
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class PutFileStressIT extends PillarPerformanceTest {
protected PutFileClient putClient;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/DeleteFileTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/DeleteFileTest.java
index 0600a2919..de01c8c5a 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/DeleteFileTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/DeleteFileTest.java
@@ -39,8 +39,8 @@
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.*;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GeneralMessageHandlingTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GeneralMessageHandlingTest.java
index f932eb901..e0eb7e05b 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GeneralMessageHandlingTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GeneralMessageHandlingTest.java
@@ -40,8 +40,8 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetAuditTrailsTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetAuditTrailsTest.java
index 70cf42a9a..13f99808d 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetAuditTrailsTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetAuditTrailsTest.java
@@ -38,8 +38,8 @@
import java.math.BigInteger;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class GetAuditTrailsTest extends MockedPillarTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetChecksumsTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetChecksumsTest.java
index 952b19561..9479a66ec 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetChecksumsTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetChecksumsTest.java
@@ -48,8 +48,8 @@
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Tests the PutFile functionality on the ReferencePillar.
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileIDsTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileIDsTest.java
index e41f12473..a783c3f52 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileIDsTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileIDsTest.java
@@ -46,8 +46,8 @@
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Tests the PutFile functionality on the ReferencePillar.
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileTest.java
index 367ef83b5..38caf1f69 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/GetFileTest.java
@@ -46,8 +46,8 @@
import java.io.ByteArrayInputStream;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java
index 40a085e48..fbaf178b7 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/PutFileTest.java
@@ -44,8 +44,8 @@
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Tests the PutFile functionality on the ReferencePillar.
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/ReplaceFileTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/ReplaceFileTest.java
index 275dbc842..afd7bdbdd 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/ReplaceFileTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/messagehandling/ReplaceFileTest.java
@@ -45,8 +45,8 @@
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java
index 4c7d2ba82..efd0b6a7c 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/schedulablejobs/RecalculateChecksumWorkflowTest.java
@@ -34,8 +34,8 @@
import javax.xml.datatype.DatatypeFactory;
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class RecalculateChecksumWorkflowTest extends DefaultPillarTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/ChecksumPillarModelTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/ChecksumPillarModelTest.java
index 7913ef390..e424976e8 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/ChecksumPillarModelTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/ChecksumPillarModelTest.java
@@ -37,8 +37,8 @@
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/FullPillarModelTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/FullPillarModelTest.java
index 213fc307b..d5d888ca2 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/FullPillarModelTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/FullPillarModelTest.java
@@ -41,8 +41,8 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class FullPillarModelTest extends DefaultFixturePillarTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ArchiveDirectoryTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ArchiveDirectoryTest.java
index be2bbec37..95b75ae6a 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ArchiveDirectoryTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ArchiveDirectoryTest.java
@@ -37,8 +37,8 @@
import java.util.List;
import java.util.Objects;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
class ArchiveDirectoryTest {
private static final String DIR_NAME = "archive-directory";
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ReferenceArchiveTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ReferenceArchiveTest.java
index 2b8ba750c..869d45de8 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ReferenceArchiveTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/archive/ReferenceArchiveTest.java
@@ -45,8 +45,8 @@
import java.nio.charset.StandardCharsets;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
@ExtendWith(SuiteInfoParameterResolver.class)
public class ReferenceArchiveTest extends DefaultPillarTest {
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseMigrationTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseMigrationTest.java
index 69ca5ef8c..0f1a30c22 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseMigrationTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseMigrationTest.java
@@ -43,12 +43,8 @@
import java.util.TimeZone;
import static org.bitrepository.pillar.store.checksumdatabase.DatabaseConstants.CHECKSUM_TABLE;
-import static org.bitrepository.pillar.store.checksumdatabase.DatabaseConstants.CS_CHECKSUM;
-import static org.bitrepository.pillar.store.checksumdatabase.DatabaseConstants.CS_COLLECTION_ID;
-import static org.bitrepository.pillar.store.checksumdatabase.DatabaseConstants.CS_DATE;
-import static org.bitrepository.pillar.store.checksumdatabase.DatabaseConstants.CS_FILE_ID;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class ChecksumDatabaseMigrationTest {
protected Settings settings;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseTest.java
index 446476ab8..02f81a4aa 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumDatabaseTest.java
@@ -40,8 +40,8 @@
import java.util.Date;
import java.util.List;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class ChecksumDatabaseTest {
private String collectionID;
diff --git a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumEntryTest.java b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumEntryTest.java
index 2f1cb705f..c4dc911b0 100644
--- a/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumEntryTest.java
+++ b/bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/store/checksumcache/ChecksumEntryTest.java
@@ -28,8 +28,8 @@
import java.util.Date;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
public class ChecksumEntryTest {
private static final String CE_FILE = "file";
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java
index 5c0b9c47e..a5004619f 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseMigrationTest.java
@@ -32,8 +32,8 @@
import java.io.File;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
* Test database migration. Generates jaccept reports.
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java
index 184d4e0b5..96ce3179e 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/audit/AuditTrailContributorDatabaseTest.java
@@ -39,8 +39,8 @@
import java.util.Date;
import java.util.Locale;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/** Run audit trail contributor database test using Derby. Generates jaccept reports. */
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java
index f43775905..9f908c16d 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IdentifyContributorExceptionTest.java
@@ -26,8 +26,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java
index c740e6bd8..db38ae949 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/exception/IllegalOperationExceptionTest.java
@@ -25,8 +25,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
diff --git a/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java b/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java
index ecc90cea1..9c7b4dc0d 100644
--- a/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java
+++ b/bitrepository-service/src/test/java/org/bitrepository/service/exception/InvalidMessageExceptionTest.java
@@ -27,8 +27,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addDescription;
-import static org.bitrepository.protocol.utils.AllureTestUtils.addStep;
+import static org.bitrepository.common.utils.AllureTestUtils.addDescription;
+import static org.bitrepository.common.utils.AllureTestUtils.addStep;
/**
From 8d9f6d66dada35344fecb654a23fe611bbfe562d Mon Sep 17 00:00:00 2001
From: kaah