You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/02/28 11:10:40 UTC

[camel] branch main updated (9ae54b0ec25 -> 94b7d855329)

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

davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 9ae54b0ec25 CAMEL-19062 - Clean up Parent POM - Junit
     new b090aa279dd CAMEL-19090: Remove deprecated apis in core
     new 94b7d855329 camel-jbang - Upgrade known dependencies

The 2 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:
 .../camel/support/IntrospectionSupportTest.java    | 24 -----------
 .../management/mbean/ManagedBacklogDebugger.java   |  3 +-
 .../org/apache/camel/support/EndpointHelper.java   | 47 ----------------------
 .../apache/camel/support/IntrospectionSupport.java | 20 ---------
 .../main/java/org/apache/camel/util/StopWatch.java | 13 ------
 .../main/java/org/apache/camel/util/TimeUtils.java | 10 +++++
 .../java/org/apache/camel/util/StopWatchTest.java  | 14 -------
 .../java/org/apache/camel/util/TimeUtilsTest.java  | 15 +++++++
 .../camel-main-known-dependencies.properties       |  8 ++--
 9 files changed, 31 insertions(+), 123 deletions(-)


[camel] 02/02: camel-jbang - Upgrade known dependencies

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 94b7d855329feedc546b420dc97103d3ae33c5a4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Feb 28 09:57:05 2023 +0100

    camel-jbang - Upgrade known dependencies
---
 .../src/main/resources/camel-main-known-dependencies.properties   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties b/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties
index b3a041ecb8c..13aebd6fa65 100644
--- a/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties
+++ b/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties
@@ -15,14 +15,14 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-com.amazon.redshift.jdbc.Driver = com.amazon.redshift:redshift-jdbc42:2.1.0.10
+com.amazon.redshift.jdbc.Driver = com.amazon.redshift:redshift-jdbc42:2.1.0.12
 com.microsoft.sqlserver.jdbc.SQLServerDriver = com.microsoft.sqlserver:mssql-jdbc:11.2.1.jre11
 com.mysql.cj.jdbc.Driver = mysql:mysql-connector-java:8.0.31
 net.sf.saxon.xpath.XPathFactoryImpl = camel:saxon
-org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory = org.apache.activemq:artemis-jms-client-all:2.27.0
+org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory = org.apache.activemq:artemis-jms-client-all:2.27.1
 org.apache.commons.dbcp2.BasicDataSource = org.apache.commons:commons-dbcp2:2.9.0
-org.apache.qpid.jms.JmsConnectionFactory = org.apache.qpid:qpid-jms-client:1.7.0
-org.postgresql.Driver = org.postgresql:postgresql:42.5.1
+org.apache.qpid.jms.JmsConnectionFactory = org.apache.qpid:qpid-jms-client:2.2.0
+org.postgresql.Driver = org.postgresql:postgresql:42.5.4
 org.apache.camel.component.cxf.jaxws.CxfEndpoint = camel:cxf-soap
 org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint = camel:cxf-rest
 META-INF/services/org/apache/camel/restapi/openapi = camel:openapi-java
\ No newline at end of file


[camel] 01/02: CAMEL-19090: Remove deprecated apis in core

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b090aa279dd4342e26614549b140d9b1903e4845
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Feb 28 09:53:44 2023 +0100

    CAMEL-19090: Remove deprecated apis in core
---
 .../camel/support/IntrospectionSupportTest.java    | 24 -----------
 .../management/mbean/ManagedBacklogDebugger.java   |  3 +-
 .../org/apache/camel/support/EndpointHelper.java   | 47 ----------------------
 .../apache/camel/support/IntrospectionSupport.java | 20 ---------
 .../main/java/org/apache/camel/util/StopWatch.java | 13 ------
 .../main/java/org/apache/camel/util/TimeUtils.java | 10 +++++
 .../java/org/apache/camel/util/StopWatchTest.java  | 14 -------
 .../java/org/apache/camel/util/TimeUtilsTest.java  | 15 +++++++
 8 files changed, 27 insertions(+), 119 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/support/IntrospectionSupportTest.java b/core/camel-core/src/test/java/org/apache/camel/support/IntrospectionSupportTest.java
index 3c80c0e1136..7677d2ab8cd 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/IntrospectionSupportTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/IntrospectionSupportTest.java
@@ -39,7 +39,6 @@ import static org.apache.camel.support.IntrospectionSupport.getProperties;
 import static org.apache.camel.support.IntrospectionSupport.getProperty;
 import static org.apache.camel.support.IntrospectionSupport.getPropertyGetter;
 import static org.apache.camel.support.IntrospectionSupport.getPropertySetter;
