import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
}
@Override
- public Set<String> listEvents() {
+ public List<String> listEvents() {
List<String> output = ShellUtils.getOutputFromCommand(true, Arrays.asList("lttng", "list", domain.flag()));
return output.stream()
.map(e -> e.trim())
.filter(e -> e.startsWith("- "))
.map(e -> e.substring(2))
- .collect(Collectors.toSet());
+ .collect(Collectors.toList());
}
@Override
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.Collections;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
@Test
public void testManyLoggersNoneAttached() {
/* Don't attach anything */
- Set<String> actualEvents = session.listEvents();
+ List<String> actualEvents = session.listEvents();
assertTrue(actualEvents.isEmpty());
}
public void testManyLoggersSomeAttached() {
attachHandlerToLogger(1, 1);
- Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1));
- Set<String> actualEvents = session.listEvents();
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
assertEquals(expectedEvents, actualEvents);
}
attachHandlerToLogger(2, 2);
attachHandlerToLogger(2, 3);
- Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3));
- Set<String> actualEvents = session.listEvents();
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
assertEquals(expectedEvents, actualEvents);
}
detachHandlerFromLogger(2, 3);
/* Only loggers 1 and 2 will be attached */
- Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2));
- Set<String> actualEvents = session.listEvents();
+ List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2);
+ List<String> actualEvents = session.listEvents();
+
+ Collections.sort(expectedEvents);
+ Collections.sort(actualEvents);
assertEquals(expectedEvents, actualEvents);
}
detachHandlerFromLogger(2, 2);
detachHandlerFromLogger(2, 3);
- Set<String> actualEvents = session.listEvents();
+ List<String> actualEvents = session.listEvents();
assertTrue(actualEvents.isEmpty());
}
}