Search in sources :

Example 31 with GeoServerConnection

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();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) URL(java.net.URL) Test(org.junit.Test)

Example 32 with GeoServerConnection

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());
}
Also used : GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Example 33 with GeoServerConnection

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);
}
Also used : GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Example 34 with GeoServerConnection

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);
}
Also used : GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Example 35 with GeoServerConnection

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());
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Aggregations

GeoServerConnection (com.sldeditor.common.data.GeoServerConnection)50 Test (org.junit.Test)31 URL (java.net.URL)12 ArrayList (java.util.ArrayList)11 StyleWrapper (com.sldeditor.common.data.StyleWrapper)10 GeoServerInput (com.sldeditor.extension.filesystem.geoserver.GeoServerInput)9 SLDFileHandlerTest (com.sldeditor.test.unit.extension.filesystem.file.sld.SLDFileHandlerTest)9 MalformedURLException (java.net.MalformedURLException)9 GeoServerNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode)8 SLDData (com.sldeditor.common.data.SLDData)7 GeoServerLayer (com.sldeditor.common.data.GeoServerLayer)5 GeoServerOverallNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode)5 GeoServerWorkspaceNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode)5 GeoServerReadProgress (com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress)5 GeoServerClientInterface (com.sldeditor.extension.filesystem.geoserver.client.GeoServerClientInterface)5 HashMap (java.util.HashMap)5 List (java.util.List)5 SLDDataInterface (com.sldeditor.common.SLDDataInterface)4 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4