use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDDataTest method testResourceLocator.
/**
* Test resource locator.
*/
@Test
public void testResourceLocator() {
SLDData data = new SLDData(null, null);
assertNull(data.getResourceLocator());
try {
URL url = new URL("http://localhost:8080/geoserver");
data.setResourceLocator(url);
URL actualValue = data.getResourceLocator();
assertTrue(url.toExternalForm().compareTo(actualValue.toExternalForm()) == 0);
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDDataTest method testOriginalFormat.
/**
* Test original format.
*/
@Test
public void testOriginalFormat() {
SLDData data = new SLDData(null, null);
assertEquals(SLDOutputFormatEnum.SLD, data.getOriginalFormat());
SLDOutputFormatEnum expected = SLDOutputFormatEnum.YSLD;
data.setOriginalFormat(expected);
assertEquals(expected, data.getOriginalFormat());
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDUtilsTest method testCreateSLDFromStringFile.
@Test
public void testCreateSLDFromStringFile() {
StyleWrapper wrapper = new StyleWrapper();
SLDData sldData = new SLDData(wrapper, expectedSld);
String filename = "D:/tmp/test.sld";
File file = new File(filename);
sldData.setSLDFile(file);
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(null);
assertNull(sld);
sld = SLDUtils.createSLDFromString(sldData);
StyledLayer[] styledLayers = sld.getStyledLayers();
NamedLayer namedLayer = (NamedLayer) styledLayers[0];
Style[] actualStyles = namedLayer.getStyles();
PointSymbolizer pointSymbolizer = (PointSymbolizer) actualStyles[0].featureTypeStyles().get(0).rules().get(0).symbolizers().get(0);
MarkImpl mark = (MarkImpl) pointSymbolizer.getGraphic().graphicalSymbols().get(0);
assertEquals("circle", mark.getWellKnownName().toString());
// Check resource locator
try {
URL url = file.getParentFile().toURI().toURL();
String actualResourceLocator = sldData.getResourceLocator().toExternalForm();
String expectedResourcelocator = url.toExternalForm();
assertTrue(expectedResourcelocator.compareTo(actualResourceLocator) == 0);
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SelectedFilesTest method test.
@Test
public void test() {
SelectedFiles selectedFiles = new SelectedFiles();
assertTrue(selectedFiles.isDataSource() == false);
assertTrue(selectedFiles.isFolder() == false);
assertTrue(selectedFiles.getSldData().isEmpty());
selectedFiles.setDataSource(true);
assertTrue(selectedFiles.isDataSource());
selectedFiles.setIsFolder(true);
assertTrue(selectedFiles.isFolder());
List<SLDDataInterface> actualSldData = new ArrayList<SLDDataInterface>();
actualSldData.add(new SLDData(null, "test1"));
actualSldData.add(new SLDData(null, "test2"));
actualSldData.add(new SLDData(null, "test3"));
selectedFiles.setSldData(actualSldData);
assertTrue(selectedFiles.getSldData().size() == actualSldData.size());
}
use of com.sldeditor.common.data.SLDData in project sldeditor by robward-scisys.
the class SLDWriterImplTest method testEncodeSLD.
/**
* Test method for {@link com.sldeditor.common.output.impl.SLDWriterImpl#encodeSLD(org.geotools.styling.StyledLayerDescriptor)}.
*/
@Test
public void testEncodeSLD() {
SLDWriterImpl writer = new SLDWriterImpl();
String result = writer.encodeSLD(null, null);
assertEquals("", result);
SLDData sldData = new SLDData(null, expectedSld);
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData);
// No resource locator
result = writer.encodeSLD(null, sld);
assertTrue(!result.isEmpty());
}
Aggregations