changeset 1692:507c6521cbc4

WebAppTest should not use actual configuration Reviewed-by: jerboaa Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-May/013765.html PR 2386
author Omair Majid <omajid@redhat.com>
date Tue, 26 May 2015 09:55:40 -0400
parents 3de392cf6a31
children 88d3eff7a6df 08d438ac9b8f
files integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/WebAppTest.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/WebAppTest.java	Tue May 26 19:30:10 2015 +0200
+++ b/integration-tests/itest-run/src/test/java/com/redhat/thermostat/itest/WebAppTest.java	Tue May 26 09:55:40 2015 -0400
@@ -42,6 +42,8 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -75,8 +77,8 @@
 import com.redhat.thermostat.common.ApplicationInfo;
 import com.redhat.thermostat.host.cpu.common.CpuStatDAO;
 import com.redhat.thermostat.host.cpu.common.model.CpuStat;
+import com.redhat.thermostat.shared.config.CommonPaths;
 import com.redhat.thermostat.shared.config.SSLConfiguration;
-import com.redhat.thermostat.shared.config.internal.CommonPathsImpl;
 import com.redhat.thermostat.shared.config.internal.SSLConfigurationImpl;
 import com.redhat.thermostat.storage.core.Add;
 import com.redhat.thermostat.storage.core.BackingStorage;
@@ -442,7 +444,10 @@
             }
             
         };
-        SSLConfiguration sslConf = new SSLConfigurationImpl(new CommonPathsImpl());
+        CommonPaths paths = mock(CommonPaths.class);
+        when(paths.getSystemConfigurationDirectory()).thenReturn(new File(getConfigurationDir()));
+        when(paths.getUserConfigurationDirectory()).thenReturn(new File(getUserThermostatHome(), "etc"));
+        SSLConfiguration sslConf = new SSLConfigurationImpl(paths);
         Storage storage = new WebStorage(url, creds, sslConf);
         if (listener != null) {
             storage.getConnection().addListener(listener);