BUG-2138: Make DistributedShardFactory return Futures.
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / TransactionContextWrapperTest.java
index bc98f9ac3f3b096ff228879837fdf3fb7cf9b60c..058968c33992d27dc10e88cc0c76229dedd5d128 100644 (file)
@@ -1,38 +1,43 @@
+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+
 package org.opendaylight.controller.cluster.datastore;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 
 public class TransactionContextWrapperTest {
-
-    @Mock
-    TransactionIdentifier identifier;
-
     @Mock
-    ActorContext actorContext;
+    private ActorContext actorContext;
 
     @Mock
-    TransactionContext transactionContext;
+    private TransactionContext transactionContext;
 
-    TransactionContextWrapper transactionContextWrapper;
+    private TransactionContextWrapper transactionContextWrapper;
 
     @Before
-    public void setUp(){
+    public void setUp() {
         MockitoAnnotations.initMocks(this);
         doReturn(DatastoreContext.newBuilder().build()).when(actorContext).getDatastoreContext();
-        transactionContextWrapper = new TransactionContextWrapper(identifier, actorContext);
+        transactionContextWrapper = new TransactionContextWrapper(MockIdentifiers.transactionIdentifier(
+            TransactionContextWrapperTest.class, "mock"), actorContext);
     }
 
     @Test
-    public void testExecutePriorTransactionOperations(){
-        for(int i=0;i<100;i++) {
+    public void testExecutePriorTransactionOperations() {
+        for (int i = 0; i < 100; i++) {
             transactionContextWrapper.maybeExecuteTransactionOperation(mock(TransactionOperation.class));
         }
         assertEquals(901, transactionContextWrapper.getLimiter().availablePermits());
@@ -41,4 +46,4 @@ public class TransactionContextWrapperTest {
 
         assertEquals(1001, transactionContextWrapper.getLimiter().availablePermits());
     }
-}
\ No newline at end of file
+}