Initial OpenECOMP policy/engine commit
[policy/engine.git] / ECOMP-XACML / src / test / java / org / openecomp / policy / xacml / test / XACMLEngineTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP-XACML
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.policy.xacml.test;
22
23 import java.io.IOException;
24 import java.util.ArrayList;
25 import java.util.Collections;
26 import java.util.List;
27
28 import javax.servlet.ServletConfig;
29 import javax.servlet.ServletOutputStream;
30 import javax.servlet.http.HttpServletRequest;
31 import javax.servlet.http.HttpServletResponse;
32
33 import junit.framework.TestCase;
34
35 import org.junit.Before;
36 import org.junit.Test;
37 import org.mockito.Mockito;
38 import org.springframework.mock.web.MockHttpServletResponse;
39 import org.springframework.mock.web.MockServletConfig;
40
41 public class XACMLEngineTest extends TestCase{
42         
43         private List<String> headers = new ArrayList<String>();
44         
45         private HttpServletRequest httpServletRequest;
46         private HttpServletResponse httpServletResponse;
47         private ServletOutputStream mockOutput;
48         private ServletConfig servletConfig; 
49
50     @Before
51    
52     public void setUp() throws IOException {
53         httpServletRequest = Mockito.mock(HttpServletRequest.class);
54         Mockito.when(httpServletRequest.getMethod()).thenReturn("POST");
55         Mockito.when(httpServletRequest.getParameter("groupId")).thenReturn(null);
56         Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers));
57         Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers));
58         
59         
60         mockOutput = Mockito.mock(ServletOutputStream.class);
61         
62         httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
63         
64         Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput);
65
66         servletConfig = Mockito.mock(MockServletConfig.class);
67
68         Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers));
69         
70         
71               
72     }
73         
74     @Test
75         public void testDummy() throws Exception{
76                 try {   
77                         assertTrue(true);
78                 } catch (Exception e) {
79                         fail();
80                 }
81
82         }
83         
84 }