FederatedStoreUtil { public static List<String> getGraphIds(final Map<String, String> config) { if (null == config) { return null; } return getCleanStrings(config.get(KEY_OPERATION_OPTIONS_GRAPH_IDS)); } private  FederatedStoreUtil(); static String createOperationErrorMsg(final Operation operation, final String graphId, final Exception e); static List<String> getGraphIds(final Map<String, String> config); static List<String> getCleanStrings(final String value); static OP updateOperationForGraph(final OP operation, final Graph graph); static boolean isUserRequestingAdminUsage(final Operation operation); static final Collection<String> STRINGS_TO_REMOVE; }
@Test public void shouldGetEmptyGraphIdsWhenEmptyCsvValue() { final Map<String, String> config = new HashMap<>(); config.put(FederatedStoreConstants.KEY_OPERATION_OPTIONS_GRAPH_IDS, ""); final List<String> graphIds = FederatedStoreUtil.getGraphIds(config); assertEquals(Collections.emptyList(), graphIds); }
@Test public void shouldGetNullGraphIdsWhenNullCsvValue() { final Map<String, String> config = new HashMap<>(); config.put(FederatedStoreConstants.KEY_OPERATION_OPTIONS_GRAPH_IDS, null); final List<String> graphIds = FederatedStoreUtil.getGraphIds(config); assertNull(graphIds); }
@Test public void shouldGetNullGraphIdsWhenNoCsvEntry() { final Map<String, String> config = new HashMap<>(); config.put("some other key", "some value"); final List<String> graphIds = FederatedStoreUtil.getGraphIds(config); assertNull(graphIds); }
@Test public void shouldGetGraphIds() { final Map<String, String> config = new HashMap<>(); config.put(FederatedStoreConstants.KEY_OPERATION_OPTIONS_GRAPH_IDS, "graph1,graph2,graph3"); final List<String> graphIds = FederatedStoreUtil.getGraphIds(config); assertEquals(Arrays.asList("graph1", "graph2", "graph3"), graphIds); }
@Test public void shouldGetGraphIdsAndSkipEmptiesAndWhitespace() { final Map<String, String> config = new HashMap<>(); config.put(FederatedStoreConstants.KEY_OPERATION_OPTIONS_GRAPH_IDS, " graph1 , graph2,,graph3 "); final List<String> graphIds = FederatedStoreUtil.getGraphIds(config); assertEquals(Arrays.asList("graph1", "graph2", "graph3"), graphIds); }