use of com.vmware.photon.controller.model.resources.TagService.TagState in project photon-model by vmware.
the class TagGroomerTaskServiceTest method testTagStateGroomerMultiplePagesOfResults.
@Test
public void testTagStateGroomerMultiplePagesOfResults() throws Throwable {
List<String> usedTags = createTagStates("usedExt-", TAG_COUNT_200, true, EnumSet.of(DISCOVERED));
usedTags.addAll(createTagStates("usedInt-", TAG_COUNT_200, false, EnumSet.of(SYSTEM)));
List<String> unusedTagsExt = createTagStates("unusedExt-", 10, true, EnumSet.of(DISCOVERED));
List<String> unusedTagsInt = createTagStates("unusedInt-", 8, false, EnumSet.of(SYSTEM));
int totalTagsCreated = usedTags.size() + unusedTagsExt.size() + unusedTagsInt.size();
createComputesWithTags(400, usedTags);
createDisksWithTags(400, usedTags);
executeTagsGroomerTask();
QueryTask tagsQT = createTagsQueryTask(false);
List<TagState> tagsAfterGrooming = getTags(tagsQT);
// the only tags returned should the ones not marked as deleted
assertEquals(totalTagsCreated - unusedTagsExt.size(), tagsAfterGrooming.size());
// assert used tags are marked as deleted
assertUsedTags(tagsAfterGrooming);
tagsQT = createTagsQueryTask(true);
tagsAfterGrooming = getTags(tagsQT);
// the only tags returned should be the 10 external tags that are marked as deleted
assertEquals(unusedTagsExt.size(), tagsAfterGrooming.size());
// assert unused tags are marked as deleted
assertUnusedTags(tagsAfterGrooming);
}
Aggregations