View Javadoc

1   /*
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
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
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.
17   */
18  package org.apache.hadoop.chukwa.rest.resource;
19  
20  import java.io.File;
21  import java.io.IOException;
22  import java.net.InetAddress;
23  import java.net.URI;
24  import java.net.URISyntaxException;
25  import java.net.UnknownHostException;
26  
27  import org.apache.hadoop.chukwa.hicc.HiccWebServer;
28  import org.apache.hadoop.chukwa.util.ExceptionUtil;
29  import org.apache.hadoop.conf.Configuration;
30  import org.apache.hadoop.fs.FileSystem;
31  import org.apache.hadoop.hdfs.MiniDFSCluster;
32  import org.mortbay.jetty.Server;
33  import org.mortbay.jetty.nio.SelectChannelConnector;
34  import org.mortbay.jetty.servlet.Context;
35  import org.mortbay.jetty.servlet.ServletHolder;
36  
37  import com.sun.jersey.api.client.Client;
38  import com.sun.jersey.api.client.WebResource;
39  import com.sun.jersey.spi.container.servlet.ServletContainer;
40  
41  import junit.framework.TestCase;
42  
43  public class SetupTestEnv extends TestCase {
44    public WebResource resource;
45    public URI baseURL;
46    public Client client;
47    public static int restPort = 4080;
48    public static Configuration conf = null;
49    public static HiccWebServer hicc = null;
50    public static String user = "admin";
51    public static String authorization = "Basic YWRtaW46YWRtaW4=";
52    public static MiniDFSCluster dfs;
53    
54    public SetupTestEnv() {
55      if(hicc==null) {
56        hicc = HiccWebServer.getInstance();
57        conf = HiccWebServer.getConfig();
58      }
59    }
60    
61    public void setUp() {
62      hicc.start();
63    }
64    
65    public void tearDown() {
66    }
67  }