use of com.sldeditor.datasource.attribute.DataSourceAttributeData in project sldeditor by robward-scisys.
the class ExtractAttributesTest method testNotFilter.
@Test
public void testNotFilter() {
DummyInternalSLDFile2 dummy = new DummyInternalSLDFile2();
StyledLayerDescriptor sld = createTestSLD(dummy);
List<Rule> ruleList = getRuleList(sld);
ExtractAttributes extract = new ExtractAttributes();
Rule rule = DefaultSymbols.createNewRule();
// Try with NOT
extract = new ExtractAttributes();
Filter filter = ff.not(ff.greater(ff.literal(42.1), ff.property("dble")));
rule.setFilter(filter);
ruleList.clear();
ruleList.add(rule);
extract.extractDefaultFields(sld);
// Check fields extracted ok
List<DataSourceAttributeData> actualFieldnameList = extract.getFields();
assertEquals(1, actualFieldnameList.size());
DataSourceAttributeData dataSourceField = actualFieldnameList.get(0);
assertEquals(Double.class, dataSourceField.getType());
}
use of com.sldeditor.datasource.attribute.DataSourceAttributeData in project sldeditor by robward-scisys.
the class SLDDataTest method testFieldList.
/**
* Test field list.
*/
@Test
public void testFieldList() {
List<DataSourceAttributeData> fieldList = new ArrayList<DataSourceAttributeData>();
fieldList.add(new DataSourceAttributeData("Field 1", String.class, null));
fieldList.add(new DataSourceAttributeData("Field 2", Double.class, null));
SLDData data = new SLDData(null, null);
data.setFieldList(fieldList);
assertEquals(fieldList, data.getFieldList());
}
use of com.sldeditor.datasource.attribute.DataSourceAttributeData in project sldeditor by robward-scisys.
the class DataSourceAttributeDataTest method testSetValue.
/**
* Test method for {@link com.sldeditor.datasource.attribute.DataSourceAttributeData#setValue(java.lang.Object)}.
*/
@Test
public void testSetValue() {
String expectedName = "test name";
Class<?> expectedType = Integer.class;
Object expectedValue1 = Integer.valueOf(42);
DataSourceAttributeData dsa = new DataSourceAttributeData(expectedName, expectedType, expectedValue1);
Object expectedValue2 = Integer.valueOf(69);
dsa.setValue(expectedValue2);
assertEquals(expectedValue2, dsa.getValue());
}
use of com.sldeditor.datasource.attribute.DataSourceAttributeData in project sldeditor by robward-scisys.
the class DataSourceAttributeDataTest method testDataSourceAttributeDataDataSourceAttributeData.
/**
* Test method for {@link com.sldeditor.datasource.attribute.DataSourceAttributeData#DataSourceAttributeData(com.sldeditor.datasource.attribute.DataSourceAttributeData)}.
*/
@Test
public void testDataSourceAttributeDataDataSourceAttributeData() {
String expectedName = "test name";
Class<?> expectedType = Integer.class;
Object expectedValue = Integer.valueOf(42);
DataSourceAttributeData dsa = new DataSourceAttributeData(expectedName, expectedType, expectedValue);
DataSourceAttributeData copyDsa = new DataSourceAttributeData(dsa);
assertTrue(expectedName.compareTo(copyDsa.getName()) == 0);
assertEquals(expectedType, copyDsa.getType());
assertEquals(expectedValue, copyDsa.getValue());
}
use of com.sldeditor.datasource.attribute.DataSourceAttributeData in project sldeditor by robward-scisys.
the class DataSourceAttributeDataTest method testClone.
/**
* Test method for {@link com.sldeditor.datasource.attribute.DataSourceAttributeData#clone()}.
*/
@Test
public void testClone() {
String expectedName = "test name";
Class<?> expectedType = Integer.class;
Object expectedValue = Integer.valueOf(42);
DataSourceAttributeData dsa = new DataSourceAttributeData(expectedName, expectedType, expectedValue);
DataSourceAttributeData cloneDsa = dsa.clone();
assertTrue(expectedName.compareTo(cloneDsa.getName()) == 0);
assertEquals(expectedType, cloneDsa.getType());
assertEquals(expectedValue, cloneDsa.getValue());
}
Aggregations