changeset 2686:74a3254fdbdb

Extract common PluginConfiguration. Reviewed-by: stooke Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-June/023556.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Thu, 08 Jun 2017 20:16:03 +0200
parents 3765e5b895dc
children 48e1cf54c238
files common/core/pom.xml common/core/src/main/java/com/redhat/thermostat/common/plugins/PluginConfiguration.java plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/common/PluginConfiguration.java plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/common/PluginDAOBase.java plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOImpl.java plugins/host-overview/agent/src/test/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOTest.java plugins/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatConfiguration.java plugins/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOImpl.java plugins/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatConfigurationTest.java plugins/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOImplTest.java plugins/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOTest.java plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/Activator.java plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatConfiguration.java plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOImpl.java plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmTlabStatDAOImpl.java plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/ActivatorTest.java plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatConfigurationTest.java plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOImplTest.java plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOTest.java plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmTlabStatDAOTest.java
diffstat 20 files changed, 377 insertions(+), 673 deletions(-) [+]
line wrap: on
line diff
--- a/common/core/pom.xml	Thu Jun 08 19:45:19 2017 +0200
+++ b/common/core/pom.xml	Thu Jun 08 20:16:03 2017 +0200
@@ -94,6 +94,7 @@
               com.redhat.thermostat.common.utils,
               com.redhat.thermostat.common.ssl,
               com.redhat.thermostat.common.model,
+              com.redhat.thermostat.common.plugins,
             </Export-Package>
             <Private-Package>
               com.redhat.thermostat.common.internal.test,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/core/src/main/java/com/redhat/thermostat/common/plugins/PluginConfiguration.java	Thu Jun 08 20:16:03 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * 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.plugins;
