Added range type to subject-feature-definition/parameter
[groupbasedpolicy.git] / renderers / opflex / src / test / java / org / opendaylight / groupbasedpolicy / renderer / opflex / lib / RoleTest.java
1 /*
2  * Copyright (C) 2014 Cisco Systems, Inc.
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  *  Authors : Thomas Bachman
9  */
10
11 package org.opendaylight.groupbasedpolicy.renderer.opflex.lib;
12
13 import static org.junit.Assert.assertTrue;
14
15 import java.util.List;
16
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.opendaylight.groupbasedpolicy.jsonrpc.RpcMessage;
20 import org.opendaylight.groupbasedpolicy.renderer.opflex.lib.Role;
21 import org.opendaylight.groupbasedpolicy.renderer.opflex.lib.messages.EndpointDeclareRequest;
22 import org.opendaylight.groupbasedpolicy.renderer.opflex.lib.messages.EndpointResolveRequest;
23 import org.opendaylight.groupbasedpolicy.renderer.opflex.lib.messages.IdentityRequest;
24 import org.opendaylight.groupbasedpolicy.renderer.opflex.lib.messages.IdentityResponse;
25 import org.opendaylight.groupbasedpolicy.renderer.opflex.lib.messages.PolicyResolveRequest;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29
30 /**
31  *
32  */
33 public class RoleTest {
34     protected static final Logger logger = LoggerFactory.getLogger(RoleTest.class);
35
36     private boolean idReq;
37     private boolean idRsp;
38     private boolean polReq;
39     private boolean epDeclReq;
40     private boolean epReqReq;
41
42
43     @Before
44     public void setUp() throws Exception {
45     }
46     @Test
47     public void testDiscovery() throws Exception {
48         idReq = false;
49         idRsp = false;
50
51         List<RpcMessage> messages = Role.DISCOVERY.getMessages();
52         for (RpcMessage msg : messages) {
53             if (msg instanceof IdentityRequest) {
54                 idReq = true;
55             }
56             if (msg instanceof IdentityResponse) {
57                 idRsp = true;
58             }
59         }
60         assertTrue(idReq == true);
61         assertTrue(idRsp == true);
62     }
63
64
65     @Test
66     public void testPolicyRepository() throws Exception {
67         polReq = false;
68
69         List<RpcMessage> messages = Role.POLICY_REPOSITORY.getMessages();
70         for (RpcMessage msg : messages) {
71             if (msg instanceof PolicyResolveRequest) {
72                 polReq = true;
73             }
74         }
75         assertTrue(polReq == true);
76     }
77
78     @Test
79     public void testEndpointRegistry() throws Exception {
80         epDeclReq = false;
81         epReqReq = false;
82
83         List<RpcMessage> messages = Role.ENDPOINT_REGISTRY.getMessages();
84         for (RpcMessage msg : messages) {
85             if (msg instanceof EndpointDeclareRequest) {
86                 epDeclReq = true;
87             }
88             if (msg instanceof EndpointResolveRequest) {
89                 epReqReq = true;
90             }
91         }
92         assertTrue(epDeclReq == true);
93         assertTrue(epReqReq == true);
94     }
95
96     //@Test
97 //    public void testObserver() throws Exception {
98 //
99 //        List<RpcMessage> messages = Role.OBSERVER.getMessages();
100 //        for (RpcMessage msg : messages) {
101 //        }
102 //    }
103
104 }