Search in sources :

Example 26 with Operation

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

the class CollectionsTime method withinParameterDefinition.

/**
 * <pre>
 * Requirement A.21: /req/edr/within-definition Parameter within 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 withinParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    // Based on
    // https://github.com/RepreZen/KaiZen-OpenApi-Parser/blob/master/GettingStarted.md
    Parameter within = null;
    String paramName = "within";
    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)) {
                            within = param;
                        }
                    }
                }
            }
        }
    }
    if (within != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(within.getName(), paramName, String.format(msg, "name", paramName, within.getName()));
        assertEquals(within.getIn(), "query", String.format(msg, "in", "query", within.getIn()));
        assertFalse(isRequired(within), String.format(msg, "required", "false", within.getRequired()));
        assertEquals(within.getStyle(), "form", String.format(msg, "style", "form", within.getStyle()));
        assertFalse(isExplode(within), String.format(msg, "explode", "false", within.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 27 with Operation

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

the class CollectionsTime method resolutionyParameterDefinition.

/**
 * <pre>
 * Requirement A.28: /req/edr/resolution-y-definition Parameter resolution-y
 * 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 resolutionyParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter resolutiony = null;
    String paramName = "resolution-y";
    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)) {
                            resolutiony = param;
                        }
                    }
                }
            }
        }
    }
    if (resolutiony != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(resolutiony.getName(), paramName, String.format(msg, "name", paramName, resolutiony.getName()));
        assertEquals(resolutiony.getIn(), "query", String.format(msg, "in", "query", resolutiony.getIn()));
        assertFalse(isRequired(resolutiony), String.format(msg, "required", "false", resolutiony.getRequired()));
        assertEquals(resolutiony.getStyle(), "form", String.format(msg, "style", "form", resolutiony.getStyle()));
        assertFalse(isExplode(resolutiony), String.format(msg, "explode", "false", resolutiony.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 28 with Operation

use of com.reprezen.kaizen.oasparser.model3.Operation 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 29 with Operation

use of com.reprezen.kaizen.oasparser.model3.Operation 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 30 with Operation

use of com.reprezen.kaizen.oasparser.model3.Operation 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)

Aggregations

ArrayList (java.util.ArrayList)81 Test (org.junit.Test)75 AbstractMessage (com.google.protobuf.AbstractMessage)65 Operation (com.google.cloud.compute.v1.Operation)49 Operation (com.google.container.v1.Operation)43 StatusCondition (com.google.container.v1.StatusCondition)40 Operation (com.google.container.v1beta1.Operation)24 StatusCondition (com.google.container.v1beta1.StatusCondition)23 InstancesClient (com.google.cloud.compute.v1.InstancesClient)20 Operation (com.reprezen.kaizen.oasparser.model3.Operation)16 Path (com.reprezen.kaizen.oasparser.model3.Path)15 Operation (net.opengis.ows.v_1_0_0.Operation)15 Parameter (com.reprezen.kaizen.oasparser.model3.Parameter)14 Instance (com.google.cloud.compute.v1.Instance)13 DomainType (net.opengis.ows.v_1_0_0.DomainType)13 AttachedDisk (com.google.cloud.compute.v1.AttachedDisk)12 InsertInstanceRequest (com.google.cloud.compute.v1.InsertInstanceRequest)11 Operation (org.osate.aadl2.Operation)8 NetworkInterface (com.google.cloud.compute.v1.NetworkInterface)7 BooleanLiteral (org.osate.aadl2.BooleanLiteral)7