Search in sources :

Example 21 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class GeoServerReadProgressTest method testRemoveNode.

/**
 * Test method for
 * {@link com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress#removeNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode, java.lang.String)}.
 */
@Test
public void testRemoveNode() {
    GeoServerOverallNode geoServerRootNode = new GeoServerOverallNode(null);
    GeoServerConnection connection = new GeoServerConnection();
    connection.setConnectionName("test connection 1");
    GeoServerNode node = new GeoServerNode(null, connection);
    geoServerRootNode.add(node);
    GeoServerReadProgress.removeNode(null, null);
    GeoServerReadProgress.removeNode(node, "test title");
}
Also used : GeoServerOverallNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode) GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Example 22 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class GeoServerReadProgressTest method testDeleteConnection.

/**
 * Test method for
 * {@link com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress#deleteConnection(com.sldeditor.common.data.GeoServerConnection)}.
 */
@Test
public void testDeleteConnection() {
    GeoServerReadProgress progress = new GeoServerReadProgress(null, null);
    GeoServerOverallNode geoServerRootNode = new GeoServerOverallNode(null);
    GeoServerConnection connection = new GeoServerConnection();
    connection.setConnectionName("test connection 1");
    GeoServerNode node = new GeoServerNode(null, connection);
    geoServerRootNode.add(node);
    progress.addNewConnectionNode(connection, node);
    progress.deleteConnection(null);
    progress.deleteConnection(connection);
}
Also used : GeoServerOverallNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode) GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) GeoServerReadProgress(com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress) Test(org.junit.Test)

Example 23 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class GeoServerReadProgressTest method testGeoServerReadProgress.

/**
 * Test method for
 * {@link com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress#GeoServerReadProgress(com.sldeditor.common.filesystem.FileSystemInterface, com.sldeditor.extension.filesystem.geoserver.GeoServerParseCompleteInterface)}.
 */
@Test
public void testGeoServerReadProgress() {
    DummyProgressComplete complete = new DummyProgressComplete();
    GeoServerReadProgress progress = new GeoServerReadProgress(null, complete);
    GeoServerOverallNode geoServerRootNode = new GeoServerOverallNode(null);
    GeoServerConnection connection = new GeoServerConnection();
    connection.setConnectionName("test connection 1");
    GeoServerNode node = new GeoServerNode(null, connection);
    geoServerRootNode.add(node);
    progress.addNewConnectionNode(connection, node);
    progress.startPopulating(null);
    progress.startPopulating(connection);
    progress.readLayersProgress(null, 0, 0);
    assertFalse(complete.completed);
    progress.readLayersProgress(connection, 0, 5);
    progress.readLayersProgress(connection, 1, 5);
    progress.readLayersProgress(connection, 2, 5);
    progress.readLayersProgress(connection, 3, 5);
    progress.readLayersProgress(connection, 4, 5);
    progress.readLayersProgress(connection, 5, 5);
    assertFalse(complete.completed);
    progress.readLayersProgress(connection, 6, 5);
    assertFalse(complete.completed);
    progress.readStylesProgress(null, 0, 0);
    progress.readStylesProgress(connection, 0, 3);
    progress.readStylesProgress(connection, 1, 3);
    progress.readStylesProgress(connection, 2, 3);
    progress.readStylesProgress(connection, 3, 3);
    progress.readStylesProgress(connection, 4, 3);
    assertFalse(complete.completed);
    Map<String, List<GeoServerLayer>> completedLayersMap = new HashMap<String, List<GeoServerLayer>>();
    Map<String, List<StyleWrapper>> completedStyleMap = new HashMap<String, List<StyleWrapper>>();
    progress.readLayersComplete(connection, completedLayersMap);
    progress.readStylesComplete(connection, completedStyleMap, false);
    assertTrue(complete.completed);
}
Also used : GeoServerOverallNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode) GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) HashMap(java.util.HashMap) StyleWrapper(com.sldeditor.common.data.StyleWrapper) GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode) List(java.util.List) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) GeoServerReadProgress(com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress) Test(org.junit.Test)

Example 24 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class GeoServerClientTest method setUpBeforeClass.

/**
 * Sets the up before class.
 *
 * @throws Exception the exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    testConnection = new GeoServerConnection();
    testConnection.setConnectionName("Test Connection");
    URL url = new URL(TEST_GEOSERVER_INSTANCE);
    testConnection.setUrl(url);
    testConnection.setUserName(TEST_GEOSERVER_USERNAME);
    testConnection.setPassword(TEST_GEOSERVER_PASSWORD);
}
Also used : GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Example 25 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class GeoServerClientTest method testInitialiseWithInvalidConnection.

/**
 * Test method for
 * {@link com.sldeditor.extension.filesystem.geoserver.client.GeoServerClient#initialise(com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgressInterface, com.sldeditor.common.data.GeoServerConnection)}.
 * Test method for
 * {@link com.sldeditor.extension.filesystem.geoserver.client.GeoServerClient#connect()}.
 */
@Test
public void testInitialiseWithInvalidConnection() {
    GeoServerClient client = new GeoServerClient();
    GeoServerConnection invalidTestConnection = new GeoServerConnection();
    invalidTestConnection.setConnectionName("Invalid Test Connection");
    try {
        invalidTestConnection.setUrl(new URL("http://invalid.url.com"));
    } catch (MalformedURLException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    client.initialise(null, invalidTestConnection);
    assertFalse(client.connect());
    assertEquals(invalidTestConnection, client.getConnection());
}
Also used : MalformedURLException(java.net.MalformedURLException) GeoServerClient(com.sldeditor.extension.filesystem.geoserver.client.GeoServerClient) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) URL(java.net.URL) 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