From 41d3bf642271d4579e51261350c265410f4073e1 Mon Sep 17 00:00:00 2001 From: john-wiens Date: Thu, 8 Aug 2024 14:06:20 -0600 Subject: [PATCH 1/3] Removing extraneous print statements --- .../java/us/dot/its/jpo/ode/api/APIServiceController.java | 2 -- .../main/java/us/dot/its/jpo/ode/api/ReportBuilder.java | 2 -- .../ActiveNotificationRepositoryImpl.java | 1 - .../java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java | 6 +++--- .../api/converters/StringToZonedDateTimeConverter.java | 1 - .../ode/api/keycloak/config/KeycloakNoSecurityConfig.java | 2 -- .../ode/api/keycloak/config/KeycloakSecurityConfig.java | 2 -- .../jpo/ode/api/keycloak/config/MethodSecurityConfig.java | 1 - .../jpo/ode/api/keycloak/support/AccessController.java | 5 ----- .../api/keycloak/support/DefaultPermissionEvaluator.java | 2 -- .../support/KeycloakJwtAuthenticationConverter.java | 1 - .../java/us/dot/its/jpo/ode/api/models/EmailSettings.java | 2 +- .../dot/its/jpo/ode/api/models/UserCreationRequest.java | 1 - .../us/dot/its/jpo/ode/api/services/EmailService.java | 8 -------- .../us/dot/its/jpo/ode/mockdata/MockBsmGenerator.java | 2 -- .../us/dot/its/jpo/ode/mockdata/MockMapGenerator.java | 4 ---- .../us/dot/its/jpo/ode/mockdata/MockSpatGenerator.java | 4 ---- .../us/dot/its/jpo/ode/mockdata/MockSrmGenerator.java | 2 -- .../us/dot/its/jpo/ode/mockdata/MockSsmGenerator.java | 2 -- .../us/dot/its/jpo/ode/mockdata/MockTimGenerator.java | 2 -- .../src/test/java/us/dot/its/jpo/ode/api/ConfigTest.java | 3 --- .../its/jpo/ode/api/decoderTests/SpatDecoderTests.java | 1 - .../dot/its/jpo/ode/api/decoderTests/SsmDecoderTests.java | 3 --- .../dot/its/jpo/ode/api/decoderTests/TimDecoderTests.java | 1 - 24 files changed, 4 insertions(+), 56 deletions(-) diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/APIServiceController.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/APIServiceController.java index 440e58b9..2f63c43f 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/APIServiceController.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/APIServiceController.java @@ -130,8 +130,6 @@ public APIServiceController( try { logger.info("Starting {}", this.getClass().getSimpleName()); - - System.out.println("Controller is Null" + stompController != null); SpatSocketForwardTopology spatSocketForwardTopology = new SpatSocketForwardTopology( "topic.ProcessedSpat", diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java index 4baea002..47f2159d 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java @@ -299,7 +299,6 @@ public void addSpatBroadcastRateDistribution(List data, Long startTime, for(IDCount elem : data){ int index = Integer.parseInt(elem.getId()) / 10; output.get(index).setCount(elem.getCount()); - System.out.println(elem); } // Convert to Chart Data and generate graph @@ -348,7 +347,6 @@ public void addMapBroadcastRateDistribution(List data, Long startTime, for(IDCount elem : data){ int index = Integer.parseInt(elem.getId()); output.get(index).setCount(elem.getCount()); - System.out.println(elem); } // Convert to Chart Data and generate graph diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java index 407e68be..9ea1cb2f 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java @@ -43,7 +43,6 @@ public Query getQuery(Integer intersectionID, Integer roadRegulatorID, String no } if(key != null){ - System.out.println(key); query.addCriteria(Criteria.where("key").is(key)); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java index 8ac7603c..2b4bc510 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java @@ -220,14 +220,14 @@ public static EncodedMessage identifyAsn1(String hexPacket){ public static String decodeXmlWithAcm(String xmlMessage) throws Exception { - System.out.println("Decoding Message: " + xmlMessage); + log.info("Decoding Message: " + xmlMessage); log.info("Decoding message: {}", xmlMessage); // Save XML to temp file String tempDir = FileUtils.getTempDirectoryPath(); String tempFileName = "asn1-codec-java-" + UUID.randomUUID().toString() + ".xml"; log.info("Temp file name: {}", tempFileName); - System.out.println("Temp File Name: " + tempFileName); + log.info("Temp File Name: " + tempFileName); Path tempFilePath = Path.of(tempDir, tempFileName); File tempFile = new File(tempFilePath.toString()); FileUtils.writeStringToFile(tempFile, xmlMessage, StandardCharsets.UTF_8); @@ -239,7 +239,7 @@ public static String decodeXmlWithAcm(String xmlMessage) throws Exception { Process process = pb.start(); String result = IOUtils.toString(process.getInputStream(), StandardCharsets.UTF_8); log.info("Result: {}", result); - System.out.println("Decode Result: " + result); + log.info("Decode Result: " + result); // Clean up temp file tempFile.delete(); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java index dc42ed05..eab79ec3 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java @@ -35,7 +35,6 @@ public ZonedDateTime convert(@NonNull String source) { // Block of code to handle errors } } - System.out.println("Unable to Parse the following source time: "+ source); return ZonedDateTime.of(0, 0, 0, 0, 0, 0, 0, null); } } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakNoSecurityConfig.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakNoSecurityConfig.java index 802d98e4..2c81bb5b 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakNoSecurityConfig.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakNoSecurityConfig.java @@ -30,8 +30,6 @@ public class KeycloakNoSecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { - - System.out.println("Running without KeyCloak Authentication"); return httpSecurity .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .cors(corsConfigurer -> CorsUtil.configureCors(corsConfigurer, properties)) diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java index 897caa72..ed6d4b00 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java @@ -35,8 +35,6 @@ public class KeycloakSecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { - System.out.println("Running with KeyCloak Authentication"); - return httpSecurity .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .cors(corsConfigurer -> CorsUtil.configureCors(corsConfigurer, properties)) diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java index d49bf0a8..20f7efe0 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java @@ -34,7 +34,6 @@ class MethodSecurityConfig { public MethodSecurityConfig(PermissionEvaluator permissionEvaluator, ApplicationContext applicationContext) { this.applicationContext = applicationContext; this.permissionEvaluator = permissionEvaluator; - System.out.println("Method-level security annotations are enabled"); } @Bean diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/AccessController.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/AccessController.java index 52a8e3f2..47651649 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/AccessController.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/AccessController.java @@ -20,11 +20,6 @@ public static AuthorizationDecision checkAccess(Supplier authent var auth = authentication.get(); - System.out.printf("Check access for username=%s path=%s%n", auth.getName(), requestContext.getRequest().getRequestURI()); - System.out.printf("Authorities: %s%n", auth.getAuthorities()); - System.out.printf("Is authenticated: %s%n", auth.isAuthenticated()); - System.out.printf("Details: %s%n", auth.getDetails()); - return auth.isAuthenticated() ? GRANTED : DENIED; } } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/DefaultPermissionEvaluator.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/DefaultPermissionEvaluator.java index 5bee1f52..03cba8a1 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/DefaultPermissionEvaluator.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/DefaultPermissionEvaluator.java @@ -16,8 +16,6 @@ class DefaultPermissionEvaluator implements PermissionEvaluator { @Override public boolean hasPermission(Authentication auth, Object targetDomainObject, Object permission) { - System.out.printf("check permission user=%s target=%s permission=%s%n", auth.getName(), targetDomainObject, permission); - return true; } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/KeycloakJwtAuthenticationConverter.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/KeycloakJwtAuthenticationConverter.java index 16dec044..d42225de 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/KeycloakJwtAuthenticationConverter.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/support/KeycloakJwtAuthenticationConverter.java @@ -30,7 +30,6 @@ public JwtAuthenticationToken convert(Jwt jwt) { String username = getUsernameFrom(jwt); var token = new JwtAuthenticationToken(jwt, authorities, username); - System.out.printf("KeycloakJwtAuthenticationConverter: Converted token: %s%n Authorities: %s%n Username: %s%n", token, authorities, username); return token; } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java index 91cff507..590ea44c 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java @@ -50,7 +50,7 @@ public static EmailSettings fromAttributes(Map> attributes) } - System.out.println("No Settings found Returning Default"); + logger.info("No Settings found Returning Default"); return new EmailSettings(); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/UserCreationRequest.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/UserCreationRequest.java index ec495cec..7eb2d587 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/UserCreationRequest.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/UserCreationRequest.java @@ -51,7 +51,6 @@ public String toString() { try { testReturn = (mapper.writeValueAsString(this)); } catch (JsonProcessingException e) { - System.out.println(e); } return testReturn; } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/EmailService.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/EmailService.java index ac1c6bc7..a220f1dd 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/EmailService.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/EmailService.java @@ -70,9 +70,7 @@ public void sendEmailViaSendGrid(String to, String subject, String text) { request.setEndpoint("mail/send"); request.setBody(mail.build()); Response response = this.sendGrid.api(request); - System.out.println("Message Sent via Sendgrid to:" + to); } catch (IOException ex) { - System.out.println(ex); } } @@ -87,9 +85,7 @@ public void sendEmailViaPostmark(String to, String subject, String text){ htmlText); try { postmark.deliverMessage(message); - System.out.println("Message Sent via Postmark to:" + to); } catch (PostmarkException | IOException e) { - System.out.println("Unable to send message" + e); } } @@ -99,13 +95,11 @@ public void sendEmailViaSpringMail(String to, String subject, String text){ message.setSubject(subject); message.setText(text); mailSender.send(message); - System.out.println("Message Sent Via SMTP to: " + to); } public void sendSimpleMessage(String to, String subject, String text) { - System.out.println("Sending Simple Message"); if(props.getEmailBroker().equals("sendgrid")){ sendEmailViaSendGrid(to, subject, text); }else if (props.getEmailBroker().equals("postmark")){ @@ -217,8 +211,6 @@ public List getEmailList(List notificationTypes, Lis } - System.out.println("Returning" + emailList.size() + "Users"); - return emailList; } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockBsmGenerator.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockBsmGenerator.java index 9e4abea6..72d4f1dc 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockBsmGenerator.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockBsmGenerator.java @@ -26,10 +26,8 @@ public static List getJsonBsms(){ OdeBsmData bsm = objectMapper.readValue(bsmString, OdeBsmData.class); bsms.add(bsm); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked BSM."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked BSM."); e.printStackTrace(); } return bsms; diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockMapGenerator.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockMapGenerator.java index 5529b4c8..f4a43e7c 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockMapGenerator.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockMapGenerator.java @@ -32,10 +32,8 @@ public static List> getProcessedMaps(){ ProcessedMap map = objectMapper.readValue(processedMapString, typeReference); maps.add(map); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked map."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked map."); e.printStackTrace(); } return maps; @@ -51,10 +49,8 @@ public static List getJsonMaps(){ OdeMapData map = objectMapper.readValue(mapString, OdeMapData.class); maps.add(map); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked map."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked map."); e.printStackTrace(); } return maps; diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSpatGenerator.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSpatGenerator.java index e5676580..77a0ad69 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSpatGenerator.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSpatGenerator.java @@ -24,10 +24,8 @@ public static List getProcessedSpats(){ ProcessedSpat spat = objectMapper.readValue(processedSpatString, ProcessedSpat.class); spats.add(spat); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked spat."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked spat."); e.printStackTrace(); } return spats; @@ -43,10 +41,8 @@ public static List getJsonSpats(){ OdeSpatData spat = objectMapper.readValue(spatString, OdeSpatData.class); spats.add(spat); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked spat."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked spat."); e.printStackTrace(); } return spats; diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSrmGenerator.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSrmGenerator.java index 87a3cca8..130d7db1 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSrmGenerator.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSrmGenerator.java @@ -23,10 +23,8 @@ public static List getJsonSrms(){ OdeSrmData srm = objectMapper.readValue(srmString, OdeSrmData.class); srms.add(srm); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked srm."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked srm."); e.printStackTrace(); } return srms; diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSsmGenerator.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSsmGenerator.java index 5ebe61a6..81774292 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSsmGenerator.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockSsmGenerator.java @@ -23,10 +23,8 @@ public static List getJsonSsms(){ OdeSsmData ssm = objectMapper.readValue(ssmString, OdeSsmData.class); ssms.add(ssm); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked ssm."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked ssm."); e.printStackTrace(); } return ssms; diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockTimGenerator.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockTimGenerator.java index 9aabcca1..d139f1f3 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockTimGenerator.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockTimGenerator.java @@ -23,10 +23,8 @@ public static List getJsonTims(){ ObjectNode tim = objectMapper.readValue(timString, ObjectNode.class); tims.add(tim); } catch (JsonMappingException e) { - System.out.println("A Json Mapping Exception Occurred while trying to get data from mocked tim."); e.printStackTrace(); } catch (JsonProcessingException e) { - System.out.println("A Json Processing Exception Occurred while trying to get data from a mocked tim."); e.printStackTrace(); } return tims; diff --git a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/ConfigTest.java b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/ConfigTest.java index a99d7c69..3bf1dcb1 100644 --- a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/ConfigTest.java +++ b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/ConfigTest.java @@ -111,9 +111,6 @@ // // List responseMap = responseEntity.getBody(); -// // System.out.println(responseMap.size()); -// // System.out.println(responseMap.get(0)); - // // assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); // // assertEquals(MediaType.APPLICATION_JSON, responseEntity.getHeaders().getContentType()); // // assertEquals(test, responseMap.get(0)); diff --git a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SpatDecoderTests.java b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SpatDecoderTests.java index f439c859..5179a5d0 100644 --- a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SpatDecoderTests.java +++ b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SpatDecoderTests.java @@ -54,7 +54,6 @@ public void testSpatGetAsOdeData() { @Test public void testSpatGetAsOdeJson() throws XmlUtilsException{ OdeSpatData spat = spatDecoder.getAsOdeJson(odeSpatDecodedXmlReference); - System.out.println("testSpatGetAsOdeJson" + spat); assertEquals(spat.toJson(), odeSpatDecodedDataReference); } diff --git a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SsmDecoderTests.java b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SsmDecoderTests.java index 6488fd5c..66cbff4b 100644 --- a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SsmDecoderTests.java +++ b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/SsmDecoderTests.java @@ -38,8 +38,6 @@ public void testSsmGetAsOdeData() { OdeData data = ssmDecoder.getAsOdeData(ssm.getAsn1Text()); OdeMsgMetadata metadata = data.getMetadata(); - - System.out.println(data); // Copy over fields that might be different metadata.setOdeReceivedAt("2024-05-14T23:01:21.516531700Z"); metadata.setSerialId(metadata.getSerialId().setStreamId("fc430f29-b761-4a2c-90fb-dc4c9f5d4e9c")); @@ -52,7 +50,6 @@ public void testSsmGetAsOdeData() { public void testSsmGetAsOdeJson() throws XmlUtilsException{ OdeSsmData ssm = ssmDecoder.getAsOdeJson(odeSsmDecodedXmlReference); assertEquals(ssm.toJson(), odeSsmDecodedDataReference); - System.out.println(ssm); } } diff --git a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/TimDecoderTests.java b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/TimDecoderTests.java index 1be98e6d..c4428a11 100644 --- a/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/TimDecoderTests.java +++ b/api/jpo-conflictvisualizer-api/src/test/java/us/dot/its/jpo/ode/api/decoderTests/TimDecoderTests.java @@ -33,7 +33,6 @@ public void testTimGetAsOdeData() { OdeMsgMetadata metadata = data.getMetadata(); - System.out.println(data); // Copy over fields that might be different metadata.setOdeReceivedAt("2024-05-14T23:01:21.516531700Z"); metadata.setSerialId(metadata.getSerialId().setStreamId("fc430f29-b761-4a2c-90fb-dc4c9f5d4e9c")); From 87ddc5edeb2e8b840fb6a7257e71edfa09f5837f Mon Sep 17 00:00:00 2001 From: John-Wiens Date: Wed, 23 Oct 2024 11:32:23 -0600 Subject: [PATCH 2/3] Added zstd compression to conflict visualizer api --- .../us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java index 71e76f08..12efc189 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java @@ -380,7 +380,10 @@ public Properties createStreamProperties(String name) { streamProps.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, FIVE_MINUTES_MS); // Disable batching - streamProps.put(ProducerConfig.BATCH_SIZE_CONFIG, 0); + // streamProps.put(ProducerConfig.BATCH_SIZE_CONFIG, 0); + + streamProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "zstd"); + streamProps.put(ProducerConfig.LINGER_MS_CONFIG, 50); if (confluentCloudEnabled) { streamProps.put("ssl.endpoint.identification.algorithm", "https"); From 9ebbb39be4751fb4d7288e26a20c334b65e4d596 Mon Sep 17 00:00:00 2001 From: john-wiens Date: Wed, 23 Oct 2024 15:31:12 -0600 Subject: [PATCH 3/3] Added configurable linger time to Conflict Visualizer --- .../ode/api/ConflictMonitorApiProperties.java | 16 ++++++++++++++-- .../src/main/resources/application.yaml | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java index 12efc189..1e077702 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java @@ -98,7 +98,7 @@ public class ConflictMonitorApiProperties { private String securitySvcsSignatureEndpoint = "sign"; - + private int lingerMs = 0; @Autowired @@ -185,6 +185,15 @@ public void setKafkaBrokers(String kafkaBrokers) { this.kafkaBrokers = kafkaBrokers; } + @Value("${kafka.linger_ms}") + public void setKafkaLingerMs(int lingerMs) { + this.lingerMs = lingerMs; + } + + public int getKafkaLingerMs() { + return lingerMs; + } + public String getKafkaProducerType() { return kafkaProducerType; } @@ -257,6 +266,8 @@ public void setKafkaTopicsDisabledSet(Set kafkaTopicsDisabledSet) { this.kafkaTopicsDisabledSet = kafkaTopicsDisabledSet; } + + @Bean public ObjectMapper defaultMapper() { @@ -383,7 +394,8 @@ public Properties createStreamProperties(String name) { // streamProps.put(ProducerConfig.BATCH_SIZE_CONFIG, 0); streamProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "zstd"); - streamProps.put(ProducerConfig.LINGER_MS_CONFIG, 50); + streamProps.put(ProducerConfig.LINGER_MS_CONFIG, getKafkaLingerMs()); + if (confluentCloudEnabled) { streamProps.put("ssl.endpoint.identification.algorithm", "https"); diff --git a/api/jpo-conflictvisualizer-api/src/main/resources/application.yaml b/api/jpo-conflictvisualizer-api/src/main/resources/application.yaml index 51041b7f..0da0937d 100644 --- a/api/jpo-conflictvisualizer-api/src/main/resources/application.yaml +++ b/api/jpo-conflictvisualizer-api/src/main/resources/application.yaml @@ -21,6 +21,10 @@ schema.bsm: classpath:schemas/bsm.schema.json schema.map: classpath:schemas/map.schema.json schema.spat: classpath:schemas/spat.schema.json + +# Amount of time to wait to try and increase batching +kafka.linger_ms: 50 + kafka.topics: autoCreateTopics: false numPartitions: 1