You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "JiriOndrusek (via GitHub)" <gi...@apache.org> on 2023/05/16 07:36:20 UTC

[GitHub] [camel] JiriOndrusek opened a new pull request, #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

JiriOndrusek opened a new pull request, #10101:
URL: https://github.com/apache/camel/pull/10101

   fixes https://issues.apache.org/jira/browse/CAMEL-19298
   
   PR contains basic tests for the combinations of actions and versions.
   
   # Description
   
   <!--
   - Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   -->
   
   # Target
   
   - [ ] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [ ] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [ ] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--  
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [ ] I formatted the code using `mvn -Pformat,fastinstall install && mvn -Psourcecheck`
   
   <!-- 
   You can run the aforementioned command in your module so that the build auto-formats your code and the source check verifies that is complies with our coding style. This will also be verified as part of the checks and your PR may be rejected if the checkstyle does not pass.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] github-actions[bot] commented on pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10101:
URL: https://github.com/apache/camel/pull/10101#issuecomment-1549218065

   ### Components tested:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 1 | 1 | 0 | 1 |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] JiriOndrusek commented on a diff in pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on code in PR #10101:
URL: https://github.com/apache/camel/pull/10101#discussion_r1194845620


##########
components/camel-snmp/src/test/java/org/apache/camel/component/snmp/TrapTest.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.snmp;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Message;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.snmp4j.PDU;
+import org.snmp4j.PDUv1;
+import org.snmp4j.mp.SnmpConstants;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.TimeTicks;
+import org.snmp4j.smi.Variable;
+import org.snmp4j.smi.VariableBinding;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TrapTest extends SnmpTestSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(TrapTest.class);
+
+    @ParameterizedTest
+    @MethodSource("supportedVersions")
+    public void testSendReceiveTraps(int version) throws Exception {
+        PDU trap = createTrap(version);
+
+        // Send it
+        LOG.info("Sending pdu " + trap);
+        Endpoint endpoint = context.getEndpoint("direct:snmptrapV" + version);
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody(trap);
+        Producer producer = endpoint.createProducer();
+        producer.process(exchange);
+
+        synchronized (this) {
+            Thread.sleep(1000);
+        }

Review Comment:
   I'll create another PR with change of this code. TBH I don't remember writing this, and definitely Awaitility should be better here, 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] JiriOndrusek commented on pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #10101:
URL: https://github.com/apache/camel/pull/10101#issuecomment-1549328908

   > @JiriOndrusek if this needs backports, then you are welcome to send PRs for those branches
   
   I'm currently trying to find out whether the backport is required.  I think that it would help camel-quarkus. Once I confirm that, I'll create backport PRs. Thankns!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus merged pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #10101:
URL: https://github.com/apache/camel/pull/10101


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske commented on a diff in pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #10101:
URL: https://github.com/apache/camel/pull/10101#discussion_r1194840178


##########
components/camel-snmp/src/test/java/org/apache/camel/component/snmp/TrapTest.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.snmp;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Message;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.snmp4j.PDU;
+import org.snmp4j.PDUv1;
+import org.snmp4j.mp.SnmpConstants;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.TimeTicks;
+import org.snmp4j.smi.Variable;
+import org.snmp4j.smi.VariableBinding;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TrapTest extends SnmpTestSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(TrapTest.class);
+
+    @ParameterizedTest
+    @MethodSource("supportedVersions")
+    public void testSendReceiveTraps(int version) throws Exception {
+        PDU trap = createTrap(version);
+
+        // Send it
+        LOG.info("Sending pdu " + trap);
+        Endpoint endpoint = context.getEndpoint("direct:snmptrapV" + version);
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody(trap);
+        Producer producer = endpoint.createProducer();
+        producer.process(exchange);
+
+        synchronized (this) {
+            Thread.sleep(1000);
+        }

Review Comment:
   Can we do this without the `Thread.sleep`, please? We already have plenty of those making out tests artificially slow. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] github-actions[bot] commented on pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10101:
