Mercurial > hg > thermostat-ng > agent
changeset 2776:6ea7021a74d6
Added framework for configurable Backend activation/deactivation
Reviewed-By: jkang, jerboaa
Review-Thread:
http://icedtea.classpath.org/pipermail/thermostat/2017-August/024612.html
http://icedtea.classpath.org/pipermail/thermostat/2017-September/024925.html
http://icedtea.classpath.org/pipermail/thermostat/2017-October/025247.html
line wrap: on
line diff
--- a/agent/core/pom.xml Tue Oct 03 15:02:21 2017 +0200 +++ b/agent/core/pom.xml Thu Oct 19 11:44:23 2017 -0400 @@ -119,6 +119,11 @@ <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.scr.annotations</artifactId> </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.configadmin</artifactId> + <version>${felix.configadmin.version}</version> + </dependency> </dependencies> <build>
--- a/agent/core/src/main/java/com/redhat/thermostat/agent/Agent.java Tue Oct 03 15:02:21 2017 +0200 +++ b/agent/core/src/main/java/com/redhat/thermostat/agent/Agent.java Thu Oct 19 11:44:23 2017 -0400 @@ -45,6 +45,7 @@ import com.redhat.thermostat.agent.dao.AgentInfoDAO; import com.redhat.thermostat.agent.dao.BackendInfoDAO; import com.redhat.thermostat.backend.Backend; +import com.redhat.thermostat.backend.BackendConfigurationRegistry; import com.redhat.thermostat.backend.BackendActivator; import com.redhat.thermostat.backend.BackendRegistry; import com.redhat.thermostat.common.ActionEvent; @@ -67,6 +68,7 @@ private static final int BACKEND_ACTIVATOR_THREAD_COUNT = 2; private final BackendRegistry backendRegistry; + private final BackendConfigurationRegistry configurationRegistry; private final AgentStartupConfiguration config; private final Map<Backend, BackendInformation> backendInfos; private final AgentInfoDAO agentDao; @@ -125,13 +127,14 @@ }; public Agent(BackendRegistry registry, AgentStartupConfiguration config, - AgentInfoDAO agentInfoDao, BackendInfoDAO backendInfoDao, WriterID writerId) { + AgentInfoDAO agentInfoDao, BackendInfoDAO backendInfoDao, WriterID writerId, + BackendConfigurationRegistry configurationRegistry) { this(registry, config, agentInfoDao, backendInfoDao, writerId, - new BackendActivator(BACKEND_ACTIVATOR_THREAD_COUNT, BACKEND_ACTIVATION_TIMEOUT_SECONDS)); + new BackendActivator(BACKEND_ACTIVATOR_THREAD_COUNT, BACKEND_ACTIVATION_TIMEOUT_SECONDS), configurationRegistry); } Agent(BackendRegistry registry, AgentStartupConfiguration config, AgentInfoDAO agentInfoDao, - BackendInfoDAO backendInfoDao, WriterID writerId, BackendActivator backendActivator) { + BackendInfoDAO backendInfoDao, WriterID writerId, BackendActivator backendActivator, BackendConfigurationRegistry configurationRegistry) { this.backendRegistry = registry; this.config = config; this.agentDao = agentInfoDao; @@ -139,6 +142,7 @@ this.writerID = writerId; this.backendActivator = backendActivator; this.backendInfos = new ConcurrentHashMap<>(); + this.configurationRegistry = configurationRegistry; backendRegistry.addActionListener(backendRegistryListener); } @@ -148,8 +152,9 @@ agentInfo = createAgentInformation(); agentInfo.setAgentId(getId()); agentDao.addAgentInformation(agentInfo); - + backendRegistry.start(); + configurationRegistry.start(); started = true; } else { logger.warning("Attempt to start agent when already started.");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/core/src/main/java/com/redhat/thermostat/agent/BackendConfigurationListener.java Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,124 @@ +/* + * 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.agent; + +import java.util.Hashtable; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.felix.scr.annotations.Activate; +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Reference; +import org.apache.felix.scr.annotations.Service; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import com.redhat.thermostat.backend.BackendConfiguration; +import com.redhat.thermostat.common.ActionEvent; +import com.redhat.thermostat.common.ActionListener; +import com.redhat.thermostat.common.ThermostatExtensionRegistry; +import com.redhat.thermostat.common.utils.LoggingUtils; + +@Component +@Service(value = BackendConfigurationListener.class) +public class BackendConfigurationListener implements ActionListener<ThermostatExtensionRegistry.Action> { + + @Reference + private ConfigurationAdmin configurationAdmin; + + private static final Logger logger = LoggingUtils.getLogger(BackendConfigurationListener.class); + + // Default constructor provided for DS + public BackendConfigurationListener() { } + + @Override + public void actionPerformed(ActionEvent<ThermostatExtensionRegistry.Action> actionEvent) { + BackendConfiguration configurator = (BackendConfiguration) actionEvent.getPayload(); + switch (actionEvent.getActionId()) { + + case SERVICE_ADDED: { + // When we receive a BackendConfiguration we need to know if the plugin services + // should be enabled, as well as what the plugin ID is. The plugin ID is used as + // the ConfigurationPid for the Configuration Admin. + try { + if (configurator.isEnabled()) { + logger.info("Plugin " + configurator.getPluginId() + " is enabled, activating services."); + Configuration configuration = configurationAdmin.getConfiguration(configurator.getPluginId()); + Hashtable<String, Object> config = new Hashtable<>(); + // When configuration is created it is bound to the calling bundle's location. We should + // assign the configuration to the plugin bundle instead. + configuration.setBundleLocation(configurator.getLocation()); + logger.config("Sending configuration to " + configurator.getPluginId()); + configuration.update(config); + + } else { + logger.info("Plugin " + configurator.getPluginId() + " is disabled"); + } + } catch (Exception e) { + logger.warning(e.getMessage()); + } + break; + } + + case SERVICE_REMOVED: { + try { + if (configurator.isEnabled()) { + logger.info("Deactivating plugin " + configurator.getPluginId()); + Configuration configuration = configurationAdmin.getConfiguration(configurator.getPluginId()); + configuration.delete(); + } + } catch (Exception e) { + logger.warning(e.getMessage()); + } + break; + } + + default: { + logger.log(Level.WARNING, "received unknown event from BackendConfigurationRegistry: " + actionEvent.getActionId()); + break; + } + } + } + + @Activate + public void activate() {} + + public void bindConfigurationAdmin(ConfigurationAdmin admin) { + this.configurationAdmin = admin; + } + +} \ No newline at end of file
--- a/agent/core/src/main/java/com/redhat/thermostat/agent/internal/AgentApplication.java Tue Oct 03 15:02:21 2017 +0200 +++ b/agent/core/src/main/java/com/redhat/thermostat/agent/internal/AgentApplication.java Thu Oct 19 11:44:23 2017 -0400 @@ -43,17 +43,20 @@ import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; +import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Service; import org.osgi.framework.BundleContext; import com.redhat.thermostat.agent.Agent; +import com.redhat.thermostat.agent.BackendConfigurationListener; import com.redhat.thermostat.agent.config.AgentConfigsUtils; import com.redhat.thermostat.agent.config.AgentOptionParser; import com.redhat.thermostat.agent.config.AgentStartupConfiguration; import com.redhat.thermostat.agent.config.AuthenticationProviderConfig; import com.redhat.thermostat.agent.dao.AgentInfoDAO; import com.redhat.thermostat.agent.dao.BackendInfoDAO; +import com.redhat.thermostat.backend.BackendConfigurationRegistry; import com.redhat.thermostat.backend.BackendRegistry; import com.redhat.thermostat.backend.BackendService; import com.redhat.thermostat.common.ExitStatus; @@ -63,8 +66,6 @@ import com.redhat.thermostat.common.cli.Command; import com.redhat.thermostat.common.cli.CommandContext; import com.redhat.thermostat.common.cli.CommandException; -import com.redhat.thermostat.common.cli.CommandRegistry; -import com.redhat.thermostat.common.cli.CommandRegistryImpl; import com.redhat.thermostat.common.tools.ApplicationState; import com.redhat.thermostat.common.utils.LoggingUtils; import com.redhat.thermostat.shared.config.CommonPaths; @@ -75,6 +76,7 @@ import sun.misc.SignalHandler; @Component(immediate = true) +@Property(name = Command.NAME, value = "agent") @Service(value = Command.class) @SuppressWarnings("restriction") public final class AgentApplication extends AbstractStateNotifyingCommand { @@ -111,15 +113,13 @@ private BackendInfoDAO backendInfoDAO; @Reference private CommonPaths commonPaths; - - private CommandRegistry reg; + @Reference + private BackendConfigurationListener listener; private CountDownLatch shutdownLatch; private CustomSignalHandler handler; - private AgentApplication instance; - public AgentApplication() { this(new ConfigurationCreator()); } @@ -131,19 +131,11 @@ @Activate public void activate(BundleContext context) { this.context = context; - reg = new CommandRegistryImpl(context); - instance = this; - reg.registerCommand("agent", instance); } @Deactivate public void deactivate(BundleContext context) { - if (instance != null) { - // Bundle may be shut down *before* deps become available and - // app is set. - instance.shutdown(ExitStatus.EXIT_SUCCESS); - } - reg.unregisterCommands(); + shutdown(ExitStatus.EXIT_SUCCESS); } private void parseArguments(Arguments args) throws InvalidConfigurationException { @@ -226,8 +218,11 @@ Agent startAgent(AgentInfoDAO agentInfoDAO, BackendInfoDAO backendInfoDAO) { BackendRegistry backendRegistry = null; + BackendConfigurationRegistry configurationRegistry = null; try { backendRegistry = new BackendRegistry(context); + configurationRegistry = new BackendConfigurationRegistry(context); + configurationRegistry.addActionListener(listener); } catch (Exception e) { logger.log(Level.SEVERE, "Could not get BackendRegistry instance.", e); @@ -237,7 +232,8 @@ throw new RuntimeException(e); } - final Agent agent = new Agent(backendRegistry, configuration, agentInfoDAO, backendInfoDAO, writerId); + final Agent agent = new Agent(backendRegistry, configuration, agentInfoDAO, + backendInfoDAO, writerId, configurationRegistry); try { logger.fine("Starting agent."); agent.start();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/core/src/main/java/com/redhat/thermostat/backend/BackendConfiguration.java Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,63 @@ +/* + * 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.backend; + +/** + * Service interface class for configuring Backends + * for activation/deactivation. + */ +public interface BackendConfiguration { + + /** + * + * @return true if the backend should be enabled + */ + public boolean isEnabled(); + + /** + * + * @return the plugin ID of the backend to be configured + */ + public String getPluginId(); + + /** + * + * @return location of the plugin bundle + */ + public String getLocation(); + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/core/src/main/java/com/redhat/thermostat/backend/BackendConfigurationRegistry.java Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,53 @@ +/* + * 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.backend; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.InvalidSyntaxException; + +import com.redhat.thermostat.common.ThermostatExtensionRegistry; + +public class BackendConfigurationRegistry extends ThermostatExtensionRegistry<BackendConfiguration> { + + private static final String FILTER = "(" + Constants.OBJECTCLASS + "=" + BackendConfiguration.class.getName() + ")"; + + public BackendConfigurationRegistry(BundleContext context) throws InvalidSyntaxException { + super(context, FILTER, BackendConfiguration.class); + } + +} \ No newline at end of file
--- a/agent/core/src/test/java/com/redhat/thermostat/agent/AgentTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/agent/core/src/test/java/com/redhat/thermostat/agent/AgentTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -57,6 +57,7 @@ import com.redhat.thermostat.agent.dao.AgentInfoDAO; import com.redhat.thermostat.agent.dao.BackendInfoDAO; import com.redhat.thermostat.backend.Backend; +import com.redhat.thermostat.backend.BackendConfigurationRegistry; import com.redhat.thermostat.backend.BackendRegistry; import com.redhat.thermostat.common.ActionEvent; import com.redhat.thermostat.common.ActionListener; @@ -70,6 +71,8 @@ private AgentStartupConfiguration config; private BackendRegistry backendRegistry; + private BackendConfigurationRegistry configurationRegistry; + private BackendConfigurationListener listener; private Backend backend; private AgentInfoDAO agentInfoDao; private BackendInfoDAO backendInfoDao; @@ -92,13 +95,15 @@ when(backend.isActive()).thenReturn(true); backendRegistry = mock(BackendRegistry.class); + configurationRegistry = mock(BackendConfigurationRegistry.class); backendActivator = new InstantBackendActivator(); } @SuppressWarnings("unused") @Test public void testAgentInit() throws Exception { - Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, null); + Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, null, + configurationRegistry); verify(backendRegistry).addActionListener(any(ActionListener.class)); } @@ -110,7 +115,8 @@ UUID uuid = UUID.randomUUID(); WriterID id = mock(WriterID.class); when(id.getWriterID()).thenReturn(uuid.toString()); - Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id, backendActivator); + Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id, backendActivator, + configurationRegistry); agent.start(); @@ -129,7 +135,8 @@ // Start agent. WriterID id = mock(WriterID.class); - Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id, backendActivator); + Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id, backendActivator, + configurationRegistry); verify(backendRegistry).addActionListener(backendListener.capture()); agent.start(); @@ -177,7 +184,7 @@ UUID uuid = UUID.randomUUID(); WriterID id = mock(WriterID.class); when(id.getWriterID()).thenReturn(uuid.toString()); - Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id); + Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id, configurationRegistry); agent.start(); // stop agent @@ -198,7 +205,7 @@ when(config.purge()).thenReturn(false); WriterID id = mock(WriterID.class); - Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id); + Agent agent = new Agent(backendRegistry, config, agentInfoDao, backendInfoDao, id, configurationRegistry); agent.start(); // stop agent
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/core/src/test/java/com/redhat/thermostat/agent/BackendConfigurationListenerTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,108 @@ +/* + * 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.agent; + +import com.redhat.thermostat.backend.BackendConfiguration; +import com.redhat.thermostat.backend.BackendConfigurationRegistry; +import com.redhat.thermostat.testutils.StubBundleContext; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import java.util.Hashtable; + +import static org.mockito.Matchers.any; +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; + +public class BackendConfigurationListenerTest { + + private BundleContext context; + private BackendConfiguration configuration; + private BackendConfigurationRegistry registry; + private ConfigurationAdmin configurationAdmin; + private Configuration mockConfig; + + @Before + public void setUp() throws Exception { + configuration = mock(BackendConfiguration.class); + when(configuration.isEnabled()).thenReturn(true); + when(configuration.getLocation()).thenReturn("/foo/bar/test-plugin-1.99.12-SNAPSHOT.jar"); + when(configuration.getPluginId()).thenReturn("test-plugin"); + context = new StubBundleContext(); + registry = new BackendConfigurationRegistry(context); + BackendConfigurationListener listener = new BackendConfigurationListener(); + registry.addActionListener(listener); + configurationAdmin = mock(ConfigurationAdmin.class); + listener.bindConfigurationAdmin(configurationAdmin); + mockConfig = mock(Configuration.class); + when(configurationAdmin.getConfiguration(anyString())).thenReturn(mockConfig); + registry.start(); + } + + @Test + public void testConfigurationRegistered() throws Exception { + context.registerService(BackendConfiguration.class, configuration, null); + verify(configuration).isEnabled(); + verify(configurationAdmin).getConfiguration(eq("test-plugin")); + verify(mockConfig).setBundleLocation(eq("/foo/bar/test-plugin-1.99.12-SNAPSHOT.jar")); + verify(mockConfig).update(any(Hashtable.class)); + } + + @Test + public void testConfigurationUnregistered() throws Exception { + ServiceRegistration reg = context.registerService(BackendConfiguration.class, configuration, null); + verify(configuration).isEnabled(); + verify(configurationAdmin).getConfiguration(eq("test-plugin")); + verify(mockConfig).setBundleLocation(eq("/foo/bar/test-plugin-1.99.12-SNAPSHOT.jar")); + verify(mockConfig).update(any(Hashtable.class)); + reg.unregister(); + verify(mockConfig).delete(); + } + + @After + public void tearDown() { + registry.stop(); + } +}
--- a/agent/core/src/test/java/com/redhat/thermostat/agent/internal/AgentApplicationTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/agent/core/src/test/java/com/redhat/thermostat/agent/internal/AgentApplicationTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -36,7 +36,6 @@ package com.redhat.thermostat.agent.internal; -import static com.redhat.thermostat.testutils.Asserts.assertCommandIsRegistered; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -61,6 +60,7 @@ import com.redhat.thermostat.agent.dao.BackendInfoDAO; import com.redhat.thermostat.agent.internal.AgentApplication.ConfigurationCreator; import com.redhat.thermostat.backend.BackendRegistry; +import com.redhat.thermostat.backend.BackendConfigurationRegistry; import com.redhat.thermostat.common.ExitStatus; import com.redhat.thermostat.common.LaunchException; import com.redhat.thermostat.common.Version; @@ -224,11 +224,12 @@ Agent mockAgent = mock(Agent.class); PowerMockito.whenNew(Agent.class).withParameterTypes(BackendRegistry.class, AgentStartupConfiguration.class, - AgentInfoDAO.class, BackendInfoDAO.class, WriterID.class).withArguments( + AgentInfoDAO.class, BackendInfoDAO.class, WriterID.class, BackendConfigurationRegistry.class) + .withArguments( any(BackendRegistry.class), any(AgentStartupConfiguration.class), any(AgentInfoDAO.class), any(BackendInfoDAO.class), - any(WriterID.class)).thenReturn(mockAgent); + any(WriterID.class), any(BackendConfigurationRegistry.class)).thenReturn(mockAgent); doThrow(LaunchException.class).when(mockAgent).start(); final AgentApplication agent = new AgentApplication(configCreator); agent.bindExitStatus(exitStatus); @@ -264,14 +265,4 @@ t.start(); } - @PrepareForTest({ AgentApplication.class }) - @Test - public void verifyAgentCommandIsRegistered() { - final AgentApplication agent = new AgentApplication(configCreator); - agent.bindExitStatus(exitStatus); - agent.bindWriterId(writerId); - agent.activate(context); - assertCommandIsRegistered(context, "agent", AgentApplication.class); - } - } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/plugin/src/main/java/com/redhat/thermostat/common/plugin/BackendConfigurationUtil.java Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,112 @@ +/* + * 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.plugin; + +import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; + +public class BackendConfigurationUtil { + + private static final String CONFIG_FILE = "backend-config.properties"; + private static final String ENABLED_PROP = "enabled"; + private static final String URL_PROP = "gatewayURL"; + + private final ConfigurationInfoSource source; + private final String pluginId; + + public BackendConfigurationUtil(ConfigurationInfoSource source, final String pluginId) { + this.source = source; + this.pluginId = pluginId; + } + + /** + * Returns the microservice URL defined by the "gatewayURL" property in the gateway.properties file + * for this plugin, expressed as a {@link URI}. If the provided URL does not end in a '/' character, + * one is appended by this method. + * <p> + * Since the microservice path is already included, appending to this URI should be done using + * the {@link URI#resolve(String)} method with a relative path. + * @return a URI to the web gateway microservice used by this plugin + * @throws IOException if the gatewayURL property is missing or invalid + */ + public URI 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()); + } + try { + // Ensure the URI ends with a '/' so relative paths resolve under the microservice path segment + if (!url.endsWith("/")) { + url = url.concat("/"); + } + URI gatewayURI = new URI(url); + return gatewayURI; + } catch (URISyntaxException e) { + throw new IOException("Invalid URL found for " + pluginId + ": " + url, e); + } + } + + /** + * Returns whether or not this plugin is enabled defined by the "enabled" property in the plugin-config.properties + * file for this plugin, expressed as a boolean. If this property is missing it will default to false and the plugin + * services will not be activated. + * + * @return true if the plugin is enabled, false otherwise + */ + public boolean isEnabled() { + try { + Map<String, String> props = source.getConfiguration(pluginId, CONFIG_FILE); + return Boolean.valueOf(props.get(ENABLED_PROP)); + } catch (Exception e) { + return false; + } + } + + 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/common/plugin/src/main/java/com/redhat/thermostat/common/plugin/PluginConfiguration.java Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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.plugin; - -import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -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; - } - - /** - * Returns the microservice URL defined by the "gatewayURL" property in the gateway.properties file - * for this plugin, expressed as a {@link URI}. If the provided URL does not end in a '/' character, - * one is appended by this method. - * <p> - * Since the microservice path is already included, appending to this URI should be done using - * the {@link URI#resolve(String)} method with a relative path. - * @return a URI to the web gateway microservice used by this plugin - * @throws IOException if the gatewayURL property is missing or invalid - */ - public URI 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()); - } - try { - // Ensure the URI ends with a '/' so relative paths resolve under the microservice path segment - if (!url.endsWith("/")) { - url = url.concat("/"); - } - URI gatewayURI = new URI(url); - return gatewayURI; - } catch (URISyntaxException e) { - throw new IOException("Invalid URL found for " + pluginId + ": " + url, e); - } - } - - 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/common/plugin/src/main/java/com/redhat/thermostat/common/plugin/PluginDAOBase.java Tue Oct 03 15:02:21 2017 +0200 +++ b/common/plugin/src/main/java/com/redhat/thermostat/common/plugin/PluginDAOBase.java Thu Oct 19 11:44:23 2017 -0400 @@ -48,7 +48,7 @@ protected abstract String toJsonString(Tobj obj) throws IOException; protected abstract HttpRequestService getHttpRequestService(); - protected abstract PluginConfiguration getConfig(); + protected abstract BackendConfigurationUtil getConfig(); protected abstract URI getPostURI(final URI basepath, final Tobj obj); protected abstract Logger getLogger();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/plugin/src/test/java/com/redhat/thermostat/common/plugin/BackendConfigurationUtilTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,112 @@ +/* + * 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.plugin; + +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 java.io.IOException; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; + +public class BackendConfigurationUtilTest { + + private static final String PLUGIN_ID = "vm-gc"; + private static final String CONFIG_FILE = "backend-config.properties"; + private static final String URL_PROP = "gatewayURL"; + private static final String ENABLED_PROP = "enabled"; + + @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); + BackendConfigurationUtil config = new BackendConfigurationUtil(source, PLUGIN_ID); + + assertEquals(URI.create("urlToGateway/"), config.getGatewayURL()); + } + + @Test + public void testGetGatewayURLNoSlash() 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); + BackendConfigurationUtil config = new BackendConfigurationUtil(source, PLUGIN_ID); + + assertEquals(URI.create("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); + BackendConfigurationUtil config = new BackendConfigurationUtil(source, PLUGIN_ID); + config.getGatewayURL(); + } + + @Test + public void testIsEnabled() throws Exception { + ConfigurationInfoSource source = mock(ConfigurationInfoSource.class); + Map<String, String> props = new HashMap<>(); + props.put(ENABLED_PROP, "true"); + when(source.getConfiguration(PLUGIN_ID, CONFIG_FILE)).thenReturn(props); + BackendConfigurationUtil config = new BackendConfigurationUtil(source, PLUGIN_ID); + assertTrue(config.isEnabled()); + } + + @Test + public void testIsEnabledDefaultsToFalse() throws Exception { + ConfigurationInfoSource source = mock(ConfigurationInfoSource.class); + Map<String, String> props = new HashMap<>(); + when(source.getConfiguration(PLUGIN_ID, CONFIG_FILE)).thenReturn(props); + BackendConfigurationUtil config = new BackendConfigurationUtil(source, PLUGIN_ID); + assertFalse(config.isEnabled()); + } + + +}
--- a/common/plugin/src/test/java/com/redhat/thermostat/common/plugin/PluginConfigurationTest.java Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +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.plugin; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; - -public class PluginConfigurationTest { - - 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); - PluginConfiguration config = new PluginConfiguration(source, PLUGIN_ID); - - assertEquals(URI.create("urlToGateway/"), config.getGatewayURL()); - } - - @Test - public void testGetGatewayURLNoSlash() 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); - PluginConfiguration config = new PluginConfiguration(source, PLUGIN_ID); - - assertEquals(URI.create("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); - PluginConfiguration config = new PluginConfiguration(source, PLUGIN_ID); - config.getGatewayURL(); - } -}
--- a/distribution/assembly/core-assembly.xml Tue Oct 03 15:02:21 2017 +0200 +++ b/distribution/assembly/core-assembly.xml Thu Oct 19 11:44:23 2017 -0400 @@ -64,6 +64,7 @@ <include>com.redhat.thermostat.agent:thermostat-storage-core</include> <include>org.osgi:org.osgi.compendium</include> <include>org.apache:org.apache.felix.scr</include> + <include>org.apache.felix:configadmin</include> <include>commons-codec:commons-codec</include> <include>org.apache.httpcomponents:httpclient-osgi</include> <include>org.eclipse.jetty:jetty-client</include>
--- a/distribution/config/commands/agent.properties Tue Oct 03 15:02:21 2017 +0200 +++ b/distribution/config/commands/agent.properties Thu Oct 19 11:44:23 2017 -0400 @@ -1,6 +1,7 @@ bundles = com.redhat.thermostat.agent.core=@project.version@, \ com.redhat.thermostat.agent.ipc.tcpsocket.server=@project.version@, \ - com.redhat.thermostat.process=@project.version@ \ + com.redhat.thermostat.process=@project.version@, \ + org.apache.felix.configadmin=@felix.configadmin.version@ \ @agent_extra_bundles@ summary = run the thermostat agent
--- a/plugins/commands/agent/src/main/java/com/redhat/thermostat/commands/agent/internal/CommandsBackend.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/commands/agent/src/main/java/com/redhat/thermostat/commands/agent/internal/CommandsBackend.java Thu Oct 19 11:44:23 2017 -0400 @@ -63,7 +63,8 @@ import com.redhat.thermostat.commands.agent.receiver.ReceiverRegistry; import com.redhat.thermostat.common.Version; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; import com.redhat.thermostat.shared.config.CommonPaths; @@ -91,7 +92,7 @@ private WebSocketClientFacade wsClient; private boolean isActive; private StorageCredentials creds; - private PluginConfiguration config; + private BackendConfigurationUtil config; private ReceiverRegistry receiverReg; @Reference @@ -288,8 +289,8 @@ } static class ConfigCreator { - PluginConfiguration createConfig(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil createConfig(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/commands/agent/src/test/java/com/redhat/thermostat/commands/agent/internal/CommandsBackendTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/commands/agent/src/test/java/com/redhat/thermostat/commands/agent/internal/CommandsBackendTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -64,7 +64,7 @@ import com.redhat.thermostat.commands.agent.internal.CommandsBackend.WsClientCreator; import com.redhat.thermostat.commands.agent.internal.socket.CmdChannelAgentSocket; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.shared.config.CommonPaths; import com.redhat.thermostat.shared.config.SSLConfiguration; @@ -92,7 +92,7 @@ client = mock(WebSocketClientFacade.class); when(creator.createClient(any(SSLConfiguration.class))).thenReturn(client); ConfigCreator configCreator = mock(ConfigCreator.class); - PluginConfiguration config = mock(PluginConfiguration.class); + BackendConfigurationUtil config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GW_URL); when(configCreator.createConfig(any(ConfigurationInfoSource.class))).thenReturn(config); backend = new CommandsBackend(creator, credsCreator, configCreator, socketConnect);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/commands/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# Web socket base URL to the commands microservice provided by the Thermostat web gateway +gatewayURL=wss://127.0.0.1:30000/commands/v1
--- a/plugins/commands/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# Web socket base URL to the commands microservice provided by the Thermostat web gateway -gatewayURL=wss://127.0.0.1:30000/commands/v1
--- a/plugins/host-cpu/agent/src/main/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-cpu/agent/src/main/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -49,7 +49,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -66,7 +66,7 @@ private final JsonHelper jsonHelper; private final ConfigurationCreator configCreator; - private PluginConfiguration config; + private BackendConfigurationUtil config; @Reference private ConfigurationInfoSource configurationInfoSource; @@ -110,7 +110,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return config; } @@ -152,8 +152,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/host-cpu/agent/src/test/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatDAOTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-cpu/agent/src/test/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatDAOTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -51,7 +51,7 @@ import com.redhat.thermostat.common.Clock; import com.redhat.thermostat.common.SystemClock; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.host.cpu.agent.internal.CpuStatDAOImpl.ConfigurationCreator; import com.redhat.thermostat.host.cpu.model.CpuStat; @@ -81,7 +81,7 @@ cfiSource = mock(ConfigurationInfoSource.class); configCreator = mock(ConfigurationCreator.class); - PluginConfiguration pluginConfig = mock(PluginConfiguration.class); + BackendConfigurationUtil pluginConfig = mock(BackendConfigurationUtil.class); when(pluginConfig.getGatewayURL()).thenReturn(GATEWAY_URI); when(configCreator.create(cfiSource)).thenReturn(pluginConfig);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/host-cpu/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/system-cpu/0.0.1
--- a/plugins/host-cpu/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/system-cpu/0.0.1
--- a/plugins/host-memory/agent/src/main/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-memory/agent/src/main/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -49,7 +49,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -66,7 +66,7 @@ private final JsonHelper jsonHelper; private final ConfigurationCreator configCreator; - private PluginConfiguration config; + private BackendConfigurationUtil config; @Reference private ConfigurationInfoSource configurationInfoSource; @@ -100,7 +100,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return config; } @@ -153,8 +153,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/host-memory/agent/src/test/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatDAOTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-memory/agent/src/test/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatDAOTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -51,7 +51,7 @@ import com.redhat.thermostat.common.Clock; import com.redhat.thermostat.common.SystemClock; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.host.memory.agent.internal.MemoryStatDAOImpl.ConfigurationCreator; import com.redhat.thermostat.host.memory.model.MemoryStat; @@ -79,7 +79,7 @@ cfiSource = mock(ConfigurationInfoSource.class); configCreator = mock(ConfigurationCreator.class); - PluginConfiguration pluginConfig = mock(PluginConfiguration.class); + BackendConfigurationUtil pluginConfig = mock(BackendConfigurationUtil.class); when(pluginConfig.getGatewayURL()).thenReturn(GATEWAY_URI); when(configCreator.create(cfiSource)).thenReturn(pluginConfig);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/host-memory/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/system-memory/0.0.1
--- a/plugins/host-memory/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/system-memory/0.0.1
--- a/plugins/host-network/agent/src/main/java/com/redhat/thermostat/host/network/internal/NetworkInfoListDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-network/agent/src/main/java/com/redhat/thermostat/host/network/internal/NetworkInfoListDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -49,7 +49,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -65,7 +65,7 @@ static final String PLUGIN_ID = "host-network"; private final ConfigurationCreator configCreator; - private PluginConfiguration config; + private BackendConfigurationUtil config; private final JsonHelper jsonHelper; @@ -103,7 +103,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return config; } @@ -147,8 +147,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/host-network/agent/src/test/java/com/redhat/thermostat/host/network/internal/NetworkInfoListDAOTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-network/agent/src/test/java/com/redhat/thermostat/host/network/internal/NetworkInfoListDAOTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -51,7 +51,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.host.network.internal.NetworkInfoListDAOImpl.ConfigurationCreator; import com.redhat.thermostat.host.network.internal.NetworkInfoListDAOImpl.JsonHelper; @@ -88,7 +88,7 @@ cfiSource = mock(ConfigurationInfoSource.class); configCreator = mock(ConfigurationCreator.class); - PluginConfiguration pluginConfig = mock(PluginConfiguration.class); + BackendConfigurationUtil pluginConfig = mock(BackendConfigurationUtil.class); when(pluginConfig.getGatewayURL()).thenReturn(GATEWAY_URI); when(configCreator.create(cfiSource)).thenReturn(pluginConfig);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/host-network/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/system-network/0.0.1
--- a/plugins/host-network/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/system-network/0.0.1
--- a/plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-overview/agent/src/main/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -49,7 +49,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -68,7 +68,7 @@ private final ConfigurationCreator configCreator; - private PluginConfiguration config; + private BackendConfigurationUtil config; @Reference private ConfigurationInfoSource configurationInfoSource; @@ -116,7 +116,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return config; } @@ -153,8 +153,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } }
--- a/plugins/host-overview/agent/src/test/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOImplTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/host-overview/agent/src/test/java/com/redhat/thermostat/host/overview/internal/models/HostInfoDAOImplTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -49,7 +49,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.host.overview.internal.models.HostInfoDAOImpl.ConfigurationCreator; import com.redhat.thermostat.host.overview.model.HostInfo; @@ -84,7 +84,7 @@ cfiSource = mock(ConfigurationInfoSource.class); configCreator = mock(ConfigurationCreator.class); - PluginConfiguration pluginConfig = mock(PluginConfiguration.class); + BackendConfigurationUtil pluginConfig = mock(BackendConfigurationUtil.class); when(pluginConfig.getGatewayURL()).thenReturn(GATEWAY_URI); when(configCreator.create(cfiSource)).thenReturn(pluginConfig);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/host-overview/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/systems/0.0.1
--- a/plugins/host-overview/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/systems/0.0.1
--- a/plugins/jcmd-stats-collector/agent/src/main/java/com/redhat/thermostat/agent/jcmd/backend/internal/NetworkHandler.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/jcmd-stats-collector/agent/src/main/java/com/redhat/thermostat/agent/jcmd/backend/internal/NetworkHandler.java Thu Oct 19 11:44:23 2017 -0400 @@ -39,7 +39,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.commands.model.WebSocketResponse; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import java.io.IOException; import java.net.URI; @@ -53,7 +53,7 @@ private HttpRequestService httpRequestService; - private PluginConfiguration configuration; + private BackendConfigurationUtil configuration; public NetworkHandler(HttpRequestService httpRequestService, ConfigurationInfoSource configInfoSource) { @@ -78,8 +78,8 @@ static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } }
--- a/plugins/jvm-overview/agent/src/main/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmInfoDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/jvm-overview/agent/src/main/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmInfoDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -53,7 +53,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.agent.http.RequestFailedException; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; import com.redhat.thermostat.jvm.overview.agent.internal.model.VmInfoTypeAdapter.VmInfoUpdateTypeAdapter; @@ -97,7 +97,7 @@ @Activate public void activate() throws Exception { - PluginConfiguration config = configCreator.create(configInfoSource); + BackendConfigurationUtil config = configCreator.create(configInfoSource); this.gatewayURL = config.getGatewayURL(); } @@ -236,8 +236,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } }
--- a/plugins/jvm-overview/agent/src/test/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmInfoDAOImplTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/jvm-overview/agent/src/test/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmInfoDAOImplTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -55,7 +55,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.jvm.overview.agent.internal.model.VmInfoDAOImpl.ConfigurationCreator; import com.redhat.thermostat.jvm.overview.agent.internal.model.VmInfoDAOImpl.JsonHelper; @@ -76,7 +76,7 @@ private SystemID systemID; private ConfigurationCreator creator; private ConfigurationInfoSource source; - private PluginConfiguration config; + private BackendConfigurationUtil config; @Before public void setUp() throws Exception { @@ -102,7 +102,7 @@ props, env, libs, uid, username); source = mock(ConfigurationInfoSource.class); - config = mock(PluginConfiguration.class); + config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); creator = mock(ConfigurationCreator.class); when(creator.create(source)).thenReturn(config);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/jvm-overview/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/jvms/0.0.1/
--- a/plugins/jvm-overview/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/jvms/0.0.1/
--- a/plugins/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -44,7 +44,7 @@ import com.google.gson.Gson; import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.vm.byteman.agent.BytemanMetric; import com.redhat.thermostat.vm.byteman.agent.VmBytemanDAO; @@ -82,7 +82,7 @@ @Activate private void activate() { - PluginConfiguration config = configCreator.create(configInfoSource); + BackendConfigurationUtil config = configCreator.create(configInfoSource); Gson gson = gsonCreator.create(); metricsStore = new VmBytemanMetricsStore(httpRequestService, config, systemId, gson); statusStore = new VmBytemanStatusStore(httpRequestService, config, systemId, gson); @@ -101,8 +101,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } }
--- a/plugins/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanMetricsStore.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanMetricsStore.java Thu Oct 19 11:44:23 2017 -0400 @@ -44,7 +44,7 @@ import com.google.gson.Gson; import com.redhat.thermostat.agent.http.HttpRequestService; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -55,12 +55,12 @@ private static final String METRICS_PATH = "metrics"; private static final Logger LOGGER = LoggingUtils.getLogger(VmBytemanMetricsStore.class); private final HttpRequestService httpRequestService; - private final PluginConfiguration pluginConfig; + private final BackendConfigurationUtil pluginConfig; private final SystemID systemId; private final Gson gson; VmBytemanMetricsStore(HttpRequestService httpRequestService, - PluginConfiguration pluginConfig, + BackendConfigurationUtil pluginConfig, SystemID systemId, Gson gson) { this.httpRequestService = httpRequestService; @@ -81,7 +81,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return pluginConfig; }
--- a/plugins/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanStatusStore.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanStatusStore.java Thu Oct 19 11:44:23 2017 -0400 @@ -45,7 +45,7 @@ import com.google.gson.Gson; import com.redhat.thermostat.agent.http.HttpRequestService; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -56,12 +56,12 @@ private static final String STATUS_PATH = "status"; private static final Logger LOGGER = LoggingUtils.getLogger(VmBytemanStatusStore.class); private final HttpRequestService httpRequestService; - private final PluginConfiguration pluginConfig; + private final BackendConfigurationUtil pluginConfig; private final SystemID systemId; private final Gson gson; VmBytemanStatusStore(HttpRequestService httpRequestService, - PluginConfiguration pluginConfig, + BackendConfigurationUtil pluginConfig, SystemID systemId, Gson gson) { this.httpRequestService = httpRequestService; @@ -82,7 +82,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return pluginConfig; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/vm-byteman/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,3 @@ +# Web base URL to the byteman microservice provided by the Thermostat web gateway +gatewayURL=https://127.0.0.1:30000/jvm-byteman/0.0.1 +
--- a/plugins/vm-byteman/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# Web socket base URL to the commands microservice provided by the Thermostat web gateway -gatewayURL=https://127.0.0.1:30000/jvm-byteman/0.0.1
--- a/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -45,7 +45,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -67,7 +67,7 @@ private final JsonHelper jsonHelper; private final ConfigurationCreator configCreator; private URI gatewayURL; - private PluginConfiguration config; + private BackendConfigurationUtil config; @Reference private ConfigurationInfoSource configurationInfoSource; @@ -104,7 +104,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return config; } @@ -154,8 +154,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -50,7 +50,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.vm.classstat.model.VmClassStat; @@ -99,7 +99,7 @@ when(jsonHelper.toJson(anyListOf(VmClassStat.class))).thenReturn(JSON); ConfigurationInfoSource source = mock(ConfigurationInfoSource.class); - PluginConfiguration config = mock(PluginConfiguration.class); + BackendConfigurationUtil config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); VmClassStatDAOImpl.ConfigurationCreator creator = mock(VmClassStatDAOImpl.ConfigurationCreator.class); when(creator.create(source)).thenReturn(config);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/vm-classstat/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/jvm-classstat/0.0.1 \ No newline at end of file
--- a/plugins/vm-classstat/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/jvm-classstat/0.0.1 \ No newline at end of file
--- a/plugins/vm-compiler/agent/src/main/java/com/redhat/thermostat/vm/compiler/agent/internal/VmCompilerStatDaoImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-compiler/agent/src/main/java/com/redhat/thermostat/vm/compiler/agent/internal/VmCompilerStatDaoImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -50,7 +50,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -67,7 +67,7 @@ private final JsonHelper jsonHelper; private final ConfigurationCreator configCreator; private URI gatewayURL; - private PluginConfiguration config; + private BackendConfigurationUtil config; @Reference private ConfigurationInfoSource configurationInfoSource; @@ -104,7 +104,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return config; } @@ -154,8 +154,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/vm-compiler/agent/src/test/java/com/redhat/thermostat/vm/compiler/agent/internal/VmCompilerStatDaoImplTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-compiler/agent/src/test/java/com/redhat/thermostat/vm/compiler/agent/internal/VmCompilerStatDaoImplTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -51,7 +51,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.vm.compiler.model.VmCompilerStat; @@ -105,7 +105,7 @@ when(jsonHelper.toJson(anyListOf(VmCompilerStat.class))).thenReturn(JSON); ConfigurationInfoSource source = mock(ConfigurationInfoSource.class); - PluginConfiguration config = mock(PluginConfiguration.class); + BackendConfigurationUtil config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); VmCompilerStatDaoImpl.ConfigurationCreator creator = mock(VmCompilerStatDaoImpl.ConfigurationCreator.class); when(creator.create(source)).thenReturn(config);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/vm-compiler/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the jvm-compiler microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/jvm-compiler/0.0.1
--- a/plugins/vm-compiler/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the jvm-compiler microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/jvm-compiler/0.0.1
--- a/plugins/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -44,7 +44,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -73,7 +73,7 @@ private final JsonHelper jsonHelper; private final ConfigurationCreator configurationCreator; - private PluginConfiguration pluginConfiguration; + private BackendConfigurationUtil pluginConfiguration; public VmCpuStatDAOImpl() { this(new JsonHelper(new VmCpuStatTypeAdapter()), new ConfigurationCreator()); @@ -100,7 +100,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return pluginConfiguration; } @@ -144,8 +144,8 @@ // For testing. static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatDAOImplTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatDAOImplTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -49,7 +49,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.vm.cpu.agent.model.VmCpuStat; import org.junit.Before; @@ -81,7 +81,7 @@ when(jsonHelper.toJson(anyListOf(VmCpuStat.class))).thenReturn(JSON); ConfigurationInfoSource source = mock(ConfigurationInfoSource.class); - PluginConfiguration config = mock(PluginConfiguration.class); + BackendConfigurationUtil config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); ConfigurationCreator creator = mock(ConfigurationCreator.class); when(creator.create(source)).thenReturn(config);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/vm-cpu/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the jvm-cpu microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/jvm-cpu/0.0.1
--- a/plugins/vm-cpu/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the jvm-cpu microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/jvm-cpu/0.0.1
--- a/plugins/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/models/VmGcStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/models/VmGcStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -52,7 +52,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.agent.http.RequestFailedException; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.utils.LoggingUtils; import com.redhat.thermostat.vm.gc.agent.model.VmGcStat; @@ -88,7 +88,7 @@ @Activate void activate() throws Exception { - PluginConfiguration config = configCreator.create(configInfoSource); + BackendConfigurationUtil config = configCreator.create(configInfoSource); this.gatewayURL = config.getGatewayURL(); } @@ -137,8 +137,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } }
--- a/plugins/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/models/VmGcStatDAOImplTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/models/VmGcStatDAOImplTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -51,7 +51,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.vm.gc.agent.internal.models.VmGcStatDAOImpl.ConfigurationCreator; import com.redhat.thermostat.vm.gc.agent.internal.models.VmGcStatDAOImpl.JsonHelper; import com.redhat.thermostat.vm.gc.agent.model.VmGcStat; @@ -82,7 +82,7 @@ when(jsonHelper.toJson(anyListOf(VmGcStat.class))).thenReturn(JSON); ConfigurationInfoSource source = mock(ConfigurationInfoSource.class); - PluginConfiguration config = mock(PluginConfiguration.class); + BackendConfigurationUtil config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); ConfigurationCreator creator = mock(ConfigurationCreator.class); when(creator.create(source)).thenReturn(config);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/vm-gc/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the jvm-gc microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/jvm-gc/0.0.3
--- a/plugins/vm-gc/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the jvm-gc microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/jvm-gc/0.0.3
--- a/plugins/vm-io/agent/src/main/java/com/redhat/thermostat/vm/io/agent/internal/VmIoStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-io/agent/src/main/java/com/redhat/thermostat/vm/io/agent/internal/VmIoStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -44,7 +44,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.PluginDAOBase; import com.redhat.thermostat.common.plugin.SystemID; import com.redhat.thermostat.common.utils.LoggingUtils; @@ -64,7 +64,7 @@ private final JsonHelper jsonHelper; private final ConfigurationCreator configCreator; - private PluginConfiguration config; + private BackendConfigurationUtil config; @Reference private ConfigurationInfoSource configurationInfoSource; @@ -98,7 +98,7 @@ } @Override - protected PluginConfiguration getConfig() { + protected BackendConfigurationUtil getConfig() { return config; } @@ -151,8 +151,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/vm-io/agent/src/test/java/com/redhat/thermostat/vm/io/agent/internal/VmIoStatDAOImplTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-io/agent/src/test/java/com/redhat/thermostat/vm/io/agent/internal/VmIoStatDAOImplTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -43,7 +43,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.plugin.SystemID; import org.junit.Before; @@ -89,7 +89,7 @@ when(jsonHelper.toJson(anyListOf(VmIoStat.class))).thenReturn(JSON); ConfigurationInfoSource source = mock(ConfigurationInfoSource.class); - PluginConfiguration config = mock(PluginConfiguration.class); + BackendConfigurationUtil config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); ConfigurationCreator creator = mock(ConfigurationCreator.class); when(creator.create(source)).thenReturn(config);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/vm-io/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/jvm-io/0.0.1
--- a/plugins/vm-io/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/jvm-io/0.0.1
--- a/plugins/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmMemoryStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmMemoryStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -52,7 +52,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.agent.http.RequestFailedException; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.utils.LoggingUtils; import com.redhat.thermostat.vm.memory.agent.model.VmMemoryStat; @@ -89,7 +89,7 @@ @Activate void activate() throws Exception { - PluginConfiguration config = configCreator.create(configInfoSource); + BackendConfigurationUtil config = configCreator.create(configInfoSource); this.gatewayURL = config.getGatewayURL(); } @@ -141,8 +141,8 @@ // For Testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } }
--- a/plugins/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmTlabStatDAOImpl.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmTlabStatDAOImpl.java Thu Oct 19 11:44:23 2017 -0400 @@ -52,7 +52,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService.Method; import com.redhat.thermostat.agent.http.RequestFailedException; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.common.utils.LoggingUtils; import com.redhat.thermostat.vm.memory.agent.model.VmTlabStat; @@ -87,7 +87,7 @@ @Activate void activate() throws Exception { - PluginConfiguration config = configurationCreator.create(configInfoSource); + BackendConfigurationUtil config = configurationCreator.create(configInfoSource); this.gatewayURL = config.getGatewayURL(); } @@ -129,8 +129,8 @@ // For testing purposes static class ConfigurationCreator { - PluginConfiguration create(ConfigurationInfoSource source) { - return new PluginConfiguration(source, PLUGIN_ID); + BackendConfigurationUtil create(ConfigurationInfoSource source) { + return new BackendConfigurationUtil(source, PLUGIN_ID); } } }
--- a/plugins/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmMemoryStatDAOImplTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmMemoryStatDAOImplTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -52,7 +52,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.vm.memory.agent.internal.models.VmMemoryStatDAOImpl.JsonHelper; import com.redhat.thermostat.vm.memory.agent.model.VmMemoryStat; import com.redhat.thermostat.vm.memory.agent.model.VmMemoryStat.Generation; @@ -64,7 +64,7 @@ private static final URI GATEWAY_URI = URI.create("http://example.com/jvm-memory/0.0.2/"); private JsonHelper jsonHelper; - private PluginConfiguration config; + private BackendConfigurationUtil config; VmMemoryStatDAOImpl.ConfigurationCreator creator; ConfigurationInfoSource source; private HttpRequestService httpRequestService; @@ -74,7 +74,7 @@ jsonHelper = mock(JsonHelper.class); when(jsonHelper.toJson(anyListOf(VmMemoryStat.class))).thenReturn(JSON); - config = mock(PluginConfiguration.class); + config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); source = mock(ConfigurationInfoSource.class);
--- a/plugins/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmTlabStatDAOTest.java Tue Oct 03 15:02:21 2017 +0200 +++ b/plugins/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/models/VmTlabStatDAOTest.java Thu Oct 19 11:44:23 2017 -0400 @@ -53,7 +53,7 @@ import com.redhat.thermostat.agent.http.HttpRequestService; import com.redhat.thermostat.agent.http.HttpRequestService.Method; import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource; -import com.redhat.thermostat.common.plugin.PluginConfiguration; +import com.redhat.thermostat.common.plugin.BackendConfigurationUtil; import com.redhat.thermostat.vm.memory.agent.internal.models.VmTlabStatDAOImpl.ConfigurationCreator; import com.redhat.thermostat.vm.memory.agent.internal.models.VmTlabStatDAOImpl.JsonHelper; import com.redhat.thermostat.vm.memory.agent.model.VmTlabStat; @@ -66,7 +66,7 @@ private static final URI GATEWAY_URI = URI.create("http://example.com/jvm-memory/0.0.2/"); private JsonHelper jsonHelper; - private PluginConfiguration config; + private BackendConfigurationUtil config; private HttpRequestService httpRequestService; private ConfigurationCreator configCreator; private ConfigurationInfoSource configInfoSource; @@ -77,7 +77,7 @@ jsonHelper = mock(JsonHelper.class); when(jsonHelper.toJson(anyListOf(VmTlabStat.class))).thenReturn(JSON); - config = mock(PluginConfiguration.class); + config = mock(BackendConfigurationUtil.class); when(config.getGatewayURL()).thenReturn(GATEWAY_URI); configCreator = mock(ConfigurationCreator.class); configInfoSource = mock(ConfigurationInfoSource.class);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/vm-memory/distribution/configFiles/backend-config.properties Thu Oct 19 11:44:23 2017 -0400 @@ -0,0 +1,2 @@ +# URL to the jvm-memory microservice provided by the Thermostat web gateway +gatewayURL=https://localhost:30000/jvm-memory/0.0.3
--- a/plugins/vm-memory/distribution/configFiles/gateway.properties Tue Oct 03 15:02:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# URL to the jvm-memory microservice provided by the Thermostat web gateway -gatewayURL=https://localhost:30000/jvm-memory/0.0.3
--- a/pom.xml Tue Oct 03 15:02:21 2017 +0200 +++ b/pom.xml Thu Oct 19 11:44:23 2017 -0400 @@ -301,6 +301,7 @@ <osgi.compendium.bundle.symbolic-name>osgi.cmpn</osgi.compendium.bundle.symbolic-name> <felix.framework.version>4.2.0</felix.framework.version> + <felix.configadmin.version>1.4.0</felix.configadmin.version> <felix.scr.version>1.8.2</felix.scr.version> <felix.scr.annotations.version>1.9.12</felix.scr.annotations.version> <kxml2.version>2.3.0</kxml2.version> @@ -738,6 +739,11 @@ <version>${felix.scr.version}</version> </dependency> <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.configadmin</artifactId> + <version>${felix.configadmin.version}</version> + </dependency> + <dependency> <groupId>net.sf.kxml</groupId> <artifactId>kxml2</artifactId> <version>${kxml2.version}</version>