Search in sources :

Example 6 with DataSourceProperties

use of com.sldeditor.datasource.impl.DataSourceProperties in project sldeditor by robward-scisys.

the class DataSourcePropertiesTest method testDataSourcePropertiesWithConnector.

/**
 * Test method for {@link com.sldeditor.datasource.impl.DataSourceProperties#DataSourceProperties(com.sldeditor.DataSourceConnectorInterface)}.
 * Test method for {@link com.sldeditor.datasource.impl.DataSourceProperties#setPropertyMap(java.util.Map)}.
 * Test method for {@link com.sldeditor.datasource.impl.DataSourceProperties#getDataSourceConnector()}.
 */
@Test
public void testDataSourcePropertiesWithConnector() {
    Map<String, Object> propertyMap = new HashMap<String, Object>();
    propertyMap.put("field1", "value1");
    propertyMap.put("field2", "value2");
    propertyMap.put("field3", "value3");
    DataSourceConnectorInterface dsc = new DataSourceConnector();
    DataSourceProperties dsp = new DataSourceProperties(dsc);
    dsp.setPropertyMap(propertyMap);
    Map<String, Object> actualPropertyMap = dsp.getConnectionProperties();
    assertEquals(propertyMap, actualPropertyMap);
    assertEquals(propertyMap, dsp.getAllConnectionProperties());
    // Is empty
    assertFalse(dsp.isEmpty());
}
Also used : DataSourceConnector(com.sldeditor.datasource.connector.instance.DataSourceConnector) HashMap(java.util.HashMap) DataSourceConnectorInterface(com.sldeditor.common.DataSourceConnectorInterface) DataSourceProperties(com.sldeditor.datasource.impl.DataSourceProperties) Test(org.junit.Test)

Example 7 with DataSourceProperties

use of com.sldeditor.datasource.impl.DataSourceProperties in project sldeditor by robward-scisys.

the class DataSourcePropertiesTest method testPopulate.

/**
 * Test method for {@link com.sldeditor.datasource.impl.DataSourceProperties#populate()}.
 */
@Test
public void testPopulate() {
    DataSourceProperties dsp = new DataSourceProperties(null);
    dsp.populate();
    // Does nothing
    DataSourceConnectorInterface dsc = new DataSourceConnector();
    dsp = new DataSourceProperties(dsc);
    dsp.populate();
}
Also used : DataSourceConnector(com.sldeditor.datasource.connector.instance.DataSourceConnector) DataSourceConnectorInterface(com.sldeditor.common.DataSourceConnectorInterface) DataSourceProperties(com.sldeditor.datasource.impl.DataSourceProperties) Test(org.junit.Test)

Example 8 with DataSourceProperties

use of com.sldeditor.datasource.impl.DataSourceProperties in project sldeditor by robward-scisys.

the class DataSourcePropertiesTest method testPassword.

/**
 * Test method for {@link com.sldeditor.datasource.impl.DataSourceProperties#getPassword()}.
 */
@Test
public void testPassword() {
    DataSourceProperties dsp = new DataSourceProperties(null);
    assertFalse(dsp.hasPassword());
    String expectedPassword = "top secret password";
    dsp.setPassword(expectedPassword);
    assertTrue(dsp.hasPassword());
    assertEquals(expectedPassword, dsp.getPassword());
}
Also used : DataSourceProperties(com.sldeditor.datasource.impl.DataSourceProperties) Test(org.junit.Test)

Aggregations

DataSourceProperties (com.sldeditor.datasource.impl.DataSourceProperties)8 Test (org.junit.Test)7 DataSourceConnector (com.sldeditor.datasource.connector.instance.DataSourceConnector)5 DataSourcePropertiesInterface (com.sldeditor.common.DataSourcePropertiesInterface)4 HashMap (java.util.HashMap)4 DataSourceConnectorInterface (com.sldeditor.common.DataSourceConnectorInterface)3 SLDData (com.sldeditor.common.data.SLDData)1 StyleWrapper (com.sldeditor.common.data.StyleWrapper)1 SLDEditorFile (com.sldeditor.datasource.SLDEditorFile)1 File (java.io.File)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1