URL: https://github.com/apache/camel/pull/10101#issuecomment-1549153204

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :camel: Maintainers, please note that first-time contributors *require manual approval* for the GitHub Actions to run.
   
   :warning: Please note that the changes on this PR may be **tested automatically** if they change components.
   
   If necessary Apache Camel Committers may access logs and test results in the job summaries!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske commented on a diff in pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #10101:
URL: https://github.com/apache/camel/pull/10101#discussion_r1194846887


##########
components/camel-snmp/src/test/java/org/apache/camel/component/snmp/TrapTest.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.snmp;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Message;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.snmp4j.PDU;
+import org.snmp4j.PDUv1;
+import org.snmp4j.mp.SnmpConstants;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.TimeTicks;
+import org.snmp4j.smi.Variable;
+import org.snmp4j.smi.VariableBinding;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TrapTest extends SnmpTestSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(TrapTest.class);
+
+    @ParameterizedTest
+    @MethodSource("supportedVersions")
+    public void testSendReceiveTraps(int version) throws Exception {
+        PDU trap = createTrap(version);
+
+        // Send it
+        LOG.info("Sending pdu " + trap);
+        Endpoint endpoint = context.getEndpoint("direct:snmptrapV" + version);
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody(trap);
+        Producer producer = endpoint.createProducer();
+        producer.process(exchange);
+
+        synchronized (this) {
+            Thread.sleep(1000);
+        }

Review Comment:
   Thanks @JiriOndrusek, much appreciated! 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus commented on pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #10101:
URL: https://github.com/apache/camel/pull/10101#issuecomment-1549262895

   @JiriOndrusek if this needs backports, then you are welcome to send PRs for those branches


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] JiriOndrusek commented on pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #10101:
URL: https://github.com/apache/camel/pull/10101#issuecomment-1549506264

   Backport to 3.183x: https://github.com/apache/camel/pull/10106


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske commented on a diff in pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #10101:
URL: https://github.com/apache/camel/pull/10101#discussion_r1194841672


##########
components/camel-snmp/src/test/java/org/apache/camel/component/snmp/TrapTest.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.snmp;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Message;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.snmp4j.PDU;
+import org.snmp4j.PDUv1;
+import org.snmp4j.mp.SnmpConstants;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.TimeTicks;
+import org.snmp4j.smi.Variable;
+import org.snmp4j.smi.VariableBinding;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TrapTest extends SnmpTestSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(TrapTest.class);
+
+    @ParameterizedTest
+    @MethodSource("supportedVersions")
+    public void testSendReceiveTraps(int version) throws Exception {
+        PDU trap = createTrap(version);
+
+        // Send it
+        LOG.info("Sending pdu " + trap);
+        Endpoint endpoint = context.getEndpoint("direct:snmptrapV" + version);
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody(trap);
+        Producer producer = endpoint.createProducer();
+        producer.process(exchange);
+
+        synchronized (this) {
+            Thread.sleep(1000);
+        }

Review Comment:
   IOW: I think you can use Awaitility here. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] JiriOndrusek commented on a diff in pull request #10101: CAMEL-19298 Snmp: version 3 is not supported for several actions

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on code in PR #10101:
URL: https://github.com/apache/camel/pull/10101#discussion_r1194870875


##########
components/camel-snmp/src/test/java/org/apache/camel/component/snmp/TrapTest.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.snmp;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Message;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.snmp4j.PDU;
+import org.snmp4j.PDUv1;
+import org.snmp4j.mp.SnmpConstants;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.TimeTicks;
+import org.snmp4j.smi.Variable;
+import org.snmp4j.smi.VariableBinding;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TrapTest extends SnmpTestSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(TrapTest.class);
+
+    @ParameterizedTest
+    @MethodSource("supportedVersions")
+    public void testSendReceiveTraps(int version) throws Exception {
+        PDU trap = createTrap(version);
+
+        // Send it
+        LOG.info("Sending pdu " + trap);
+        Endpoint endpoint = context.getEndpoint("direct:snmptrapV" + version);
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody(trap);
+        Producer producer = endpoint.createProducer();
+        producer.process(exchange);
+
+        synchronized (this) {
+            Thread.sleep(1000);
+        }

Review Comment:
   PR: https://github.com/apache/camel/pull/10102



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org