KeenClient { public void sendQueuedEvents() { sendQueuedEvents(null); } protected  KeenClient(Builder builder);   KeenClient(Builder builder, Environment env); static KeenClient client(); static void initialize(KeenClient client); static boolean isInitialized(); void addEvent(String eventCollection, Map<String, Object> event); void addEvent(String eventCollection, Map<String, Object> event,
                         Map<String, Object> keenProperties); void addEvent(KeenProject project, String eventCollection, Map<String, Object> event,
                         Map<String, Object> keenProperties, KeenCallback callback); void addEventAsync(String eventCollection, Map<String, Object> event); void addEventAsync(String eventCollection, Map<String, Object> event,
                              final Map<String, Object> keenProperties); void addEventAsync(final KeenProject project, final String eventCollection,
                              final Map<String, Object> event,
                              final Map<String, Object> keenProperties,
                              final KeenCallback callback); void queueEvent(String eventCollection, Map<String, Object> event); void queueEvent(String eventCollection, Map<String, Object> event,
                           Map<String, Object> keenProperties); void queueEvent(KeenProject project, String eventCollection, Map<String, Object> event,
                           Map<String, Object> keenProperties, final KeenCallback callback); void sendQueuedEvents(); void sendQueuedEvents(KeenProject project); synchronized void sendQueuedEvents(KeenProject project, KeenCallback callback); void sendQueuedEventsAsync(); void sendQueuedEventsAsync(final KeenProject project); void sendQueuedEventsAsync(final KeenProject project, final KeenCallback callback); KeenJsonHandler getJsonHandler(); KeenEventStore getEventStore(); Executor getPublishExecutor(); KeenProject getDefaultProject(); void setDefaultProject(KeenProject defaultProject); String getBaseUrl(); void setBaseUrl(String baseUrl); void setMaxAttempts(int maxAttempts); int getMaxAttempts(); GlobalPropertiesEvaluator getGlobalPropertiesEvaluator(); void setGlobalPropertiesEvaluator(GlobalPropertiesEvaluator globalPropertiesEvaluator); Map<String, Object> getGlobalProperties(); void setGlobalProperties(Map<String, Object> globalProperties); boolean isDebugMode(); void setDebugMode(boolean isDebugMode); boolean isActive(); void setProxy(String proxyHost, int proxyPort); void setProxy(Proxy proxy); Proxy getProxy();  }
@Test public void testSendQueuedEvents() throws Exception { Map<String, Integer> expectedResponse = new HashMap<String, Integer>(); expectedResponse.put(TEST_COLLECTION, 3); setMockResponse(200, getPostEventsResponse(buildSuccessMap(expectedResponse))); client.queueEvent(TEST_COLLECTION, TEST_EVENTS.get(0)); client.queueEvent(TEST_COLLECTION, TEST_EVENTS.get(1)); client.queueEvent(TEST_COLLECTION, TEST_EVENTS.get(2)); RamEventStore store = (RamEventStore) client.getEventStore(); Map<String, List<Object>> handleMap = store.getHandles(TEST_PROJECT.getProjectId()); assertEquals(1, handleMap.size()); assertEquals(3, handleMap.get(TEST_COLLECTION).size()); client.sendQueuedEvents(); handleMap = store.getHandles(TEST_PROJECT.getProjectId()); assertEquals(0, handleMap.size()); setMockResponse(200, "{}"); client.sendQueuedEvents(); handleMap = store.getHandles(TEST_PROJECT.getProjectId()); assertEquals(0, handleMap.size()); }