This is an automated email from the ASF dual-hosted git repository.
JiriOndrusek pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/camel-main by this push:
new 0cfcbc1796 Fixed snmp test module
0cfcbc1796 is described below
commit 0cfcbc17962624c777e7564f45b09aaf68616fcd
Author: Jiří Ondrušek <[email protected]>
AuthorDate: Mon Oct 5 06:33:56 2026 +0000
Fixed snmp test module
CAMEL-25245 turned the SNMP GET_NEXT producer into a walk that fails on a
non-increasing OID and on a timeout. The test responder answered every
request with the base OID and then stayed silent. Derive the step from
the requested OID, answer with increasing child OIDs and end the walk
with an OID outside the subtree.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
---
.../component/snmp/it/SnmpTestResource.java | 25 ++++++++++++----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git
a/integration-tests-jvm/snmp/src/test/java/org/apache/camel/quarkus/component/snmp/it/SnmpTestResource.java
b/integration-tests-jvm/snmp/src/test/java/org/apache/camel/quarkus/component/snmp/it/SnmpTestResource.java
index 9f8d962376..6958f297ed 100644
---
a/integration-tests-jvm/snmp/src/test/java/org/apache/camel/quarkus/component/snmp/it/SnmpTestResource.java
+++
b/integration-tests-jvm/snmp/src/test/java/org/apache/camel/quarkus/component/snmp/it/SnmpTestResource.java
@@ -174,19 +174,22 @@ public class SnmpTestResource implements
QuarkusTestResourceLifecycleManager {
}
private VariableBinding generateResponseBinding(int counter, int
version, OID oid) {
- //get next test
- if (SnmpTest.GET_NEXT_OID.equals(oid)) {
- //if counter < 2 return the same oid
- if (counter < 3) {
- return new VariableBinding(SnmpTest.GET_NEXT_OID, new
OctetString("" + counter));
+ //get next test: the producer walks the subtree, each request asks
for the OID returned by the previous
+ //response, so the step is derived from the requested OID and the
returned OIDs must increase
+ if (oid.startsWith(SnmpTest.GET_NEXT_OID)) {
+ int step = oid.size() > SnmpTest.GET_NEXT_OID.size() ?
oid.last() : 0;
+ if (step < 2) {
+ return new VariableBinding(new
OID(SnmpTest.GET_NEXT_OID).append(step + 1),
+ new OctetString("" + (step + 1)));
}
- if (counter == 3) {
- //else return sysDescr
- return new VariableBinding(SnmpTest.GET_NEXT_OID,
- new OctetString("My GET_NEXT Printer - response #"
+ counter));
+ if (step == 2) {
+ return new VariableBinding(new
OID(SnmpTest.GET_NEXT_OID).append(3),
+ new OctetString("My GET_NEXT Printer - response
#3"));
}
- //else do not send response
- return null;
+ //an OID outside the walked subtree ends the walk
+ OID end = new OID(SnmpTest.GET_NEXT_OID);
+ end.set(end.size() - 1, end.last() + 1);
+ return new VariableBinding(end, new OctetString("end of the
GET_NEXT subtree"));
}
if (SnmpTest.POLL_OID.equals(oid)) {