use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerConnectionTest method testGetUrl.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#getUrl()}.
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#setUrl(java.net.URL)}.
*/
@Test
public void testGetUrl() {
try {
URL url = new URL("http://www.example.com/dummy");
GeoServerConnection connection = new GeoServerConnection();
connection.setUrl(url);
assertEquals(connection.getUrl().toExternalForm(), url.toExternalForm());
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
}
use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerConnectionTest method testEncodeAsString.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#encodeAsString()}.
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#GeoServerConnection(java.lang.String)}.
*/
@Test
public void testEncodeAsString() {
GeoServerConnection connection1 = getTestData();
String connectionString = connection1.encodeAsString();
GeoServerConnection connection2 = GeoServerConnection.decodeString(connectionString);
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 testGetConnectionName.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#getConnectionName()}.
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#setConnectionName(java.lang.String)}.
*/
@Test
public void testGetConnectionName() {
GeoServerConnection connection = new GeoServerConnection();
String connectionName = "my geoserver";
connection.setConnectionName(connectionName);
assertEquals(connection.getConnectionName(), connectionName);
}
use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerConnectionTest method testCompareTo.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerConnection#compareTo(com.sldeditor.common.data.GeoServerConnection)}.
*/
@Test
public void testCompareTo() {
// CHECKSTYLE:OFF
GeoServerConnection connection1 = getTestData();
// CHECKSTYLE:ON
GeoServerConnection connection2 = new GeoServerConnection();
connection2.setConnectionName(connectionName);
connection2.setUrl(url);
connection2.setUserName(userName);
connection2.setPassword(password);
assertEquals(connection1.compareTo(connection2), 0);
connection2.setConnectionName("new connection");
assertEquals(connection1.compareTo(connection2), -1);
connection2.setConnectionName(connectionName);
assertEquals(connection1.compareTo(connection2), 0);
// Setting password does nothing
connection2.setPassword("different password");
assertEquals(connection1.compareTo(connection2), 0);
}
use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.
the class GeoServerLayerTest method testGetConnection.
/**
* Test method for {@link com.sldeditor.common.data.GeoServerLayer#getConnection()}.
* Test method for {@link com.sldeditor.common.data.GeoServerLayer#setConnection(com.sldeditor.common.data.GeoServerConnection)}.
*/
@Test
public void testGetConnection() {
GeoServerConnection connection = new GeoServerConnection();
GeoServerLayer layer = new GeoServerLayer();
layer.setConnection(connection);
assertEquals(connection, layer.getConnection());
}
Aggregations