summaryrefslogtreecommitdiffstats
path: root/infra/translate-api/src/test/java/io/fd
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-11-09 09:44:26 +0100
committerMarek Gradzki <mgradzki@cisco.com>2016-11-23 13:03:57 +0000
commit567247ad5a1ba1c8aff3cb2b47211f7c68f0545d (patch)
treeeca23e838a6b1c7e69838b617e25762de1e2170e /infra/translate-api/src/test/java/io/fd
parent8e0c7007906730fe4547b0265a895ad8a322a7dc (diff)
HONEYCOMB-170 Add more information to RevertFailedEx
Change-Id: I6b24a1d061c94d57730b20cde4c5b3c39444b119 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'infra/translate-api/src/test/java/io/fd')
-rw-r--r--infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java11
-rw-r--r--infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java19
2 files changed, 26 insertions, 4 deletions
diff --git a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java
index ae0c36d5b..9623db5bc 100644
--- a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java
+++ b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import com.google.common.collect.Sets;
+import io.fd.honeycomb.translate.write.DataObjectUpdate;
import io.fd.honeycomb.translate.write.WriteContext;
import java.util.HashSet;
import org.junit.Before;
@@ -35,9 +36,12 @@ public class BulkUpdateExceptionTest {
@Mock
private WriteContext writeContext;
-
@Mock
private WriterRegistry.Reverter reverter;
+ @Mock
+ private DataObject before;
+ @Mock
+ private DataObject after;
@Before
public void setUp() throws Exception {
@@ -48,9 +52,10 @@ public class BulkUpdateExceptionTest {
public void testRevert() throws Exception {
final HashSet<InstanceIdentifier<?>> failedIds = Sets.newHashSet(id);
final WriterRegistry.BulkUpdateException bulkUpdateException =
- new WriterRegistry.BulkUpdateException(failedIds, reverter, new RuntimeException());
+ new WriterRegistry.BulkUpdateException(id, DataObjectUpdate.create(id, before, after),
+ failedIds, reverter, new RuntimeException());
- assertEquals(failedIds, bulkUpdateException.getFailedIds());
+ assertEquals(failedIds, bulkUpdateException.getUnrevertedSubtrees());
bulkUpdateException.revertChanges(writeContext);
verify(reverter).revert(writeContext);
diff --git a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java
index 721941d1e..6502235d0 100644
--- a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java
+++ b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java
@@ -19,20 +19,37 @@ package io.fd.honeycomb.translate.write.registry;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.Sets;
+import io.fd.honeycomb.translate.write.DataObjectUpdate;
import java.util.Set;
+import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class RevertFailedExceptionTest {
private InstanceIdentifier<?> id = InstanceIdentifier.create(DataObject.class);
+ @Mock
+ private WriterRegistry.Reverter reverter;
+ @Mock
+ private DataObject before;
+ @Mock
+ private DataObject after;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
@Test
public void testNonRevert() throws Exception {
final Set<InstanceIdentifier<?>> notReverted = Sets.newHashSet(id);
final WriterRegistry.Reverter.RevertFailedException revertFailedException =
- new WriterRegistry.Reverter.RevertFailedException(notReverted, new RuntimeException());
+ new WriterRegistry.Reverter.RevertFailedException(
+ new WriterRegistry.BulkUpdateException(id, DataObjectUpdate.create(id, before, after),
+ notReverted, reverter, new RuntimeException()));
assertEquals(notReverted, revertFailedException.getNotRevertedChanges());
}
} \ No newline at end of file