Search in sources :

Example 16 with Parameter

use of com.reprezen.kaizen.oasparser.model3.Parameter in project ets-ogcapi-edr10 by opengeospatial.

the class CollectionsTime method crsParameterDefinition.

/**
 * Abstract Test 46: Validate that the crs query parameters are constructed correctly. (position)
 * Abstract Test 62: Validate that the crs query parameters are constructed correctly. (area)
 * Abstract Test 78: Validate that the crs query parameters are constructed correctly. (cube)
 * Abstract Test 96: Validate that the crs query parameters are constructed correctly. (trajectory)
 * Abstract Test 128: Validate that the crs query parameters are constructed correctly. (corridor)
 * Abstract Test 143: Validate that the crs query parameters are constructed correctly.	(locations)
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void crsParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter crs = null;
    String paramName = "crs";
    for (Path path : model.getPaths().values()) {
        if (testPoint.getPath().equals(path.getPathString())) {
            for (Operation op : path.getOperations().values()) {
                for (Parameter param : op.getParameters()) {
                    if (hasName(param)) {
                        if (param.getName().equals(paramName)) {
                            crs = param;
                        }
                    }
                }
            }
        }
    }
    if (crs != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(crs.getName(), paramName, String.format(msg, "name", paramName, crs.getName()));
        assertEquals(crs.getIn(), "query", String.format(msg, "in", "query", crs.getIn()));
        assertFalse(isRequired(crs), String.format(msg, "required", "false", crs.getRequired()));
        assertEquals(crs.getStyle(), "form", String.format(msg, "style", "form", crs.getStyle()));
        assertFalse(isExplode(crs), String.format(msg, "explode", "false", crs.getExplode()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Example 17 with Parameter

use of com.reprezen.kaizen.oasparser.model3.Parameter in project ets-ogcapi-edr10 by opengeospatial.

the class CollectionsTime method parameternameParameterDefinition.

/**
 * Abstract Test 44: Validate that the parameter-name query parameters are processed correctly. (position)
 * Abstract Test 60: Validate that the parameter-name query parameters are processed correctly. (area)
 * Abstract Test 76: Validate that the parameter-name query parameters are processed correctly. (cube)
 * Abstract Test 94: Validate that the parameter-name query parameters are processed correctly. (trajectory)
 * Abstract Test 126: Validate that the parameter-name query parameters are processed correctly. (corridor)
 * Abstract Test 141: Validate that the parameter-name query parameters are processed correctly. (locations)
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void parameternameParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter parametername = null;
    String paramName = "parameter-name";
    for (Path path : model.getPaths().values()) {
        if (testPoint.getPath().equals(path.getPathString())) {
            for (Operation op : path.getOperations().values()) {
                for (Parameter param : op.getParameters()) {
                    if (hasName(param)) {
                        if (param.getName().equals(paramName)) {
                            parametername = param;
                        }
                    }
                }
            }
        }
    }
    if (parametername != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertNotNull(parametername, "Required " + paramName + " parameter for collections with path '" + testPoint.getPath() + "'  in OpenAPI document is missing");
        assertEquals(parametername.getName(), paramName, String.format(msg, "name", paramName, parametername.getName()));
        assertEquals(parametername.getIn(), "query", String.format(msg, "in", "query", parametername.getIn()));
        assertFalse(isRequired(parametername), String.format(msg, "required", "false", parametername.getRequired()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Example 18 with Parameter

use of com.reprezen.kaizen.oasparser.model3.Parameter in project ets-ogcapi-edr10 by opengeospatial.

the class CollectionsTime method fParameterDefinition.

/**
 * Abstract Test 48: Validate that the f query parameter is constructed correctly. (position)
 * Abstract Test 64: Validate that the f query parameter is constructed correctly. (area)
 * Abstract Test 80: Validate that the f query parameter is constructed correctly. (cube)
 * Abstract Test 98: Validate that the f query parameter is constructed correctly. (trajectory)
 * Abstract Test 130: Validate that the f query parameter is constructed correctly. (corridor)
 * Abstract Test 145: Validate that the f query parameter is constructed correctly. (locations)
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void fParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter f = null;
    String paramName = "f";
    for (Path path : model.getPaths().values()) {
        if (testPoint.getPath().equals(path.getPathString())) {
            for (Operation op : path.getOperations().values()) {
                for (Parameter param : op.getParameters()) {
                    if (hasName(param)) {
                        if (param.getName().equals(paramName)) {
                            f = param;
                        }
                    }
                }
            }
        }
    }
    if (f != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(f.getName(), paramName, String.format(msg, "name", paramName, f.getName()));
        assertEquals(f.getIn(), "query", String.format(msg, "in", "query", f.getIn()));
        assertFalse(isRequired(f), String.format(msg, "required", "false", f.getRequired()));
        assertEquals(f.getStyle(), "form", String.format(msg, "style", "form", f.getStyle()));
        assertFalse(isExplode(f), String.format(msg, "explode", "false", f.getExplode()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Example 19 with Parameter

use of com.reprezen.kaizen.oasparser.model3.Parameter in project ets-ogcapi-edr10 by opengeospatial.

the class CollectionsTime method corridorHeightParameterDefinition.

/**
 * <pre>
 * Abstract Test 120: Validate that the corridor-height query parameter is constructed correctly.
 * </pre>
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void corridorHeightParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter corridorHeight = null;
    String paramName = "corridor-height";
    for (Path path : model.getPaths().values()) {
        if (testPoint.getPath().equals(path.getPathString())) {
            for (Operation op : path.getOperations().values()) {
                for (Parameter param : op.getParameters()) {
                    if (hasName(param)) {
                        if (param.getName().equals(paramName)) {
                            corridorHeight = param;
                        }
                    }
                }
            }
        }
    }
    if (corridorHeight != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(corridorHeight.getName(), paramName, String.format(msg, "name", paramName, corridorHeight.getName()));
        assertEquals(corridorHeight.getIn(), "query", String.format(msg, "in", "query", corridorHeight.getIn()));
        assertTrue(isRequired(corridorHeight), String.format(msg, "required", "true", corridorHeight.getRequired()));
        assertEquals(corridorHeight.getStyle(), "form", String.format(msg, "style", "form", corridorHeight.getStyle()));
        assertFalse(isExplode(corridorHeight), String.format(msg, "explode", "false", corridorHeight.getExplode()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Example 20 with Parameter

use of com.reprezen.kaizen.oasparser.model3.Parameter in project ets-ogcapi-edr10 by opengeospatial.

the class CollectionsTime method resolutionzParameterDefinition.

/**
 * <pre>
 * Requirement A.30: /req/edr/resolution-z-definition Parameter resolution-z definition
 * </pre>
 * NOTE: Not referenced by ATS
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void resolutionzParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter resolutionz = null;
    String paramName = "resolution-z";
    for (Path path : model.getPaths().values()) {
        if (testPoint.getPath().equals(path.getPathString())) {
            for (Operation op : path.getOperations().values()) {
                for (Parameter param : op.getParameters()) {
                    if (hasName(param)) {
                        if (param.getName().equals(paramName)) {
                            resolutionz = param;
                        }
                    }
                }
            }
        }
    }
    if (resolutionz != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(resolutionz.getName(), paramName, String.format(msg, "name", paramName, resolutionz.getName()));
        assertEquals(resolutionz.getIn(), "query", String.format(msg, "in", "query", resolutionz.getIn()));
        assertFalse(isRequired(resolutionz), String.format(msg, "required", "false", resolutionz.getRequired()));
        assertEquals(resolutionz.getStyle(), "form", String.format(msg, "style", "form", resolutionz.getStyle()));
        assertFalse(isExplode(resolutionz), String.format(msg, "explode", "false", resolutionz.getExplode()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Aggregations

Parameter (com.reprezen.kaizen.oasparser.model3.Parameter)26 Path (com.reprezen.kaizen.oasparser.model3.Path)17 Operation (com.reprezen.kaizen.oasparser.model3.Operation)13 Schema (com.reprezen.kaizen.oasparser.model3.Schema)7 Parameter (org.osate.aadl2.Parameter)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 DataAccess (org.osate.aadl2.DataAccess)4 FeatureGroup (org.osate.aadl2.FeatureGroup)3 Test (org.testng.annotations.Test)3 Map (java.util.Map)2 Parameter (org.eclipse.jst.server.tomcat.core.internal.xml.server32.Parameter)2 TestPoint (org.opengis.cite.ogcapifeatures10.openapi3.TestPoint)2 AbstractFeature (org.osate.aadl2.AbstractFeature)2 ClassifierValue (org.osate.aadl2.ClassifierValue)2 DataSubcomponent (org.osate.aadl2.DataSubcomponent)2 Port (org.osate.aadl2.Port)2 SubprogramSubcomponent (org.osate.aadl2.SubprogramSubcomponent)2 CobiGenRuntimeException (com.devonfw.cobigen.api.exception.CobiGenRuntimeException)1 ParameterDef (com.devonfw.cobigen.openapiplugin.model.ParameterDef)1