2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.groupbasedpolicy.renderer.faas;
10 import static org.mockito.Matchers.any;
11 import static org.mockito.Mockito.doNothing;
12 import static org.mockito.Mockito.mock;
13 import static org.mockito.Mockito.when;
15 import com.google.common.util.concurrent.CheckedFuture;
16 import org.junit.Test;
17 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
18 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
19 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
20 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
21 import org.opendaylight.groupbasedpolicy.api.EpRendererAugmentationRegistry;
22 import org.opendaylight.yangtools.yang.binding.DataObject;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
25 public class FaasRendererCovrgTest {
27 @SuppressWarnings("unchecked")
29 public void testConstructor() throws Exception {
30 DataBroker dataProvider = mock(DataBroker.class);
31 EpRendererAugmentationRegistry epRendererAugmentationRegistry = mock(EpRendererAugmentationRegistry.class);
33 WriteTransaction wTx = mock(WriteTransaction.class);
34 CheckedFuture<Void, TransactionCommitFailedException> futureVoid = mock(CheckedFuture.class);
35 when(wTx.submit()).thenReturn(futureVoid);
36 doNothing().when(wTx).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
37 any(DataObject.class));
38 when(dataProvider.newWriteOnlyTransaction()).thenReturn(wTx);
40 FaasRenderer renderer = new FaasRenderer(dataProvider, epRendererAugmentationRegistry);