Fix fileEncoding violations for checkstyle
[groupbasedpolicy.git] / neutron-vpp-mapper / src / test / java / org / opendaylight / groupbasedpolicy / neutron / vpp / mapper / hostconfigs / VppNodeListenerTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
3  * 
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
7  */
8
9 package org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.hostconfigs;
10
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13
14 import java.util.concurrent.ExecutionException;
15
16 import org.junit.After;
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.SocketInfo;
20 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
21 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
22 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
24
25 public class VppNodeListenerTest extends TestResources {
26
27     private TopologyId topologyId = new TopologyId("topology1");
28     private NodeId nodeId = new NodeId("node1");
29     private InstanceIdentifier<Node> nodeIid = createNodeIid(topologyId, nodeId);
30     private VppNodeListener vppNodeListener;
31
32     @Before
33     public void init() throws InterruptedException, ExecutionException {
34         String socketPath = "/tmp/";
35         String socketPrefix = "socket_";
36         setDataBroker();
37         vppNodeListener = new VppNodeListener(dataBroker, new SocketInfo(socketPath, socketPrefix));
38         writeTopologyNode(topologyId, nodeId);
39         writeRendererNode(createNodeIid(topologyId, nodeId));
40     }
41
42     @Test
43     public void writeDataTest() throws InterruptedException, ExecutionException {
44         assertTrue(readHostconfig(nodeId).isPresent());
45     }
46
47     @Test
48     public void deleteDataTest() throws InterruptedException, ExecutionException {
49         deleteRendererNode(nodeIid);
50         assertFalse(readHostconfig(nodeId).isPresent());
51     }
52
53     @After
54     public void after() {
55         vppNodeListener.close();
56     }
57 }