fb03334174a9391be67f9bebc8372764758806b7
[moon.git] /
1 /*
2  * Copyright (c) 2014 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.aaa.authz.srv;
10
11 import org.junit.Assert;
12 import org.junit.Before;
13 import org.mockito.Mockito;
14 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
15 import org.opendaylight.controller.sal.core.api.Broker;
16 import org.opendaylight.controller.sal.core.api.Provider;
17
18 public class AuthzConsumerContextImplTest {
19
20     private Broker.ConsumerSession realconsumercontext;
21     private Provider realprovidercontext;
22     private AuthzBrokerImpl authzBroker;
23     private Broker realbroker;
24
25     @Before
26     public void beforeTest() {
27         realconsumercontext = Mockito.mock(Broker.ConsumerSession.class);
28         realprovidercontext = Mockito.mock(Provider.class);
29         realbroker = Mockito.mock(Broker.class);
30         realbroker.registerProvider(realprovidercontext);
31         authzBroker = Mockito.mock(AuthzBrokerImpl.class);
32     }
33
34     @org.junit.Test
35     public void testGetService() throws Exception {
36         AuthzConsumerContextImpl authzConsumerContext = new AuthzConsumerContextImpl(
37                 realconsumercontext, authzBroker);
38
39         Assert.assertEquals("Expected Authz session context",
40                 authzConsumerContext.getService(DOMDataBroker.class).getClass(),
41                 AuthzDomDataBroker.class);
42         // Assert.assertEquals("Expected Authz session context",
43         // authzConsumerContext.getService(SchemaService.class).getClass(),
44         // SchemaService.class);
45     }
46 }