diff --git a/pom.xml b/pom.xml index 50756d8..5d04abc 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ de.swingbe.ifleet irt-parser - 1.0.0 + 1.1.0 IVU radio telegram parser. diff --git a/src/main/java/de/swingbe/ifleet/model/LctMsg.java b/src/main/java/de/swingbe/ifleet/model/TcLctMsg.java similarity index 84% rename from src/main/java/de/swingbe/ifleet/model/LctMsg.java rename to src/main/java/de/swingbe/ifleet/model/TcLctMsg.java index 40754a9..c580971 100644 --- a/src/main/java/de/swingbe/ifleet/model/LctMsg.java +++ b/src/main/java/de/swingbe/ifleet/model/TcLctMsg.java @@ -2,13 +2,13 @@ package de.swingbe.ifleet.model; import java.util.Objects; -public class LctMsg extends TelegrCntnt{ +public class TcLctMsg extends TelegrCntnt{ private final Position position; private final String driverNumber; private final Trip trip; - public LctMsg(final String type, final Position position, final String driverNumber, final Trip trip) { + public TcLctMsg(final String type, final Position position, final String driverNumber, final Trip trip) { super(type); this.position = position; this.driverNumber = driverNumber; @@ -36,7 +36,7 @@ public class LctMsg extends TelegrCntnt{ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - LctMsg that = (LctMsg) o; + TcLctMsg that = (TcLctMsg) o; return position.equals(that.position) && driverNumber.equals(that.driverNumber) && trip.equals(that.trip); } diff --git a/src/main/java/de/swingbe/ifleet/parser/LctMsgParser.java b/src/main/java/de/swingbe/ifleet/parser/LctMsgParser.java index cfab8d5..3f37380 100644 --- a/src/main/java/de/swingbe/ifleet/parser/LctMsgParser.java +++ b/src/main/java/de/swingbe/ifleet/parser/LctMsgParser.java @@ -1,18 +1,18 @@ package de.swingbe.ifleet.parser; -import de.swingbe.ifleet.model.LctMsg; +import de.swingbe.ifleet.model.TcLctMsg; /** - * Parses a {@link LctMsg}. + * Parses a {@link TcLctMsg}. */ interface LctMsgParser { /** - * Returns a new {@link LctMsg} that holds the parses fields. + * Returns a new {@link TcLctMsg} that holds the parses fields. * * @param type the telegram type * @param input the {@link String} to be parsed - * @return the parsed {@link LctMsg} + * @return the parsed {@link TcLctMsg} */ - LctMsg parse(final String type, final String input); + TcLctMsg parse(final String type, final String input); } diff --git a/src/main/java/de/swingbe/ifleet/parser/LctMsgParserImpl.java b/src/main/java/de/swingbe/ifleet/parser/LctMsgParserImpl.java index 59a1d65..e49e930 100644 --- a/src/main/java/de/swingbe/ifleet/parser/LctMsgParserImpl.java +++ b/src/main/java/de/swingbe/ifleet/parser/LctMsgParserImpl.java @@ -1,6 +1,6 @@ package de.swingbe.ifleet.parser; -import de.swingbe.ifleet.model.LctMsg; +import de.swingbe.ifleet.model.TcLctMsg; import de.swingbe.ifleet.model.Position; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,7 +13,7 @@ class LctMsgParserImpl implements LctMsgParser { public final static int DRIVER_NO_FIELD_NO = 1; - public LctMsg parse(final String type, final String input) { + public TcLctMsg parse(final String type, final String input) { LOG.debug("parse() type: " + type); //parse position @@ -31,6 +31,6 @@ class LctMsgParserImpl implements LctMsgParser { //parse trip inputNew = popField(inputNew, DRIVER_NO_FIELD_NO); - return new LctMsg(type, position, driverNo, TripParserFactory.createTripParser().parse(inputNew)); + return new TcLctMsg(type, position, driverNo, TripParserFactory.createTripParser().parse(inputNew)); } } diff --git a/src/test/java/de/swingbe/ifleet/TelegrParserImplTest.java b/src/test/java/de/swingbe/ifleet/TelegrParserImplTest.java index 224c46e..2a2937e 100644 --- a/src/test/java/de/swingbe/ifleet/TelegrParserImplTest.java +++ b/src/test/java/de/swingbe/ifleet/TelegrParserImplTest.java @@ -13,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ class TelegrParserImplTest { - private final Enty eSendLctMsg = new Enty("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Comm(new Header(new Sender("I", "WOL/234"), new Receiver("B", "")), new Telegr(new TelegramHdr("1", "1.8", "1"), new LctMsg("1", new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2"))))); + private final Enty eSendLctMsg = new Enty("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Comm(new Header(new Sender("I", "WOL/234"), new Receiver("B", "")), new Telegr(new TelegramHdr("1", "1.8", "1"), new TcLctMsg("1", new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2"))))); private final String strSendLctMsg = "2021-11-30 11:24:13,438 INFO [BON /195.30.103.89:58713] (NpmTCPAcceptedChannel) (/195.30.103.89:58713) sent "; private final Enty eFromStrSendLctMsg = EntyParserFactory.createEntyParser().parse(strSendLctMsg);