--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+
+public class Assert extends Operation {
+
+ public static final String ASSERT = "assert";
+ String lock;
+
+ public Assert(String lock) {
+ super(null, ASSERT);
+ this.lock = lock;
+ }
+
+ public String getLock() {
+ return lock;
+ }
+}
public Comment comment(String comment) {
return new Comment(comment);
}
+
+ /*
+ * Could not use Java keyword "assert" which clashes with the ovsdb json-rpc method.
+ * using assertion instead.
+ */
+ public Assert assertion(String lock) {
+ return new Assert(lock);
+ }
}
\ No newline at end of file
operationResults = results.get();
Assert.assertFalse(operationResults.isEmpty());
+ /* Testing for Abort Error */
+ Assert.assertFalse(operationResults.get(1).getError() == null);
System.out.println("Abort operation results = " + operationResults);
+ /*
+ * Adding a separate Abort operation in a transaction. Lets not mix this with other
+ * valid transactions as above.
+ */
+ results = ovs.transactBuilder()
+ .add(op.delete(bridge)
+ .where(name.opEqual("br-int"))
+ .operation())
+ .add(op.assertion("Assert12345")) // Failing intentionally
+ .execute();
+
+ operationResults = results.get();
+ Assert.assertFalse(operationResults.isEmpty());
+ /* Testing for an Assertion Error */
+ Assert.assertFalse(operationResults.get(1).getError() == null);
+ System.out.println("Assert operation results = " + operationResults);
+
}
@Test