View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  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   */
19  
20  package org.apache.hadoop.hbase.rest.model;
21  
22  import org.apache.hadoop.hbase.testclassification.SmallTests;
23  
24  import org.junit.experimental.categories.Category;
25  
26  @Category(SmallTests.class)
27  public class TestVersionModel extends TestModelBase<VersionModel> {
28    private static final String REST_VERSION = "0.0.1";
29    private static final String OS_VERSION = 
30      "Linux 2.6.18-128.1.6.el5.centos.plusxen amd64";
31    private static final String JVM_VERSION =
32      "Sun Microsystems Inc. 1.6.0_13-11.3-b02";
33    private static final String JETTY_VERSION = "6.1.14";
34    private static final String JERSEY_VERSION = "1.1.0-ea";
35    
36    public TestVersionModel() throws Exception {
37      super(VersionModel.class);
38      AS_XML =
39        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Version JVM=\"Sun " +
40            "Microsystems Inc. 1.6.0_13-11.3-b02\" Jersey=\"1.1.0-ea\" " +
41            "OS=\"Linux 2.6.18-128.1.6.el5.centos.plusxen amd64\" REST=\"0.0.1\" Server=\"6.1.14\"/>";
42  
43      AS_PB =
44        "CgUwLjAuMRInU3VuIE1pY3Jvc3lzdGVtcyBJbmMuIDEuNi4wXzEzLTExLjMtYjAyGi1MaW51eCAy" +
45        "LjYuMTgtMTI4LjEuNi5lbDUuY2VudG9zLnBsdXN4ZW4gYW1kNjQiBjYuMS4xNCoIMS4xLjAtZWE=";
46  
47      AS_JSON =
48        "{\"JVM\":\"Sun Microsystems Inc. 1.6.0_13-11.3-b02\",\"Jersey\":\"1.1.0-ea\"," +
49            "\"OS\":\"Linux 2.6.18-128.1.6.el5.centos.plusxen amd64\",\"" +
50            "REST\":\"0.0.1\",\"Server\":\"6.1.14\"}";
51    }
52  
53    protected VersionModel buildTestModel() {
54      VersionModel model = new VersionModel();
55      model.setRESTVersion(REST_VERSION);
56      model.setOSVersion(OS_VERSION);
57      model.setJVMVersion(JVM_VERSION);
58      model.setServerVersion(JETTY_VERSION);
59      model.setJerseyVersion(JERSEY_VERSION);
60      return model;
61    }
62  
63    protected void checkModel(VersionModel model) {
64      assertEquals(model.getRESTVersion(), REST_VERSION);
65      assertEquals(model.getOSVersion(), OS_VERSION);
66      assertEquals(model.getJVMVersion(), JVM_VERSION);
67      assertEquals(model.getServerVersion(), JETTY_VERSION);
68      assertEquals(model.getJerseyVersion(), JERSEY_VERSION);
69    }
70  }
71