Search in sources :

Example 11 with Parameter

use of com.reprezen.kaizen.oasparser.model3.Parameter in project webtools.servertools by eclipse.

the class XmlTestCase method testDefaultServerXml32.

/**
 * Test reading of the default server.xml provided by the
 * current Tomcat 3.2.
 */
public void testDefaultServerXml32() {
    org.eclipse.jst.server.tomcat.core.internal.xml.server32.Server server = getXml32Server("default.serverxml.32");
    assertNotNull(server);
    ContextManager contextManager = server.getContextManager();
    assertNotNull(contextManager);
    assertEquals(2, contextManager.getConnectorCount());
    assertNotNull(contextManager.getConnector(0));
    Parameter parameter = contextManager.getConnector(0).getParameter(0);
    assertEquals("handler", parameter.getName());
    assertEquals("org.apache.tomcat.service.http.HttpConnectionHandler", parameter.getValue());
    parameter = contextManager.getConnector(0).getParameter(1);
    assertEquals("port", parameter.getName());
    assertEquals("8080", parameter.getValue());
    assertNotNull(contextManager.getConnector(1));
    parameter = contextManager.getConnector(1).getParameter(0);
    assertEquals("handler", parameter.getName());
    assertEquals("org.apache.tomcat.service.connector.Ajp12ConnectionHandler", parameter.getValue());
    parameter = contextManager.getConnector(1).getParameter(1);
    assertEquals("port", parameter.getName());
    assertEquals("8007", parameter.getValue());
    assertEquals(2, contextManager.getContextCount());
    assertNotNull(contextManager.getContext(0));
    assertEquals("/examples", contextManager.getContext(0).getPath());
    assertNotNull(contextManager.getContext(1));
    assertEquals("/admin", contextManager.getContext(1).getPath());
}
Also used : ContextManager(org.eclipse.jst.server.tomcat.core.internal.xml.server32.ContextManager) Parameter(org.eclipse.jst.server.tomcat.core.internal.xml.server32.Parameter)

Example 12 with Parameter

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

the class CollectionsTime method zParameterDefinition.

/**
 * Abstract Test 40 (/conf/edr/rc-z-definition): Validate that the vertical level query parameters are constructed correctly. (position)
 * Abstract Test 56 (/conf/edr/rc-z-definition): Validate that the vertical level query parameters are constructed correctly. (area)
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void zParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter z = null;
    String paramName = "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)) {
                            z = param;
                        }
                    }
                }
            }
        }
    }
    if (z != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(z.getName(), paramName, String.format(msg, "name", paramName, z.getName()));
        assertEquals(z.getIn(), "query", String.format(msg, "in", "query", z.getIn()));
        assertTrue(isRequired(z), String.format(msg, "required", "true", z.getRequired()));
        assertEquals(z.getStyle(), "form", String.format(msg, "style", "form", z.getStyle()));
        assertFalse(isExplode(z), String.format(msg, "explode", "false", z.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 13 with Parameter

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

the class CollectionsTime method resolutionxParameterDefinition.

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

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

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

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