b9b7b16d6c9c1794acd773025e219cd711748035
[aaf/authz.git] / cadi / core / src / test / java / org / onap / aaf / cadi / taf / dos / test / JU_DenialOfServiceTafResp.java
1 /**
2  * 
3  * ============LICENSE_START====================================================
4  * org.onap.aaf
5  * ===========================================================================
6  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
7  * ===========================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END====================================================
20  *
21  */
22
23 package org.onap.aaf.cadi.taf.dos.test;
24
25 import static org.hamcrest.CoreMatchers.is;
26 import static org.junit.Assert.assertThat;
27
28 import java.io.ByteArrayOutputStream;
29 import java.io.IOException;
30 import java.io.PrintStream;
31
32 import org.junit.Before;
33 import org.junit.Test;
34 import org.onap.aaf.cadi.PropAccess;
35 import org.onap.aaf.cadi.taf.TafResp.RESP;
36 import org.onap.aaf.cadi.taf.dos.DenialOfServiceTafResp;
37
38 public class JU_DenialOfServiceTafResp {
39
40     private final static String description = "description";
41     private final static RESP status = RESP.IS_AUTHENTICATED;
42
43     private PropAccess access;
44
45     @Before
46     public void setup() {
47         access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
48     }
49
50     @Test
51     public void test() throws IOException {
52         DenialOfServiceTafResp resp = new DenialOfServiceTafResp(access, status, description);
53         assertThat(resp.isAuthenticated(), is(status));
54         assertThat(resp.authenticate(), is(status));
55     }
56
57 }