MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / setupMockBase

Method setupMockBase

test/tools/TestUID.java:922–959  ·  view source on GitHub ↗

Write clean data to MockBase that can be overridden by individual unit tests

()

Source from the content-addressed store, hash-verified

920 * Write clean data to MockBase that can be overridden by individual unit tests
921 */
922 private void setupMockBase() {
923 storage = new MockBase(tsdb, client, true, true, true, true);
924 storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, METRICS,
925 Bytes.fromLong(2L));
926 storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, TAGK,
927 Bytes.fromLong(2L));
928 storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, TAGV,
929 Bytes.fromLong(2L));
930 // forward mappings
931 storage.addColumn(UID_TABLE, "foo".getBytes(MockBase.ASCII()), ID_FAMILY,
932 METRICS, new byte[] {0, 0, 1});
933 storage.addColumn(UID_TABLE, "host".getBytes(MockBase.ASCII()), ID_FAMILY,
934 TAGK, new byte[] {0, 0, 1});
935 storage.addColumn(UID_TABLE, "web01".getBytes(MockBase.ASCII()), ID_FAMILY,
936 TAGV, new byte[] {0, 0, 1});
937
938 storage.addColumn(UID_TABLE, "bar".getBytes(MockBase.ASCII()), ID_FAMILY,
939 METRICS, new byte[] {0, 0, 2});
940 storage.addColumn(UID_TABLE, "dc".getBytes(MockBase.ASCII()), ID_FAMILY,
941 TAGK, new byte[] {0, 0, 2});
942 storage.addColumn(UID_TABLE, "web02".getBytes(MockBase.ASCII()), ID_FAMILY,
943 TAGV, new byte[] {0, 0, 2});
944
945 // reverse mappings
946 storage.addColumn(UID_TABLE, new byte[] {0, 0, 1}, NAME_FAMILY,
947 METRICS, "foo".getBytes(MockBase.ASCII()));
948 storage.addColumn(UID_TABLE, new byte[] {0, 0, 1}, NAME_FAMILY,
949 TAGK, "host".getBytes(MockBase.ASCII()));
950 storage.addColumn(UID_TABLE, new byte[] {0, 0, 1}, NAME_FAMILY,
951 TAGV, "web01".getBytes(MockBase.ASCII()));
952
953 storage.addColumn(UID_TABLE, new byte[] {0, 0, 2}, NAME_FAMILY,
954 METRICS, "bar".getBytes(MockBase.ASCII()));
955 storage.addColumn(UID_TABLE, new byte[] {0, 0, 2}, NAME_FAMILY,
956 TAGK, "dc".getBytes(MockBase.ASCII()));
957 storage.addColumn(UID_TABLE, new byte[] {0, 0, 2}, NAME_FAMILY,
958 TAGV, "web02".getBytes(MockBase.ASCII()));
959 }
960
961 @After
962 public void tearDown() {

Callers 1

beforeMethod · 0.95

Calls 3

ASCIIMethod · 0.95
addColumnMethod · 0.80
getBytesMethod · 0.45

Tested by

no test coverage detected