+
+import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+public class PluginConfiguration {
+
+    private static final String CONFIG_FILE = "gateway.properties";
+    private static final String URL_PROP = "gatewayURL";
+
+    private final ConfigurationInfoSource source;
+    private final String pluginId;
+
+    public PluginConfiguration(ConfigurationInfoSource source, final String pluginId) {
+        this.source = source;
+        this.pluginId = pluginId;
+    }
+
+    public String getGatewayURL() throws IOException {
+        Map<String, String> props = source.getConfiguration(pluginId, CONFIG_FILE);
+        String url = props.get(URL_PROP);
+        if (url == null) {
+            throw new IOException("No gateway URL found for " + pluginId + " in " + getConfigFilePath());
+        }
+        return url;
+    }
+
+    private String getConfigFilePath() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("$THERMOSTAT_HOME").append(File.separator).append("etc").append(File.separator)
+                .append("plugins.d").append(File.separator).append(pluginId).append(File.separator)
+                .append(CONFIG_FILE);
+        return builder.toString();
+    }
+}
\ No newline at end of file
--- a/plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/common/PluginConfiguration.java	Thu Jun 08 19:45:19 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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.host.overview.internal.common;
-
-import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-public class PluginConfiguration {
-
-    private static final String CONFIG_FILE = "gateway.properties";
-    private static final String URL_PROP = "gatewayURL";
-
-    private final ConfigurationInfoSource source;
-    private final String pluginId;
-
-    public PluginConfiguration(ConfigurationInfoSource source, final String pluginId) {
-        this.source = source;
-        this.pluginId = pluginId;
-    }
-
-    public String getGatewayURL() throws IOException {
-        Map<String, String> props = source.getConfiguration(pluginId, CONFIG_FILE);
-        String url = props.get(URL_PROP);
-        if (url == null) {
-            throw new IOException("No gateway URL found for " + pluginId + " in " + getConfigFilePath());
-        }
-        return url;
-    }
-
-    private String getConfigFilePath() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("$THERMOSTAT_HOME").append(File.separator).append("etc").append(File.separator)
-                .append("plugins.d").append(File.separator).append(pluginId).append(File.separator)
-                .append(CONFIG_FILE);
-        return builder.toString();
-    }
-}
\ No newline at end of file
--- a/plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/common/PluginDAOBase.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/common/PluginDAOBase.java	Thu Jun 08 20:16:03 2017 +0200
@@ -50,6 +50,7 @@
 import org.eclipse.jetty.http.HttpMethod;
 import org.eclipse.jetty.http.HttpStatus;
 
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 
 abstract public class PluginDAOBase<Tobj,Tdao> {
--- a/plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOImpl.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOImpl.java	Thu Jun 08 20:16:03 2017 +0200
@@ -49,9 +49,9 @@
 import org.eclipse.jetty.client.util.StringContentProvider;
 
 import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.host.overview.internal.HostInfoTypeAdapter;
-import com.redhat.thermostat.host.overview.internal.common.PluginConfiguration;
 import com.redhat.thermostat.host.overview.internal.common.PluginDAOBase;
 import com.redhat.thermostat.host.overview.model.HostInfo;
 
--- a/plugins/host-overview/agent/src/test/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOTest.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/host-overview/agent/src/test/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOTest.java	Thu Jun 08 20:16:03 2017 +0200
@@ -47,10 +47,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
-import com.redhat.thermostat.host.overview.internal.common.PluginConfiguration;
-import com.redhat.thermostat.host.overview.internal.models.HostInfoDAOImpl.ConfigurationCreator;
-
 import org.eclipse.jetty.client.HttpClient;
 import org.eclipse.jetty.client.api.ContentProvider;
 import org.eclipse.jetty.client.api.ContentResponse;
@@ -61,9 +57,12 @@
 import org.eclipse.jetty.http.HttpStatus;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Matchers;
 
+import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
+import com.redhat.thermostat.host.overview.internal.models.HostInfoDAOImpl.ConfigurationCreator;
 import com.redhat.thermostat.host.overview.model.HostInfo;
-import org.mockito.Matchers;
 
 public class HostInfoDAOTest {
 
--- a/plugins/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatConfiguration.java	Thu Jun 08 19:45:19 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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.vm.gc.common.internal;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
-
-class VmGcStatConfiguration {
-    
-    private static final String PLUGIN_ID = "vm-gc";
-    private static final String CONFIG_FILE = "gateway.properties";
-    private static final String URL_PROP = "gatewayURL";
-    
-    private final ConfigurationInfoSource source;
-    
-    VmGcStatConfiguration(ConfigurationInfoSource source) {
-        this.source = source;
-    }
-    
-    String getGatewayURL() throws IOException {
-        Map<String, String> props = source.getConfiguration(PLUGIN_ID, CONFIG_FILE);
-        String url = props.get(URL_PROP);
-        if (url == null) {
-            throw new IOException("No gateway URL found for " + PLUGIN_ID + " in " + getConfigFilePath());
-        }
-        return url;
-    }
-    
-    private String getConfigFilePath() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("$THERMOSTAT_HOME").append(File.separator).append("etc").append(File.separator)
-                .append("plugins.d").append(File.separator).append(PLUGIN_ID).append(File.separator)
-                .append(CONFIG_FILE);
-        return builder.toString();
-    }
-
-}
--- a/plugins/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOImpl.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOImpl.java	Thu Jun 08 20:16:03 2017 +0200
@@ -45,6 +45,7 @@
 import java.util.logging.Logger;
 
 import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.vm.gc.common.VmGcStatDAO;
 import com.redhat.thermostat.vm.gc.common.model.VmGcStat;
@@ -65,6 +66,7 @@
 public class VmGcStatDAOImpl implements VmGcStatDAO {
     
     private static final Logger logger = LoggingUtils.getLogger(VmGcStatDAOImpl.class);
+    private static final String PLUGIN_ID = "vm-gc";
     static final String CONTENT_TYPE = "application/json";
     
     private final JsonHelper jsonHelper;
@@ -92,7 +94,7 @@
 
     @Activate
     void activate() throws Exception {
-        VmGcStatConfiguration config = configCreator.create(configInfoSource);
+        PluginConfiguration config = configCreator.create(configInfoSource);
         this.gatewayURL = config.getGatewayURL();
         
         httpHelper.startClient(httpClient);
@@ -152,8 +154,8 @@
     // For Testing purposes
     static class ConfigurationCreator {
         
-        VmGcStatConfiguration create(ConfigurationInfoSource source) {
-            return new VmGcStatConfiguration(source);
+        PluginConfiguration create(ConfigurationInfoSource source) {
+            return new PluginConfiguration(source, PLUGIN_ID);
         }
         
     }
--- a/plugins/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatConfigurationTest.java	Thu Jun 08 19:45:19 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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.vm.gc.common.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Test;
-
-import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
-
-public class VmGcStatConfigurationTest {
-    
-    private static final String PLUGIN_ID = "vm-gc";
-    private static final String CONFIG_FILE = "gateway.properties";
-    private static final String URL_PROP = "gatewayURL";
-
-    @Test
-    public void testGetGatewayURL() throws Exception {
-        ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
-        Map<String, String> props = new HashMap<>();
-        props.put(URL_PROP, "urlToGateway");
-        when(source.getConfiguration(PLUGIN_ID, CONFIG_FILE)).thenReturn(props);
-        VmGcStatConfiguration config = new VmGcStatConfiguration(source);
-        
-        assertEquals("urlToGateway", config.getGatewayURL());
-    }
-    
-    @Test(expected=IOException.class)
-    public void testGetGatewayURLMissing() throws Exception {
-        ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
-        Map<String, String> props = new HashMap<>();
-        when(source.getConfiguration(PLUGIN_ID, CONFIG_FILE)).thenReturn(props);
-        VmGcStatConfiguration config = new VmGcStatConfiguration(source);
-        config.getGatewayURL();
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOImplTest.java	Thu Jun 08 20:16:03 2017 +0200
@@ -0,0 +1,125 @@
+/*
+ * 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.vm.gc.common.internal;
+
+import static org.mockito.Matchers.anyListOf;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.api.ContentResponse;
+import org.eclipse.jetty.client.api.Request;
+import org.eclipse.jetty.client.util.StringContentProvider;
+import org.eclipse.jetty.http.HttpMethod;
+import org.eclipse.jetty.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
+import com.redhat.thermostat.vm.gc.common.internal.VmGcStatDAOImpl.ConfigurationCreator;
+import com.redhat.thermostat.vm.gc.common.internal.VmGcStatDAOImpl.HttpHelper;
+import com.redhat.thermostat.vm.gc.common.internal.VmGcStatDAOImpl.JsonHelper;
+import com.redhat.thermostat.vm.gc.common.model.VmGcStat;
+
+public class VmGcStatDAOImplTest {
+
+    private static final String AGENT_ID = "some-agent";
+    private static final String JSON = "{\"this\":\"is\",\"also\":\"JSON\"}";
+    private static final String GATEWAY_URL = "http://example.com/jvm-gc";
+    
+    private VmGcStat stat;
+    private HttpClient httpClient;
+    private HttpHelper httpHelper;
+    private JsonHelper jsonHelper;
+    private StringContentProvider contentProvider;
+    private Request request;
+    private ContentResponse response;
+    private VmGcStatDAOImpl dao;
+
+    @Before
+    public void setup() throws Exception {
+        stat = new VmGcStat();
+        stat.setAgentId(AGENT_ID);
+        stat.setTimeStamp(1234l);
+        stat.setWallTime(4000l);
+        stat.setRunCount(1000l);
+        stat.setVmId("Vm-1");
+        stat.setCollectorName("Collector");
+
+        httpClient = mock(HttpClient.class);
+        request = mock(Request.class);
+        when(httpClient.newRequest(anyString())).thenReturn(request);
+        response = mock(ContentResponse.class);
+        when(response.getStatus()).thenReturn(HttpStatus.OK_200);
+        when(request.send()).thenReturn(response);
+
+        jsonHelper = mock(JsonHelper.class);
+        when(jsonHelper.toJson(anyListOf(VmGcStat.class))).thenReturn(JSON);
+        httpHelper = mock(HttpHelper.class);
+        contentProvider = mock(StringContentProvider.class);
+        when(httpHelper.createContentProvider(anyString())).thenReturn(contentProvider);
+        
+        ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
+        PluginConfiguration config = mock(PluginConfiguration.class);
+        when(config.getGatewayURL()).thenReturn(GATEWAY_URL);
+        ConfigurationCreator creator = mock(ConfigurationCreator.class);
+        when(creator.create(source)).thenReturn(config);
+        dao = new VmGcStatDAOImpl(httpClient, jsonHelper, httpHelper, creator, source);
+    }
+
+    @Test
+    public void verifyAddVmGcStat() throws Exception {
+        dao.activate();
+        dao.putVmGcStat(stat);
+
+        verify(httpClient).newRequest(GATEWAY_URL);
+        verify(request).method(HttpMethod.POST);
+        verify(jsonHelper).toJson(eq(Arrays.asList(stat)));
+        verify(httpHelper).createContentProvider(JSON);
+        verify(request).content(contentProvider, VmGcStatDAOImpl.CONTENT_TYPE);
+        verify(request).send();
+        verify(response).getStatus();
+    }
+
+}
+
--- a/plugins/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOTest.java	Thu Jun 08 19:45:19 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +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.vm.gc.common.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.eclipse.jetty.client.HttpClient;
-import org.eclipse.jetty.client.api.ContentResponse;
-import org.eclipse.jetty.client.api.Request;
-import org.eclipse.jetty.client.util.StringContentProvider;
-import org.eclipse.jetty.http.HttpMethod;
-import org.eclipse.jetty.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
-import com.redhat.thermostat.storage.core.Key;
-import com.redhat.thermostat.vm.gc.common.VmGcStatDAO;
-import com.redhat.thermostat.vm.gc.common.internal.VmGcStatDAOImpl.ConfigurationCreator;
-import com.redhat.thermostat.vm.gc.common.internal.VmGcStatDAOImpl.HttpHelper;
-import com.redhat.thermostat.vm.gc.common.internal.VmGcStatDAOImpl.JsonHelper;
-import com.redhat.thermostat.vm.gc.common.model.VmGcStat;
-
-public class VmGcStatDAOTest {
-
-    private static final String AGENT_ID = "some-agent";
-    private static final String JSON = "{\"this\":\"is\",\"also\":\"JSON\"}";
-    private static final String GATEWAY_URL = "http://example.com/jvm-gc";
-    
-    private VmGcStat stat;
-    private HttpClient httpClient;
-    private HttpHelper httpHelper;
-    private JsonHelper jsonHelper;
-    private StringContentProvider contentProvider;
-    private Request request;
-    private ContentResponse response;
-    private VmGcStatDAOImpl dao;
-
-    @Before
-    public void setup() throws Exception {
-        stat = new VmGcStat();
-        stat.setAgentId(AGENT_ID);
-        stat.setTimeStamp(1234l);
-        stat.setWallTime(4000l);
-        stat.setRunCount(1000l);
-        stat.setVmId("Vm-1");
-        stat.setCollectorName("Collector");
-
-        httpClient = mock(HttpClient.class);
-        request = mock(Request.class);
-        when(httpClient.newRequest(anyString())).thenReturn(request);
-        response = mock(ContentResponse.class);
-        when(response.getStatus()).thenReturn(HttpStatus.OK_200);
-        when(request.send()).thenReturn(response);
-
-        jsonHelper = mock(JsonHelper.class);
-        when(jsonHelper.toJson(anyListOf(VmGcStat.class))).thenReturn(JSON);
-        httpHelper = mock(HttpHelper.class);
-        contentProvider = mock(StringContentProvider.class);
-        when(httpHelper.createContentProvider(anyString())).thenReturn(contentProvider);
-        
-        ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
-        VmGcStatConfiguration config = mock(VmGcStatConfiguration.class);
-        when(config.getGatewayURL()).thenReturn(GATEWAY_URL);
-        ConfigurationCreator creator = mock(ConfigurationCreator.class);
-        when(creator.create(source)).thenReturn(config);
-        dao = new VmGcStatDAOImpl(httpClient, jsonHelper, httpHelper, creator, source);
-    }
-
-    @Test
-    public void verifyAddVmGcStat() throws Exception {
-        dao.activate();
-        dao.putVmGcStat(stat);
-
-        verify(httpClient).newRequest(GATEWAY_URL);
-        verify(request).method(HttpMethod.POST);
-        verify(jsonHelper).toJson(eq(Arrays.asList(stat)));
-        verify(httpHelper).createContentProvider(JSON);
-        verify(request).content(contentProvider, VmGcStatDAOImpl.CONTENT_TYPE);
-        verify(request).send();
-        verify(response).getStatus();
-    }
-
-}
-
--- a/plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/Activator.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/Activator.java	Thu Jun 08 20:16:03 2017 +0200
@@ -46,6 +46,7 @@
 import org.osgi.util.tracker.ServiceTracker;
 
 import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO;
 import com.redhat.thermostat.vm.memory.common.VmTlabStatDAO;
@@ -53,6 +54,7 @@
 public class Activator implements BundleActivator {
     
     private static final Logger logger = LoggingUtils.getLogger(Activator.class);
+    private static final String PLUGIN_ID = "vm-memory";
     
     private final DAOCreator creator;
     private ServiceTracker tracker;
@@ -73,7 +75,7 @@
             @Override
             public Object addingService(ServiceReference reference) {
                 ConfigurationInfoSource source = (ConfigurationInfoSource) super.addingService(reference);
-                VmMemoryStatConfiguration config = new VmMemoryStatConfiguration(source);
+                PluginConfiguration config = new PluginConfiguration(source, PLUGIN_ID);
                 try {
                     VmMemoryStatDAO vmMemoryStatDao = creator.createMemoryStatDAO(config);
                     memoryReg = context.registerService(VmMemoryStatDAO.class.getName(), vmMemoryStatDao, null);
@@ -104,10 +106,10 @@
     }
     
     static class DAOCreator {
-        VmMemoryStatDAO createMemoryStatDAO(VmMemoryStatConfiguration config) throws Exception {
+        VmMemoryStatDAO createMemoryStatDAO(PluginConfiguration config) throws Exception {
             return new VmMemoryStatDAOImpl(config);
         }
-        VmTlabStatDAO createTlabStatDAO(VmMemoryStatConfiguration config) throws Exception {
+        VmTlabStatDAO createTlabStatDAO(PluginConfiguration config) throws Exception {
             return new VmTlabStatDAOImpl(config);
         }
     }
--- a/plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatConfiguration.java	Thu Jun 08 19:45:19 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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.vm.memory.common.internal;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
-
-class VmMemoryStatConfiguration {
-    
-    private static final String PLUGIN_ID = "vm-memory";
-    private static final String CONFIG_FILE = "gateway.properties";
-    private static final String URL_PROP = "gatewayURL";
-    
-    private final ConfigurationInfoSource source;
-    
-    VmMemoryStatConfiguration(ConfigurationInfoSource source) {
-        this.source = source;
-    }
-    
-    String getGatewayURL() throws IOException {
-        Map<String, String> props = source.getConfiguration(PLUGIN_ID, CONFIG_FILE);
-        String url = props.get(URL_PROP);
-        if (url == null) {
-            throw new IOException("No gateway URL found for " + PLUGIN_ID + " in " + getConfigFilePath());
-        }
-        return url;
-    }
-    
-    private String getConfigFilePath() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("$THERMOSTAT_HOME").append(File.separator).append("etc").append(File.separator)
-                .append("plugins.d").append(File.separator).append(PLUGIN_ID).append(File.separator)
-                .append(CONFIG_FILE);
-        return builder.toString();
-    }
-
-}
--- a/plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOImpl.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOImpl.java	Thu Jun 08 20:16:03 2017 +0200
@@ -44,6 +44,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO;
 import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat;
@@ -64,11 +65,11 @@
     private final HttpHelper httpHelper;
     private final JsonHelper jsonHelper;
 
-    VmMemoryStatDAOImpl(VmMemoryStatConfiguration config) throws Exception {
+    VmMemoryStatDAOImpl(PluginConfiguration config) throws Exception {
         this(config, new HttpClient(), new HttpHelper(), new JsonHelper(new VmMemoryStatTypeAdapter()));
     }
 
-    VmMemoryStatDAOImpl(VmMemoryStatConfiguration config, HttpClient client, HttpHelper httpHelper, 
+    VmMemoryStatDAOImpl(PluginConfiguration config, HttpClient client, HttpHelper httpHelper, 
             JsonHelper jsonHelper) throws Exception {
         this.gatewayURL = config.getGatewayURL();
         this.client = client;
--- a/plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmTlabStatDAOImpl.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmTlabStatDAOImpl.java	Thu Jun 08 20:16:03 2017 +0200
@@ -44,6 +44,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.vm.memory.common.VmTlabStatDAO;
 import com.redhat.thermostat.vm.memory.common.model.VmTlabStat;
@@ -65,11 +66,11 @@
     private final HttpHelper httpHelper;
     private final JsonHelper jsonHelper;
 
-    VmTlabStatDAOImpl(VmMemoryStatConfiguration config) throws Exception {
+    VmTlabStatDAOImpl(PluginConfiguration config) throws Exception {
         this(config, new HttpClient(), new HttpHelper(), new JsonHelper(new VmTlabStatTypeAdapter()));
     }
 
-    VmTlabStatDAOImpl(VmMemoryStatConfiguration config, HttpClient client, HttpHelper httpHelper, 
+    VmTlabStatDAOImpl(PluginConfiguration config, HttpClient client, HttpHelper httpHelper, 
             JsonHelper jsonHelper) throws Exception {
         this.gatewayURL = config.getGatewayURL();
         this.client = client;
--- a/plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/ActivatorTest.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/ActivatorTest.java	Thu Jun 08 20:16:03 2017 +0200
@@ -44,6 +44,7 @@
 import org.junit.Test;
 
 import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.testutils.StubBundleContext;
 import com.redhat.thermostat.vm.memory.common.internal.Activator.DAOCreator;
 
@@ -54,8 +55,8 @@
         DAOCreator creator = mock(DAOCreator.class);
         VmMemoryStatDAOImpl memoryDao = mock(VmMemoryStatDAOImpl.class);
         VmTlabStatDAOImpl tlabDao = mock(VmTlabStatDAOImpl.class);
-        when(creator.createMemoryStatDAO(any(VmMemoryStatConfiguration.class))).thenReturn(memoryDao);
-        when(creator.createTlabStatDAO(any(VmMemoryStatConfiguration.class))).thenReturn(tlabDao);
+        when(creator.createMemoryStatDAO(any(PluginConfiguration.class))).thenReturn(memoryDao);
+        when(creator.createTlabStatDAO(any(PluginConfiguration.class))).thenReturn(tlabDao);
         
         ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
         StubBundleContext context = new StubBundleContext();
--- a/plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatConfigurationTest.java	Thu Jun 08 19:45:19 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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.vm.memory.common.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Test;
-
-import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
-
-public class VmMemoryStatConfigurationTest {
-    
-    private static final String PLUGIN_ID = "vm-memory";
-    private static final String CONFIG_FILE = "gateway.properties";
-    private static final String URL_PROP = "gatewayURL";
-
-    @Test
-    public void testGetGatewayURL() throws Exception {
-        ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
-        Map<String, String> props = new HashMap<>();
-        props.put(URL_PROP, "urlToGateway");
-        when(source.getConfiguration(PLUGIN_ID, CONFIG_FILE)).thenReturn(props);
-        VmMemoryStatConfiguration config = new VmMemoryStatConfiguration(source);
-        
-        assertEquals("urlToGateway", config.getGatewayURL());
-    }
-    
-    @Test(expected=IOException.class)
-    public void testGetGatewayURLMissing() throws Exception {
-        ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
-        Map<String, String> props = new HashMap<>();
-        when(source.getConfiguration(PLUGIN_ID, CONFIG_FILE)).thenReturn(props);
-        VmMemoryStatConfiguration config = new VmMemoryStatConfiguration(source);
-        config.getGatewayURL();
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOImplTest.java	Thu Jun 08 20:16:03 2017 +0200
@@ -0,0 +1,149 @@
+/*
+ * 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.vm.memory.common.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyListOf;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.api.ContentResponse;
+import org.eclipse.jetty.client.api.Request;
+import org.eclipse.jetty.client.util.StringContentProvider;
+import org.eclipse.jetty.http.HttpMethod;
+import org.eclipse.jetty.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
+import com.redhat.thermostat.storage.core.Key;
+import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO;
+import com.redhat.thermostat.vm.memory.common.internal.VmMemoryStatDAOImpl.HttpHelper;
+import com.redhat.thermostat.vm.memory.common.internal.VmMemoryStatDAOImpl.JsonHelper;
+import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat;
+import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation;
+import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space;
+
+public class VmMemoryStatDAOImplTest {
+
+    private static final String JSON = "{\"this\":\"is\",\"test\":\"JSON\"}";
+    private static final String CONTENT_TYPE = "application/json";
+    private static final String GATEWAY_URL = "http://example.com/jvm-memory/0.0.2/";
+    
+    private HttpClient httpClient;
+    private HttpHelper httpHelper;
+    private JsonHelper jsonHelper;
+    private StringContentProvider contentProvider;
+    private Request request;
+    private ContentResponse response;
+    private PluginConfiguration config;
+
+    @Before
+    public void setUp() throws Exception {
+        httpClient = mock(HttpClient.class);
+        request = mock(Request.class);
+        when(httpClient.newRequest(anyString())).thenReturn(request);
+        response = mock(ContentResponse.class);
+        when(response.getStatus()).thenReturn(HttpStatus.OK_200);
+        when(request.send()).thenReturn(response);
+
+        httpHelper = mock(HttpHelper.class);
+        contentProvider = mock(StringContentProvider.class);
+        when(httpHelper.createContentProvider(anyString())).thenReturn(contentProvider);
+        jsonHelper = mock(JsonHelper.class);
+        when(jsonHelper.toJson(anyListOf(VmMemoryStat.class))).thenReturn(JSON);
+        
+        config = mock(PluginConfiguration.class);
+        when(config.getGatewayURL()).thenReturn(GATEWAY_URL);
+    }
+
+    @Test
+    public void testPutVmMemoryStat() throws Exception {
+        List<Generation> generations = new ArrayList<Generation>();
+
+        int i = 0;
+        for (String genName: new String[] { "new", "old", "perm" }) {
+            Generation gen = new Generation();
+            gen.setName(genName);
+            gen.setCollector(gen.getName());
+            generations.add(gen);
+            List<Space> spaces = new ArrayList<Space>();
+            String[] spaceNames = null;
+            if (genName.equals("new")) {
+                spaceNames = new String[] { "eden", "s0", "s1" };
+            } else if (genName.equals("old")) {
+                spaceNames = new String[] { "old" };
+            } else {
+                spaceNames = new String[] { "perm" };
+            }
+            for (String spaceName: spaceNames) {
+                Space space = new Space();
+                space.setName(spaceName);
+                space.setIndex(0);
+                space.setUsed(i++);
+                space.setCapacity(i++);
+                space.setMaxCapacity(i++);
+                spaces.add(space);
+            }
+            gen.setSpaces(spaces.toArray(new Space[spaces.size()]));
+        }
+        VmMemoryStat stat = new VmMemoryStat("foo-agent", 1, "vmId", generations.toArray(new Generation[generations.size()]),
+                2, 3, 4, 5);
+        
+        VmMemoryStatDAO dao = new VmMemoryStatDAOImpl(config, httpClient, httpHelper, jsonHelper);
+        dao.putVmMemoryStat(stat);
+
+        verify(httpClient).newRequest(GATEWAY_URL);
+        verify(request).method(HttpMethod.POST);
+        verify(jsonHelper).toJson(Arrays.asList(stat));
+        verify(httpHelper).createContentProvider(JSON);
+        verify(request).content(contentProvider, CONTENT_TYPE);
+        verify(request).send();
+        verify(response).getStatus();
+    }
+    
+}
+
--- a/plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOTest.java	Thu Jun 08 19:45:19 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +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.vm.memory.common.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jetty.client.HttpClient;
-import org.eclipse.jetty.client.api.ContentResponse;
-import org.eclipse.jetty.client.api.Request;
-import org.eclipse.jetty.client.util.StringContentProvider;
-import org.eclipse.jetty.http.HttpMethod;
-import org.eclipse.jetty.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.redhat.thermostat.storage.core.Key;
-import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO;
-import com.redhat.thermostat.vm.memory.common.internal.VmMemoryStatDAOImpl.HttpHelper;
-import com.redhat.thermostat.vm.memory.common.internal.VmMemoryStatDAOImpl.JsonHelper;
-import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat;
-import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation;
-import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space;
-
-public class VmMemoryStatDAOTest {
-
-    private static final String JSON = "{\"this\":\"is\",\"test\":\"JSON\"}";
-    private static final String CONTENT_TYPE = "application/json";
-    private static final String GATEWAY_URL = "http://example.com/jvm-memory/0.0.2/";
-    
-    private HttpClient httpClient;
-    private HttpHelper httpHelper;
-    private JsonHelper jsonHelper;
-    private StringContentProvider contentProvider;
-    private Request request;
-    private ContentResponse response;
-    private VmMemoryStatConfiguration config;
-
-    @Before
-    public void setUp() throws Exception {
-        httpClient = mock(HttpClient.class);
-        request = mock(Request.class);
-        when(httpClient.newRequest(anyString())).thenReturn(request);
-        response = mock(ContentResponse.class);
-        when(response.getStatus()).thenReturn(HttpStatus.OK_200);
-        when(request.send()).thenReturn(response);
-
-        httpHelper = mock(HttpHelper.class);
-        contentProvider = mock(StringContentProvider.class);
-        when(httpHelper.createContentProvider(anyString())).thenReturn(contentProvider);
-        jsonHelper = mock(JsonHelper.class);
-        when(jsonHelper.toJson(anyListOf(VmMemoryStat.class))).thenReturn(JSON);
-        
-        config = mock(VmMemoryStatConfiguration.class);
-        when(config.getGatewayURL()).thenReturn(GATEWAY_URL);
-    }
-
-    @Test
-    public void testPutVmMemoryStat() throws Exception {
-        List<Generation> generations = new ArrayList<Generation>();
-
-        int i = 0;
-        for (String genName: new String[] { "new", "old", "perm" }) {
-            Generation gen = new Generation();
-            gen.setName(genName);
-            gen.setCollector(gen.getName());
-            generations.add(gen);
-            List<Space> spaces = new ArrayList<Space>();
-            String[] spaceNames = null;
-            if (genName.equals("new")) {
-                spaceNames = new String[] { "eden", "s0", "s1" };
-            } else if (genName.equals("old")) {
-                spaceNames = new String[] { "old" };
-            } else {
-                spaceNames = new String[] { "perm" };
-            }
-            for (String spaceName: spaceNames) {
-                Space space = new Space();
-                space.setName(spaceName);
-                space.setIndex(0);
-                space.setUsed(i++);
-                space.setCapacity(i++);
-                space.setMaxCapacity(i++);
-                spaces.add(space);
-            }
-            gen.setSpaces(spaces.toArray(new Space[spaces.size()]));
-        }
-        VmMemoryStat stat = new VmMemoryStat("foo-agent", 1, "vmId", generations.toArray(new Generation[generations.size()]),
-                2, 3, 4, 5);
-        
-        VmMemoryStatDAO dao = new VmMemoryStatDAOImpl(config, httpClient, httpHelper, jsonHelper);
-        dao.putVmMemoryStat(stat);
-
-        verify(httpClient).newRequest(GATEWAY_URL);
-        verify(request).method(HttpMethod.POST);
-        verify(jsonHelper).toJson(Arrays.asList(stat));
-        verify(httpHelper).createContentProvider(JSON);
-        verify(request).content(contentProvider, CONTENT_TYPE);
-        verify(request).send();
-        verify(response).getStatus();
-    }
-    
-}
-
--- a/plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmTlabStatDAOTest.java	Thu Jun 08 19:45:19 2017 +0200
+++ b/plugins/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmTlabStatDAOTest.java	Thu Jun 08 20:16:03 2017 +0200
@@ -36,6 +36,7 @@
 
 package com.redhat.thermostat.vm.memory.common.internal;
 
+import com.redhat.thermostat.common.plugins.PluginConfiguration;
 import com.redhat.thermostat.vm.memory.common.VmTlabStatDAO;
 import com.redhat.thermostat.vm.memory.common.model.VmTlabStat;
 import org.eclipse.jetty.client.HttpClient;
@@ -73,7 +74,7 @@
     private StringContentProvider contentProvider;
     private Request request;
     private ContentResponse response;
-    private VmMemoryStatConfiguration config;
+    private PluginConfiguration config;
 
     @Before
     public void setUp() throws Exception {
@@ -90,7 +91,7 @@
         jsonHelper = mock(JsonHelper.class);
         when(jsonHelper.toJson(anyListOf(VmTlabStat.class))).thenReturn(JSON);
         
-        config = mock(VmMemoryStatConfiguration.class);
+        config = mock(PluginConfiguration.class);
         when(config.getGatewayURL()).thenReturn(GATEWAY_URL);
     }