Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 10 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.ecsp</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
<artifactId>ro</artifactId>
<name>ro</name>
<description>RO library for ECSP project</description>
Expand Down Expand Up @@ -181,6 +181,7 @@
<checkstyle.config.location>${project.basedir}/checkstyle.xml</checkstyle.config.location>
<sonar.java.checkstyle.reportPaths>${project.build.directory}/checkstyle-result.xml
</sonar.java.checkstyle.reportPaths>
<central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
</properties>

<!-- ############ DEPENDENCIES ############ -->
Expand Down Expand Up @@ -621,16 +622,6 @@
</pluginRepository>
</pluginRepositories>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<!-- To download third party dependencies from non public repository -->
<profiles>
<profile>
Expand Down Expand Up @@ -660,27 +651,19 @@
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
<centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots/</centralSnapshotsUrl>
<skipPublishing>false</skipPublishing>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -730,16 +713,6 @@
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
Expand Down
4 changes: 3 additions & 1 deletion ro-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<parent>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>ro</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>ro-api</artifactId>
<name>ro-api</name>
<description>ro library for ECSP project</description>
<url>https://github.com/eclipse-ecsp/ro</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>org.eclipse.ecsp.platform.services.ro.Application</start-class>
Expand Down
4 changes: 3 additions & 1 deletion ro-entities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
<parent>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>ro</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>ro-entities</artifactId>
<name>ro-entities</name>
<description>ro library for ECSP project</description>
<url>https://github.com/eclipse-ecsp/ro</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
4 changes: 3 additions & 1 deletion ro-sp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
<parent>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>ro</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<artifactId>ro-sp</artifactId>
<name>ro-sp</name>
<description>ro library for ECSP project</description>
<url>https://github.com/eclipse-ecsp/ro</url>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DefaultDMAShoulderTapResolverTest {
private DefaultDMAShoulderTapResolver resolver;

