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

Method before

test/core/TestSaltScannerHistogram.java:90–191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88 protected byte[] key_c;
89
90 @Before
91 public void before() throws Exception {
92 // Copying the whole thing as the SPY in the base mucks up the references.
93 uid_map = Maps.newHashMap();
94 PowerMockito.mockStatic(Threads.class);
95 timer = new FakeTaskTimer();
96 PowerMockito.when(Threads.newTimer(anyString())).thenReturn(timer);
97 PowerMockito.when(Threads.newTimer(anyInt(), anyString())).thenReturn(timer);
98
99 PowerMockito.whenNew(HashedWheelTimer.class).withNoArguments()
100 .thenReturn(timer);
101 PowerMockito.whenNew(HBaseClient.class).withAnyArguments()
102 .thenReturn(client);
103
104 config = new Config(false);
105 config.overrideConfig("tsd.storage.enable_compaction", "false");
106 tsdb = new TSDB(config);
107
108 config.setAutoMetric(true);
109
110 Whitebox.setInternalState(tsdb, "metrics", metrics);
111 Whitebox.setInternalState(tsdb, "tag_names", tag_names);
112 Whitebox.setInternalState(tsdb, "tag_values", tag_values);
113
114 setupMetricMaps();
115 setupTagkMaps();
116 setupTagvMaps();
117
118 mockUID(UniqueIdType.METRIC, HISTOGRAM_METRIC_STRING, HISTOGRAM_METRIC_BYTES);
119
120 // add metrics and tags to the UIDs list for other functions to share
121 uid_map.put(METRIC_STRING, METRIC_BYTES);
122 uid_map.put(METRIC_B_STRING, METRIC_B_BYTES);
123 uid_map.put(NSUN_METRIC, NSUI_METRIC);
124 uid_map.put(HISTOGRAM_METRIC_STRING, HISTOGRAM_METRIC_BYTES);
125
126 uid_map.put(TAGK_STRING, TAGK_BYTES);
127 uid_map.put(TAGK_B_STRING, TAGK_B_BYTES);
128 uid_map.put(NSUN_TAGK, NSUI_TAGK);
129
130 uid_map.put(TAGV_STRING, TAGV_BYTES);
131 uid_map.put(TAGV_B_STRING, TAGV_B_BYTES);
132 uid_map.put(NSUN_TAGV, NSUI_TAGV);
133
134 uid_map.putAll(UIDS);
135
136 when(metrics.width()).thenReturn((short)3);
137 when(tag_names.width()).thenReturn((short)3);
138 when(tag_values.width()).thenReturn((short)3);
139
140 tags = new HashMap<String, String>(1);
141 tags.put(TAGK_STRING, TAGV_STRING);
142 config.overrideConfig("tsd.core.histograms.config",
143 "{\"net.opentsdb.core.LongHistogramDataPointForTestDecoder\": 0}");
144 HistogramCodecManager manager =
145 new HistogramCodecManager(tsdb);
146 Whitebox.setInternalState(tsdb, "histogram_manager", manager);
147

Callers

nothing calls this directly

Calls 13

newTimerMethod · 0.95
setupMockScannersMethod · 0.95
setAutoMetricMethod · 0.80
mockUIDMethod · 0.80
putMethod · 0.80
toByteArrayMethod · 0.80
widthMethod · 0.65
overrideConfigMethod · 0.45
setupMetricMapsMethod · 0.45
setupTagkMapsMethod · 0.45
setupTagvMapsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected