You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/11/10 10:29:54 UTC

[camel-k-runtime] branch master updated (1c51d30 -> 8ccfd07)

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git.


    from 1c51d30  Updated CHANGELOG.md
     new b9719f2  Leveragte MP Config to load application and user properties
     new f58f929  Remove initial properties method from Runtime
     new a9c1eab  Add jvadoc to Runtime
     new 8ccfd07  Cleanup SourceLoader

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/camel/k/Runtime.java  |  74 +++++++--------
 .../main/java/org/apache/camel/k/SourceLoader.java |   1 -
 .../camel/k/listener/PropertiesConfigurer.java     |   8 --
 .../apache/camel/k/support/DelegatingRuntime.java  |  26 ------
 .../apache/camel/k/support/PropertiesSupport.java  | 103 ---------------------
 .../org/apache/camel/k/support/RuntimeSupport.java |  84 +++++++++++++++++
 .../org/apache/camel/k/quarkus/Application.java    |   5 -
 .../k/quarkus/ApplicationConfigSourceProvider.java |  21 ++---
 .../org/apache/camel/k/quarkus/it/Application.java |  24 +----
 .../org/apache/camel/k/quarkus/it/RuntimeTest.java |  23 +----
 .../src/test/resources/conf.d/003/flat-property    |   1 +
 11 files changed, 134 insertions(+), 236 deletions(-)
 create mode 100644 itests/camel-k-itests-runtime/src/test/resources/conf.d/003/flat-property


[camel-k-runtime] 04/04: Cleanup SourceLoader

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit 8ccfd0799e72c14ec253591d3cedfc67626e5920
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Nov 10 09:59:07 2020 +0100

    Cleanup SourceLoader
---
 camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java b/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java
