2 * Copyright (C) 2014 Cisco Systems, Inc.
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 * Authors : Thomas Bachman
11 package org.opendaylight.groupbasedpolicy.renderer.opflex.lib;
13 import static org.junit.Assert.assertTrue;
15 import java.util.List;
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;
33 public class RoleTest {
34 protected static final Logger logger = LoggerFactory.getLogger(RoleTest.class);
36 private boolean idReq;
37 private boolean idRsp;
38 private boolean polReq;
39 private boolean epDeclReq;
40 private boolean epReqReq;
44 public void setUp() throws Exception {
47 public void testDiscovery() throws Exception {
51 List<RpcMessage> messages = Role.DISCOVERY.getMessages();
52 for (RpcMessage msg : messages) {
53 if (msg instanceof IdentityRequest) {
56 if (msg instanceof IdentityResponse) {
60 assertTrue(idReq == true);
61 assertTrue(idRsp == true);
66 public void testPolicyRepository() throws Exception {
69 List<RpcMessage> messages = Role.POLICY_REPOSITORY.getMessages();
70 for (RpcMessage msg : messages) {
71 if (msg instanceof PolicyResolveRequest) {
75 assertTrue(polReq == true);
79 public void testEndpointRegistry() throws Exception {
83 List<RpcMessage> messages = Role.ENDPOINT_REGISTRY.getMessages();
84 for (RpcMessage msg : messages) {
85 if (msg instanceof EndpointDeclareRequest) {
88 if (msg instanceof EndpointResolveRequest) {
92 assertTrue(epDeclReq == true);
93 assertTrue(epReqReq == true);
97 // public void testObserver() throws Exception {
99 // List<RpcMessage> messages = Role.OBSERVER.getMessages();
100 // for (RpcMessage msg : messages) {