@Test public void initShouldCatchUnknownHostException(@Mocked final InetAddress mockInetAddress) { try { new Expectations() { { InetAddress.getLocalHost(); result = new UnknownHostException("testException123"); } }; } catch (Exception e) { fail("Unexpected exception in expectations block: " + e); } try { new OdeProperties().initialize(); } catch (Exception e) { fail("Unexpected exception in init: " + e); } }
@PostConstruct void initialize() { String pomPropsFile = "/META-INF/maven/usdot.jpo.ode/jpo-ode-svcs/pom.properties"; try { InputStream resourceAsStream = this.getClass().getResourceAsStream(pomPropsFile); Properties properties = new Properties(); properties.load(resourceAsStream); setVersion(properties.getProperty("version")); logger.info("groupId: {}", properties.getProperty("groupId")); logger.info("artifactId: {}", properties.getProperty("artifactId")); logger.info("version: {}", version); } catch (IOException e) { logger.error("Error loading properties file " + pomPropsFile, e); } OdeMsgMetadata.setStaticSchemaVersion(OUTPUT_SCHEMA_VERSION); uploadLocations.add(Paths.get(uploadLocationRoot)); String hostname; try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { hostname = UUID.randomUUID().toString(); logger.info("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); String dockerIp = CommonUtils.getEnvironmentVariable("DOCKER_HOST_IP"); if (dockerIp == null) { logger.warn( "Neither ode.kafkaBrokers ode property nor DOCKER_HOST_IP environment variable are defined. Defaulting to localhost."); dockerIp = "localhost"; } kafkaBrokers = dockerIp + ":" + DEFAULT_KAFKA_PORT; if (securitySvcsSignatureUri == null) { securitySvcsSignatureUri = "http: + securitySvcsSignatureEndpoint; } } List<String> asList = Arrays.asList(this.getKafkaTopicsDisabled()); logger.info("Disabled Topics: {}", asList); kafkaTopicsDisabledSet.addAll(asList); }
OdeProperties implements EnvironmentAware { @PostConstruct void initialize() { String pomPropsFile = "/META-INF/maven/usdot.jpo.ode/jpo-ode-svcs/pom.properties"; try { InputStream resourceAsStream = this.getClass().getResourceAsStream(pomPropsFile); Properties properties = new Properties(); properties.load(resourceAsStream); setVersion(properties.getProperty("version")); logger.info("groupId: {}", properties.getProperty("groupId")); logger.info("artifactId: {}", properties.getProperty("artifactId")); logger.info("version: {}", version); } catch (IOException e) { logger.error("Error loading properties file " + pomPropsFile, e); } OdeMsgMetadata.setStaticSchemaVersion(OUTPUT_SCHEMA_VERSION); uploadLocations.add(Paths.get(uploadLocationRoot)); String hostname; try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { hostname = UUID.randomUUID().toString(); logger.info("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); String dockerIp = CommonUtils.getEnvironmentVariable("DOCKER_HOST_IP"); if (dockerIp == null) { logger.warn( "Neither ode.kafkaBrokers ode property nor DOCKER_HOST_IP environment variable are defined. Defaulting to localhost."); dockerIp = "localhost"; } kafkaBrokers = dockerIp + ":" + DEFAULT_KAFKA_PORT; if (securitySvcsSignatureUri == null) { securitySvcsSignatureUri = "http: + securitySvcsSignatureEndpoint; } } List<String> asList = Arrays.asList(this.getKafkaTopicsDisabled()); logger.info("Disabled Topics: {}", asList); kafkaTopicsDisabledSet.addAll(asList); } }
OdeProperties implements EnvironmentAware { @PostConstruct void initialize() { String pomPropsFile = "/META-INF/maven/usdot.jpo.ode/jpo-ode-svcs/pom.properties"; try { InputStream resourceAsStream = this.getClass().getResourceAsStream(pomPropsFile); Properties properties = new Properties(); properties.load(resourceAsStream); setVersion(properties.getProperty("version")); logger.info("groupId: {}", properties.getProperty("groupId")); logger.info("artifactId: {}", properties.getProperty("artifactId")); logger.info("version: {}", version); } catch (IOException e) { logger.error("Error loading properties file " + pomPropsFile, e); } OdeMsgMetadata.setStaticSchemaVersion(OUTPUT_SCHEMA_VERSION); uploadLocations.add(Paths.get(uploadLocationRoot)); String hostname; try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { hostname = UUID.randomUUID().toString(); logger.info("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); String dockerIp = CommonUtils.getEnvironmentVariable("DOCKER_HOST_IP"); if (dockerIp == null) { logger.warn( "Neither ode.kafkaBrokers ode property nor DOCKER_HOST_IP environment variable are defined. Defaulting to localhost."); dockerIp = "localhost"; } kafkaBrokers = dockerIp + ":" + DEFAULT_KAFKA_PORT; if (securitySvcsSignatureUri == null) { securitySvcsSignatureUri = "http: + securitySvcsSignatureEndpoint; } } List<String> asList = Arrays.asList(this.getKafkaTopicsDisabled()); logger.info("Disabled Topics: {}", asList); kafkaTopicsDisabledSet.addAll(asList); }  }
OdeProperties implements EnvironmentAware { @PostConstruct void initialize() { String pomPropsFile = "/META-INF/maven/usdot.jpo.ode/jpo-ode-svcs/pom.properties"; try { InputStream resourceAsStream = this.getClass().getResourceAsStream(pomPropsFile); Properties properties = new Properties(); properties.load(resourceAsStream); setVersion(properties.getProperty("version")); logger.info("groupId: {}", properties.getProperty("groupId")); logger.info("artifactId: {}", properties.getProperty("artifactId")); logger.info("version: {}", version); } catch (IOException e) { logger.error("Error loading properties file " + pomPropsFile, e); } OdeMsgMetadata.setStaticSchemaVersion(OUTPUT_SCHEMA_VERSION); uploadLocations.add(Paths.get(uploadLocationRoot)); String hostname; try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { hostname = UUID.randomUUID().toString(); logger.info("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); String dockerIp = CommonUtils.getEnvironmentVariable("DOCKER_HOST_IP"); if (dockerIp == null) { logger.warn( "Neither ode.kafkaBrokers ode property nor DOCKER_HOST_IP environment variable are defined. Defaulting to localhost."); dockerIp = "localhost"; } kafkaBrokers = dockerIp + ":" + DEFAULT_KAFKA_PORT; if (securitySvcsSignatureUri == null) { securitySvcsSignatureUri = "http: + securitySvcsSignatureEndpoint; } } List<String> asList = Arrays.asList(this.getKafkaTopicsDisabled()); logger.info("Disabled Topics: {}", asList); kafkaTopicsDisabledSet.addAll(asList); }  String getVersion(); void setVersion(String version); boolean dataSigningEnabled(); List<Path> getUploadLocations(); String getProperty(String key); String getProperty(String key, String defaultValue); Object getProperty(String key, int i); String getHostId(); String getPluginsLocations(); void setPluginsLocations(String pluginsLocations); String getKafkaBrokers(); void setKafkaBrokers(String kafkaBrokers); String getKafkaProducerType(); void setKafkaProducerType(String kafkaProducerType); Environment getEnv(); void setEnv(Environment env); @Override void setEnvironment(Environment environment); String getUploadLocationRoot(); String getDdsCasPassword(); void setDdsCasPassword(String ddsCasPass); int getMessagesUntilTrustReestablished(); void setMessagesUntilTrustReestablished(int messagesUntilTrustReestablished); String getCaCertPath(); void setCaCertPath(String caCertPath); String getSelfCertPath(); void setSelfCertPath(String selfCertPath); String getSelfPrivateKeyReconstructionFilePath(); void setSelfPrivateKeyReconstructionFilePath(String selfPrivateKeyReconstructionFilePath); String getSelfSigningPrivateKeyFilePath(); void setSelfSigningPrivateKeyFilePath(String selfSigningPrivateKeyFilePath); Boolean getVerboseJson(); void setVerboseJson(Boolean verboseJson); String getDdsCasUrl(); void setDdsCasUrl(String ddsCasUrl); String getDdsCasUsername(); void setDdsCasUsername(String ddsCasUsername); String getDdsWebsocketUrl(); void setDdsWebsocketUrl(String ddsWebsocketUrl); void setUploadLocationRoot(String uploadLocationRoot); int getRsuSrmSlots(); void setRsuSrmSlots(int rsuSrmSlots); int getTrustRetries(); void setTrustRetries(int trustRetries); static byte[] getJpoOdeGroupId(); int getImportProcessorBufferSize(); void setImportProcessorBufferSize(int importProcessorBufferSize); String[] getKafkaTopicsDisabled(); void setKafkaTopicsDisabled(String[] kafkaTopicsDisabled); Set<String> getKafkaTopicsDisabledSet(); void setKafkaTopicsDisabledSet(Set<String> kafkaTopicsDisabledSet); String getKafkaTopicFilteredOdeBsmJson(); void setKafkaTopicFilteredOdeBsmJson(String kafkaTopicFilteredOdeBsmJson); String getKafkaTopicOdeBsmPojo(); void setKafkaTopicOdeBsmPojo(String kafkaTopicOdeBsmPojo); String getKafkaTopicOdeBsmJson(); void setKafkaTopicOdeBsmJson(String kafkaTopicOdeBsmJson); String getKafkaTopicAsn1DecoderInput(); void setKafkaTopicAsn1DecoderInput(String kafkaTopicAsn1DecoderInput); String getKafkaTopicAsn1DecoderOutput(); void setKafkaTopicAsn1DecoderOutput(String kafkaTopicAsn1DecoderOutput); String getKafkaTopicAsn1EncoderInput(); void setKafkaTopicAsn1EncoderInput(String kafkaTopicAsn1EncoderInput); String getKafkaTopicAsn1EncoderOutput(); void setKafkaTopicAsn1EncoderOutput(String kafkaTopicAsn1EncoderOutput); String getKafkaTopicOdeDNMsgJson(); void setKafkaTopicOdeDNMsgJson(String kafkaTopicOdeDNMsgJson); String getKafkaTopicOdeTimJson(); void setKafkaTopicOdeTimJson(String kafkaTopicOdeTimJson); String getUploadLocationObuLog(); void setUploadLocationObuLog(String uploadLocationObuLog); String getKafkaTopicOdeBsmDuringEventPojo(); void setKafkaTopicOdeBsmDuringEventPojo(String kafkaTopicOdeBsmDuringEventPojo); String getKafkaTopicOdeBsmRxPojo(); void setKafkaTopicOdeBsmRxPojo(String kafkaTopicOdeBsmRxPojo); String getKafkaTopicOdeBsmTxPojo(); void setKafkaTopicOdeBsmTxPojo(String kafkaTopicOdeBsmTxPojo); String getKafkaTopicOdeTimRxJson(); void setKafkaTopicOdeTimRxJson(String kafkaTopicOdeTimRxJson); String getKafkaTopicOdeTimBroadcastPojo(); void setKafkaTopicOdeTimBroadcastPojo(String kafkaTopicOdeTimBroadcastPojo); String getKafkaTopicOdeTimBroadcastJson(); void setKafkaTopicOdeTimBroadcastJson(String kafkaTopicOdeTimBroadcastJson); String getKafkaTopicJ2735TimBroadcastJson(); void setKafkaTopicJ2735TimBroadcastJson(String kafkaTopicJ2735TimBroadcastJson); String getKafkaTopicFilteredOdeTimJson(); void setKafkaTopicFilteredOdeTimJson(String kafkaTopicFilteredOdeTimJson); String getKafkaTopicDriverAlertJson(); void setKafkaTopicDriverAlertJson(String kafkaTopicDriverAlertJson); Integer getFileWatcherPeriod(); void setFileWatcherPeriod(Integer fileWatcherPeriod); String getSecuritySvcsSignatureUri(); void setSecuritySvcsSignatureUri(String securitySvcsSignatureUri); String getRsuUsername(); void setRsuUsername(String rsuUsername); String getRsuPassword(); void setRsuPassword(String rsuPassword); String getKafkaTopicSdwDepositorInput(); void setKafkaTopicSdwDepositorInput(String kafkaTopicSdwDepositorInput); boolean shouldDepositSdwMessagesOverWebsocket(); void setDepositSdwMessagesOverWebsocket(boolean depositSdwMessagesOverWebsocket); }
OdeProperties implements EnvironmentAware { @PostConstruct void initialize() { String pomPropsFile = "/META-INF/maven/usdot.jpo.ode/jpo-ode-svcs/pom.properties"; try { InputStream resourceAsStream = this.getClass().getResourceAsStream(pomPropsFile); Properties properties = new Properties(); properties.load(resourceAsStream); setVersion(properties.getProperty("version")); logger.info("groupId: {}", properties.getProperty("groupId")); logger.info("artifactId: {}", properties.getProperty("artifactId")); logger.info("version: {}", version); } catch (IOException e) { logger.error("Error loading properties file " + pomPropsFile, e); } OdeMsgMetadata.setStaticSchemaVersion(OUTPUT_SCHEMA_VERSION); uploadLocations.add(Paths.get(uploadLocationRoot)); String hostname; try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { hostname = UUID.randomUUID().toString(); logger.info("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); String dockerIp = CommonUtils.getEnvironmentVariable("DOCKER_HOST_IP"); if (dockerIp == null) { logger.warn( "Neither ode.kafkaBrokers ode property nor DOCKER_HOST_IP environment variable are defined. Defaulting to localhost."); dockerIp = "localhost"; } kafkaBrokers = dockerIp + ":" + DEFAULT_KAFKA_PORT; if (securitySvcsSignatureUri == null) { securitySvcsSignatureUri = "http: + securitySvcsSignatureEndpoint; } } List<String> asList = Arrays.asList(this.getKafkaTopicsDisabled()); logger.info("Disabled Topics: {}", asList); kafkaTopicsDisabledSet.addAll(asList); }  String getVersion(); void setVersion(String version); boolean dataSigningEnabled(); List<Path> getUploadLocations(); String getProperty(String key); String getProperty(String key, String defaultValue); Object getProperty(String key, int i); String getHostId(); String getPluginsLocations(); void setPluginsLocations(String pluginsLocations); String getKafkaBrokers(); void setKafkaBrokers(String kafkaBrokers); String getKafkaProducerType(); void setKafkaProducerType(String kafkaProducerType); Environment getEnv(); void setEnv(Environment env); @Override void setEnvironment(Environment environment); String getUploadLocationRoot(); String getDdsCasPassword(); void setDdsCasPassword(String ddsCasPass); int getMessagesUntilTrustReestablished(); void setMessagesUntilTrustReestablished(int messagesUntilTrustReestablished); String getCaCertPath(); void setCaCertPath(String caCertPath); String getSelfCertPath(); void setSelfCertPath(String selfCertPath); String getSelfPrivateKeyReconstructionFilePath(); void setSelfPrivateKeyReconstructionFilePath(String selfPrivateKeyReconstructionFilePath); String getSelfSigningPrivateKeyFilePath(); void setSelfSigningPrivateKeyFilePath(String selfSigningPrivateKeyFilePath); Boolean getVerboseJson(); void setVerboseJson(Boolean verboseJson); String getDdsCasUrl(); void setDdsCasUrl(String ddsCasUrl); String getDdsCasUsername(); void setDdsCasUsername(String ddsCasUsername); String getDdsWebsocketUrl(); void setDdsWebsocketUrl(String ddsWebsocketUrl); void setUploadLocationRoot(String uploadLocationRoot); int getRsuSrmSlots(); void setRsuSrmSlots(int rsuSrmSlots); int getTrustRetries(); void setTrustRetries(int trustRetries); static byte[] getJpoOdeGroupId(); int getImportProcessorBufferSize(); void setImportProcessorBufferSize(int importProcessorBufferSize); String[] getKafkaTopicsDisabled(); void setKafkaTopicsDisabled(String[] kafkaTopicsDisabled); Set<String> getKafkaTopicsDisabledSet(); void setKafkaTopicsDisabledSet(Set<String> kafkaTopicsDisabledSet); String getKafkaTopicFilteredOdeBsmJson(); void setKafkaTopicFilteredOdeBsmJson(String kafkaTopicFilteredOdeBsmJson); String getKafkaTopicOdeBsmPojo(); void setKafkaTopicOdeBsmPojo(String kafkaTopicOdeBsmPojo); String getKafkaTopicOdeBsmJson(); void setKafkaTopicOdeBsmJson(String kafkaTopicOdeBsmJson); String getKafkaTopicAsn1DecoderInput(); void setKafkaTopicAsn1DecoderInput(String kafkaTopicAsn1DecoderInput); String getKafkaTopicAsn1DecoderOutput(); void setKafkaTopicAsn1DecoderOutput(String kafkaTopicAsn1DecoderOutput); String getKafkaTopicAsn1EncoderInput(); void setKafkaTopicAsn1EncoderInput(String kafkaTopicAsn1EncoderInput); String getKafkaTopicAsn1EncoderOutput(); void setKafkaTopicAsn1EncoderOutput(String kafkaTopicAsn1EncoderOutput); String getKafkaTopicOdeDNMsgJson(); void setKafkaTopicOdeDNMsgJson(String kafkaTopicOdeDNMsgJson); String getKafkaTopicOdeTimJson(); void setKafkaTopicOdeTimJson(String kafkaTopicOdeTimJson); String getUploadLocationObuLog(); void setUploadLocationObuLog(String uploadLocationObuLog); String getKafkaTopicOdeBsmDuringEventPojo(); void setKafkaTopicOdeBsmDuringEventPojo(String kafkaTopicOdeBsmDuringEventPojo); String getKafkaTopicOdeBsmRxPojo(); void setKafkaTopicOdeBsmRxPojo(String kafkaTopicOdeBsmRxPojo); String getKafkaTopicOdeBsmTxPojo(); void setKafkaTopicOdeBsmTxPojo(String kafkaTopicOdeBsmTxPojo); String getKafkaTopicOdeTimRxJson(); void setKafkaTopicOdeTimRxJson(String kafkaTopicOdeTimRxJson); String getKafkaTopicOdeTimBroadcastPojo(); void setKafkaTopicOdeTimBroadcastPojo(String kafkaTopicOdeTimBroadcastPojo); String getKafkaTopicOdeTimBroadcastJson(); void setKafkaTopicOdeTimBroadcastJson(String kafkaTopicOdeTimBroadcastJson); String getKafkaTopicJ2735TimBroadcastJson(); void setKafkaTopicJ2735TimBroadcastJson(String kafkaTopicJ2735TimBroadcastJson); String getKafkaTopicFilteredOdeTimJson(); void setKafkaTopicFilteredOdeTimJson(String kafkaTopicFilteredOdeTimJson); String getKafkaTopicDriverAlertJson(); void setKafkaTopicDriverAlertJson(String kafkaTopicDriverAlertJson); Integer getFileWatcherPeriod(); void setFileWatcherPeriod(Integer fileWatcherPeriod); String getSecuritySvcsSignatureUri(); void setSecuritySvcsSignatureUri(String securitySvcsSignatureUri); String getRsuUsername(); void setRsuUsername(String rsuUsername); String getRsuPassword(); void setRsuPassword(String rsuPassword); String getKafkaTopicSdwDepositorInput(); void setKafkaTopicSdwDepositorInput(String kafkaTopicSdwDepositorInput); boolean shouldDepositSdwMessagesOverWebsocket(); void setDepositSdwMessagesOverWebsocket(boolean depositSdwMessagesOverWebsocket); static final int OUTPUT_SCHEMA_VERSION; }