feat: add equals and hashCode methods and adjust toString method
This commit is contained in:
parent
ff7e170bff
commit
a207c90dbe
|
@ -1,15 +1,20 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
public class Communication {
|
||||
import java.util.Objects;
|
||||
|
||||
public class Communication {
|
||||
private final Header header;
|
||||
private final Telegram telegram;
|
||||
|
||||
public Communication(Header header, Telegram telegram) {
|
||||
this.header = header;
|
||||
this.telegram = telegram;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Communication{" + "header=" + header + ", telegram=" + telegram + '}';
|
||||
}
|
||||
|
||||
public Header getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
@ -19,13 +24,15 @@ public class Communication {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String ccString = "Communication{";
|
||||
ccString += header != null ? "header=" + header : "";
|
||||
ccString += telegram != null ? ", telegram=" + telegram : "";
|
||||
ccString += '}';
|
||||
return ccString;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Communication that = (Communication) o;
|
||||
return header.equals(that.header) && telegram.equals(that.telegram);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(header, telegram);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Entity {
|
||||
private final String date;
|
||||
private final String time;
|
||||
|
@ -31,6 +33,11 @@ public class Entity {
|
|||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Entity{" + "date='" + date + '\'' + ", time='" + time + '\'' + ", logLevel='" + logLevel + '\'' + ", addressPartA='" + addressPartA + '\'' + ", addressPartB='" + addressPartB + '\'' + ", peer='" + peer + '\'' + ", addressNext='" + addressNext + '\'' + ", direction='" + direction + '\'' + ", cc=" + cc + '}';
|
||||
}
|
||||
|
||||
public String getLogLevel() {
|
||||
return logLevel;
|
||||
}
|
||||
|
@ -60,19 +67,15 @@ public class Entity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String eString = "Entity{";
|
||||
eString += date != null ? "date='" + date + '\'' : "";
|
||||
eString += time != null ? ", time='" + time + '\'' : "";
|
||||
eString += logLevel != null ? ", logLevel='" + logLevel + '\'' : "";
|
||||
eString += addressPartA != null ? ", addressPartA='" + addressPartA + '\'' : "";
|
||||
eString += addressPartB != null ? ", addressPartB='" + addressPartB + '\'' : "";
|
||||
eString += peer != null ? ", peer='" + peer + '\'' : "";
|
||||
eString += addressNext != null ? ", addressNext='" + addressNext + '\'' : "";
|
||||
eString += direction != null ? ", direction='" + direction + '\'' : "";
|
||||
eString += cc != null ? ", cc=" + cc : "";
|
||||
eString += '}';
|
||||
return eString;
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Entity entity = (Entity) o;
|
||||
return date.equals(entity.date) && time.equals(entity.time) && logLevel.equals(entity.logLevel) && addressPartA.equals(entity.addressPartA) && addressPartB.equals(entity.addressPartB) && peer.equals(entity.peer) && addressNext.equals(entity.addressNext) && direction.equals(entity.direction) && cc.equals(entity.cc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(date, time, logLevel, addressPartA, addressPartB, peer, addressNext, direction, cc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Header {
|
||||
|
||||
private final Sender sender;
|
||||
|
@ -10,6 +12,11 @@ public class Header {
|
|||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Header{" + "sender=" + sender + ", receiver=" + receiver + '}';
|
||||
}
|
||||
|
||||
public Sender getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
@ -19,11 +26,15 @@ public class Header {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String hString = "Header{";
|
||||
hString += sender != null ? "sender=" + sender : "";
|
||||
hString += receiver != null ? ", receiver=" + receiver : "";
|
||||
hString += '}';
|
||||
return hString;
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Header header = (Header) o;
|
||||
return sender.equals(header.sender) && receiver.equals(header.receiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sender, receiver);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class LocationMsg {
|
||||
|
||||
private final Position position;
|
||||
private final String driverNumber;
|
||||
private final Trip trip;
|
||||
|
||||
public LocationMsg(final Position position, final String driverNumber,
|
||||
final Trip trip) {
|
||||
public LocationMsg(final Position position, final String driverNumber, final Trip trip) {
|
||||
this.position = position;
|
||||
this.driverNumber = driverNumber;
|
||||
this.trip = trip;
|
||||
|
@ -15,13 +16,7 @@ public class LocationMsg {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
String tString = "LocationMsg{" +
|
||||
"position=" + position +
|
||||
", driverNumber='" + driverNumber + '\'';
|
||||
tString += trip != null ? ", trip=" + trip + '\'' : "" + '\'';
|
||||
tString += '}';
|
||||
|
||||
return tString;
|
||||
return "LocationMsg{" + "position=" + position + ", driverNumber='" + driverNumber + '\'' + ", trip=" + trip + '}';
|
||||
}
|
||||
|
||||
public String getDriverNumber() {
|
||||
|
@ -36,4 +31,16 @@ public class LocationMsg {
|
|||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
LocationMsg that = (LocationMsg) o;
|
||||
return position.equals(that.position) && driverNumber.equals(that.driverNumber) && trip.equals(that.trip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(position, driverNumber, trip);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Peer {
|
||||
|
||||
private final String type;
|
||||
|
@ -12,10 +14,7 @@ public class Peer {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Peer{" +
|
||||
"type='" + type + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
'}';
|
||||
return "Peer{" + "type='" + type + '\'' + ", id='" + id + '\'' + '}';
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
|
@ -25,4 +24,17 @@ public class Peer {
|
|||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Peer peer = (Peer) o;
|
||||
return type.equals(peer.type) && id.equals(peer.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Position {
|
||||
|
||||
public final static int POSITION_FIELD_NO = 7;
|
||||
|
@ -12,9 +14,7 @@ public class Position {
|
|||
private final String velocity;
|
||||
private final String heading;
|
||||
|
||||
public Position(final String netPoint, final String relPosition, final String longitude,
|
||||
final String latitude, final String offRoute,
|
||||
final String velocity, final String heading) {
|
||||
public Position(final String netPoint, final String relPosition, final String longitude, final String latitude, final String offRoute, final String velocity, final String heading) {
|
||||
this.netPoint = netPoint;
|
||||
this.relPosition = relPosition;
|
||||
this.longitude = longitude;
|
||||
|
@ -26,15 +26,7 @@ public class Position {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Position{" +
|
||||
"netPoint='" + netPoint + '\'' +
|
||||
", relPosition='" + relPosition + '\'' +
|
||||
", longitude='" + longitude + '\'' +
|
||||
", latitude='" + latitude + '\'' +
|
||||
", offRoute='" + offRoute + '\'' +
|
||||
", velocity='" + velocity + '\'' +
|
||||
", heading='" + heading + '\'' +
|
||||
'}';
|
||||
return "Position{" + "netPoint='" + netPoint + '\'' + ", relPosition='" + relPosition + '\'' + ", longitude='" + longitude + '\'' + ", latitude='" + latitude + '\'' + ", offRoute='" + offRoute + '\'' + ", velocity='" + velocity + '\'' + ", heading='" + heading + '\'' + '}';
|
||||
}
|
||||
|
||||
public String getOffRoute() {
|
||||
|
@ -64,4 +56,17 @@ public class Position {
|
|||
public String getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Position position = (Position) o;
|
||||
return netPoint.equals(position.netPoint) && relPosition.equals(position.relPosition) && longitude.equals(position.longitude) && latitude.equals(position.latitude) && offRoute.equals(position.offRoute) && velocity.equals(position.velocity) && heading.equals(position.heading);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(netPoint, relPosition, longitude, latitude, offRoute, velocity, heading);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Telegram {
|
||||
|
||||
private final TelegramHdr teleHeader;
|
||||
|
@ -20,10 +22,19 @@ public class Telegram {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
String telegramString = "Telegram{";
|
||||
telegramString += teleHeader != null ? "teleHeader=" + teleHeader + '\'' : "" + '\'';
|
||||
telegramString += locationMsg != null ? ", locationMsg=" + locationMsg + '\'' : "" + '\'';
|
||||
telegramString += '}';
|
||||
return telegramString;
|
||||
return "Telegram{" + "teleHeader=" + teleHeader + ", locationMsg=" + locationMsg + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Telegram telegram = (Telegram) o;
|
||||
return teleHeader.equals(telegram.teleHeader) && locationMsg.equals(telegram.locationMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(teleHeader, locationMsg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class TelegramHdr {
|
||||
|
||||
public final static int TELEGRAM_HDR_FIELD_NO = 3;
|
||||
|
@ -7,13 +9,17 @@ public class TelegramHdr {
|
|||
private final String teleType;
|
||||
private final String teleVersion;
|
||||
private final String teleId;
|
||||
|
||||
public TelegramHdr(String teleType, String teleVersion, String teleId) {
|
||||
this.teleType = teleType;
|
||||
this.teleVersion = teleVersion;
|
||||
this.teleId = teleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TelegramHdr{" + "teleType='" + teleType + '\'' + ", teleVersion='" + teleVersion + '\'' + ", teleId='" + teleId + '\'' + '}';
|
||||
}
|
||||
|
||||
public String getTeleType() {
|
||||
return teleType;
|
||||
}
|
||||
|
@ -27,11 +33,15 @@ public class TelegramHdr {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TelegramHdr{" +
|
||||
"teleType='" + teleType + '\'' +
|
||||
", teleVersion='" + teleVersion + '\'' +
|
||||
", teleId='" + teleId + '\'' +
|
||||
'}';
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
TelegramHdr that = (TelegramHdr) o;
|
||||
return teleType.equals(that.teleType) && teleVersion.equals(that.teleVersion) && teleId.equals(that.teleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(teleType, teleVersion, teleId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package de.swingbe.ifleet.model;
|
||||
|
||||
public class Trip {
|
||||
import java.util.Objects;
|
||||
|
||||
public final static int TRIP_FIELD_NO = 8;
|
||||
public class Trip {
|
||||
|
||||
private final String blockNo;
|
||||
private final String lineNo;
|
||||
|
@ -12,10 +12,7 @@ public class Trip {
|
|||
private final String loadDegree;
|
||||
private final String destinationNo;
|
||||
private final String tripType;
|
||||
|
||||
public Trip(final String blockNo, final String lineNo, final String tripNo,
|
||||
final String routeNo, final String deviation, final String loadDegree,
|
||||
final String destinationNo, final String tripType) {
|
||||
public Trip(final String blockNo, final String lineNo, final String tripNo, final String routeNo, final String deviation, final String loadDegree, final String destinationNo, final String tripType) {
|
||||
this.blockNo = blockNo;
|
||||
this.lineNo = lineNo;
|
||||
this.tripNo = tripNo;
|
||||
|
@ -26,18 +23,22 @@ public class Trip {
|
|||
this.tripType = tripType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Trip trip = (Trip) o;
|
||||
return blockNo.equals(trip.blockNo) && lineNo.equals(trip.lineNo) && tripNo.equals(trip.tripNo) && routeNo.equals(trip.routeNo) && deviation.equals(trip.deviation) && loadDegree.equals(trip.loadDegree) && destinationNo.equals(trip.destinationNo) && tripType.equals(trip.tripType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(blockNo, lineNo, tripNo, routeNo, deviation, loadDegree, destinationNo, tripType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Trip{" +
|
||||
"blockNo='" + blockNo + '\'' +
|
||||
", lineNo='" + lineNo + '\'' +
|
||||
", tripNo='" + tripNo + '\'' +
|
||||
", routeNo='" + routeNo + '\'' +
|
||||
", deviation='" + deviation + '\'' +
|
||||
", loadDegree='" + loadDegree + '\'' +
|
||||
", destinationNo='" + destinationNo + '\'' +
|
||||
", tripType='" + tripType + '\'' +
|
||||
'}';
|
||||
return "Trip{" + "blockNo='" + blockNo + '\'' + ", lineNo='" + lineNo + '\'' + ", tripNo='" + tripNo + '\'' + ", routeNo='" + routeNo + '\'' + ", deviation='" + deviation + '\'' + ", loadDegree='" + loadDegree + '\'' + ", destinationNo='" + destinationNo + '\'' + ", tripType='" + tripType + '\'' + '}';
|
||||
}
|
||||
|
||||
public String getBlockNo() {
|
||||
|
|
|
@ -1,25 +1,30 @@
|
|||
package de.swingbe.ifleet.parser;
|
||||
|
||||
import de.swingbe.ifleet.model.Header;
|
||||
import de.swingbe.ifleet.model.Receiver;
|
||||
import de.swingbe.ifleet.model.Sender;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static de.swingbe.ifleet.utils.TelegramUtils.popField;
|
||||
|
||||
class HeaderParserImpl implements HeaderParser {
|
||||
private final static Logger LOG = LoggerFactory.getLogger(HeaderParserImpl.class);
|
||||
|
||||
HeaderParserImpl() {
|
||||
}
|
||||
|
||||
public Header parse(final String input) {
|
||||
|
||||
Sender sender;
|
||||
|
||||
//parse Sender
|
||||
sender = SenderParserFactory.createSenderParser().parse(input);
|
||||
Sender sender = SenderParserFactory.createSenderParser().parse(input);
|
||||
LOG.debug("sender: " + sender.toString());
|
||||
|
||||
//parse Receiver
|
||||
String inputPop = popField(input, 2);
|
||||
Receiver receiver = ReceiverParserFactory.createReceiverParser().parse(inputPop);
|
||||
LOG.debug("receiver: " + receiver.toString());
|
||||
|
||||
return new Header(sender, ReceiverParserFactory.createReceiverParser().parse(inputPop));
|
||||
return new Header(sender, receiver);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class SenderParserImpl implements SenderParser {
|
|||
//parse type
|
||||
String type = "";
|
||||
if (splits.length > 0) {
|
||||
type = splits[0];
|
||||
type = splits[0].replace("<", "");
|
||||
}
|
||||
|
||||
//parse id
|
||||
|
|
|
@ -13,95 +13,167 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
class TelegramParserImplTest {
|
||||
|
||||
private final Entity eSendLctMsg = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(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 <I#WOL/234#B##1#1.8#1#1501303H#280#87263783#529019052#0#420#162#29#711#1101#1101099##452#0#2#37500#0#6.>";
|
||||
private final Entity eFromStrSendLctMsg = EntityParserFactory.createEntityParser().parse(strSendLctMsg);
|
||||
|
||||
@Test
|
||||
void getDate() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "[BON", "195.30.103.89:58713]", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getDate()).isEqualTo(entity.getDate());
|
||||
assertThat(eFromStrSendLctMsg.getDate()).isEqualTo(eSendLctMsg.getDate());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTime() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "[BON", "195.30.103.89:58713]", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getTime()).isEqualTo(entity.getTime());
|
||||
assertThat(eFromStrSendLctMsg.getTime()).isEqualTo(eSendLctMsg.getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLogLevel() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "[BON", "195.30.103.89:58713]", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getLogLevel()).isEqualTo(entity.getLogLevel());
|
||||
assertThat(eFromStrSendLctMsg.getLogLevel()).isEqualTo(eSendLctMsg.getLogLevel());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getAddressPartA() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713]", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getAddressPartA()).isEqualTo(entity.getAddressPartA());
|
||||
assertThat(eFromStrSendLctMsg.getAddressPartA()).isEqualTo(eSendLctMsg.getAddressPartA());
|
||||
}
|
||||
|
||||
@Test
|
||||
void parse() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713]", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>")).isEqualTo(entity);
|
||||
assertThat(eFromStrSendLctMsg).isEqualTo(eSendLctMsg);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getAddressPartB() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getAddressPartB()).isEqualTo(entity.getAddressPartB());
|
||||
assertThat(eFromStrSendLctMsg.getAddressPartB()).isEqualTo(eSendLctMsg.getAddressPartB());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getPeer() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getPeer()).isEqualTo(entity.getPeer());
|
||||
assertThat(eFromStrSendLctMsg.getPeer()).isEqualTo(eSendLctMsg.getPeer());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getAddressNext() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getAddressNext()).isEqualTo(entity.getAddressNext());
|
||||
assertThat(eFromStrSendLctMsg.getAddressNext()).isEqualTo(eSendLctMsg.getAddressNext());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDirection() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getDirection()).isEqualTo(entity.getDirection());
|
||||
assertThat(eFromStrSendLctMsg.getDirection()).isEqualTo(eSendLctMsg.getDirection());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSenderTyp() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getCc().getHeader().getSender().getType()).isEqualTo(entity.getCc().getHeader().getSender().getType());
|
||||
assertThat(eFromStrSendLctMsg.getCc().getHeader().getSender().getType()).isEqualTo(eSendLctMsg.getCc().getHeader().getSender().getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSenderId() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getCc().getHeader().getSender().getId()).isEqualTo(entity.getCc().getHeader().getSender().getId());
|
||||
assertThat(eFromStrSendLctMsg.getCc().getHeader().getSender().getId()).isEqualTo(eSendLctMsg.getCc().getHeader().getSender().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getReceiverTyp() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "WOL/234")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getCc().getHeader().getSender().getType()).isEqualTo(entity.getCc().getHeader().getReceiver().getType());
|
||||
assertThat(eFromStrSendLctMsg.getCc().getHeader().getReceiver().getType()).isEqualTo(eSendLctMsg.getCc().getHeader().getReceiver().getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getReceiverId() {
|
||||
Entity entity = new Entity("2021-11-30", "11:24:13,438", "INFO", "BON", "195.30.103.89:58713", "(NpmTCPAcceptedChannel)", "(195.30.103.89:58713)", "sent", new Communication(new Header(new Sender("I", "WOL/234"), new Receiver("B", "")), new Telegram(new TelegramHdr("1", "1.8", "1"), new LocationMsg(new Position("1501303H", "280", "87263783", "529019052", "0", "420", "162"), "29", new Trip("711", "1101", "1101099", "", "452", "0", "2", "2")))));
|
||||
|
||||
assertThat(EntityParserFactory.createEntityParser().parse("2021-11-30 11:24:13,438 INFO " + "[BON /195.30.103.89:58713] " + "(NpmTCPAcceptedChannel) " + "(/195.30.103.89:58713) sent " + "<I#WOL/234#B##1#1.8#1#1501303H#280" + "#87263783#529019052#0#420#162#29#711#1101#" + "1101099##452#0#2#37500#0#6.>").getCc().getHeader().getSender().getId()).isEqualTo(entity.getCc().getHeader().getReceiver().getId());
|
||||
assertThat(eFromStrSendLctMsg.getCc().getHeader().getReceiver().getId()).isEqualTo(eSendLctMsg.getCc().getHeader().getReceiver().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTeleType() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getTeleHeader().getTeleType()).isEqualTo(eSendLctMsg.getCc().getTelegram().getTeleHeader().getTeleType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTeleId() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getTeleHeader().getTeleId()).isEqualTo(eSendLctMsg.getCc().getTelegram().getTeleHeader().getTeleId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTeleVersion() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getTeleHeader().getTeleVersion()).isEqualTo(eSendLctMsg.getCc().getTelegram().getTeleHeader().getTeleVersion());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDriverNumber() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getDriverNumber()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getDriverNumber());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getHeading() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getHeading()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getHeading());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRelPosition() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getRelPosition()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getRelPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLat() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getLatitude()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getLatitude());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLon() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getLongitude()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getLongitude());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getNetPoint() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getNetPoint()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getNetPoint());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOffRoute() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getOffRoute()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getOffRoute());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getVelocity() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getVelocity()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getPosition().getVelocity());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBlockNo() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getBlockNo()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getBlockNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTripNo() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getTripNo()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getTripNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTripType() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getTripType()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getTripType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDeviation() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getDeviation()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getDeviation());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDestinationNo() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getDestinationNo()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getDestinationNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLineNo() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getLineNo()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getLineNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRouteNo() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getRouteNo()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getRouteNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLoadDegree() {
|
||||
assertThat(eFromStrSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getLoadDegree()).isEqualTo(eSendLctMsg.getCc().getTelegram().getLocationMessage().getTrip().getLoadDegree());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue