Mercurial > hg > release > thermostat-0.6
changeset 879:59738c25578b
Remove PROTOCOL config from db.properties.
As of now the storage command is inherently tied to mongo. As such it doesn't
make sense to make the protocol configurable (since there is only one valid
value anyway). Hence, I've removed this config option.
If we eventually end up needing this again we can re-introduce it. Right now, I
think it's wrong to ship a config value which isn't tunable. My gut feeling
tells me that we may never use it. In the sql case we will likely not start the
db itself via thermostat means. For the embedded case the DB may not need to be
started at all.
Reviewed-by: rkennke
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-December/004931.html
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Thu, 20 Dec 2012 14:49:16 +0100 |
parents | e5cda64075ed |
children | acbfd9752b11 |
files | agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBConfig.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBOptionParser.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBStartupConfiguration.java agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/StorageCommand.java agent/cli/src/test/java/com/redhat/thermostat/agent/cli/impl/StorageCommandTest.java distribution/config/db.properties |
diffstat | 6 files changed, 5 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBConfig.java Tue Dec 18 12:32:36 2012 +0100 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBConfig.java Thu Dec 20 14:49:16 2012 +0100 @@ -45,5 +45,5 @@ BIND, PORT, - PROTOCOL, + }
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBOptionParser.java Tue Dec 18 12:32:36 2012 +0100 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBOptionParser.java Thu Dec 20 14:49:16 2012 +0100 @@ -82,10 +82,9 @@ } // leave at the end, since it depends on the previous settings - String urlPrefix = configuration.getProtocol(); String address = configuration.getBindIP(); long port = configuration.getPort(); - configuration.setDBConnectionString(urlPrefix + "://" + address + ":" + port); + configuration.setDBConnectionString("mongodb://" + address + ":" + port); } public boolean isDryRun() {
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBStartupConfiguration.java Tue Dec 18 12:32:36 2012 +0100 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/db/DBStartupConfiguration.java Thu Dec 20 14:49:16 2012 +0100 @@ -50,8 +50,6 @@ private long localPort; - private String protocol; - private String dbConnectionString; private String ip; @@ -82,14 +80,6 @@ return localPort; } - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getProtocol() { - return protocol; - } - void setDBConnectionString(String dbConnectionString) { this.dbConnectionString = dbConnectionString; }
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/StorageCommand.java Tue Dec 18 12:32:36 2012 +0100 +++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/StorageCommand.java Thu Dec 20 14:49:16 2012 +0100 @@ -131,13 +131,6 @@ throw new InvalidConfigurationException(DBConfig.PORT + " property missing"); } - if (properties.containsKey(DBConfig.PROTOCOL.name())) { - String url = (String) properties.get(DBConfig.PROTOCOL.name()); - configuration.setProtocol(url); - } else { - throw new InvalidConfigurationException(DBConfig.PROTOCOL + " property missing"); - } - if (properties.containsKey(DBConfig.BIND.name())) { String ip = (String) properties.get(DBConfig.BIND.name()); configuration.setBindIP(ip);
--- a/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/impl/StorageCommandTest.java Tue Dec 18 12:32:36 2012 +0100 +++ b/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/impl/StorageCommandTest.java Thu Dec 20 14:49:16 2012 +0100 @@ -64,7 +64,6 @@ import com.redhat.thermostat.agent.cli.db.DBConfig; import com.redhat.thermostat.agent.cli.db.DBStartupConfiguration; import com.redhat.thermostat.agent.cli.db.MongoProcessRunner; -import com.redhat.thermostat.agent.cli.impl.StorageCommand; import com.redhat.thermostat.common.ActionEvent; import com.redhat.thermostat.common.ActionListener; import com.redhat.thermostat.common.cli.CommandContext; @@ -78,7 +77,6 @@ private static final String PORT = "27518"; private static final String BIND = "127.0.0.1"; - private static final String PROTOCOL = "mongodb"; private static final String DB = "storage/db"; private String tmpDir; @@ -106,7 +104,6 @@ props.setProperty(DBConfig.BIND.name(), BIND); props.setProperty(DBConfig.PORT.name(), PORT); - props.setProperty(DBConfig.PROTOCOL.name(), PROTOCOL); props.store(new FileOutputStream(tmpConfigs), "thermostat test properties"); @@ -137,7 +134,7 @@ Assert.assertEquals(tmpDir + DB, conf.getDBPath().getPath()); Assert.assertEquals(Integer.parseInt(PORT), conf.getPort()); - Assert.assertEquals(PROTOCOL, conf.getProtocol()); + Assert.assertEquals("mongodb://" + BIND + ":" + PORT , conf.getDBConnectionString()); } private StorageCommand prepareService(boolean startSuccess) throws IOException, @@ -170,6 +167,7 @@ final boolean[] result = new boolean[2]; service.getNotifier().addActionListener(new ActionListener<ApplicationState>() { + @SuppressWarnings("incomplete-switch") @Override public void actionPerformed(ActionEvent<ApplicationState> actionEvent) { switch (actionEvent.getActionId()) { @@ -207,6 +205,7 @@ final CountDownLatch latch = new CountDownLatch(1); final boolean[] result = new boolean[1]; service.getNotifier().addActionListener(new ActionListener<ApplicationState>() { + @SuppressWarnings("incomplete-switch") @Override public void actionPerformed(ActionEvent<ApplicationState> actionEvent) { switch (actionEvent.getActionId()) {