Search in sources :

Example 1 with SelectedProcessFunction

use of com.sldeditor.rendertransformation.SelectedProcessFunction in project sldeditor by robward-scisys.

the class SelectedProcessFunctionTest method testSetBuiltInProcessFunction.

/**
 * Test method for
 * {@link com.sldeditor.rendertransformation.SelectedProcessFunction#setBuiltInProcessFunction(org.opengis.filter.capability.FunctionName, org.geotools.process.function.ProcessFunction)}.
 */
@Test
public void testSetBuiltInProcessFunction() {
    SelectedProcessFunction obj = new SelectedProcessFunction();
    assertTrue(obj.isBuiltInSelected());
    assertTrue(obj.extractParameters().isEmpty());
    assertNull(obj.getFunctionName());
    assertEquals(0, obj.getRowCount());
    ProcessFunctionFactory processFunctionFactory = new ProcessFunctionFactory();
    List<FunctionName> functionNameList = processFunctionFactory.getFunctionNames();
    FunctionName functionName = functionNameList.get(0);
    obj.setBuiltInProcessFunction(functionName, null);
    assertTrue(obj.isBuiltInSelected());
    assertTrue(obj.getFunctionName().getLocalPart().compareTo(functionName.getName()) == 0);
    assertEquals(obj.getRowCount(), obj.extractParameters().size());
    assertFalse(obj.extractParameters().isEmpty());
}
Also used : SelectedProcessFunction(com.sldeditor.rendertransformation.SelectedProcessFunction) FunctionName(org.opengis.filter.capability.FunctionName) ProcessFunctionFactory(org.geotools.process.function.ProcessFunctionFactory) Test(org.junit.Test)

Example 2 with SelectedProcessFunction

use of com.sldeditor.rendertransformation.SelectedProcessFunction in project sldeditor by robward-scisys.

the class SelectedProcessFunctionTest method testSetSelectedCustomFunction.

/**
 * Test method for
 * {@link com.sldeditor.rendertransformation.SelectedProcessFunction#setSelectedCustomFunction(net.opengis.wps10.ProcessDescriptionType)}.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testSetSelectedCustomFunction() {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    String expectedFunctionName = "JTS:area";
    codeType.setValue(expectedFunctionName);
    process.setIdentifier(codeType);
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(1));
    inputDescription.setMaxOccurs(BigInteger.valueOf(1));
    LiteralInputType literal = Wps10FactoryImpl.init().createLiteralInputType();
    DomainMetadataType domainType = Ows11FactoryImpl.init().createDomainMetadataType();
    domainType.setValue("xs:int");
    literal.setDefaultValue("1234");
    literal.setDataType(domainType);
    inputDescription.setLiteralData(literal);
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    LanguageStringType title = Ows11FactoryImpl.init().createLanguageStringType();
    title.setValue(expectedFunctionName);
    process.setTitle(title);
    SelectedProcessFunction obj = new SelectedProcessFunction();
    obj.setSelectedCustomFunction(process);
    assertFalse(obj.isBuiltInSelected());
    assertTrue(obj.getFunctionName().getLocalPart().compareTo(expectedFunctionName) == 0);
    assertEquals(1, obj.getRowCount());
    assertFalse(obj.extractParameters().isEmpty());
    obj.setSelectedCustomFunction(null);
    assertFalse(obj.isBuiltInSelected());
    assertNull(obj.getFunctionName());
    assertEquals(0, obj.getRowCount());
    assertTrue(obj.extractParameters().isEmpty());
}
Also used : DomainMetadataType(net.opengis.ows11.DomainMetadataType) SelectedProcessFunction(com.sldeditor.rendertransformation.SelectedProcessFunction) InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) LanguageStringType(net.opengis.ows11.LanguageStringType) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) CodeType(net.opengis.ows11.CodeType) LiteralInputType(net.opengis.wps10.LiteralInputType) Test(org.junit.Test)

Aggregations

SelectedProcessFunction (com.sldeditor.rendertransformation.SelectedProcessFunction)2 Test (org.junit.Test)2 CodeType (net.opengis.ows11.CodeType)1 DomainMetadataType (net.opengis.ows11.DomainMetadataType)1 LanguageStringType (net.opengis.ows11.LanguageStringType)1 DataInputsType (net.opengis.wps10.DataInputsType)1 InputDescriptionType (net.opengis.wps10.InputDescriptionType)1 LiteralInputType (net.opengis.wps10.LiteralInputType)1 ProcessDescriptionType (net.opengis.wps10.ProcessDescriptionType)1 EList (org.eclipse.emf.common.util.EList)1 ProcessFunctionFactory (org.geotools.process.function.ProcessFunctionFactory)1 FunctionName (org.opengis.filter.capability.FunctionName)1