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

Class TestMultiAction

test/TestMultiAction.java:58–1250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56import org.powermock.modules.junit4.PowerMockRunner;
57
58@RunWith(PowerMockRunner.class)
59@PrepareForTest({ RowLock.class })
60public class TestMultiAction extends BaseTestHBaseClient {
61 protected static final RegionInfo region2 =
62 mkregion("table", "table,A,1234567890");
63 protected static final RegionInfo region3 =
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!

Callers

nothing calls this directly

Calls 1

mkregionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…