index 0b15130..602de98 100644
--- a/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java
+++ b/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java
@@ -34,7 +34,6 @@ public interface SourceLoader {
      * @param runtime the runtime.
      * @param source the source to load.
      * @return the RoutesBuilder.
-     * @throws Exception
      */
     RoutesBuilder load(Runtime runtime, Source source);
 


[camel-k-runtime] 03/04: Add jvadoc to Runtime

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit a9c1eabfc25814c3cb476014f92bd00c3d181f47
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Nov 10 09:58:02 2020 +0100

    Add jvadoc to Runtime
---
 .../src/main/java/org/apache/camel/k/Runtime.java  | 40 ++++++++++++++++++++--
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java
index f22e475..9b301a6 100644
--- a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java
+++ b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java
@@ -30,7 +30,14 @@ import org.apache.camel.spi.Registry;
 import static org.apache.camel.util.CollectionHelper.mapOf;
 
 public interface Runtime extends HasCamelContext, AutoCloseable {
-
+    /**
+     * Returns the camel context adapting it to the specialized type.
+     *
+     * @see HasCamelContext#getCamelContext()
+     * @see CamelContext#adapt(Class)
+     *
+     * @return the camel context.
+     */
     default <T extends CamelContext> T getCamelContext(Class<T> type) {
         return getCamelContext().adapt(type);
     }
@@ -42,10 +49,22 @@ public interface Runtime extends HasCamelContext, AutoCloseable {
         return getCamelContext().getRegistry();
     }
 
+    /**
+     * Sets a special list of properties that take precedence and will use first, if a property exist.
+     *
+     * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties)
+     * @param properties the properties to set
+     */
     default void setProperties(Properties properties) {
         getCamelContext().getPropertiesComponent().setOverrideProperties(properties);
     }
 
+    /**
+     * Sets a special list of properties that take precedence and will use first, if a property exist.
+     *
+     * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties)
+     * @param properties the properties to set
+     */
     default void setProperties(Map<String, String> properties) {
         Properties p = new Properties();
         p.putAll(properties);
@@ -53,12 +72,27 @@ public interface Runtime extends HasCamelContext, AutoCloseable {
         setProperties(p);
     }
 
-    default void setProperties(String key, String value, String... keyVals) {
+    /**
+     * Sets a special list of properties that take precedence and will use first, if a property exist.
+     *
+     * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties)
+     * @param key the mapping's key
+     * @param value the mapping's value
+     * @param entries containing the keys and values from which the map is populated
+     *
+     */
+    default void setProperties(String key, String value, String... entries) {
         setProperties(
-            mapOf(HashMap::new, key, value, keyVals)
+            mapOf(HashMap::new, key, value, entries)
         );
     }
 
+    /**
+     * Sets a special list of properties that take precedence and will use first, if a property exist.
+     *
+     * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties)
+     * @param builder the builder which will create the routes
+     */
     default void addRoutes(RoutesBuilder builder) {
         try {
             getCamelContext().addRoutes(builder);


[camel-k-runtime] 01/04: Leveragte MP Config to load application and user properties

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit b9719f275aa8502e487f0ccb2c30e03a8a012130
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Nov 10 09:41:20 2020 +0100

    Leveragte MP Config to load application and user properties
---
 .../camel/k/listener/PropertiesConfigurer.java     |   8 --
 .../apache/camel/k/support/PropertiesSupport.java  | 103 ---------------------
 .../org/apache/camel/k/support/RuntimeSupport.java |  84 +++++++++++++++++
 .../k/quarkus/ApplicationConfigSourceProvider.java |  21 ++---
 .../org/apache/camel/k/quarkus/it/Application.java |  24 +----
 .../org/apache/camel/k/quarkus/it/RuntimeTest.java |  23 +----
 .../src/test/resources/conf.d/003/flat-property    |   1 +
 7 files changed, 97 insertions(+), 167 deletions(-)

diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java b/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java
index 5baeb4a..2dadca5 100644
--- a/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java
+++ b/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java
@@ -20,7 +20,6 @@ import org.apache.camel.Ordered;
 import org.apache.camel.k.Runtime;
 import org.apache.camel.k.support.Constants;
 import org.apache.camel.k.support.KubernetesPropertiesFunction;
-import org.apache.camel.k.support.PropertiesSupport;
 
 public class PropertiesConfigurer extends AbstractPhaseListener {
     public PropertiesConfigurer() {
@@ -34,13 +33,6 @@ public class PropertiesConfigurer extends AbstractPhaseListener {
 
     @Override
     protected void accept(Runtime runtime) {
-        runtime.setInitialProperties(
-            PropertiesSupport.loadApplicationProperties()
-        );
-        runtime.setPropertiesLocations(
-            PropertiesSupport.resolveUserPropertiesLocations()
-        );
-
         //
         // Register properties functions to resolve k8s secrets or config maps like:
         //
diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java b/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java
index b88d64d..43a93e4 100644
--- a/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java
+++ b/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java
@@ -16,22 +16,9 @@
  */
 package org.apache.camel.k.support;
 
-import java.io.IOException;
-import java.io.Reader;
-import java.nio.file.FileVisitResult;
-import java.nio.file.FileVisitor;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.Collection;
 import java.util.HashMap;
-import java.util.LinkedHashSet;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Properties;
-import java.util.Set;
 import java.util.function.Predicate;
 
 import org.apache.camel.CamelContext;
@@ -41,7 +28,6 @@ import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.spi.PropertyConfigurer;
 import org.apache.camel.support.PropertyBindingSupport;
 import org.apache.camel.support.service.ServiceHelper;
-import org.apache.camel.util.ObjectHelper;
 
 public final class PropertiesSupport {
     private PropertiesSupport() {
@@ -103,93 +89,4 @@ public final class PropertiesSupport {
         return target;
     }
 
-    public static String resolveApplicationPropertiesLocation() {
-        return System.getProperty(Constants.PROPERTY_CAMEL_K_CONF, System.getenv(Constants.ENV_CAMEL_K_CONF));
-    }
-
-    public static Properties loadApplicationProperties() {
-        final String conf = resolveApplicationPropertiesLocation();
-        final Properties properties = new Properties();
-
-        if (ObjectHelper.isEmpty(conf)) {
-            return properties;
-        }
-
-        try {
-            Path confPath = Paths.get(conf);
-
-            if (Files.exists(confPath)) {
-                try (Reader reader = Files.newBufferedReader(confPath)) {
-                    properties.load(reader);
-                }
-            }
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-
-        return properties;
-    }
-
-    public static String resolveUserPropertiesLocation() {
-        return System.getProperty(Constants.PROPERTY_CAMEL_K_CONF_D, System.getenv(Constants.ENV_CAMEL_K_CONF_D));
-    }
-
-    public static Properties loadUserProperties() {
-        final Properties properties = new Properties();
-
-        try {
-            for (String location: resolveUserPropertiesLocations()) {
-                try (Reader reader = Files.newBufferedReader(Paths.get(location))) {
-                    properties.load(reader);
-                }
-            }
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-
-        return properties;
-    }
-
-    public static Properties loadProperties() {
-        final Properties app = loadApplicationProperties();
-        final Properties usr = loadUserProperties();
-
-        app.putAll(usr);
-
-        return app;
-    }
-
-    public static Collection<String> resolveUserPropertiesLocations() {
-        final String conf = resolveUserPropertiesLocation();
-        final Set<String> locations = new LinkedHashSet<>();
-
-        // Additional locations
-        if (ObjectHelper.isNotEmpty(conf)) {
-            Path root = Paths.get(conf);
-            FileVisitor<Path> visitor = new SimpleFileVisitor<>() {
-                @Override
-                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
-                    Objects.requireNonNull(file);
-                    Objects.requireNonNull(attrs);
-
-                    final String path = file.toFile().getAbsolutePath();
-                    if (path.endsWith(".properties")) {
-                        locations.add(path);
-                    }
-
-                    return FileVisitResult.CONTINUE;
-                }
-            };
-
-            if (Files.exists(root)) {
-                try {
-                    Files.walkFileTree(root, visitor);
-                } catch (IOException e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        }
-
-        return locations;
-    }
 }
diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/support/RuntimeSupport.java b/camel-k-core/support/src/main/java/org/apache/camel/k/support/RuntimeSupport.java
index b211307..16df12d 100644
--- a/camel-k-core/support/src/main/java/org/apache/camel/k/support/RuntimeSupport.java
+++ b/camel-k-core/support/src/main/java/org/apache/camel/k/support/RuntimeSupport.java
@@ -16,8 +16,19 @@
  */
 package org.apache.camel.k.support;
 
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.Reader;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.FileVisitResult;
+import java.nio.file.FileVisitor;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -294,4 +305,77 @@ public final class RuntimeSupport {
         return Objects.requireNonNull(version, "Could not determine Camel K Runtime version");
     }
 
+    // *********************************
+    //
+    // Properties
+    //
+    // *********************************
+
+    public static Map<String, String> loadApplicationProperties() {
+        final String conf = System.getProperty(Constants.PROPERTY_CAMEL_K_CONF, System.getenv(Constants.ENV_CAMEL_K_CONF));
+        final Map<String, String> properties = new HashMap<>();
+
+        if (ObjectHelper.isEmpty(conf)) {
+            return properties;
+        }
+
+        try {
+            Path confPath = Paths.get(conf);
+
+            if (Files.exists(confPath)) {
+                try (Reader reader = Files.newBufferedReader(confPath)) {
+                    Properties p = new Properties();
+                    p.load(reader);
+                    p.forEach((key, value) -> properties.put(String.valueOf(key), String.valueOf(value)));
+                }
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+        return properties;
+    }
+
+    public static Map<String, String> loadUserProperties() {
+        final String conf = System.getProperty(Constants.PROPERTY_CAMEL_K_CONF_D, System.getenv(Constants.ENV_CAMEL_K_CONF_D));
+        final Map<String, String> properties = new HashMap<>();
+
+        if (ObjectHelper.isEmpty(conf)) {
+            return properties;
+        }
+
+        FileVisitor<Path> visitor = new SimpleFileVisitor<>() {
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+                Objects.requireNonNull(file);
+                Objects.requireNonNull(attrs);
+
+                if (file.toFile().getAbsolutePath().endsWith(".properties")) {
+                    try (Reader reader = Files.newBufferedReader(file)) {
+                        Properties p = new Properties();
+                        p.load(reader);
+                        p.forEach((key, value) -> properties.put(String.valueOf(key), String.valueOf(value)));
+                    }
+                } else {
+                    properties.put(
+                        file.getFileName().toString(),
+                        Files.readString(file, StandardCharsets.UTF_8));
+                }
+
+                return FileVisitResult.CONTINUE;
+            }
+        };
+
+        Path root = Paths.get(conf);
+
+        if (Files.exists(root)) {
+            try {
+                Files.walkFileTree(root, visitor);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        return properties;
+    }
 }
diff --git a/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationConfigSourceProvider.java b/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationConfigSourceProvider.java
index cef2910..77fffb2 100644
--- a/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationConfigSourceProvider.java
+++ b/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationConfigSourceProvider.java
@@ -16,28 +16,23 @@
  */
 package org.apache.camel.k.quarkus;
 
-import java.util.Collections;
-import java.util.Properties;
+import java.util.List;
+import java.util.Map;
 
 import io.smallrye.config.PropertiesConfigSource;
-import org.apache.camel.k.support.PropertiesSupport;
+import org.apache.camel.k.support.RuntimeSupport;
 import org.eclipse.microprofile.config.spi.ConfigSource;
 import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
 
 public class ApplicationConfigSourceProvider implements ConfigSourceProvider {
     @Override
     public Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader) {
-        final Properties applicationProperties = PropertiesSupport.loadProperties();
-        final Properties quarkusProperties = new Properties();
+        final Map<String, String> appProperties = RuntimeSupport.loadApplicationProperties();
+        final Map<String, String> usrProperties = RuntimeSupport.loadUserProperties();
 
-        for (String name : applicationProperties.stringPropertyNames()) {
-            if (name.startsWith("quarkus.")) {
-                quarkusProperties.put(name, applicationProperties.get(name));
-            }
-        }
-
-        return Collections.singletonList(
-            new PropertiesConfigSource(quarkusProperties, "camel-k")
+        return List.of(
+            new PropertiesConfigSource(appProperties, "camel-k-app", ConfigSource.DEFAULT_ORDINAL),
+            new PropertiesConfigSource(usrProperties, "camel-k-usr", ConfigSource.DEFAULT_ORDINAL + 1)
         );
     }
 }
diff --git a/itests/camel-k-itests-runtime/src/main/java/org/apache/camel/k/quarkus/it/Application.java b/itests/camel-k-itests-runtime/src/main/java/org/apache/camel/k/quarkus/it/Application.java
index 92391ac..cf4c855 100644
--- a/itests/camel-k-itests-runtime/src/main/java/org/apache/camel/k/quarkus/it/Application.java
+++ b/itests/camel-k-itests-runtime/src/main/java/org/apache/camel/k/quarkus/it/Application.java
@@ -57,13 +57,6 @@ public class Application {
             .add(
                 "routes-collector",
                 instance(CamelMain.class).map(BaseMainSupport::getRoutesCollector).map(Object::getClass).map(Class::getName).orElse(""))
-            .add(
-                "properties-locations",
-                Json.createArrayBuilder(instance(CamelContext.class)
-                    .map(CamelContext::getPropertiesComponent)
-                    .map(PropertiesComponent.class::cast)
-                    .map(PropertiesComponent::getLocations)
-                    .orElseGet(Collections::emptyList)))
             .build();
     }
 
@@ -88,27 +81,16 @@ public class Application {
             .flatMap(pc -> pc.resolveProperty(name)).orElse("");
     }
 
-    @GET
-    @Path("/initial-property/{name}")
-    @Produces(MediaType.TEXT_PLAIN)
-    public String initialProperty(@PathParam("name") String name) {
-        return (String)instance(CamelContext.class)
-            .map(CamelContext::getPropertiesComponent)
-            .map(PropertiesComponent.class::cast)
-            .map(pc -> pc.getInitialProperties().get(name))
-            .orElse("");
-    }
-
     @SuppressWarnings("unchecked")
     @GET
-    @Path("/initial-properties")
+    @Path("/properties")
     @Produces(MediaType.APPLICATION_JSON)
-    public JsonObject initialProperties() {
+    public JsonObject properties() {
         return Json.createObjectBuilder(
             instance(CamelContext.class)
                 .map(CamelContext::getPropertiesComponent)
                 .map(PropertiesComponent.class::cast)
-                .map(PropertiesComponent::getInitialProperties)
+                .map(PropertiesComponent::loadProperties)
                 .map(Map.class::cast)
                 .orElseGet(Collections::emptyMap)
         ).build();
diff --git a/itests/camel-k-itests-runtime/src/test/java/org/apache/camel/k/quarkus/it/RuntimeTest.java b/itests/camel-k-itests-runtime/src/test/java/org/apache/camel/k/quarkus/it/RuntimeTest.java
index 3d7f41a..19fea58 100644
--- a/itests/camel-k-itests-runtime/src/test/java/org/apache/camel/k/quarkus/it/RuntimeTest.java
+++ b/itests/camel-k-itests-runtime/src/test/java/org/apache/camel/k/quarkus/it/RuntimeTest.java
@@ -16,14 +16,11 @@
  */
 package org.apache.camel.k.quarkus.it;
 
-import java.util.Map;
-
 import javax.ws.rs.core.MediaType;
 
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.path.json.JsonPath;
 import org.apache.camel.k.quarkus.Application;
-import org.apache.camel.k.support.PropertiesSupport;
 import org.apache.camel.quarkus.core.FastCamelContext;
 import org.junit.jupiter.api.Test;
 
@@ -50,25 +47,6 @@ public class RuntimeTest {
             .isEqualTo(Application.Runtime.class.getName());
         assertThat(p.getString("routes-collector"))
             .isEqualTo(Application.NoRoutesCollector.class.getName());
-        assertThat(p.getList("properties-locations", String.class))
-            .contains("file:" + System.getProperty("camel.k.conf.d", System.getenv("CAMEL_K_CONF_D")) + "/001/conf.properties")
-            .contains("file:" + System.getProperty("camel.k.conf.d", System.getenv("CAMEL_K_CONF_D")) + "/002/conf.properties");
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void initialProperties() {
-        Map<String, String> initialProperties = given()
-            .accept(MediaType.APPLICATION_JSON)
-            .get("/test/initial-properties")
-            .then()
-            .statusCode(200)
-            .extract()
-                .body().jsonPath().getMap(".", String.class, String.class);
-
-        assertThat(initialProperties).containsExactlyEntriesOf((Map)PropertiesSupport.loadApplicationProperties());
-        assertThat(initialProperties).containsEntry("root.key", "root.value");
-        assertThat(initialProperties).containsEntry("a.key", "a.root");
     }
 
     @Test
@@ -78,5 +56,6 @@ public class RuntimeTest {
         given().get("/test/property/001.key").then().statusCode(200).body(is("001.value"));
         given().get("/test/property/002.key").then().statusCode(200).body(is("002.value"));
         given().get("/test/property/a.key").then().statusCode(200).body(is("a.002"));
+        given().get("/test/property/flat-property").then().statusCode(200).body(is("flat-value"));
     }
 }
\ No newline at end of file
diff --git a/itests/camel-k-itests-runtime/src/test/resources/conf.d/003/flat-property b/itests/camel-k-itests-runtime/src/test/resources/conf.d/003/flat-property
new file mode 100644
index 0000000..313b57d
--- /dev/null
+++ b/itests/camel-k-itests-runtime/src/test/resources/conf.d/003/flat-property
@@ -0,0 +1 @@
+flat-value
\ No newline at end of file


[camel-k-runtime] 02/04: Remove initial properties method from Runtime

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit f58f929245bbf60cc58f51296d7f1f33b7c42e66
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Nov 10 09:50:37 2020 +0100

    Remove initial properties method from Runtime
---
 .../src/main/java/org/apache/camel/k/Runtime.java  | 34 ----------------------
 .../apache/camel/k/support/DelegatingRuntime.java  | 26 -----------------
 .../org/apache/camel/k/quarkus/Application.java    |  5 ----
 3 files changed, 65 deletions(-)

diff --git a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java
index b194804..f22e475 100644
--- a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java
+++ b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java
@@ -16,12 +16,9 @@
  */
 package org.apache.camel.k;
 
-import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
-import java.util.stream.Collectors;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Ordered;
@@ -45,23 +42,6 @@ public interface Runtime extends HasCamelContext, AutoCloseable {
         return getCamelContext().getRegistry();
     }
 
-    default void setInitialProperties(Properties properties) {
-        getCamelContext().getPropertiesComponent().setInitialProperties(properties);
-    }
-
-    default void setInitialProperties(Map<String, String> properties) {
-        Properties p = new Properties();
-        p.putAll(properties);
-
-        setInitialProperties(p);
-    }
-
-    default void setInitialProperties(String key, String value, String... keyVals) {
-        setInitialProperties(
-            mapOf(HashMap::new, key, value, keyVals)
-        );
-    }
-
     default void setProperties(Properties properties) {
         getCamelContext().getPropertiesComponent().setOverrideProperties(properties);
     }
@@ -87,20 +67,6 @@ public interface Runtime extends HasCamelContext, AutoCloseable {
         }
     }
 
-    default void setPropertiesLocations(Collection<String> locations) {
-        getCamelContext().getPropertiesComponent().setLocation(
-            locations.stream()
-                .map(location -> location.startsWith("file:") ? location : "file:" + location)
-                .distinct()
-                .sorted()
-                .collect(Collectors.joining(","))
-        );
-    }
-
-    default void setPropertiesLocations(String... locations) {
-        setPropertiesLocations(Arrays.asList(locations));
-    }
-
     /**
      * Lifecycle method used to stops the entire integration.
      */
diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java b/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java
index 9cce10f..c853d77 100644
--- a/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java
+++ b/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.k.support;
 
-import java.util.Collection;
 import java.util.Map;
 import java.util.Properties;
 
@@ -43,21 +42,6 @@ public class DelegatingRuntime implements Runtime {
     }
 
     @Override
-    public void setInitialProperties(Properties properties) {
-        runtime.setInitialProperties(properties);
-    }
-
-    @Override
-    public void setInitialProperties(Map<String, String> properties) {
-        runtime.setInitialProperties(properties);
-    }
-
-    @Override
-    public void setInitialProperties(String key, String value, String... keyVals) {
-        runtime.setInitialProperties(key, value, keyVals);
-    }
-
-    @Override
     public void setProperties(Properties properties) {
         runtime.setProperties(properties);
     }
@@ -78,16 +62,6 @@ public class DelegatingRuntime implements Runtime {
     }
 
     @Override
-    public void setPropertiesLocations(Collection<String> locations) {
-        runtime.setPropertiesLocations(locations);
-    }
-
-    @Override
-    public void setPropertiesLocations(String... locations) {
-        runtime.setPropertiesLocations(locations);
-    }
-
-    @Override
     public void stop() throws Exception {
         runtime.stop();
     }
diff --git a/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java b/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java
index 91c89b8..50da099 100644
--- a/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java
+++ b/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java
@@ -64,11 +64,6 @@ public final class Application {
         }
 
         @Override
-        public void setInitialProperties(Properties properties) {
-            main.setInitialProperties(properties);
-        }
-
-        @Override
         public void setProperties(Properties properties) {
             main.setOverrideProperties(properties);
         }