Search in sources :

Example 6 with ProcessFunctionParameterValue

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

the class CustomProcessFunctionTest method createProcessDescription.

/**
 * Creates the process description.
 *
 * @param type the type
 * @param defaultValue the default value
 * @param minOccurs the min occurs
 * @param maxOccurs the max occurs
 * @return the process function parameter value
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private ProcessFunctionParameterValue createProcessDescription(String type, String defaultValue, int minOccurs, int maxOccurs) {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    codeType.setValue("JTS:area");
    process.setIdentifier(codeType);
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(minOccurs));
    inputDescription.setMaxOccurs(BigInteger.valueOf(maxOccurs));
    LiteralInputType literal = Wps10FactoryImpl.init().createLiteralInputType();
    DomainMetadataType domainType = Ows11FactoryImpl.init().createDomainMetadataType();
    domainType.setValue(type);
    literal.setDefaultValue(defaultValue);
    literal.setDataType(domainType);
    inputDescription.setLiteralData(literal);
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    CustomProcessFunction obj = new CustomProcessFunction();
    List<ProcessFunctionParameterValue> valueList = obj.extractParameters(process);
    assertEquals(type, 1, valueList.size());
    ProcessFunctionParameterValue value = valueList.get(0);
    assertEquals(type, minOccurs, value.minOccurences);
    assertEquals(type, maxOccurs, value.maxOccurences);
    return value;
}
Also used : DomainMetadataType(net.opengis.ows11.DomainMetadataType) InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue) CustomProcessFunction(com.sldeditor.rendertransformation.CustomProcessFunction) CodeType(net.opengis.ows11.CodeType) LiteralInputType(net.opengis.wps10.LiteralInputType)

Example 7 with ProcessFunctionParameterValue

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

the class ProcessFunctionParameterValueTest method testProcessFunctionParameterValueProcessFunctionParameterValue.

/**
 * Test method for {@link com.sldeditor.rendertransformation.ProcessFunctionParameterValue#ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue)}.
 */
@Test
public void testProcessFunctionParameterValueProcessFunctionParameterValue() {
    ProcessFunctionParameterValue obj1 = new ProcessFunctionParameterValue();
    obj1.name = "test";
    obj1.dataType = "datatype";
    obj1.type = Date.class;
    obj1.minOccurences = 10;
    obj1.maxOccurences = 78;
    obj1.included = true;
    obj1.optional = true;
    ProcessFunctionParameterValue obj2 = new ProcessFunctionParameterValue(obj1);
    assertTrue(obj1.name.compareTo(obj2.name) == 0);
    assertTrue(obj1.dataType.compareTo(obj2.dataType) == 0);
    assertEquals(obj1.included, obj2.included);
    assertEquals(obj1.type, obj2.type);
    assertEquals(obj1.minOccurences, obj2.minOccurences);
    assertEquals(obj1.maxOccurences, obj2.maxOccurences);
    assertEquals(obj1.optional, obj2.optional);
}
Also used : ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue) Test(org.junit.Test)

Aggregations

ProcessFunctionParameterValue (com.sldeditor.rendertransformation.ProcessFunctionParameterValue)7 Test (org.junit.Test)6 CustomProcessFunction (com.sldeditor.rendertransformation.CustomProcessFunction)4 CodeType (net.opengis.ows11.CodeType)3 DataInputsType (net.opengis.wps10.DataInputsType)3 InputDescriptionType (net.opengis.wps10.InputDescriptionType)3 ProcessDescriptionType (net.opengis.wps10.ProcessDescriptionType)3 EList (org.eclipse.emf.common.util.EList)3 BuiltInProcessFunction (com.sldeditor.rendertransformation.BuiltInProcessFunction)2 LiteralInputType (net.opengis.wps10.LiteralInputType)2 ProcessFunctionFactory (org.geotools.process.function.ProcessFunctionFactory)2 FunctionName (org.opengis.filter.capability.FunctionName)2 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 AllowedValuesType (net.opengis.ows11.AllowedValuesType)1 DomainMetadataType (net.opengis.ows11.DomainMetadataType)1 ValueType (net.opengis.ows11.ValueType)1