changeset 2715:752a90af8d85

Remove ApplicationService and related classes. Reviewed-by: neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-June/023896.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Mon, 26 Jun 2017 11:22:04 +0200
parents cd2f41102214
children cc297a1bf67f
files common/core/pom.xml common/core/src/main/java/com/redhat/thermostat/common/ApplicationCache.java common/core/src/main/java/com/redhat/thermostat/common/ApplicationService.java common/core/src/main/java/com/redhat/thermostat/common/ThreadPoolTimerFactory.java common/core/src/main/java/com/redhat/thermostat/common/Timer.java common/core/src/main/java/com/redhat/thermostat/common/TimerFactory.java common/core/src/main/java/com/redhat/thermostat/common/Timers.java common/core/src/main/java/com/redhat/thermostat/common/internal/Activator.java common/core/src/main/java/com/redhat/thermostat/common/internal/ApplicationServiceImpl.java common/core/src/main/java/com/redhat/thermostat/common/internal/test/TestTimerFactory.java common/core/src/test/java/com/redhat/thermostat/common/ApplicationCacheTest.java common/core/src/test/java/com/redhat/thermostat/common/ThreadPoolTimerFactoryTest.java common/core/src/test/java/com/redhat/thermostat/common/TimersTest.java common/core/src/test/java/com/redhat/thermostat/common/internal/ApplicationServiceImplTest.java common/core/src/test/java/com/redhat/thermostat/common/internal/test/TestTimerFactoryTest.java launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java launcher/src/test/java/com/redhat/thermostat/launcher/internal/LauncherImplTest.java storage/core/src/test/java/com/redhat/thermostat/storage/internal/ActivatorTest.java
diffstat 18 files changed, 4 insertions(+), 1333 deletions(-) [+]
line wrap: on
line diff
--- a/common/core/pom.xml	Wed Jun 28 16:22:22 2017 +0200
+++ b/common/core/pom.xml	Mon Jun 26 11:22:04 2017 +0200
@@ -84,7 +84,6 @@
             <Include-Resource>{maven-resources}, com/redhat/thermostat/app-info.properties=target/classes/com/redhat/thermostat/app-info.properties</Include-Resource>
             <Bundle-SymbolicName>com.redhat.thermostat.common.core</Bundle-SymbolicName>
             <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor>
-            <Bundle-Activator>com.redhat.thermostat.common.internal.Activator</Bundle-Activator>
             <Export-Package>
               com.redhat.thermostat.common.cli,
               com.redhat.thermostat.common.tools,
