@Test public void runWhenSpywareIsDisabledTest() throws InterruptedException { when(settings.isSpywareEnabled()).thenReturn(false); for (Course c : courseDAO.getCourses()) { List<String> l = new ArrayList<String>(); l.add("a"); l.add("b"); l.add("c"); c.setSpywareUrls(l); } task.run(); assertEquals(sendQueue.size(), 5); }
@Override public void run() { if (!settings.isSpywareEnabled()) { return; } boolean shouldSendMore; do { ArrayList<LoggableEvent> eventsToSend = copyEventsToSendFromQueue(); if (eventsToSend.isEmpty()) { return; } synchronized (sendQueue) { shouldSendMore = sendQueue.size() > eventsToSend.size(); } String url = pickDestinationUrl(); if (url == null) { return; } log.log(Level.INFO, "Sending {0} events to {1}", new Object[] {eventsToSend.size(), url}); doSend(eventsToSend, url); } while (shouldSendMore); }
SendingTask implements Runnable { @Override public void run() { if (!settings.isSpywareEnabled()) { return; } boolean shouldSendMore; do { ArrayList<LoggableEvent> eventsToSend = copyEventsToSendFromQueue(); if (eventsToSend.isEmpty()) { return; } synchronized (sendQueue) { shouldSendMore = sendQueue.size() > eventsToSend.size(); } String url = pickDestinationUrl(); if (url == null) { return; } log.log(Level.INFO, "Sending {0} events to {1}", new Object[] {eventsToSend.size(), url}); doSend(eventsToSend, url); } while (shouldSendMore); } }
SendingTask implements Runnable { @Override public void run() { if (!settings.isSpywareEnabled()) { return; } boolean shouldSendMore; do { ArrayList<LoggableEvent> eventsToSend = copyEventsToSendFromQueue(); if (eventsToSend.isEmpty()) { return; } synchronized (sendQueue) { shouldSendMore = sendQueue.size() > eventsToSend.size(); } String url = pickDestinationUrl(); if (url == null) { return; } log.log(Level.INFO, "Sending {0} events to {1}", new Object[] {eventsToSend.size(), url}); doSend(eventsToSend, url); } while (shouldSendMore); } SendingTask(ArrayDeque<LoggableEvent> sendQueue, ServerManager serverManager, CourseDAO courseDAO,
            Settings settings, SingletonTask savingTask, AtomicInteger eventsToRemoveAfterSend); }
SendingTask implements Runnable { @Override public void run() { if (!settings.isSpywareEnabled()) { return; } boolean shouldSendMore; do { ArrayList<LoggableEvent> eventsToSend = copyEventsToSendFromQueue(); if (eventsToSend.isEmpty()) { return; } synchronized (sendQueue) { shouldSendMore = sendQueue.size() > eventsToSend.size(); } String url = pickDestinationUrl(); if (url == null) { return; } log.log(Level.INFO, "Sending {0} events to {1}", new Object[] {eventsToSend.size(), url}); doSend(eventsToSend, url); } while (shouldSendMore); } SendingTask(ArrayDeque<LoggableEvent> sendQueue, ServerManager serverManager, CourseDAO courseDAO,
            Settings settings, SingletonTask savingTask, AtomicInteger eventsToRemoveAfterSend); @Override void run(); }
SendingTask implements Runnable { @Override public void run() { if (!settings.isSpywareEnabled()) { return; } boolean shouldSendMore; do { ArrayList<LoggableEvent> eventsToSend = copyEventsToSendFromQueue(); if (eventsToSend.isEmpty()) { return; } synchronized (sendQueue) { shouldSendMore = sendQueue.size() > eventsToSend.size(); } String url = pickDestinationUrl(); if (url == null) { return; } log.log(Level.INFO, "Sending {0} events to {1}", new Object[] {eventsToSend.size(), url}); doSend(eventsToSend, url); } while (shouldSendMore); } SendingTask(ArrayDeque<LoggableEvent> sendQueue, ServerManager serverManager, CourseDAO courseDAO,
            Settings settings, SingletonTask savingTask, AtomicInteger eventsToRemoveAfterSend); @Override void run();  }