SQLStatKey { public String getName() { return name; } SQLStatKey(final long ms,
                      final String statName,
                      final List<StatisticTag> tags); static final String cleanText(final String text); long getMs(); String getName(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test void testConstructorTwoTags() { final SQLStatKey sqlStatKey = new SQLStatKey(time, statName, tags); final RollUpBitMask rollUpBitMask = RollUpBitMaskUtil.fromSortedTagList(tags); assertThat(sqlStatKey.getName()).isEqualTo(statName + rollUpBitMask.asHexString() + buildTagsPart(tags)); }
@Test void testConstructorNoTags() { tags.clear(); final SQLStatKey sqlStatKey = new SQLStatKey(time, statName, tags); final RollUpBitMask rollUpBitMask = RollUpBitMaskUtil.fromSortedTagList(tags); assertThat(sqlStatKey.getName()).isEqualTo(statName + rollUpBitMask.asHexString()); }
@Test void testConstructorStarInTagName() { tags.clear(); tags.add(new StatisticTag("x*x", "T1V")); tags.add(new StatisticTag("T2", "T2V")); final SQLStatKey sqlStatKey = new SQLStatKey(time, statName, tags); final RollUpBitMask rollUpBitMask = RollUpBitMaskUtil.fromSortedTagList(tags); assertThat(sqlStatKey.getName()).isEqualTo(statName + rollUpBitMask.asHexString() + buildTagsPart(tags)); }
@Test void testConstructorDelimiterInStatName() { tags.clear(); final String newStatName = "My" + SQLStatisticConstants.NAME_SEPARATOR + "Stat" + SQLStatisticConstants.NAME_SEPARATOR + "Name"; final SQLStatKey sqlStatKey = new SQLStatKey(time, newStatName, tags); final RollUpBitMask rollUpBitMask = RollUpBitMaskUtil.fromSortedTagList(tags); System.out.println(sqlStatKey.getName()); assertThat(sqlStatKey.getName()).isEqualTo(newStatName.replaceAll(SQLStatisticConstants.NAME_SEPARATOR, SQLStatisticConstants.DIRTY_CHARACTER_REPLACEMENT) + rollUpBitMask.asHexString()); }
@Test void testConstructorRolledUpTag() { tags.clear(); tags.add(new StatisticTag("T1", "T1V")); tags.add(new StatisticTag("T2", "*")); final SQLStatKey sqlStatKey = new SQLStatKey(time, statName, tags); final RollUpBitMask rollUpBitMask = RollUpBitMaskUtil.fromSortedTagList(tags); System.out.println(sqlStatKey.getName()); assertThat(sqlStatKey.getName()).isEqualTo(statName + rollUpBitMask.asHexString() + buildTagsPart(tags)); }
@Test void testConstructorNullTagValue() { tags.clear(); tags.add(new StatisticTag("T1", "T1V")); tags.add(new StatisticTag("T2", null)); final SQLStatKey sqlStatKey = new SQLStatKey(time, statName, tags); final RollUpBitMask rollUpBitMask = RollUpBitMaskUtil.fromSortedTagList(tags); System.out.println(sqlStatKey.getName()); assertThat(sqlStatKey.getName()).isEqualTo(statName + rollUpBitMask.asHexString() + buildTagsPart(tags)); }
@Test void testConstructorEmptyTagValue() { tags.clear(); tags.add(new StatisticTag("T1", "T1V")); tags.add(new StatisticTag("T2", "")); final SQLStatKey sqlStatKey = new SQLStatKey(time, statName, tags); final RollUpBitMask rollUpBitMask = RollUpBitMaskUtil.fromSortedTagList(tags); System.out.println(sqlStatKey.getName()); assertThat(sqlStatKey.getName()).isEqualTo(statName + rollUpBitMask.asHexString() + buildTagsPart(tags)); }