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 java.io.StringReader;
23 import java.io.StringWriter;
24
25 import javax.xml.bind.JAXBContext;
26 import javax.xml.bind.JAXBException;
27
28 import junit.framework.TestCase;
29 import org.apache.hadoop.hbase.SmallTests;
30 import org.junit.Ignore;
31 import org.junit.Test;
32 import org.junit.experimental.categories.Category;
33
34 @Category(SmallTests.class)
35 public class TestColumnSchemaModel extends TestModelBase<ColumnSchemaModel> {
36
37 protected static final String COLUMN_NAME = "testcolumn";
38 protected static final boolean BLOCKCACHE = true;
39 protected static final int BLOCKSIZE = 16384;
40 protected static final String BLOOMFILTER = "NONE";
41 protected static final String COMPRESSION = "GZ";
42 protected static final boolean IN_MEMORY = false;
43 protected static final int TTL = 86400;
44 protected static final int VERSIONS = 1;
45
46 public TestColumnSchemaModel() throws Exception {
47 super(ColumnSchemaModel.class);
48 AS_XML =
49 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ColumnSchema " +
50 "name=\"testcolumn\" BLOCKSIZE=\"16384\" BLOOMFILTER=\"NONE\" BLOCKCACHE=\"true\" " +
51 "COMPRESSION=\"GZ\" VERSIONS=\"1\" TTL=\"86400\" IN_MEMORY=\"false\"/>";
52
53 AS_JSON =
54 "{\"name\":\"testcolumn\",\"BLOCKSIZE\":\"16384\",\"BLOOMFILTER\":\"NONE\"," +
55 "\"BLOCKCACHE\":\"true\",\"COMPRESSION\":\"GZ\",\"VERSIONS\":\"1\"," +
56 "\"TTL\":\"86400\",\"IN_MEMORY\":\"false\"}";
57 }
58
59 protected ColumnSchemaModel buildTestModel() {
60 ColumnSchemaModel model = new ColumnSchemaModel();
61 model.setName(COLUMN_NAME);
62 model.__setBlocksize(BLOCKSIZE);
63 model.__setBloomfilter(BLOOMFILTER);
64 model.__setBlockcache(BLOCKCACHE);
65 model.__setCompression(COMPRESSION);
66 model.__setVersions(VERSIONS);
67 model.__setTTL(TTL);
68 model.__setInMemory(IN_MEMORY);
69 return model;
70 }
71
72 protected void checkModel(ColumnSchemaModel model) {
73 assertEquals(model.getName(), COLUMN_NAME);
74 assertEquals(model.__getBlockcache(), BLOCKCACHE);
75 assertEquals(model.__getBlocksize(), BLOCKSIZE);
76 assertEquals(model.__getBloomfilter(), BLOOMFILTER);
77 assertTrue(model.__getCompression().equalsIgnoreCase(COMPRESSION));
78 assertEquals(model.__getInMemory(), IN_MEMORY);
79 assertEquals(model.__getTTL(), TTL);
80 assertEquals(model.__getVersions(), VERSIONS);
81 }
82
83 public void testFromPB() throws Exception {
84 }
85 }
86