--- a/common/core/src/main/java/com/redhat/thermostat/common/ApplicationCache.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * A simple cache to keep resources in.
- */
-public class ApplicationCache {
-
-    // FIXME: Add some sort of support for evication of resources
-    // otherwise this 'cache' will become a memory leak
-
-    private final Map<Object, Object> cache = new ConcurrentHashMap<>();
-    
-    public void addAttribute(Object key, Object value) {
-        cache.put(key, value);
-    }
-    
-    public Object getAttribute(Object key) {
-        return cache.get(key);
-    }
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/ApplicationService.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import java.util.concurrent.ExecutorService;
-
-import com.redhat.thermostat.annotations.Service;
-
-@Service
-public interface ApplicationService {
-
-    ApplicationCache getApplicationCache();
-
-    ExecutorService getApplicationExecutor();
-
-    public TimerFactory getTimerFactory();
-
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/ThreadPoolTimerFactory.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-
-public class ThreadPoolTimerFactory implements TimerFactory {
-
-    public ThreadPoolTimerFactory(int poolSize) {
-        this(poolSize, Thread.currentThread().getThreadGroup());
-    }
-
-    ThreadPoolTimerFactory(int poolSize, final ThreadGroup group) {
-        timerThreadPool = Executors.newScheduledThreadPool(poolSize, new ThreadFactory() {
-            
-            @Override
-            public Thread newThread(Runnable r) {
-                return new Thread(group, r);
-            }
-        });
-    }
-
-    private class ThreadPoolTimer implements Timer {
-
-        private Runnable action;
-
-        private long delay;
-
-        private long period;
-
-        private TimeUnit timeUnit = TimeUnit.MILLISECONDS;
-
-        private SchedulingType schedulingType = SchedulingType.ONCE;
-
-        private ScheduledFuture<?> timerTask;
-
-        @Override
-        public void start() {
-            if (action != null) {
-                startScheduling();
-            }          
-        }
-
-        private void startScheduling() {
-            switch (schedulingType) {
-            case FIXED_RATE:
-                timerTask = timerThreadPool.scheduleAtFixedRate(action, delay, period, timeUnit);
-                break;
-            case FIXED_DELAY:
-                timerTask = timerThreadPool.scheduleWithFixedDelay(action, delay, period, timeUnit);
-                break;
-            case ONCE:
-            default:
-                timerTask = timerThreadPool.schedule(action, delay, timeUnit);
-            }
-        }
-
-        @Override
-        public void stop() {
-            if (timerTask != null) {
-                timerTask.cancel(false);
-            }
-        }
-
-        @Override
-        public void setAction(Runnable action) {
-            this.action = new ExceptionPrintingRunnable(action);
-        }
-
-        @Override
-        public void setInitialDelay(long delay) {
-            this.delay = delay;
-        }
-
-        @Override
-        public void setDelay(long period) {
-            this.period = period;
-        }
-
-        @Override
-        public void setSchedulingType(SchedulingType schedulingType) {
-            if (schedulingType == null) {
-                throw new NullPointerException();
-            }
-            this.schedulingType = schedulingType;
-        }
-
-        @Override
-        public void setTimeUnit(TimeUnit timeUnit) {
-            this.timeUnit = timeUnit;
-        }
-        
-    }
-
-    /**
-     * A decorator for another Runnable object that ensures all exceptions are
-     * printed. Needed because scheduled executors remain silent on failures.
-     */
-    private static class ExceptionPrintingRunnable implements Runnable {
-
-        private final Runnable original;
-
-        public ExceptionPrintingRunnable(Runnable original) {
-            this.original = original;
-        }
-
-        @Override
-        public void run() {
-            try {
-                original.run();
-            } catch (Exception e) {
-                e.printStackTrace();
-                throw e;
-            }
-        }
-
-    }
-
-    private ScheduledExecutorService timerThreadPool;
-
-    @Override
-    public Timer createTimer() {
-        return new ThreadPoolTimer();
-    }
-
-    @Override
-    public void shutdown() {
-        timerThreadPool.shutdown();
-    }
-
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/Timer.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import java.util.concurrent.TimeUnit;
-
-public interface Timer {
-
-    enum SchedulingType {
-        ONCE, FIXED_RATE, FIXED_DELAY;
-    }
-
-    void start();
-    void stop();
-    void setAction(Runnable action);
-    void setInitialDelay(long initialDelay);
-    void setDelay(long period);
-    void setSchedulingType(SchedulingType schedulingType);
-    void setTimeUnit(TimeUnit timeUnit);
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/TimerFactory.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-/**
- * An instance of this can be obtained from {@link ApplicationService}.
- */
-public interface TimerFactory {
-
-    Timer createTimer();
-
-    void shutdown();
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/Timers.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import java.util.concurrent.TimeUnit;
-
-public class Timers {
-    private Timers() {
-        // Do not instantiate
-    }
-
-    /**
-     * Creates a timer suitable for fetching data to refresh GUI
-     */
-    public static Timer createDataRefreshTimer(TimerFactory factory, Runnable action) {
-        Timer timer = factory.createTimer();
-        timer.setAction(action);
-        timer.setSchedulingType(Timer.SchedulingType.FIXED_RATE);
-        timer.setTimeUnit(TimeUnit.SECONDS);
-        timer.setInitialDelay(0);
-        timer.setDelay(5);
-        return timer;
-    }
-}
--- a/common/core/src/main/java/com/redhat/thermostat/common/internal/Activator.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.internal;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-import com.redhat.thermostat.common.ApplicationService;
-
-public class Activator implements BundleActivator {
-    
-    @Override
-    public void start(BundleContext context) throws Exception {
-        ApplicationService service = new ApplicationServiceImpl();
-        context.registerService(ApplicationService.class.getName(), service, null);
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        // Services unregistered automatically
-    }
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/internal/ApplicationServiceImpl.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.internal;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import com.redhat.thermostat.common.ApplicationCache;
-import com.redhat.thermostat.common.ApplicationService;
-import com.redhat.thermostat.common.ThreadPoolTimerFactory;
-import com.redhat.thermostat.common.TimerFactory;
-
-public class ApplicationServiceImpl implements ApplicationService {
-
-    private ApplicationCache cache = new ApplicationCache();
-
-    // NOTE: When merging with ApplicationContext, this could be provided by the same
-    // thread pool that does the timer scheduling. Not sure we want this though,
-    // as scheduled thread pools are always limited in number of threads (could lead to deadlocks
-    // when used carelessly).
-    private ExecutorService executor = Executors.newCachedThreadPool();
-
-    private TimerFactory timers;
-
-    public ApplicationServiceImpl() {
-        // TODO merge with QueuedStorage's determine-number-of-threads implementation
-        int poolSize = Runtime.getRuntime().availableProcessors() * 2;
-        timers = new ThreadPoolTimerFactory(poolSize);
-    }
-
-    @Override
-    public ApplicationCache getApplicationCache() {
-        return cache;
-    }
-
-    @Override
-    public ExecutorService getApplicationExecutor() {
-        return executor;
-    }
-
-    @Override
-    public TimerFactory getTimerFactory() {
-        return timers;
-    }
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/internal/test/TestTimerFactory.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.internal.test;
-
-import java.util.concurrent.TimeUnit;
-
-import com.redhat.thermostat.common.Timer;
-import com.redhat.thermostat.common.TimerFactory;
-
-public class TestTimerFactory implements TimerFactory {
-
-    private class TestTimer implements Timer {
-
-        @Override
-        public void start() {
-            isActive = true;
-        }
-
-        @Override
-        public void stop() {
-            isActive = false;
-        }
-
-        @Override
-        public void setAction(Runnable action) {
-            TestTimerFactory.this.action = action;
-        }
-
-        @Override
-        public void setInitialDelay(long initialDelay) {
-            TestTimerFactory.this.initialDelay = initialDelay;
-        }
-
-        @Override
-        public void setDelay(long delay) {
-            TestTimerFactory.this.delay = delay;
-        }
-
-        @Override
-        public void setSchedulingType(SchedulingType schedulingType) {
-            TestTimerFactory.this.schedulingType = schedulingType;
-        }
-
-        @Override
-        public void setTimeUnit(TimeUnit timeUnit) {
-            TestTimerFactory.this.timeUnit = timeUnit;
-        }
-        
-    }
-
-    private Timer timer = new TestTimer();
-
-    private Runnable action;
-
-    private long initialDelay;
-
-    private long delay;
-
-    private Timer.SchedulingType schedulingType;
-
-    private TimeUnit timeUnit;
-
-    private boolean isActive;
-
-    private boolean shutdown;
-
-    public long getInitialDelay() {
-        return initialDelay;
-    }
-
-    public long getDelay() {
-        return delay;
-    }
-
-    public Timer.SchedulingType getSchedulingType() {
-        return schedulingType;
-    }
-
-    public TimeUnit getTimeUnit() {
-        return timeUnit;
-    }
-
-    public Runnable getAction() {
-        return action;
-    }
-
-    @Override
-    public Timer createTimer() {
-        return timer;
-    }
-
-    @Override
-    public void shutdown() {
-        shutdown = true;
-    }
-
-    public boolean isActive() {
-        return isActive;
-    }
-
-    public boolean isShutdown() {
-        return shutdown;
-    }
-
-}
-
--- a/common/core/src/test/java/com/redhat/thermostat/common/ApplicationCacheTest.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ApplicationCacheTest {
-
-    @Test
-    public void verityCache() {
-        ApplicationCache cache = new ApplicationCache();
-        cache.addAttribute("test", "fluff");
-        assertEquals("fluff", cache.getAttribute("test"));
-    }
-}
-
--- a/common/core/src/test/java/com/redhat/thermostat/common/ThreadPoolTimerFactoryTest.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import com.redhat.thermostat.common.Timer.SchedulingType;
-import com.redhat.thermostat.common.internal.test.Bug;
-
-public class ThreadPoolTimerFactoryTest {
-
-    private static final long DELAY = 200;
-
-    private Timer timer;
-
-    private ThreadGroup threadGroup;
-
-    private TimerFactory timerFactory;
-
-    @Before
-    public void setUp() {
-        threadGroup = new ThreadGroup("test");
-        timerFactory = new ThreadPoolTimerFactory(1, threadGroup);
-        timer = timerFactory.createTimer();
-    }
-
-    @After
-    public void tearDown() {
-        
-        timer = null;
-        timerFactory.shutdown();
-        timerFactory = null;
-        threadGroup = null;
-    }
-
-    @Test
-    public void testDefault() throws InterruptedException {
-        Runnable action = mock(Runnable.class);
-        timer.setAction(action);
-        timer.start();
-        Thread.sleep(DELAY / 2);
-        verify(action).run();
-    }
-
-    @Test
-    public void testNullAction() {
-        timer.setAction(null);
-        timer.start();
-        // Good when no NPE is thrown.
-    }
-
-    @Test
-    public void testDefaultWithDelay() throws InterruptedException {
-        Runnable action = mock(Runnable.class);
-        timer.setAction(action);
-        timer.setInitialDelay(DELAY);
-        timer.start();
-        Thread.sleep(DELAY / 2);
-        verify(action, never()).run();
-        Thread.sleep(DELAY);
-        verify(action).run();
-        Thread.sleep(DELAY);
-        verify(action).run();
-    }
-
-    @Test
-    public void testTimeUnitSecond() throws InterruptedException {
-        Runnable action = mock(Runnable.class);
-        timer.setAction(action);
-        timer.setInitialDelay(1);
-        timer.setTimeUnit(TimeUnit.SECONDS);
-        timer.start();
-        Thread.sleep(500);
-        verify(action, never()).run();
-        Thread.sleep(1000);
-        verify(action).run();
-        Thread.sleep(1000);
-        verify(action).run();
-    }
-
-    @Test(expected=NullPointerException.class)
-    public void testNullType() throws InterruptedException {
-        timer.setSchedulingType(null);
-    }
-
-    @Test
-    public void testWithFixedRate() throws InterruptedException {
-        Runnable action = mock(Runnable.class);
-        doAnswer(new Answer<Void>() {
-
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
-                // Wait a little less than delay to
-                // 1. Verify more easily that the duration of the task does not push back the activation of next task.
-                // 2. Not congest the timer thread (which would happen if we take >= DELAY).
-                Thread.sleep(DELAY * 8 / 10 );
-                return null;
-            }
-            
-        }).when(action).run();
-        timer.setAction(action);
-        timer.setInitialDelay(DELAY);
-        timer.setDelay(DELAY);
-        timer.setSchedulingType(SchedulingType.FIXED_RATE);
-        timer.start();
-        Thread.sleep(DELAY / 2);
-        verify(action, never()).run();
-        Thread.sleep(DELAY);
-        verify(action).run();
-        Thread.sleep(DELAY);
-        verify(action, times(2)).run();
-        timer.stop();
-        Thread.sleep(DELAY);
-        verify(action, times(2)).run();
-    }
-
-    @Test
-    public void testStopWithoutStart() {
-        timer.stop();
-        // Good when no exception is thrown.
-    }
-
-    @Test
-    public void testWithFixedDelay() throws InterruptedException {
-        Runnable action = mock(Runnable.class);
-        doAnswer(new Answer<Void>() {
-
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
-                Thread.sleep(DELAY / 2);
-                return null;
-            }
-            
-        }).when(action).run();
-        timer.setAction(action);
-        timer.setInitialDelay(DELAY);
-        timer.setDelay(DELAY);
-        timer.setSchedulingType(SchedulingType.FIXED_DELAY);
-        timer.start();
-        Thread.sleep(DELAY / 2);
-        verify(action, never()).run();
-        Thread.sleep(DELAY);
-        verify(action).run();
-        Thread.sleep(DELAY / 2);
-        verify(action).run();
-        Thread.sleep(DELAY);
-        verify(action, times(2)).run();
-        Thread.sleep(DELAY / 2);
-        verify(action, times(2)).run();
-        timer.stop();
-        Thread.sleep(DELAY);
-        verify(action, times(2)).run();
-    }
-
-    @Bug(id="957",
-         summary="Thermostat GUI doesn't exit when closed, needs killing",
-         url="http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=957")
-    @Test
-    public void verifyShutdownKillsThreads() throws InterruptedException {
-
-        Runnable action = mock(Runnable.class);
-        timer.setAction(action);
-        timer.setInitialDelay(DELAY / 2);
-        timer.start();
-
-        assertTrue(threadGroup.activeCount() > 0);
-
-        timerFactory.shutdown();
-
-        Thread.sleep(DELAY);
-
-        assertEquals(0, threadGroup.activeCount());
-    }
-}
-
--- a/common/core/src/test/java/com/redhat/thermostat/common/TimersTest.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Test;
-
-public class TimersTest {
-
-    @Test
-    public void verifyDataRefreshTimer() {
-        TimerFactory factory = mock(TimerFactory.class);
-        when(factory.createTimer()).thenReturn(mock(Timer.class));
-        Runnable action = mock(Runnable.class);
-
-        Timer retTimer = Timers.createDataRefreshTimer(factory, action);
-        verify(retTimer).setAction(action);
-        verify(retTimer).setSchedulingType(Timer.SchedulingType.FIXED_RATE);
-        verify(retTimer).setTimeUnit(TimeUnit.SECONDS);
-        verify(retTimer).setInitialDelay(0);
-        verify(retTimer).setDelay(5);
-    }
-}
--- a/common/core/src/test/java/com/redhat/thermostat/common/internal/ApplicationServiceImplTest.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.Future;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.redhat.thermostat.common.internal.ApplicationServiceImpl;
-
-public class ApplicationServiceImplTest {
-
-    private ApplicationServiceImpl provider;
-
-    @Before
-    public void setUp() {
-        provider = new ApplicationServiceImpl();
-    }
-
-    @After
-    public void tearDown() {
-        provider = null;
-    }
-
-    @Test
-    public void testCache() {
-        provider.getApplicationCache().addAttribute("test", "fluff");
-        assertEquals("fluff", provider.getApplicationCache().getAttribute("test"));
-    }
-
-    @Test
-    public void testApplicationExecutor() throws Exception {
-        assertNotNull(provider.getApplicationExecutor());
-        final String obj = "test";
-        Future<String> future = provider.getApplicationExecutor().submit(new Callable<String>() {
-
-            @Override
-            public String call() throws Exception {
-                return obj;
-            }
-        });
-        String result = future.get();
-        assertSame(result, obj);
-    }
-
-    @Test
-    public void testTimerFactory() {
-        assertNotNull(provider.getTimerFactory());
-    }
-}
-
--- a/common/core/src/test/java/com/redhat/thermostat/common/internal/test/TestTimerFactoryTest.java	Wed Jun 28 16:22:22 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.internal.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.redhat.thermostat.common.Timer;
-
-public class TestTimerFactoryTest {
-
-    private TestTimerFactory timerFactory;
-    private Timer timer;
-
-    @Before
-    public void setUp() {
-        timerFactory = new TestTimerFactory();
-        timer = timerFactory.createTimer();
-    }
-
-    @After
-    public void tearDown() {
-        timer = null;
-        timerFactory = null;
-    }
-
-    @Test
-    public void testStart() {
-        assertFalse(timerFactory.isActive());
-        timer.start();
-        assertTrue(timerFactory.isActive());
-    }
-
-    @Test
-    public void testStop() {
-        assertFalse(timerFactory.isActive());
-        timer.start();
-        assertTrue(timerFactory.isActive());
-        timer.stop();
-        assertFalse(timerFactory.isActive());
-    }
-
-    @Test
-    public void testSetAction() {
-        final boolean[] run = new boolean[1];
-        Runnable action = new Runnable() {
-            @Override
-            public void run() {
-                run[0] = true;
-            }
-        };
-        timer.setAction(action);
-        assertSame(action, timerFactory.getAction());
-        timerFactory.getAction().run();
-        assertTrue(run[0]);
-    }
-
-    @Test
-    public void testSetInitialDelay() {
-        timer.setInitialDelay(123);
-        assertEquals(123l, timerFactory.getInitialDelay());
-    }
-
-    @Test
-    public void testSetDelay() {
-        timer.setDelay(123);
-        assertEquals(123l, timerFactory.getDelay());
-    }
-
-    @Test
-    public void testSetSchedulingType() {
-        timer.setSchedulingType(Timer.SchedulingType.FIXED_RATE);
-        assertEquals(Timer.SchedulingType.FIXED_RATE, timerFactory.getSchedulingType());
-    }
-
-    @Test
-    public void testSetTimeUnit() {
-        timer.setTimeUnit(TimeUnit.HOURS);
-        assertEquals(TimeUnit.HOURS, timerFactory.getTimeUnit());
-    }
-
-    @Test
-    public void testShutdown() {
-        assertFalse(timerFactory.isShutdown());
-        timerFactory.shutdown();
-        assertTrue(timerFactory.isShutdown());
-    }
-}
-
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java	Wed Jun 28 16:22:22 2017 +0200
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java	Mon Jun 26 11:22:04 2017 +0200
@@ -57,7 +57,6 @@
 
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.ActionNotifier;
-import com.redhat.thermostat.common.ApplicationService;
 import com.redhat.thermostat.common.ExitStatus;
 import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.common.cli.AbstractStateNotifyingCommand;
@@ -205,15 +204,6 @@
     @SuppressWarnings({ "unchecked", "rawtypes" })
     private void shutdown() throws InternalError {
         try {
-            ServiceReference appServiceRef = context.getServiceReference(ApplicationService.class);
-            if (appServiceRef != null) {
-                ApplicationService appSvc = (ApplicationService) context.getService(appServiceRef);
-                appSvc.getApplicationExecutor().shutdown();
-                appSvc.getTimerFactory().shutdown();
-                appSvc = null;
-                context.ungetService(appServiceRef);
-            }
-
             // default to success for exit status
             int exitStatus = ExitStatus.EXIT_SUCCESS;
             if (context != null) {
@@ -234,10 +224,6 @@
         return args == null || args.length == 0;
     }
 
-    private void runHelpCommand() {
-        runCommand(HELP_COMMAND_NAME, new String[0], null);
-    }
-
     private void runHelpCommandFor(String cmdName) {
         runCommand(HELP_COMMAND_NAME, new String[] { "--", cmdName }, null);
     }
--- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/LauncherImplTest.java	Wed Jun 28 16:22:22 2017 +0200
+++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/LauncherImplTest.java	Mon Jun 26 11:22:04 2017 +0200
@@ -55,7 +55,6 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.concurrent.ExecutorService;
 import java.util.logging.Handler;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
@@ -72,15 +71,12 @@
 import org.osgi.framework.BundleException;
 
 import com.redhat.thermostat.common.ActionListener;
-import com.redhat.thermostat.common.ActionNotifier;
-import com.redhat.thermostat.common.ApplicationService;
 import com.redhat.thermostat.common.ExitStatus;
 import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandRegistry;
 import com.redhat.thermostat.common.internal.test.TestCommandContextFactory;
-import com.redhat.thermostat.common.internal.test.TestTimerFactory;
 import com.redhat.thermostat.common.tools.ApplicationState;
 import com.redhat.thermostat.launcher.BundleInformation;
 import com.redhat.thermostat.launcher.BundleManager;
@@ -122,18 +118,9 @@
         }
     }
 
-    private static class TestCmd2 implements TestCommand.Handle {
-        @Override
-        public void run(CommandContext ctx) {
-            Arguments args = ctx.getArguments();
-            ctx.getConsole().getOutput().print(args.getArgument("arg4") + ": " + args.getArgument("arg3"));
-        }
-    }
-
     private TestCommandContextFactory  ctxFactory;
     private StubBundleContext bundleContext;
     private Bundle sysBundle;
-    private TestTimerFactory timerFactory;
     private BundleManager registry;
     private Version version;
     private CommandInfoSource infos;
@@ -143,7 +130,6 @@
 
     private CommonPaths paths;
 
-    @SuppressWarnings("unchecked")
     @Before
     public void setUp() throws CommandInfoNotFoundException, BundleException, IOException {
         setupCommandContextFactory();
@@ -198,13 +184,6 @@
 
         registry = mock(BundleManager.class);
 
-        timerFactory = new TestTimerFactory();
-        ExecutorService exec = mock(ExecutorService.class);
-        ApplicationService appSvc = mock(ApplicationService.class);
-        when(appSvc.getTimerFactory()).thenReturn(timerFactory);
-        when(appSvc.getApplicationExecutor()).thenReturn(exec);
-        bundleContext.registerService(ApplicationService.class, appSvc, null);
-
         version = mock(Version.class);
 
         paths = mock(CommonPaths.class);
@@ -525,7 +504,6 @@
     private void runAndVerifyCommand(String[] args, String expected) {
         wrappedRun(launcher, args);
         assertEquals(expected, ctxFactory.getOutput());
-        assertTrue(timerFactory.isShutdown());
     }
     
     private void wrappedRun(LauncherImpl launcher, String[] args) {
@@ -551,7 +529,6 @@
         wrappedRun(launcher, new String[] {Version.VERSION_OPTION});
 
         assertEquals(expectedVersionInfo, ctxFactory.getOutput());
-        assertTrue(timerFactory.isShutdown());
     }
     
     /**
--- a/storage/core/src/test/java/com/redhat/thermostat/storage/internal/ActivatorTest.java	Wed Jun 28 16:22:22 2017 +0200
+++ b/storage/core/src/test/java/com/redhat/thermostat/storage/internal/ActivatorTest.java	Mon Jun 26 11:22:04 2017 +0200
@@ -39,14 +39,9 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 import org.junit.Test;
 
-import com.redhat.thermostat.common.ApplicationService;
-import com.redhat.thermostat.common.Timer;
-import com.redhat.thermostat.common.TimerFactory;
 import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.storage.dao.NetworkInterfaceInfoDAO;
 import com.redhat.thermostat.storage.internal.dao.NetworkInterfaceInfoDAOImpl;
@@ -90,12 +85,6 @@
     @Test
     public void verifyActivatorRegistersServicesMultipleTimes() throws Exception {
         StubBundleContext context = new StubBundleContext();
-        ApplicationService appService = mock(ApplicationService.class);
-        TimerFactory timerFactory = mock(TimerFactory.class);
-        when(appService.getTimerFactory()).thenReturn(timerFactory);        
-        Timer timer = mock(Timer.class);
-        when(timerFactory.createTimer()).thenReturn(timer);
-        context.registerService(ApplicationService.class, appService, null);
 
         Activator activator = new Activator();
 
@@ -103,22 +92,23 @@
 
         assertTrue(context.isServiceRegistered(NetworkInterfaceInfoDAO.class.getName(), NetworkInterfaceInfoDAOImpl.class));
         assertTrue(context.isServiceRegistered(WriterID.class.getName(), WriterIDImpl.class));
+        assertEquals(2, context.getAllServices().size());
 
         activator.stop(context);
         
         assertEquals(0, context.getServiceListeners().size());
-        assertEquals(1, context.getAllServices().size());
+        assertEquals(0, context.getAllServices().size());
         
         activator.start(context);
 
         assertTrue(context.isServiceRegistered(NetworkInterfaceInfoDAO.class.getName(), NetworkInterfaceInfoDAOImpl.class));
         assertTrue(context.isServiceRegistered(WriterID.class.getName(), WriterIDImpl.class));
+        assertEquals(2, context.getAllServices().size());
 
         activator.stop(context);
 
         assertEquals(0, context.getServiceListeners().size());
-        assertEquals(1, context.getAllServices().size());
-        
+        assertEquals(0, context.getAllServices().size());
     }
 }