MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / multiComparator

Method multiComparator

test/TestMultiAction.java:66–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64 mkregion("table", "table,B,1234567890");
65
66 @Test
67 public void multiComparator() throws Exception {
68 PutRequest put1 = new PutRequest(TABLE, KEY, FAMILY, QUALIFIER, VALUE);
69 put1.region = region;
70 PutRequest put2 = new PutRequest(TABLE, KEY, FAMILY, QUALIFIER, VALUE);
71 put2.region = region;
72
73 // same
74 assertEquals(0, MultiAction.MULTI_CMP.compare(put1, put2));
75
76 // diff region on 2
77 put2.region = mkregion("table", "table,a,1234567890");
78 assertTrue(MultiAction.MULTI_CMP.compare(put1, put2) < 0);
79
80 // diff region on 1
81 put1.region = mkregion("table", "table,a,1234567890");
82 put2.region = region;
83 assertTrue(MultiAction.MULTI_CMP.compare(put1, put2) > 0);
84
85 // diff table on 2
86 put1.region = region;
87 put2.region = mkregion("table", "atable,,1234567890");
88 assertTrue(MultiAction.MULTI_CMP.compare(put1, put2) > 0);
89
90 // diff table on 1
91 put1.region = mkregion("table", "atable,,1234567890");
92 put2.region = region;
93 assertTrue(MultiAction.MULTI_CMP.compare(put1, put2) < 0);
94
95 // different RPC types
96 DeleteRequest delete1 = new DeleteRequest(TABLE, KEY, FAMILY, QUALIFIER);
97 delete1.region = region;
98 put1.region = region;
99 put2.region = region;
100 assertTrue(MultiAction.MULTI_CMP.compare(delete1, put2) < 0);
101 assertTrue(MultiAction.MULTI_CMP.compare(put1, delete1) > 0);
102
103 // different keys
104 put1 = new PutRequest(TABLE, KEY2, FAMILY, QUALIFIER, VALUE);
105 put1.region = region;
106 assertTrue(MultiAction.MULTI_CMP.compare(put1, put2) > 0);
107 assertTrue(MultiAction.MULTI_CMP.compare(put2, put1) < 0);
108
109 // different families
110 put1 = new PutRequest(TABLE, KEY, "t".getBytes(), QUALIFIER, VALUE);
111 put1.region = region;
112 assertTrue(MultiAction.MULTI_CMP.compare(put1, put2) > 0);
113 assertTrue(MultiAction.MULTI_CMP.compare(put2, put1) < 0);
114
115 // apparently we don't care about qualifiers!
116 put1 = new PutRequest(TABLE, KEY, FAMILY, "hobbes".getBytes(), VALUE);
117 put1.region = region;
118 assertEquals(0, MultiAction.MULTI_CMP.compare(put1, put2));
119 }
120
121 @Test
122 public void multiComparatorErrors() throws Exception {

Callers

nothing calls this directly

Calls 2

compareMethod · 0.45
mkregionMethod · 0.45

Tested by

no test coverage detected