-import static org.apache.camel.support.IntrospectionSupport.hasProperties;
 import static org.apache.camel.support.IntrospectionSupport.isGetter;
 import static org.apache.camel.support.IntrospectionSupport.isSetter;
 import static org.apache.camel.support.IntrospectionSupport.setProperty;
@@ -257,29 +256,6 @@ public class IntrospectionSupportTest extends ContextTestSupport {
         assertTrue(isSetter(setter3, true));
     }
 
-    @Test
-    public void testHasProperties() throws Exception {
-        Map<String, Object> empty = Collections.emptyMap();
-        assertFalse(hasProperties(empty, null));
-        assertFalse(hasProperties(empty, ""));
-        assertFalse(hasProperties(empty, "foo."));
-
-        Map<String, Object> param = new HashMap<>();
-        assertFalse(hasProperties(param, null));
-        assertFalse(hasProperties(param, ""));
-        assertFalse(hasProperties(param, "foo."));
-
-        param.put("name", "Claus");
-        assertTrue(hasProperties(param, null));
-        assertTrue(hasProperties(param, ""));
-        assertFalse(hasProperties(param, "foo."));
-
-        param.put("foo.name", "Hadrian");
-        assertTrue(hasProperties(param, null));
-        assertTrue(hasProperties(param, ""));
-        assertTrue(hasProperties(param, "foo."));
-    }
-
     @Test
     public void testGetProperties() throws Exception {
         ExampleBean bean = new ExampleBean();
diff --git a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedBacklogDebugger.java b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedBacklogDebugger.java
index 891d3f1683e..78b3a712f5e 100644
--- a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedBacklogDebugger.java
+++ b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedBacklogDebugger.java
@@ -41,6 +41,7 @@ import org.apache.camel.support.LoggerHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StopWatch;
 import org.apache.camel.util.StringHelper;
+import org.apache.camel.util.TimeUtils;
 import org.apache.camel.util.URISupport;
 
 @ManagedResource(description = "Managed BacklogDebugger")
@@ -383,7 +384,7 @@ public class ManagedBacklogDebugger implements ManagedBacklogDebuggerMBean {
                             + "]";
                 }
 
-                long elapsed = StopWatch.elapsedMillisSince(suspendedExchange.getCreated());
+                long elapsed = TimeUtils.elapsedMillisSince(suspendedExchange.getCreated());
 
                 messageHistoryBuffer
                         .append("    <messageHistoryEntry")
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
index 1809bd67a22..ac9b7a97fc5 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
@@ -275,53 +275,6 @@ public final class EndpointHelper {
         }
     }
 
-    /**
-     * Sets the regular properties on the given bean
-     *
-     * @param      context    the camel context
-     * @param      bean       the bean
-     * @param      parameters parameters
-     * @throws     Exception  is thrown if setting property fails
-     * @deprecated            use PropertyBindingSupport
-     */
-    @Deprecated
-    public static void setProperties(CamelContext context, Object bean, Map<String, Object> parameters) throws Exception {
-        // use the property binding which can do more advanced configuration
-        PropertyBindingSupport.build().bind(context, bean, parameters);
-    }
-
-    /**
-     * Sets the reference properties on the given bean
-     * <p/>
-     * This is convention over configuration, setting all reference parameters (using
-     * {@link #isReferenceParameter(String)} by looking it up in registry and setting it on the bean if possible.
-     *
-     * @param      context    the camel context
-     * @param      bean       the bean
-     * @param      parameters parameters
-     * @throws     Exception  is thrown if setting property fails
-     * @deprecated            use PropertyBindingSupport
-     */
-    @Deprecated
-    public static void setReferenceProperties(CamelContext context, Object bean, Map<String, Object> parameters)
-            throws Exception {
-        Iterator<Map.Entry<String, Object>> it = parameters.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry<String, Object> entry = it.next();
-            String name = entry.getKey();
-            Object v = entry.getValue();
-            String value = v != null ? v.toString() : null;
-            if (isReferenceParameter(value)) {
-                boolean hit = context.getCamelContextExtension().getBeanIntrospection().setProperty(context,
-                        context.getTypeConverter(), bean, name, null, value, true, false, false);
-                if (hit) {
-                    // must remove as its a valid option and we could configure it
-                    it.remove();
-                }
-            }
-        }
-    }
-
     /**
      * Is the given parameter a reference parameter (starting with a # char)
      *
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java
index 373f0e9042d..d5cd062c6c6 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java
@@ -348,26 +348,6 @@ public final class IntrospectionSupport {
         return answer;
     }
 
-    /**
-     * @deprecated use {@link org.apache.camel.util.PropertiesHelper}
-     */
-    @Deprecated
-    public static boolean hasProperties(Map<String, Object> properties, String optionPrefix) {
-        ObjectHelper.notNull(properties, "properties");
-
-        if (ObjectHelper.isNotEmpty(optionPrefix)) {
-            for (String name : properties.keySet()) {
-                if (name.startsWith(optionPrefix)) {
-                    return true;
-                }
-            }
-            // no parameters with this prefix
-            return false;
-        } else {
-            return !properties.isEmpty();
-        }
-    }
-
     public static Object getProperty(Object target, String propertyName)
             throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         ObjectHelper.notNull(target, "target");
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/StopWatch.java b/core/camel-util/src/main/java/org/apache/camel/util/StopWatch.java
index e78575c8438..891a86f029e 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/StopWatch.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/StopWatch.java
@@ -90,17 +90,4 @@ public final class StopWatch {
         return answer;
     }
 
