Skip to content

Commit

Permalink
refactor(position): updated name of position service api (#5456)
Browse files Browse the repository at this point in the history
* refactor: updated name of position service api

Signed-off-by: SimoneFiorani <[email protected]>

* fix: jaxrs repaired

Signed-off-by: SimoneFiorani <[email protected]>

* test: added missing import

Signed-off-by: SimoneFiorani <[email protected]>

---------

Signed-off-by: SimoneFiorani <[email protected]>
  • Loading branch information
sfiorani authored Oct 18, 2024
1 parent 608c818 commit 81007a9
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public LocalDateTime getDateTime() {
}

@Override
public Set<GNSSType> getGnssType() {
public Set<GNSSType> getGnssTypes() {
return new HashSet<>(Arrays.asList(GNSSType.GPS));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public interface PositionService {
*
* @since 2.8
*/
public Set<GNSSType> getGnssType();
public Set<GNSSType> getGnssTypes();

/**
* Registers position listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public synchronized String getTimeNmea() {
return this.nmeaParser.getTimeNmea();
}

public synchronized Set<GNSSType> getGnssType() {
return this.nmeaParser.getGnssType();
public synchronized Set<GNSSType> getGnssTypes() {
return this.nmeaParser.getGnssTypes();
}

public void disconnect() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public PositionProviderType getType() {
}

@Override
public Set<GNSSType> getGnssType() {
public Set<GNSSType> getGnssTypes() {
return this.gnssType.get();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public char getLongitudeHemisphere() {
return this.longitudeHemisphere;
}

public Set<GNSSType> getGnssType() {
public Set<GNSSType> getGnssTypes() {
return this.gnssType;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ public void init(PositionServiceOptions configuration, Listener gpsDeviceListene

public PositionProviderType getType();

public Set<GNSSType> getGnssType();
public Set<GNSSType> getGnssTypes();

}
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ public LocalDateTime getDateTime() {
}

@Override
public Set<GNSSType> getGnssType() {
public Set<GNSSType> getGnssTypes() {
if (this.options.isEnabled()) {

if (!this.options.isStatic() && this.currentProvider != null) {
return this.currentProvider.getGnssType();
return this.currentProvider.getGnssTypes();
} else if (this.options.isStatic()) {
return new HashSet<>(Arrays.asList(this.staticGnssType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ public PositionProviderType getType() {
}

@Override
public Set<GNSSType> getGnssType() {
return this.gpsDevice.getGnssType();
public Set<GNSSType> getGnssTypes() {
return this.gpsDevice.getGnssTypes();
}

protected GpsDevice getGpsDevice() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void unsetRequestHandlerRegistry(final RequestHandlerRegistry registry) {
@Produces(MediaType.APPLICATION_JSON)
public PositionDTO getPosition() {
if (positionServiceImpl.isLocked()) {
return new PositionDTO(positionServiceImpl.getPosition(), positionServiceImpl.getGnssType());
return new PositionDTO(positionServiceImpl.getPosition(), positionServiceImpl.getGnssTypes());
}

throw DefaultExceptionHandler.toWebApplicationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void testActivateStatic() throws IOException {
assertEquals(300.0d, position.getAltitude().getValue(), EPS);

assertNotNull(fixture.ps.getDateTime());
assertEquals(new HashSet<>(Arrays.asList(GNSSType.GPS)), fixture.ps.getGnssType());
assertEquals(new HashSet<>(Arrays.asList(GNSSType.GPS)), fixture.ps.getGnssTypes());

final NmeaPosition nmeaPosition = fixture.ps.getNmeaPosition();

Expand Down Expand Up @@ -452,7 +452,7 @@ public void testSwitchToStatic() throws IOException {
assertEquals(40.0d, position.getAltitude().getValue(), EPS);

assertNotNull(fixture.ps.getDateTime());
assertEquals(new HashSet<>(Arrays.asList(GNSSType.GLONASS)), fixture.ps.getGnssType());
assertEquals(new HashSet<>(Arrays.asList(GNSSType.GLONASS)), fixture.ps.getGnssTypes());

verify(fixture.eventAdmin, times(1)).postEvent(argThat(isPositionLockedEvent));
}
Expand Down Expand Up @@ -533,7 +533,7 @@ public void testPositionDataFromGps() throws IOException, InterruptedException {
final String date = fixture.ps.getNmeaDate();
final String time = fixture.ps.getNmeaTime();
final String lastSentence = fixture.ps.getLastSentence();
final Set<GNSSType> gnssType = fixture.ps.getGnssType();
final Set<GNSSType> gnssTypes = fixture.ps.getGnssTypes();

// from GGA
assertEquals(1, nmeaPosition.getFixQuality());
Expand Down Expand Up @@ -564,7 +564,7 @@ public void testPositionDataFromGps() throws IOException, InterruptedException {

assertEquals("$GNVTG,,,,,,,12.34,,,,*4a\n", lastSentence);

assertEquals(new HashSet<>(Arrays.asList(GNSSType.GPS, GNSSType.GLONASS)), gnssType);
assertEquals(new HashSet<>(Arrays.asList(GNSSType.GPS, GNSSType.GLONASS)), gnssTypes);

fixture.ps.deactivate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private void thenPositionIsLocked() {
}

private void thenGnssTypeIs(Set<GNSSType> types) {
assertEquals(types, this.gpsdPositionProvider.getGnssType());
assertEquals(types, this.gpsdPositionProvider.getGnssTypes());
}

private void gpsdPositionProviderStart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void givenPosition(Double longitude, Double latitude, Double altitude, D
trackMesurment);

when(positionService.getPosition()).thenReturn(testPosition);
when(positionService.getGnssType()).thenReturn(gnssTypeSet);
when(positionService.getGnssTypes()).thenReturn(gnssTypeSet);
}

private void givenLocalDateTime(String zonedDateTime) {
Expand Down

0 comments on commit 81007a9

Please sign in to comment.