test_class.file: optaweb-vehicle-routing-backend/src/test/java/org/optaweb/vehiclerouting/plugin/routing/RoutingConfigTest.java
test_class.identifier: RoutingConfigTest
test_case.body: @Test
      void should_throw_exception_when_url_is_malformed() {
          Path osmFile = Mockito.mock(Path.class);
          String malformedUrl = "x+y";
          assertThatExceptionOfType(RoutingEngineException.class)
                  .isThrownBy(() -> RoutingConfig.downloadOsmFile(malformedUrl, osmFile))
                  .withMessageContaining("malformed");
      }
test_case.class_method_signature: RoutingConfigTest.should_throw_exception_when_url_is_malformed()
test_case.full_signature: @Test void should_throw_exception_when_url_is_malformed()
test_case.identifier: should_throw_exception_when_url_is_malformed
test_case.invocations: mock withMessageContaining isThrownBy assertThatExceptionOfType downloadOsmFile
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_throw_exception_when_url_is_malformed()
focal_class.declarator: logger = LoggerFactory.getLogger(RoutingConfig.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(RoutingConfig.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: osmDir
focal_class.modifier: private final
focal_class.original_string: private final Path osmDir;
focal_class.type: Path
focal_class.var_name: osmDir
focal_class.declarator: osmFile
focal_class.modifier: private final
focal_class.original_string: private final Path osmFile;
focal_class.type: Path
focal_class.var_name: osmFile
focal_class.declarator: osmDownloadUrl
focal_class.modifier: private final
focal_class.original_string: private final String osmDownloadUrl;
focal_class.type: String
focal_class.var_name: osmDownloadUrl
focal_class.declarator: graphHopperDir
focal_class.modifier: private final
focal_class.original_string: private final Path graphHopperDir;
focal_class.type: Path
focal_class.var_name: graphHopperDir
focal_class.declarator: graphDir
focal_class.modifier: private final
focal_class.original_string: private final Path graphDir;
focal_class.type: Path
focal_class.var_name: graphDir
focal_class.file: optaweb-vehicle-routing-backend/src/main/java/org/optaweb/vehiclerouting/plugin/routing/RoutingConfig.java
focal_class.identifier: RoutingConfig
focal_class.class_method_signature: RoutingConfig.RoutingConfig(RoutingProperties routingProperties)
focal_class.full_signature: @Autowired  RoutingConfig(RoutingProperties routingProperties)
focal_class.identifier: RoutingConfig
focal_class.modifiers: @Autowired
focal_class.parameters: (RoutingProperties routingProperties)
focal_class.signature:  RoutingConfig(RoutingProperties routingProperties)
focal_class.class_method_signature: RoutingConfig.graphHopper()
focal_class.full_signature: @Profile(Profiles.NOT_TEST) @Bean @ConditionalOnProperty(prefix = "app.routing", name = "engine", havingValue = "graphhopper", matchIfMissing = true) GraphHopperOSM graphHopper()
focal_class.identifier: graphHopper
focal_class.modifiers: @Profile(Profiles.NOT_TEST) @Bean @ConditionalOnProperty(prefix = "app.routing", name = "engine", havingValue = "graphhopper", matchIfMissing = true)
focal_class.parameters: ()
focal_class.return: GraphHopperOSM
focal_class.signature: GraphHopperOSM graphHopper()
focal_class.class_method_signature: RoutingConfig.initDirs()
focal_class.full_signature: private void initDirs()
focal_class.identifier: initDirs
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initDirs()
focal_class.class_method_signature: RoutingConfig.downloadOsmFile(String urlString, Path osmFile)
focal_class.full_signature: static void downloadOsmFile(String urlString, Path osmFile)
focal_class.identifier: downloadOsmFile
focal_class.modifiers: static
focal_class.parameters: (String urlString, Path osmFile)
focal_class.return: void
focal_class.signature: void downloadOsmFile(String urlString, Path osmFile)
focal_method.body: static void downloadOsmFile(String urlString, Path osmFile) {
          HttpURLConnection con;
          URL url;
          try {
              url = new URL(urlString);
              con = (HttpURLConnection) url.openConnection();
          } catch (MalformedURLException e) {
              throw new RoutingEngineException("The OSM file URL is malformed", e);
          } catch (IOException e) {
              throw new RoutingEngineException("The OSM file cannot be downloaded", e);
          }
          try {
              con.setRequestMethod("GET");
          } catch (ProtocolException e) {
              throw new IllegalStateException("Can't set request method", e);
          }
  
          con.setConnectTimeout(10000);
          con.setReadTimeout(10000);
  
          logger.info("Downloading OSM file from {}", urlString);
          try {
              Files.copy(con.getInputStream(), osmFile);
          } catch (IOException e) {
              throw new RoutingEngineException("OSM file download failed", e);
          }
          logger.info("File saved to {}", osmFile);
      }
focal_method.class_method_signature: RoutingConfig.downloadOsmFile(String urlString, Path osmFile)
focal_method.full_signature: static void downloadOsmFile(String urlString, Path osmFile)
focal_method.identifier: downloadOsmFile
focal_method.invocations: openConnection setRequestMethod setConnectTimeout setReadTimeout info copy getInputStream info
focal_method.modifiers: static
focal_method.parameters: (String urlString, Path osmFile)
focal_method.return: void
focal_method.signature: void downloadOsmFile(String urlString, Path osmFile)