1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.rest.model;
21
22 import org.apache.hadoop.hbase.testclassification.SmallTests;
23 import org.junit.experimental.categories.Category;
24
25 @Category(SmallTests.class)
26 public class TestColumnSchemaModel extends TestModelBase<ColumnSchemaModel> {
27
28 protected static final String COLUMN_NAME = "testcolumn";
29 protected static final boolean BLOCKCACHE = true;
30 protected static final int BLOCKSIZE = 16384;
31 protected static final String BLOOMFILTER = "NONE";
32 protected static final String COMPRESSION = "GZ";
33 protected static final boolean IN_MEMORY = false;
34 protected static final int TTL = 86400;
35 protected static final int VERSIONS = 1;
36
37 public TestColumnSchemaModel() throws Exception {
38 super(ColumnSchemaModel.class);
39 AS_XML =
40 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ColumnSchema " +
41 "name=\"testcolumn\" BLOCKSIZE=\"16384\" BLOOMFILTER=\"NONE\" BLOCKCACHE=\"true\" " +
42 "COMPRESSION=\"GZ\" VERSIONS=\"1\" TTL=\"86400\" IN_MEMORY=\"false\"/>";
43
44 AS_JSON =
45 "{\"name\":\"testcolumn\",\"BLOCKSIZE\":\"16384\",\"BLOOMFILTER\":\"NONE\"," +
46 "\"BLOCKCACHE\":\"true\",\"COMPRESSION\":\"GZ\",\"VERSIONS\":\"1\"," +
47 "\"TTL\":\"86400\",\"IN_MEMORY\":\"false\"}";
48 }
49
50 protected ColumnSchemaModel buildTestModel() {
51 ColumnSchemaModel model = new ColumnSchemaModel();
52 model.setName(COLUMN_NAME);
53 model.__setBlocksize(BLOCKSIZE);
54 model.__setBloomfilter(BLOOMFILTER);
55 model.__setBlockcache(BLOCKCACHE);
56 model.__setCompression(COMPRESSION);
57 model.__setVersions(VERSIONS);
58 model.__setTTL(TTL);
59 model.__setInMemory(IN_MEMORY);
60 return model;
61 }
62
63 protected void checkModel(ColumnSchemaModel model) {
64 assertEquals(model.getName(), COLUMN_NAME);
65 assertEquals(model.__getBlockcache(), BLOCKCACHE);
66 assertEquals(model.__getBlocksize(), BLOCKSIZE);
67 assertEquals(model.__getBloomfilter(), BLOOMFILTER);
68 assertTrue(model.__getCompression().equalsIgnoreCase(COMPRESSION));
69 assertEquals(model.__getInMemory(), IN_MEMORY);
70 assertEquals(model.__getTTL(), TTL);
71 assertEquals(model.__getVersions(), VERSIONS);
72 }
73
74 public void testFromPB() throws Exception {
75 }
76 }
77