1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.http;
19
20 import org.junit.Test;
21 import org.junit.experimental.categories.Category;
22 import org.apache.commons.logging.LogFactory;
23 import org.apache.commons.logging.Log;
24 import org.apache.hadoop.hbase.testclassification.SmallTests;
25
26 import java.io.FileNotFoundException;
27
28
29
30
31 @Category(SmallTests.class)
32 public class TestHttpServerWebapps extends HttpServerFunctionalTest {
33 private static final Log log = LogFactory.getLog(TestHttpServerWebapps.class);
34
35
36
37
38
39 @Test
40 public void testValidServerResource() throws Throwable {
41 HttpServer server = null;
42 try {
43 server = createServer("test");
44 } finally {
45 stop(server);
46 }
47 }
48
49
50
51
52
53 @Test
54 public void testMissingServerResource() throws Throwable {
55 try {
56 HttpServer server = createServer("NoSuchWebapp");
57
58
59 String serverDescription = server.toString();
60 stop(server);
61 fail("Expected an exception, got " + serverDescription);
62 } catch (FileNotFoundException expected) {
63 log.debug("Expected exception " + expected, expected);
64 }
65 }
66
67 }