summaryrefslogtreecommitdiffstats
path: root/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java
blob: 260d66b5c4f233b241eb32e351428fa0544887b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package org.onap.sdnc.apps.ms.gra.controllers;

import org.apache.shiro.realm.Realm;
import org.apache.shiro.realm.text.PropertiesRealm;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp;

import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class GenericResourceMsAppTest {

    GenericResourceMsApp app;

    @Before
    public  void setUp() throws Exception {
        app = new GenericResourceMsApp();
        System.out.println("GenericResourceMsAppTest: Setting serviceLogicProperties, serviceLogicDirectory and sdnc.config.dir");
        System.setProperty("serviceLogicProperties", "src/test/resources/svclogic.properties");
        System.setProperty("serviceLogicDirectory", "src/test/resources/svclogic");
        System.setProperty("sdnc.config.dir", "src/test/resources");
   
    }

    @Test
    public void realm() {
        Realm realm = app.realm();
        assertTrue(realm instanceof PropertiesRealm);


    }

    @Test
    public void shiroFilterChainDefinition() {
        ShiroFilterChainDefinition chainDefinition = app.shiroFilterChainDefinition();
        Map<String, String> chainMap = chainDefinition.getFilterChainMap();
        assertEquals("anon", chainMap.get("/**"));


    }
}