001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.rest.model; 019 020import static org.junit.jupiter.api.Assertions.assertEquals; 021import static org.junit.jupiter.api.Assertions.assertTrue; 022 023import org.apache.hadoop.hbase.testclassification.RestTests; 024import org.apache.hadoop.hbase.testclassification.SmallTests; 025import org.junit.jupiter.api.Tag; 026import org.junit.jupiter.api.Test; 027 028@Tag(RestTests.TAG) 029@Tag(SmallTests.TAG) 030public class TestColumnSchemaModel extends TestModelBase<ColumnSchemaModel> { 031 032 protected static final String COLUMN_NAME = "testcolumn"; 033 protected static final boolean BLOCKCACHE = true; 034 protected static final int BLOCKSIZE = 16384; 035 protected static final String BLOOMFILTER = "NONE"; 036 protected static final String COMPRESSION = "GZ"; 037 protected static final boolean IN_MEMORY = false; 038 protected static final int TTL = 86400; 039 protected static final int VERSIONS = 1; 040 041 public TestColumnSchemaModel() throws Exception { 042 super(ColumnSchemaModel.class); 043 AS_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ColumnSchema " 044 + "name=\"testcolumn\" BLOCKSIZE=\"16384\" BLOOMFILTER=\"NONE\" BLOCKCACHE=\"true\" " 045 + "COMPRESSION=\"GZ\" VERSIONS=\"1\" TTL=\"86400\" IN_MEMORY=\"false\"/>"; 046 047 AS_JSON = "{\"name\":\"testcolumn\",\"BLOCKSIZE\":\"16384\",\"BLOOMFILTER\":\"NONE\"," 048 + "\"BLOCKCACHE\":\"true\",\"COMPRESSION\":\"GZ\",\"VERSIONS\":\"1\"," 049 + "\"TTL\":\"86400\",\"IN_MEMORY\":\"false\"}"; 050 } 051 052 @Override 053 protected ColumnSchemaModel buildTestModel() { 054 ColumnSchemaModel model = new ColumnSchemaModel(); 055 model.setName(COLUMN_NAME); 056 model.__setBlocksize(BLOCKSIZE); 057 model.__setBloomfilter(BLOOMFILTER); 058 model.__setBlockcache(BLOCKCACHE); 059 model.__setCompression(COMPRESSION); 060 model.__setVersions(VERSIONS); 061 model.__setTTL(TTL); 062 model.__setInMemory(IN_MEMORY); 063 return model; 064 } 065 066 @Override 067 protected void checkModel(ColumnSchemaModel model) { 068 assertEquals(COLUMN_NAME, model.getName(), "name"); 069 assertEquals(BLOCKCACHE, model.__getBlockcache(), "block cache"); 070 assertEquals(BLOCKSIZE, model.__getBlocksize(), "block size"); 071 assertEquals(BLOOMFILTER, model.__getBloomfilter(), "bloomfilter"); 072 assertTrue(model.__getCompression().equalsIgnoreCase(COMPRESSION), "compression"); 073 assertEquals(IN_MEMORY, model.__getInMemory(), "in memory"); 074 assertEquals(TTL, model.__getTTL(), "ttl"); 075 assertEquals(VERSIONS, model.__getVersions(), "versions"); 076 } 077 078 @Override 079 @Test 080 public void testFromPB() throws Exception { 081 } 082}