Search in sources :

Example 31 with Parameter

use of com.reprezen.kaizen.oasparser.model3.Parameter in project osate2 by osate.

the class FlowSpecificationCreationUtil method isValidFlowEnd.

/**
 * Returns whether a specified feature diagram element may be used as a flow end for a flow specification.
 * feature, its direction must be IN OUT or match the specified direction
 */
public static boolean isValidFlowEnd(final Feature feature, final BusinessObjectContext featureBoc, final DirectionType requiredDirection, final QueryService queryService) {
    // Ensure that the feature is contained in a component type
    if (getPotentialOwnersByFeature(featureBoc, queryService).size() == 0) {
        return false;
    }
    // Check that the feature is of the appropriate type
    if (!(feature instanceof Port || feature instanceof Parameter || feature instanceof DataAccess || feature instanceof FeatureGroup || feature instanceof AbstractFeature)) {
        return false;
    }
    // If it is a direct feature, it must have the specified direction or be an in out feature. Take into account feature group, inverse, etc..
    if (feature instanceof DirectedFeature) {
        // Determine the actual direction of the feature. Since it could effected by things like inverse feature groups, etc
        final DirectedFeature df = (DirectedFeature) feature;
        DirectionType direction = df.getDirection();
        if (direction == DirectionType.IN || direction == DirectionType.OUT) {
            if (AadlFeatureUtil.isFeatureInverted(featureBoc)) {
                direction = (direction == DirectionType.IN) ? DirectionType.OUT : DirectionType.IN;
            }
        }
        if (direction != requiredDirection && direction != DirectionType.IN_OUT) {
            return false;
        }
    }
    return true;
}
Also used : DirectionType(org.osate.aadl2.DirectionType) FeatureGroup(org.osate.aadl2.FeatureGroup) Port(org.osate.aadl2.Port) Parameter(org.osate.aadl2.Parameter) AbstractFeature(org.osate.aadl2.AbstractFeature) DirectedFeature(org.osate.aadl2.DirectedFeature) DataAccess(org.osate.aadl2.DataAccess)

Example 32 with Parameter

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

the class FeaturesLimit method collectionItemUrisWithLimits.

@DataProvider(name = "collectionItemUrisWithLimits")
public Iterator<Object[]> collectionItemUrisWithLimits(ITestContext testContext) {
    URI iut = (URI) testContext.getSuite().getAttribute(IUT.getName());
    List<Object[]> collectionsWithLimits = new ArrayList<>();
    for (Map<String, Object> collection : collections) {
        String collectionId = (String) collection.get("id");
        List<TestPoint> testPoints = retrieveTestPointsForCollection(getApiModel(), iut, collectionId);
        for (TestPoint testPoint : testPoints) {
            Parameter limit = retrieveParameterByName(testPoint.getPath(), getApiModel(), "limit");
            if (limit != null && limit.getSchema() != null) {
                int min = limit.getSchema().getMinimum().intValue();
                int max = limit.getSchema().getMaximum().intValue();
                if (min == max) {
                    collectionsWithLimits.add(new Object[] { collection, min, max });
                } else {
                    collectionsWithLimits.add(new Object[] { collection, min, max });
                    int betweenMinAndMax = min + ((max - min) / 2) > 100 ? 100 : min + ((max - min) / 2);
                    collectionsWithLimits.add(new Object[] { collection, betweenMinAndMax, max });
                }
            }
        }
    }
    return collectionsWithLimits.iterator();
}
Also used : ArrayList(java.util.ArrayList) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) TestPoint(org.opengis.cite.ogcapifeatures10.openapi3.TestPoint) URI(java.net.URI) TestPoint(org.opengis.cite.ogcapifeatures10.openapi3.TestPoint) DataProvider(org.testng.annotations.DataProvider)

Example 33 with Parameter

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

the class OpenApiUtils method isParameterSupportedForCollection.

public static boolean isParameterSupportedForCollection(OpenApi3 apiModel, URI iut, String collectionName, String queryParam) {
    String requestedPath = createCollectionPath(apiModel, iut, collectionName);
    List<Path> paths = identifyTestPoints(apiModel, requestedPath, new PathMatcher());
    for (Path path : paths) {
        Collection<Parameter> parameters = path.getGet().getParameters();
        for (Parameter parameter : parameters) {
            if (queryParam.equalsIgnoreCase(parameter.getName())) {
                return true;
            }
        }
    }
    return false;
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter)

Example 34 with Parameter

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

the class OpenApiUtils method isFreeFormParameterSupportedForCollection.

public static boolean isFreeFormParameterSupportedForCollection(OpenApi3 apiModel, URI iut, String collectionName) {
    String requestedPath = createCollectionPath(apiModel, iut, collectionName);
    List<Path> paths = identifyTestPoints(apiModel, requestedPath, new PathMatcher());
    for (Path path : paths) {
        Collection<Parameter> parameters = path.getGet().getParameters();
        for (Parameter parameter : parameters) {
            if (parameter.getSchema() != null && parameter.getSchema().isAdditionalProperties()) {
                return true;
            }
        }
    }
    return false;
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter)

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