CloudTrailEventSupport { public static List<String> readSecurityGroupIds(final CloudTrailEvent cloudTrailEvent) { final LinkedHashSet<String> result = newLinkedHashSet(); result.addAll(read(cloudTrailEvent, SECURITY_GROUP_IDS_JSON_PATH, true)); result.addAll(read(cloudTrailEvent, INSTANCES_SECURITY_GROUP_IDS_JSON_PATH, true)); return newArrayList(result); }  static List<String> getInstanceIds(final CloudTrailEvent event); static String getEventId(final CloudTrailEvent event); static String getAccountId(final CloudTrailEvent event); static List<String> read(final String responseElements, final String pattern,
                                    final boolean emptyListOnNullOrEmptyResponse); static List<String> read(final String responseElements, final String pattern); static List<String> read(final CloudTrailEvent cloudTrailEvent, final String pattern,
                                    final boolean emptyListOnNullOrEmptyResponse); static List<String> getInstanceLaunchTime(CloudTrailEvent cloudTrailEvent); static Region getRegion(final CloudTrailEvent cloudTrailEvent); static String getRegionAsString(final CloudTrailEvent event); static ViolationBuilder violationFor(final CloudTrailEvent cloudTrailEvent); static String getUsernameAsString(final CloudTrailEvent cloudTrailEvent); static List<String> getInstances(final CloudTrailEvent event); static DateTime getRunInstanceTime(final String instance); static DateTime getEventTime(CloudTrailEvent event); static List<String> readSecurityGroupIds(final CloudTrailEvent cloudTrailEvent); static final String INSTANCE_ID_JSON_PATH; static final String INSTANCE_JSON_PATH; static final String RUN_INSTANCE_DATE_JSON_PATH; static final String SECURITY_GROUP_IDS_JSON_PATH; static final String INSTANCES_SECURITY_GROUP_IDS_JSON_PATH; static final String INSTANCE_LAUNCH_TIME; }
@Test public void testReadEmptySecurityGroups() throws Exception { final List<String> groups = CloudTrailEventSupport.readSecurityGroupIds(createCloudTrailEvent("/empty-security-groups.json")); assertThat(groups).containsOnly("sg-aaaabbbb"); }