// mock UniqueId
when(metrics.getId("sys.cpu.user")).thenReturn(new byte[] { 0, 0, 1 });
when(metrics.getNameAsync(new byte[] { 0, 0, 1 }))
.thenReturn(Deferred.fromResult("sys.cpu.user"));
when(metrics.getId("sys.cpu.system"))
.thenThrow(new NoSuchUniqueName("sys.cpu.system", "metric"));
when(metrics.getId("sys.cpu.nice")).thenReturn(new byte[] { 0, 0, 2 });
when(metrics.getNameAsync(new byte[] { 0, 0, 2 }))
.thenReturn(Deferred.fromResult("sys.cpu.nice"));
when(tag_names.getId("host")).thenReturn(new byte[] { 0, 0, 1 });
when(tag_names.getIdAsync("host")).thenReturn(
Deferred.fromResult(new byte[] { 0, 0, 1 }));
when(tag_names.getNameAsync(new byte[] { 0, 0, 1 }))
.thenReturn(Deferred.fromResult("host"));
when(tag_names.getOrCreateIdAsync("host")).thenReturn(
Deferred.fromResult(new byte[] { 0, 0, 1 }));
when(tag_names.getIdAsync("dc"))
.thenThrow(new NoSuchUniqueName("dc", "metric"));
when(tag_values.getId("web01")).thenReturn(new byte[] { 0, 0, 1 });
when(tag_values.getIdAsync("web01")).thenReturn(
Deferred.fromResult(new byte[] { 0, 0, 1 }));
when(tag_values.getNameAsync(new byte[] { 0, 0, 1 }))
.thenReturn(Deferred.fromResult("web01"));
when(tag_values.getOrCreateIdAsync("web01")).thenReturn(
Deferred.fromResult(new byte[] { 0, 0, 1 }));
when(tag_values.getId("web02")).thenReturn(new byte[] { 0, 0, 2 });
when(tag_values.getIdAsync("web02")).thenReturn(
Deferred.fromResult(new byte[] { 0, 0, 2 }));
when(tag_values.getNameAsync(new byte[] { 0, 0, 2 }))
.thenReturn(Deferred.fromResult("web02"));
when(tag_values.getOrCreateIdAsync("web02")).thenReturn(
Deferred.fromResult(new byte[] { 0, 0, 2 }));
when(tag_values.getId("web03"))
.thenThrow(new NoSuchUniqueName("web03", "metric"));
when(metrics.width()).thenReturn((short)3);
when(tag_names.width()).thenReturn((short)3);
when(tag_values.width()).thenReturn((short)3);
}