-    /**
-     * Utility method to provide the elapsed time using milliseconds since epoch. This serves as an alternative for the
-     * former constructor based on a Date argument. This should be used only when converting old code that relies on
-     * that constructor as it can provide incorrect measurements in rare circumstances
-     *
-     * @param  start the timestamp in milliseconds since epoch
-     * @return       the elapsed time in milliseconds
-     */
-    @Deprecated
-    public static long elapsedMillisSince(long start) {
-        return Duration.ofMillis(System.currentTimeMillis()).minusMillis(start).toMillis();
-    }
-
 }
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java b/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java
index b1e529aa830..835c1b9c446 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java
@@ -251,4 +251,14 @@ public final class TimeUtils {
         return answer;
     }
 
+    /**
+     * Elapsed time using milliseconds since epoch.
+     *
+     * @param  start the timestamp in milliseconds since epoch
+     * @return       the elapsed time in milliseconds
+     */
+    public static long elapsedMillisSince(long start) {
+        return System.currentTimeMillis() - start;
+    }
+
 }
diff --git a/core/camel-util/src/test/java/org/apache/camel/util/StopWatchTest.java b/core/camel-util/src/test/java/org/apache/camel/util/StopWatchTest.java
index 03da6ba1efb..1e9c15e6d73 100644
--- a/core/camel-util/src/test/java/org/apache/camel/util/StopWatchTest.java
+++ b/core/camel-util/src/test/java/org/apache/camel/util/StopWatchTest.java
@@ -14,11 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.util;
 
 import java.time.Duration;
-import java.util.Date;
 
 import org.junit.jupiter.api.Test;
 
@@ -37,18 +35,6 @@ class StopWatchTest {
         assertTrue(taken < 1500, "Elapsed time should be smaller than 1500 ms but was " + taken);
     }
 
-    @SuppressWarnings("deprecated")
-    @Test
-    void testDurationMatchesExpectWithDate() throws InterruptedException {
-        Date startTime = new Date();
-
-        Thread.sleep(Duration.ofSeconds(1).toMillis());
-
-        long taken = StopWatch.elapsedMillisSince(startTime.getTime());
-        assertTrue(taken >= 1000, "Elapsed time should be equal to or greater than 1000 ms but was " + taken);
-        assertTrue(taken < 1500, "Elapsed time should be smaller than 1500 ms but was " + taken);
-    }
-
     @Test
     void testDurationMatchesExpectWithRestart() throws InterruptedException {
         StopWatch stopWatch = new StopWatch();
diff --git a/core/camel-util/src/test/java/org/apache/camel/util/TimeUtilsTest.java b/core/camel-util/src/test/java/org/apache/camel/util/TimeUtilsTest.java
index 514239acf00..93715533a29 100644
--- a/core/camel-util/src/test/java/org/apache/camel/util/TimeUtilsTest.java
+++ b/core/camel-util/src/test/java/org/apache/camel/util/TimeUtilsTest.java
@@ -18,7 +18,11 @@ package org.apache.camel.util;
 
 import org.junit.jupiter.api.Test;
 
+import java.time.Duration;
+import java.util.Date;
+
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class TimeUtilsTest {
 
@@ -67,4 +71,15 @@ public class TimeUtilsTest {
         long time2 = TimeUtils.toMilliSeconds(TimeUtils.printDuration(time, true));
         assertEquals(time, time2);
     }
+
+    @Test
+    void testDurationMatchesExpectWithDate() throws InterruptedException {
+        Date startTime = new Date();
+
+        Thread.sleep(Duration.ofSeconds(1).toMillis());
+
+        long taken = TimeUtils.elapsedMillisSince(startTime.getTime());
+        assertTrue(taken >= 1000, "Elapsed time should be equal to or greater than 1000 ms but was " + taken);
+        assertTrue(taken < 1500, "Elapsed time should be smaller than 1500 ms but was " + taken);
+    }
 }