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;
}
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();
}
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;
}
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;
}
Aggregations