@BeforeEach
void setUp() throws Exception {
void setUp() {
resolver = new DefaultDMAShoulderTapResolver();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -25,7 +24,7 @@
* RCPDRequestProcessorTest - This class contains unit tests for the RCPDRequestProcessor.
*/
@ExtendWith(MockitoExtension.class)
public class RCPDRequestProcessorTest {
class RCPDRequestProcessorTest {

// Mock dependencies using @Mock
@Mock
Expand Down Expand Up @@ -69,9 +68,9 @@ void testProcess() {
IgniteEventImpl mockRcpdReqImpl = mock(IgniteEventImpl.class);

when(rcpdEventHandler.processRCPDRequest(
eq(mockKey),
eq(mockValue),
eq(serviceUtil)
mockKey,
mockValue,
serviceUtil
)).thenReturn(mockRcpdReqImpl);

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.eclipse.ecsp.key.IgniteKey;
import org.eclipse.ecsp.nosqldao.Updates;
import org.eclipse.ecsp.ro.RoDAOMongoImpl;
import org.eclipse.ecsp.ro.utils.TimeZoneUtils;
import org.eclipse.ecsp.services.utils.ServiceUtil;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.eclipse.ecsp.entities.IgniteEvent;
import org.eclipse.ecsp.key.IgniteKey;
import org.eclipse.ecsp.ro.RoDAOMongoImpl;
import org.eclipse.ecsp.ro.utils.TimeZoneUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
Expand All @@ -18,7 +17,6 @@
import java.util.Iterator;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -105,6 +103,6 @@ void testProcess_withExpiredEvent_shouldUpdateStatusAndRemove() {
requestQueueHandler.process(igniteKey, igniteEvent, context);

// Should call updateEntityByROStatus
verify(roDAOMongoImpl, atLeastOnce()).getROEntityByFieldNameByRoReqIdExceptACV(eq("VIN1234"), eq("REQ-2"));
verify(roDAOMongoImpl, atLeastOnce()).getROEntityByFieldNameByRoReqIdExceptACV("VIN1234", "REQ-2");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Test for {@link NotificationUtil} class.
*/
public class NotificationUtilTest {
class NotificationUtilTest {

@InjectMocks
private NotificationUtil notificationUtil;
Expand All @@ -51,7 +51,7 @@ public class NotificationUtilTest {
* Initializes mocks and sets up the test environment before each test case.
*/
@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
MockitoAnnotations.openMocks(this);

notificationUtil = new NotificationUtil();
Expand All @@ -73,7 +73,7 @@ private void setField(Object target, String fieldName, Object value) throws Exce
}

@Test
public void testSendRONotification_withValidInput_shouldForwardEvent() {
void testSendRONotification_withValidInput_shouldForwardEvent() {
when(igniteEvent.getVehicleId()).thenReturn("veh123");
when(igniteEvent.getBizTransactionId()).thenReturn("biz123");

Expand All @@ -96,7 +96,7 @@ public void testSendRONotification_withValidInput_shouldForwardEvent() {
}

@Test
public void testSendRONotification_withNonWhitelistedOrigin_shouldNotSend() {
void testSendRONotification_withNonWhitelistedOrigin_shouldNotSend() {
notificationUtil.sendRONotification(
igniteKey,
igniteEvent,
Expand All @@ -110,7 +110,7 @@ public void testSendRONotification_withNonWhitelistedOrigin_shouldNotSend() {
}

@Test
public void testSendRONotification_withEmptyNotificationId_shouldSkip() {
void testSendRONotification_withEmptyNotificationId_shouldSkip() {
when(response.getRoRequestId()).thenReturn("ro-req-1");

notificationUtil.sendRONotification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ public void getStockingRuleConfig() {
}

@Test
public void getStockingRuleConfig_withMissingKey() {
void getStockingRuleConfig_withMissingKey() {
// Missing STOCKING_RULE_CONFIGURATIONOBJECT key
Map<String, Object> input = new HashMap<>();
Map<String, String> resultMap = StockingRuleConfigUtil.getStockingRuleConfig(input);
Assertions.assertTrue(resultMap == null || resultMap.isEmpty(), "Expected empty map when key is missing");
}

@Test
public void getStockingRuleConfig_withNullInput() {
void getStockingRuleConfig_withNullInput() {
// Null input
Map<String, String> resultMap = StockingRuleConfigUtil.getStockingRuleConfig(null);
Assertions.assertTrue(resultMap == null || resultMap.isEmpty(), "Expected empty map when input is null");
}

@Test
public void getStockingRuleConfig_withInvalidValue() {
void getStockingRuleConfig_withInvalidValue() {
// Value that can't be converted to string
Map<String, Object> input = new HashMap<>();
input.put(Constants.STOCKING_RULE_CONFIGURATIONOBJECT, new Object());
Expand All @@ -83,7 +83,7 @@ public void getStockingRuleConfig_withInvalidValue() {
}

@Test
public void getStockingRuleConfig_withMalformedJsonString() {
void getStockingRuleConfig_withMalformedJsonString() {
// Manually passing malformed JSON string
Map<String, Object> input = new HashMap<>();
input.put(Constants.STOCKING_RULE_CONFIGURATIONOBJECT, "{invalidJson: }");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.eclipse.ecsp.ro.utils;

import org.eclipse.ecsp.ro.queue.DeviceMessageFailureQueueHandler;
import org.junit.jupiter.api.Test;
import java.time.ZoneId;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand All @@ -10,41 +9,41 @@
/**
* Test for {@link TimeZoneUtils} class.
*/
public class TimeZoneUtilsTest {
class TimeZoneUtilsTest {

private static final double NYlat = 40.7128;
private static final double NY_LAT = 40.7128;

private static final double NYlongi = -74.0060;
private static final double NY_LONG = -74.0060;

@Test
public void testGetZoneIdByLocation_validCoordinates() {
void testGetZoneIdByLocation_validCoordinates() {
// Sample coordinates for New York City
double latitude = NYlat;
double longitude = NYlongi;
double latitude = NY_LAT;
double longitude = NY_LONG;

ZoneId zoneId = TimeZoneUtils.getZoneIdByLocation(latitude, longitude);

assertNotNull(zoneId, "ZoneId should not be null for valid coordinates");
System.out.println("Zone ID for NYC: " + zoneId);
}

private static final double INVlat = -90.0;
private static final double INV_LAT = -90.0;

private static final double INVlongi = -180.0;
private static final double INV_LONG = -180.0;

@Test
public void testGetZoneIdByLocation_invalidCoordinates() {
void testGetZoneIdByLocation_invalidCoordinates() {
// Invalid coordinates in the middle of the ocean
double invlatitude = INVlat;
double invlongitude = INVlongi;
double invlatitude = INV_LAT;
double invlongitude = INV_LONG;

ZoneId zoneId = TimeZoneUtils.getZoneIdByLocation(invlatitude, invlongitude);

assertNull(zoneId, "ZoneId should be null for invalid coordinates");
}

@Test
public void testGetUTCTimestamp_validInput() {
void testGetUTCTimestamp_validInput() {
ZoneId zoneId = ZoneId.of("Asia/Kolkata");
String timeStr = "2025/06/08 10:30:00";
String pattern = "yyyy/MM/dd HH:mm:ss";
Expand All @@ -56,7 +55,7 @@ public void testGetUTCTimestamp_validInput() {
}

@Test
public void testGetCurrentUTCTimestamp() {
void testGetCurrentUTCTimestamp() {
long currentUtc = TimeZoneUtils.getCurrentUTCTimestamp();

assertTrue(currentUtc > 0, "Current UTC timestamp should be greater than zero");
Expand Down
Loading