89ba6c130397eec6b66be633a950e2d203f7bf80
[dmaap/messagerouter/msgrtr.git] / src / test / java / com / att / nsa / cambria / security / impl / DMaaPMechIdAuthenticatorTest.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP Policy Engine\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package com.att.nsa.cambria.security.impl;\r
22 \r
23 import static org.junit.Assert.*;\r
24 \r
25 import javax.servlet.http.HttpServletRequest;\r
26 \r
27 import org.junit.After;\r
28 import org.junit.Before;\r
29 import org.junit.Test;\r
30 import org.springframework.mock.web.MockHttpServletRequest;\r
31 \r
32 import com.att.dmf.mr.CambriaApiException;\r
33 import com.att.dmf.mr.beans.DMaaPContext;\r
34 import com.att.dmf.mr.security.DMaaPAuthenticator;\r
35 import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
36 import com.att.dmf.mr.security.impl.DMaaPMechIdAuthenticator;\r
37 \r
38 \r
39 \r
40 public class DMaaPMechIdAuthenticatorTest {\r
41         \r
42         private MockHttpServletRequest request = null;\r
43         @Before\r
44         public void setUp() throws Exception {\r
45                 //creating servlet object\r
46                 request = new MockHttpServletRequest();\r
47                 request.setServerName("www.example.com");\r
48                 request.setRequestURI("/foo");\r
49                 request.setQueryString("param1=value1&param");\r
50                 String url = request.getRequestURL() + "?" + request.getQueryString(); \r
51 \r
52                 \r
53         }\r
54 \r
55         @After\r
56         public void tearDown() throws Exception {\r
57         }\r
58         \r
59         \r
60         @Test\r
61         public void testQualify() {\r
62                 \r
63                 DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
64                 \r
65                 authenticator.qualify(request);\r
66                 assertTrue(true);\r
67                 \r
68         }       \r
69         \r
70         @Test\r
71         public void testAuthenticate() {\r
72                 \r
73                 DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
74                 \r
75                 DMaaPContext ctx = new DMaaPContext();\r
76                 authenticator.authenticate(ctx);\r
77                 assertTrue(true);\r
78                 \r
79         }\r
80         \r
81         @Test\r
82         public void testIsAuthentic() {\r
83                 DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
84                 \r
85                 authenticator.isAuthentic(request);\r
86                 assertTrue(true);\r
87                 \r
88         }\r
89         \r
90         \r
91         \r
92         @Test\r
93         public void testAddAuthenticator() {\r
94                 \r
95                 DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
96                 DMaaPMechIdAuthenticator authenticator2 = new DMaaPMechIdAuthenticator();\r
97                 \r
98                 authenticator.addAuthenticator(authenticator2);\r
99                 assertTrue(true);\r
100                 \r
101         }\r
102         \r
103         \r
104         \r
105         \r
106 \r
107 }\r