use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDDataTest method testDataSourceProperties.
/**
* Test data source properties.
*/
@Test
public void testDataSourceProperties() {
DataSourcePropertiesInterface dataSourceProperties = new DummyDataSourceProperties();
SLDData data = new SLDData(null, null);
data.setDataSourceProperties(dataSourceProperties);
assertEquals(dataSourceProperties, data.getDataSourceProperties());
// Increase code coverage
data.setDataSourceProperties(dataSourceProperties);
assertEquals(dataSourceProperties, data.getDataSourceProperties());
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDDataTest method testSLDFile.
/**
* Test sld file.
*/
@Test
public void testSLDFile() {
SLDData data = new SLDData(null, null);
File sldFile = null;
try {
sldFile = File.createTempFile(getClass().getSimpleName(), ".txt");
} catch (IOException e) {
e.printStackTrace();
fail("Failed to create test SLD file");
}
data.setSLDFile(sldFile);
String expectedFile = sldFile.getAbsolutePath();
String actualSldFile = data.getSLDFile().getAbsolutePath();
assertEquals(expectedFile, actualSldFile);
assertNull(data.getConnectionData());
sldFile.delete();
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDDataTest method testVendorOptionList.
/**
* Test vendor option list.
*/
@Test
public void testVendorOptionList() {
List<VersionData> vendorOptionList = new ArrayList<VersionData>();
vendorOptionList.add(VersionData.getLatestVersion(this.getClass()));
SLDData data = new SLDData(null, null);
data.setVendorOptionList(vendorOptionList);
assertEquals(vendorOptionList, data.getVendorOptionList());
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDDataTest method testSldEditorFile.
/**
* Test sld editor file.
*/
@Test
public void testSldEditorFile() {
SLDData data = new SLDData(null, null);
File sldEditorFile = null;
try {
sldEditorFile = File.createTempFile(getClass().getSimpleName(), ".txt");
} catch (IOException e) {
e.printStackTrace();
fail("Failed to create test SLD Editor file");
}
data.setSldEditorFile(sldEditorFile);
assertEquals(sldEditorFile, data.getSldEditorFile());
sldEditorFile.delete();
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class ExternalFilenamesTest method testGetText.
/**
* Test method for {@link com.sldeditor.common.utils.ExternalFilenames#getText(java.net.URL)}.
*/
@Test
public void testGetText() {
assertNull(ExternalFilenames.getText(null, null));
SLDData sldData = new SLDData(new StyleWrapper("workspace", "style"), "contents");
File tempSLDFile = null;
try {
tempSLDFile = File.createTempFile(getClass().getSimpleName(), ".sld");
} catch (IOException e1) {
e1.printStackTrace();
fail("Couldn't create temp test file");
}
String expectedFilename = "test.tst";
// Try it with no SLD file set
assertNull(ExternalFilenames.getFile(sldData, expectedFilename));
// Now set the SLD file
sldData.setSLDFile(tempSLDFile);
String rootFolder = tempSLDFile.getParent();
String expectedResult = File.separator + expectedFilename;
File file = new File(rootFolder + expectedResult);
try {
String actualResult = ExternalFilenames.getText(sldData, file.toURI().toURL());
assertEquals(expectedResult, actualResult);
} catch (MalformedURLException e) {
e.printStackTrace();
fail(e.getMessage());
}
String actualFilename2 = new File(expectedFilename).getAbsolutePath();
File file2 = new File(actualFilename2);
try {
assertEquals(actualFilename2, ExternalFilenames.getText(sldData, file2.toURI().toURL()));
} catch (MalformedURLException e) {
e.printStackTrace();
fail(e.getMessage());
}
tempSLDFile.delete();
}
Aggregations