2 * Copyright (c) 2014 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
9 package org.opendaylight.aaa.authz.srv;
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;
18 public class AuthzConsumerContextImplTest {
20 private Broker.ConsumerSession realconsumercontext;
21 private Provider realprovidercontext;
22 private AuthzBrokerImpl authzBroker;
23 private Broker realbroker;
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);
35 public void testGetService() throws Exception {
36 AuthzConsumerContextImpl authzConsumerContext = new AuthzConsumerContextImpl(
37 realconsumercontext, authzBroker);
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);