summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-10-06 08:54:02 +0200
committerJan Srnicek <jsrnicek@cisco.com>2016-10-06 08:54:02 +0200
commitfb6666efe7b6009528e98702efc66e9118011174 (patch)
treee7dd2b205552c1a756f7f8410fc11536162db9aa /v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier
parentcf15cfe3593ec4c02cdb1121649bf95d19814e0c (diff)
HONEYCOMB-236 - Unified read/write exceptions
Change-Id: Idde761d0c0c2c4d96555ef94dbdaa87fad889493 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java26
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java20
2 files changed, 22 insertions, 24 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
index b70ccf0f3..cb507b104 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
@@ -27,6 +27,9 @@ import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
@@ -41,9 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
public class ClassifySessionWriterTest extends WriterCustomizerTest {
@@ -81,13 +81,13 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
private static InstanceIdentifier<ClassifySession> getClassifySessionId(final String tableName,
final String match) {
return InstanceIdentifier.create(VppClassifier.class)
- .child(ClassifyTable.class, new ClassifyTableKey(tableName))
- .child(ClassifySession.class, new ClassifySessionKey(new HexString(match)));
+ .child(ClassifyTable.class, new ClassifyTableKey(tableName))
+ .child(ClassifySession.class, new ClassifySessionKey(new HexString(match)));
}
private void whenClassifyAddDelSessionThenSuccess() {
doReturn(future(new ClassifyAddDelSessionReply())).when(api)
- .classifyAddDelSession(any(ClassifyAddDelSession.class));
+ .classifyAddDelSession(any(ClassifyAddDelSession.class));
}
private void whenClassifyAddDelSessionThenFailure() {
@@ -103,8 +103,8 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
request.hitNextIndex = 0;
request.advance = 123;
request.match =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
+ new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+ (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
return request;
}
@@ -131,7 +131,7 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
try {
customizer.writeCurrentAttributes(id, classifySession, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 1, TABLE_INDEX, SESSION_INDEX));
return;
@@ -154,8 +154,7 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
customizer.deleteCurrentAttributes(id, classifySession, writeContext);
- verify(api).classifyAddDelSession(
- generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
+ verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
}
@Test
@@ -168,10 +167,9 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
try {
customizer.deleteCurrentAttributes(id, classifySession, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).classifyAddDelSession(
- generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
+ verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
return;
}
fail("WriteFailedException.DeleteFailedException was expected");
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
index c8844e5cc..3c62c2d40 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
@@ -26,6 +26,9 @@ import static org.mockito.Mockito.when;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
@@ -37,9 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
public class ClassifyTableWriterTest extends WriterCustomizerTest {
@@ -71,7 +71,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
private static InstanceIdentifier<ClassifyTable> getClassifyTableId(final String name) {
return InstanceIdentifier.create(VppClassifier.class)
- .child(ClassifyTable.class, new ClassifyTableKey(name));
+ .child(ClassifyTable.class, new ClassifyTableKey(name));
}
private void whenClassifyAddDelTableThenSuccess() {
@@ -99,8 +99,8 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
request.nextTableIndex = ~0;
request.missNextIndex = ~0;
request.mask =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
+ new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+ (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
return request;
}
@@ -115,7 +115,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1));
verify(classifierContext)
- .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
+ .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
}
@Test
@@ -127,11 +127,11 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
try {
customizer.writeCurrentAttributes(id, classifyTable, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1));
verify(classifierContext, times(0))
- .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
+ .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
return;
}
fail("WriteFailedException.CreateFailedException was expected");
@@ -162,7 +162,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
try {
customizer.deleteCurrentAttributes(id, classifyTable, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 0, TABLE_INDEX));
return;