2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org
.apache
.hadoop
.hbase
.http
;
20 import static org
.hamcrest
.CoreMatchers
.instanceOf
;
21 import static org
.hamcrest
.MatcherAssert
.assertThat
;
22 import static org
.junit
.Assert
.assertEquals
;
23 import static org
.junit
.Assert
.assertNotNull
;
25 import org
.apache
.hadoop
.hbase
.HBaseClassTestRule
;
26 import org
.apache
.hadoop
.hbase
.testclassification
.MiscTests
;
27 import org
.apache
.hadoop
.hbase
.testclassification
.SmallTests
;
28 import org
.junit
.ClassRule
;
29 import org
.junit
.Test
;
30 import org
.junit
.experimental
.categories
.Category
;
32 import org
.apache
.hbase
.thirdparty
.org
.eclipse
.jetty
.server
.CustomRequestLog
;
33 import org
.apache
.hbase
.thirdparty
.org
.eclipse
.jetty
.server
.RequestLog
;
34 import org
.apache
.hbase
.thirdparty
.org
.eclipse
.jetty
.server
.Slf4jRequestLogWriter
;
36 @Category({ MiscTests
.class, SmallTests
.class })
37 public class TestHttpRequestLog
{
40 public static final HBaseClassTestRule CLASS_RULE
=
41 HBaseClassTestRule
.forClass(TestHttpRequestLog
.class);
44 public void testAppenderDefined() {
45 RequestLog requestLog
= HttpRequestLog
.getRequestLog("test");
46 assertNotNull("RequestLog should not be null", requestLog
);
47 assertThat(requestLog
, instanceOf(CustomRequestLog
.class));
48 CustomRequestLog crl
= (CustomRequestLog
) requestLog
;
49 assertThat(crl
.getWriter(), instanceOf(Slf4jRequestLogWriter
.class));
50 assertEquals(CustomRequestLog
.EXTENDED_NCSA_FORMAT
, crl
.getFormatString());