< prev index next >

core/tests/org.openjdk.jmc.flightrecorder.test/src/test/java/org/openjdk/jmc/flightrecorder/test/JfrAttributesTest.java

Print this page




  37 import java.io.IOException;
  38 import java.util.Set;
  39 
  40 import org.junit.Test;
  41 import org.openjdk.jmc.common.item.Aggregators;
  42 import org.openjdk.jmc.common.item.IAggregator;
  43 import org.openjdk.jmc.common.item.IItemCollection;
  44 import org.openjdk.jmc.common.item.IType;
  45 import org.openjdk.jmc.flightrecorder.CouldNotLoadRecordingException;
  46 import org.openjdk.jmc.flightrecorder.JfrAttributes;
  47 import org.openjdk.jmc.flightrecorder.test.util.RecordingToolkit;
  48 
  49 /**
  50  * Class to test JfrAttributes
  51  */
  52 public class JfrAttributesTest {
  53         
  54         @Test
  55         public void testGetEventTypes() throws IOException, CouldNotLoadRecordingException {
  56                 IItemCollection events = RecordingToolkit.getFlightRecording(RecordingToolkit.getRecordings());
  57                 String typesStr = events.getAggregate(Aggregators.distinctAsString(JfrAttributes.EVENT_TYPE_ID, ", ")); //$NON-NLS-1$
  58                 
  59                 IAggregator<Set<IType<?>>, ?> distinct = Aggregators.distinct(JfrAttributes.EVENT_TYPE);
  60                 Set<IType<?>> types = events.getAggregate(distinct);
  61                 assertEquals(types.size(), typesStr.split(",").length); //$NON-NLS-1$
  62         }
  63 }


  37 import java.io.IOException;
  38 import java.util.Set;
  39 
  40 import org.junit.Test;
  41 import org.openjdk.jmc.common.item.Aggregators;
  42 import org.openjdk.jmc.common.item.IAggregator;
  43 import org.openjdk.jmc.common.item.IItemCollection;
  44 import org.openjdk.jmc.common.item.IType;
  45 import org.openjdk.jmc.flightrecorder.CouldNotLoadRecordingException;
  46 import org.openjdk.jmc.flightrecorder.JfrAttributes;
  47 import org.openjdk.jmc.flightrecorder.test.util.RecordingToolkit;
  48 
  49 /**
  50  * Class to test JfrAttributes
  51  */
  52 public class JfrAttributesTest {
  53         
  54         @Test
  55         public void testGetEventTypes() throws IOException, CouldNotLoadRecordingException {
  56                 IItemCollection events = RecordingToolkit.getFlightRecording(RecordingToolkit.getRecordings());
  57                 String typesStr = events.getAggregate(Aggregators.distinctAsString(JfrAttributes.EVENT_TYPE_ID, ", "));
  58                 
  59                 IAggregator<Set<IType<?>>, ?> distinct = Aggregators.distinct(JfrAttributes.EVENT_TYPE);
  60                 Set<IType<?>> types = events.getAggregate(distinct);
  61                 assertEquals(types.size(), typesStr.split(",").length);
  62         }
  63 }
< prev index next >