94a4613cf90896b795b106055fcca798f9d10ab9
[aaa.git] / aaa-shiro / impl / src / test / java / org / opendaylight / aaa / shiro / idm / rest / test / HandlerTest.java
1 /*
2  * Copyright (c) 2016, 2017 Inocybe Technologies 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.shiro.idm.rest.test;
10
11 import com.sun.jersey.spi.container.servlet.WebComponent;
12 import com.sun.jersey.test.framework.AppDescriptor;
13 import com.sun.jersey.test.framework.JerseyTest;
14 import com.sun.jersey.test.framework.WebAppDescriptor;
15 import org.junit.Before;
16 import org.opendaylight.aaa.api.StoreBuilder;
17 import org.opendaylight.aaa.shiro.idm.IdmLightApplication;
18 import org.opendaylight.aaa.AAAShiroProvider;
19 import org.slf4j.bridge.SLF4JBridgeHandler;
20
21 public abstract class HandlerTest extends JerseyTest {
22
23     protected IDMTestStore testStore = new IDMTestStore();
24
25     @Override
26     protected AppDescriptor configure() {
27         return new WebAppDescriptor.Builder()
28                 .initParam(WebComponent.RESOURCE_CONFIG_CLASS, IdmLightApplication.class.getName())
29                 .initParam("com.sun.jersey.config.feature.Trace", "true")
30                 .initParam("com.sun.jersey.spi.container.ContainerResponseFilters",
31                            "com.sun.jersey.api.container.filter.LoggingFilter")
32                 .build();
33     }
34
35     @Before
36     @Override
37     public void setUp() throws Exception {
38         SLF4JBridgeHandler.removeHandlersForRootLogger();
39         SLF4JBridgeHandler.install();
40         super.setUp();
41         new StoreBuilder(testStore).init();
42         AAAShiroProvider.setIdmStore(testStore);
43     }
44 }