Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into readme-update
Browse files Browse the repository at this point in the history
  • Loading branch information
drewjj committed Jun 27, 2023
2 parents 720152d + 2e64568 commit a7ca783
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private String getTicketGrantingTicket(String server, String username,
try {
httpClient.close();
} catch (HttpException e) {
logger.warn(http, e);
logger.error(http, e);
}
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ private String getServiceTicket(String server, String ticketGrantingTicket,
try {
httpClient.close();
} catch (HttpException e) {
logger.warn(http, e);
logger.error(http, e);
}
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ private String getServiceCall(String service, String serviceTicket)
try {
httpClient.close();
} catch (HttpException e) {
logger.warn(http, e);
logger.error(http, e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void loadAllClasses(File file) throws OdePluginException {
try {
loader.close();
} catch (IOException e) {
logger.debug("Error closing URLClassLoader: {}", e);
logger.error("Error closing URLClassLoader: {}", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public static long translateISOTimeStampToMinuteOfYear(String isoTime) {
startMinute = (int) Duration.between(DateTimeUtils.isoDateTime(startYear, 1, 1, 0, 0, 0, 0), zDateTime)
.toMinutes();
} catch (Exception e) { // NOSONAR
logger.warn("Failed to parse datetime {}, defaulting to unknown value {}", isoTime, startMinute);
logger.error("Failed to parse datetime {}, defaulting to unknown value {}", isoTime, startMinute);
}

return startMinute;
Expand All @@ -277,7 +277,7 @@ public static void replaceDataFrameTimestamp(ObjectNode dataFrame) {
startMinute = (int) ChronoUnit.MINUTES.between(DateTimeUtils.isoDateTime(startYear, 1, 1, 0, 0, 0, 0),
zDateTime);
} catch (Exception e) {
logger.warn("Failed to startDateTime {}, defaulting to unknown value {}.", startDateTime, startMinute);
logger.error("Failed to startDateTime {}, defaulting to unknown value {}.", startDateTime, startMinute);
}

dataFrame.put("startYear", startYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ void initialize() {
} catch (UnknownHostException e) {
// Let's just use a random hostname
hostname = UUID.randomUUID().toString();
logger.info("Unknown host error: {}, using random", e);
logger.error("Unknown host error: {}, using random", e);
}
hostId = hostname;
logger.info("Host ID: {}", hostId);
EventLogger.logger.info("Initializing services on host {}", hostId);

if (kafkaBrokers == null) {

logger.info("ode.kafkaBrokers property not defined. Will try DOCKER_HOST_IP => {}", kafkaBrokers);
logger.warn("ode.kafkaBrokers property not defined. Will try DOCKER_HOST_IP => {}", kafkaBrokers);

String dockerIp = CommonUtils.getEnvironmentVariable("DOCKER_HOST_IP");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private RsuSnmp() {
public static String sendSnmpV3Request(String ip, String oid, Snmp snmp, String username) {

if (ip == null || oid == null || snmp == null) {
logger.debug("Invalid SNMP request parameter");
logger.warn("Invalid SNMP request parameter");
throw new IllegalArgumentException("Invalid SNMP request parameter");
}

Expand Down Expand Up @@ -68,16 +68,16 @@ public static String sendSnmpV3Request(String ip, String oid, Snmp snmp, String
snmp.close();
} catch (Exception e) {
responseEvent = null;
logger.debug("SNMP4J library exception", e);
logger.error("SNMP4J library exception", e);
}

// Interpret snmp response
String stringResponse;
if (responseEvent == null) {
logger.debug("SNMP connection error");
logger.error("SNMP connection error");
stringResponse = "[ERROR] SNMP connection error";
} else if (responseEvent.getResponse() == null) {
logger.debug("Empty SNMP response");
logger.error("Empty SNMP response");
stringResponse = "[ERROR] Empty SNMP response";
} else {
stringResponse = responseEvent.getResponse().getVariableBindings().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public Resource loadAsResource(String filename) {
@Override
public void deleteAll() {
FileSystemUtils.deleteRecursively(rootLocation.toFile());
EventLogger.logger.error("Deleting {}", this.rootLocation);
EventLogger.logger.info("Deleting {}", this.rootLocation);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ public void run() {
public byte[] removeHeader(byte[] packet) {
String hexPacket = HexUtils.toHexString(packet);

// logger.debug("BSM packet length: {}, start index: {}",
// hexPacket.length(), startIndex);

int startIndex = hexPacket.indexOf(BSM_START_FLAG);
if (startIndex == 0) {
logger.debug("Message is raw BSM with no headers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ public void run() {
public byte[] removeHeader(byte[] packet) {
String hexPacket = HexUtils.toHexString(packet);

// logger.debug("MAP packet: {}", hexPacket);

int startIndex = hexPacket.indexOf(MAP_START_FLAG);
if (startIndex == 0) {
logger.debug("Message is raw MAP with no headers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ public void run() {
public byte[] removeHeader(byte[] packet) {
String hexPacket = HexUtils.toHexString(packet);

//logger.debug("SPAT packet: {}", hexPacket);

int startIndex = hexPacket.indexOf(SPAT_START_FLAG);
if (startIndex == 0) {
logger.debug("Message is raw SPAT with no headers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ public void run() {
public byte[] removeHeader(byte[] packet) {
String hexPacket = HexUtils.toHexString(packet);

//logger.debug("SRM packet: {}", hexPacket);

int startIndex = hexPacket.indexOf(SRM_START_FLAG);
if (startIndex == 0) {
logger.debug("Message is raw SRM with no headers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ public void run() {
public byte[] removeHeader(byte[] packet) {
String hexPacket = HexUtils.toHexString(packet);

//logger.debug("SSM packet: {}", hexPacket);

int startIndex = hexPacket.indexOf(SSM_START_FLAG);
if (startIndex == 0) {
logger.debug("Message is raw SSM with no headers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ public void run() {
public byte[] removeHeader(byte[] packet) {
String hexPacket = HexUtils.toHexString(packet);

//logger.debug("TIM packet: {}", hexPacket);

int startIndex = hexPacket.indexOf(TIM_START_FLAG);
if (startIndex == 0) {
logger.info("Message is raw TIM with no headers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void emptyRequestShouldReturnEmptyError() {

@Test
public void invalidJsonSyntaxShouldReturnJsonSyntaxError() {
ResponseEntity<String> actualResponse = testTimDepositController.postTim("{\"invalid\":\"json\"}}");
ResponseEntity<String> actualResponse = testTimDepositController.postTim("{\"in\"va}}}on\"}}");
assertEquals("{\"error\":\"Malformed or non-compliant JSON syntax.\"}", actualResponse.getBody());
}

Expand Down Expand Up @@ -160,4 +160,11 @@ public void testSuccessfulMessageReturnsSuccessMessagePut(@Capturing TimTransmog
assertEquals("{\"success\":\"true\"}", actualResponse.getBody());
}

@Test
public void testDepositingTimWithExtraProperties(@Capturing TimTransmogrifier capturingTimTransmogrifier, @Capturing XmlUtils capturingXmlUtils) {
String timToSubmit = "{\"request\":{\"rsus\":[],\"snmp\":{},\"randomProp1\":true,\"randomProp2\":\"hello world\"},\"tim\":{\"msgCnt\":\"13\",\"timeStamp\":\"2017-03-13T01:07:11-05:00\",\"randomProp3\":123,\"randomProp4\":{\"nestedProp1\":\"foo\",\"nestedProp2\":\"bar\"}}}";
ResponseEntity<String> actualResponse = testTimDepositController.postTim(timToSubmit);
assertEquals("{\"success\":\"true\"}", actualResponse.getBody());
}

}

0 comments on commit a7ca783

Please sign in to comment.