use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerConnectionTest method getTestData.
/**
* Gets the test data.
*
* @return the test data
*/
private GeoServerConnection getTestData() {
try {
url = new URL("http://www.example.com/dummy");
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
GeoServerConnection connection1 = new GeoServerConnection();
connection1.setConnectionName(connectionName);
connection1.setUrl(url);
connection1.setUserName(userName);
connection1.setPassword(password);
return connection1;
}
use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerConnectionTest method testUpdate.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#update(com.sldeditor.common.data.GeoServerConnection)}.
*/
@Test
public void testUpdate() {
GeoServerConnection connection1 = getTestData();
GeoServerConnection connection2 = new GeoServerConnection();
connection2.update(connection1);
assertEquals(connection1.getConnectionName(), connection2.getConnectionName());
assertEquals(connection1.getPassword(), connection2.getPassword());
assertEquals(connection1.getUserName(), connection2.getUserName());
assertEquals(connection1.getUrl().toExternalForm(), connection2.getUrl().toExternalForm());
}
use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerConnectionTest method testDuplicate.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#duplicate()}.
*/
@Test
public void testDuplicate() {
GeoServerConnection connection1 = getTestData();
GeoServerConnection connection2 = connection1.duplicate();
assertEquals("Copy of " + connection1.getConnectionName(), connection2.getConnectionName());
assertEquals(connection1.getPassword(), connection2.getPassword());
assertEquals(connection1.getUserName(), connection2.getUserName());
assertEquals(connection1.getUrl().toExternalForm(), connection2.getUrl().toExternalForm());
}
use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerConnectionTest method testGetPassword.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#getPassword()}.
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#setPassword(java.lang.String)}.
*/
@Test
public void testGetPassword() {
GeoServerConnection connection = new GeoServerConnection();
String password = "not secret password";
connection.setPassword(password);
assertEquals(connection.getPassword(), password);
}
use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class PrefManagerTest method testSetLastFolderViewed.
/**
* Test method for {@link com.sldeditor.common.preferences.PrefManager#setLastFolderViewed()}.
*/
@Test
public void testSetLastFolderViewed() {
PrefManager.initialise(null);
DummyPropertyManager propertyManager = new DummyPropertyManager();
PrefManager.initialise(propertyManager);
// Try with a null argument
PrefManager.getInstance().setLastFolderViewed(null);
PrefData actualPrefData = PrefManager.getInstance().getPrefData();
assertFalse(actualPrefData.isSaveLastFolderView());
assertEquals(PrefDataLastViewedEnum.FOLDER, actualPrefData.getLastViewedKey());
assertNull(actualPrefData.getLastFolderViewed());
// Try with an empty selected files object
SelectedFiles selectedFiles = new SelectedFiles();
PrefManager.getInstance().setLastFolderViewed(selectedFiles);
actualPrefData = PrefManager.getInstance().getPrefData();
assertFalse(actualPrefData.isSaveLastFolderView());
assertEquals(PrefDataLastViewedEnum.FOLDER, actualPrefData.getLastViewedKey());
assertNull(actualPrefData.getLastFolderViewed());
// Set folder
String expectedFolderName = "/tmp/test/abc";
selectedFiles.setFolderName(expectedFolderName);
PrefManager.getInstance().setLastFolderViewed(selectedFiles);
actualPrefData = PrefManager.getInstance().getPrefData();
assertFalse(actualPrefData.isSaveLastFolderView());
assertEquals(PrefDataLastViewedEnum.FOLDER, actualPrefData.getLastViewedKey());
assertEquals(expectedFolderName, actualPrefData.getLastFolderViewed());
expectedFolderName = "c:/tmp/test/abc";
selectedFiles.setFolderName(expectedFolderName);
PrefManager.getInstance().setLastFolderViewed(selectedFiles);
actualPrefData = PrefManager.getInstance().getPrefData();
assertFalse(actualPrefData.isSaveLastFolderView());
assertEquals(PrefDataLastViewedEnum.FOLDER, actualPrefData.getLastViewedKey());
assertEquals(expectedFolderName, actualPrefData.getLastFolderViewed());
actualPrefData.setSaveLastFolderView(true);
PrefManager.getInstance().setPrefData(actualPrefData);
actualPrefData = PrefManager.getInstance().getPrefData();
assertTrue(actualPrefData.isSaveLastFolderView());
// Set geoserver
String expectedGeoServerName = "GeoServer test";
GeoServerConnection connectionData = new GeoServerConnection();
connectionData.setConnectionName(expectedGeoServerName);
selectedFiles = new SelectedFiles();
selectedFiles.setConnectionData(connectionData);
PrefManager.getInstance().setLastFolderViewed(selectedFiles);
actualPrefData = PrefManager.getInstance().getPrefData();
assertTrue(actualPrefData.isSaveLastFolderView());
assertEquals(PrefDataLastViewedEnum.GEOSERVER, actualPrefData.getLastViewedKey());
assertEquals(expectedGeoServerName, actualPrefData.getLastFolderViewed());
}
Aggregations