Search in sources :

Example 1 with Parameter

use of org.osate.aadl2.Parameter in project webtools.servertools by eclipse.

the class XmlTestCase method testServerInstance32.

/**
 * Test behavior of ServerInstance with Tomcat 3.2 default server.xml.
 */
public void testServerInstance32() {
    org.eclipse.jst.server.tomcat.core.internal.xml.server32.Server server = getXml32Server("default.serverxml.32");
    assertNotNull(server);
    org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance si = new org.eclipse.jst.server.tomcat.core.internal.xml.server32.ServerInstance(server);
    assertNotNull(si.getContextManager());
    org.eclipse.jst.server.tomcat.core.internal.xml.server32.Connector[] connectors = si.getConnectors();
    assertNotNull(connectors);
    assertEquals(2, connectors.length);
    Parameter parameter = connectors[0].getParameter(0);
    assertEquals("handler", parameter.getName());
    assertEquals("org.apache.tomcat.service.http.HttpConnectionHandler", parameter.getValue());
    parameter = connectors[0].getParameter(1);
    assertEquals("port", parameter.getName());
    assertEquals("8080", parameter.getValue());
    parameter = connectors[1].getParameter(0);
    assertEquals("handler", parameter.getName());
    assertEquals("org.apache.tomcat.service.connector.Ajp12ConnectionHandler", parameter.getValue());
    parameter = connectors[1].getParameter(1);
    assertEquals("port", parameter.getName());
    assertEquals("8007", parameter.getValue());
    parameter = si.getConnector(0).getParameter(0);
    assertEquals("handler", parameter.getName());
    assertEquals("org.apache.tomcat.service.http.HttpConnectionHandler", parameter.getValue());
    parameter = si.getConnector(0).getParameter(1);
    assertEquals("port", parameter.getName());
    assertEquals("8080", parameter.getValue());
    parameter = si.getConnector(1).getParameter(0);
    assertEquals("handler", parameter.getName());
    assertEquals("org.apache.tomcat.service.connector.Ajp12ConnectionHandler", parameter.getValue());
    parameter = si.getConnector(1).getParameter(1);
    assertEquals("port", parameter.getName());
    assertEquals("8007", parameter.getValue());
    org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context[] contexts = si.getContexts();
    assertNotNull(contexts);
    assertEquals(2, contexts.length);
    assertEquals("/examples", contexts[0].getPath());
    assertEquals("/admin", contexts[1].getPath());
    assertEquals("/examples", si.getContext(0).getPath());
    assertEquals("/admin", si.getContext(1).getPath());
    assertEquals("/examples", si.getContext("examples").getPath());
    assertEquals("/admin", si.getContext("/admin").getPath());
    org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context context = si.createContext(2);
    context.setPath("/WebApp1");
    contexts = si.getContexts();
    assertNotNull(contexts);
    assertEquals(3, contexts.length);
    assertEquals("/examples", contexts[0].getPath());
    assertEquals("/admin", contexts[1].getPath());
    assertEquals("/WebApp1", contexts[2].getPath());
    assertEquals(new Path("/Base/work/localhost_8080%2Fexamples"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("examples")));
    assertEquals(new Path("/Base/work/localhost_8080%2Fadmin"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("admin")));
    assertEquals(new Path("/Base/work/localhost_8080%2FWebApp1"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("WebApp1")));
    assertTrue(si.removeContext(2));
    contexts = si.getContexts();
    assertNotNull(contexts);
    assertEquals(2, contexts.length);
    assertEquals("/examples", contexts[0].getPath());
    assertEquals("/admin", contexts[1].getPath());
    context = si.createContext(2);
    context.setPath("");
    context = si.getContext("");
    assertNotNull(context);
    assertEquals("", context.getPath());
    assertEquals(new Path("/Base/work/localhost_8080"), si.getContextWorkDirectory(new Path("/Base"), si.getContext("")));
    assertEquals(si.getServerWorkDirectory(new Path("/Base")), new Path("/Base/work"));
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) Path(org.eclipse.core.runtime.Path) Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Parameter(org.eclipse.jst.server.tomcat.core.internal.xml.server32.Parameter) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)

Example 2 with Parameter

use of org.osate.aadl2.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 3 with Parameter

use of org.osate.aadl2.Parameter in project VERDICT by ge-high-assurance.

the class Aadl2Vdm method getConnectionKind.

/**
 * Returns the VDM ConnectionKind
 * @param kind
 * @return
 */
verdict.vdm.vdm_model.ConnectionKind getConnectionKind(Connection aConn) {
    String kindString = "port";
    if (aConn.getClass().getSimpleName().equalsIgnoreCase("AccessConnectionImpl")) {
        AccessConnectionImpl accessConnImpl = (AccessConnectionImpl) aConn;
        if (accessConnImpl.getAccessCategory().getName().equalsIgnoreCase("data")) {
            kindString = "dataAccess";
        } else if (accessConnImpl.getAccessCategory().getName().equalsIgnoreCase("bus")) {
            kindString = "busAccess";
        }
    } else if (aConn.getClass().getSimpleName().equalsIgnoreCase("PortConnectionImpl")) {
        kindString = "port";
    } else if (aConn.getClass().getSimpleName().equalsIgnoreCase("ParameterConnectionImpl")) {
        kindString = "parameter";
    }
    verdict.vdm.vdm_model.ConnectionKind returnKind = verdict.vdm.vdm_model.ConnectionKind.fromValue(kindString);
    return returnKind;
}
Also used : AccessConnectionImpl(org.osate.aadl2.impl.AccessConnectionImpl)

Example 4 with Parameter

use of org.osate.aadl2.Parameter in project AMASE by loonwerks.

the class SafetyValidator method checkInput.

/**
 * Checks fault def name is valid,
 * expressions passed into node match parameter types,
 * and correct number of arguments passed in.
 *
 * @param inputs
 */
@Check(CheckType.FAST)
public void checkInput(InputStatement inputs) {
    EObject container = inputs.eContainer();
    NamedElement defNameSub;
    List<Expr> exprList = inputs.getNom_conn();
    List<String> inputList = inputs.getFault_in();
    ArrayList<String> argNames = new ArrayList<String>();
    if (container instanceof FaultStatement) {
        FaultStatement faultStatement = (FaultStatement) container;
        DoubleDotRef defName = faultStatement.getFaultDefName();
        defNameSub = defName.getElm();
        // Make sure we have a NodeDefExpr
        if (defNameSub instanceof NodeDef) {
            List<Arg> nodeArgs = ((NodeDef) defNameSub).getArgs();
            for (Arg arg : nodeArgs) {
                argNames.add(arg.getFullName());
                if (arg.getType() instanceof DoubleDotRefImpl) {
                    if ((((DoubleDotRefImpl) arg.getType()).getElm() instanceof PropertyImpl) || (((DoubleDotRefImpl) arg.getType()).getElm() instanceof DataTypeImpl)) {
                        error(inputs, "Fault node parameters are not recognized: a possible issue is that the keyword 'float' is used instead of 'real.'");
                    }
                }
            }
            // If the sizes are accurate, make sure names match
            if (nodeArgs.size() - 1 == (inputList.size())) {
                // Go through input list and make sure each name is in the arg list
                for (String inputName : inputList) {
                    if (!argNames.contains(inputName)) {
                        error(inputs, "Input names must match fault node definition names. " + "The input name " + inputName + " is not an input in the node definition. " + "All possible input names are: " + argNames.toString());
                    }
                }
            } else {
                argNames.remove("trigger");
                error(inputs, "With this fault definition, you must have " + (argNames.size() - 1) + " inputs." + " These are called: " + argNames.toString());
            }
            if (inputListHasRepeats(inputList)) {
                error(inputs, "There is a repeated name in the input list: " + inputList.toString());
            }
            if (!checkInputTypes(exprList, nodeArgs)) {
                error(inputs, "Types of inputs do not match types of node parameters");
            }
        } else {
            // Not a node def expr
            error(defName, "Fault definition: " + defNameSub.getFullName() + " must be a valid agree node definition name.");
        }
    } else {
        error(inputs, "Fault inputs must be defined within a fault statement.");
    }
}
Also used : NodeDef(com.rockwellcollins.atc.agree.agree.NodeDef) ArrayList(java.util.ArrayList) FaultStatement(edu.umn.cs.crisys.safety.safety.FaultStatement) HWFaultStatement(edu.umn.cs.crisys.safety.safety.HWFaultStatement) PropertyImpl(org.osate.aadl2.impl.PropertyImpl) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) UnaryExpr(com.rockwellcollins.atc.agree.agree.UnaryExpr) Expr(com.rockwellcollins.atc.agree.agree.Expr) PrevExpr(com.rockwellcollins.atc.agree.agree.PrevExpr) BoolLitExpr(com.rockwellcollins.atc.agree.agree.BoolLitExpr) IntLitExpr(com.rockwellcollins.atc.agree.agree.IntLitExpr) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) DataTypeImpl(org.osate.aadl2.impl.DataTypeImpl) EObject(org.eclipse.emf.ecore.EObject) DoubleDotRef(com.rockwellcollins.atc.agree.agree.DoubleDotRef) Arg(com.rockwellcollins.atc.agree.agree.Arg) DoubleDotRefImpl(com.rockwellcollins.atc.agree.agree.impl.DoubleDotRefImpl) NamedElement(org.osate.aadl2.NamedElement) Check(org.eclipse.xtext.validation.Check)

Example 5 with Parameter

use of org.osate.aadl2.Parameter in project osate2 by osate.

the class CommonSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Aadl2Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Aadl2Package.AADL_BOOLEAN:
                sequence_TypeRef(context, (AadlBoolean) semanticObject);
                return;
            case Aadl2Package.AADL_INTEGER:
                sequence_TypeRef(context, (AadlInteger) semanticObject);
                return;
            case Aadl2Package.AADL_REAL:
                sequence_TypeRef(context, (AadlReal) semanticObject);
                return;
            case Aadl2Package.AADL_STRING:
                sequence_TypeRef(context, (AadlString) semanticObject);
                return;
            case Aadl2Package.BOOLEAN_LITERAL:
                sequence_ABooleanLiteral(context, (BooleanLiteral) semanticObject);
                return;
            case Aadl2Package.INTEGER_LITERAL:
                sequence_AIntegerTerm(context, (IntegerLiteral) semanticObject);
                return;
            case Aadl2Package.REAL_LITERAL:
                sequence_ARealTerm(context, (RealLiteral) semanticObject);
                return;
            case Aadl2Package.STRING_LITERAL:
                sequence_StringTerm(context, (StringLiteral) semanticObject);
                return;
        }
    else if (epackage == CommonPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case CommonPackage.ABINARY_OPERATION:
                sequence_AAdditiveExpression_AAndExpression_AEqualityExpression_AMultiplicativeExpression_AOrExpression_ARelationalExpression(context, (ABinaryOperation) semanticObject);
                return;
            case CommonPackage.ACONDITIONAL:
                sequence_AIfExpression(context, (AConditional) semanticObject);
                return;
            case CommonPackage.AFUNCTION_CALL:
                sequence_AFunctionCall(context, (AFunctionCall) semanticObject);
                return;
            case CommonPackage.AMODEL_REFERENCE:
                sequence_AModelReference(context, (AModelReference) semanticObject);
                return;
            case CommonPackage.APROPERTY_REFERENCE:
                if (rule == grammarAccess.getAModelOrPropertyReferenceRule() || rule == grammarAccess.getAExpressionRule() || rule == grammarAccess.getAOrExpressionRule() || action == grammarAccess.getAOrExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAndExpressionRule() || action == grammarAccess.getAAndExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAEqualityExpressionRule() || action == grammarAccess.getAEqualityExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getARelationalExpressionRule() || action == grammarAccess.getARelationalExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAdditiveExpressionRule() || action == grammarAccess.getAAdditiveExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAMultiplicativeExpressionRule() || action == grammarAccess.getAMultiplicativeExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAUnaryOperationRule() || rule == grammarAccess.getAUnitExpressionRule() || action == grammarAccess.getAUnitExpressionAccess().getAUnitExpressionExpressionAction_1_0() || rule == grammarAccess.getAPrimaryExpressionRule() || rule == grammarAccess.getAParenthesizedExpressionRule()) {
                    sequence_AModelOrPropertyReference_APropertyReference(context, (APropertyReference) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAPropertyReferenceRule()) {
                    sequence_APropertyReference(context, (APropertyReference) semanticObject);
                    return;
                } else
                    break;
            case CommonPackage.ARANGE:
                sequence_ARangeExpression(context, (ARange) semanticObject);
                return;
            case CommonPackage.AUNARY_OPERATION:
                sequence_AUnaryOperation(context, (AUnaryOperation) semanticObject);
                return;
            case CommonPackage.AUNIT_EXPRESSION:
                if (rule == grammarAccess.getAExpressionRule() || rule == grammarAccess.getAOrExpressionRule() || action == grammarAccess.getAOrExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAndExpressionRule() || action == grammarAccess.getAAndExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAEqualityExpressionRule() || action == grammarAccess.getAEqualityExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getARelationalExpressionRule() || action == grammarAccess.getARelationalExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAdditiveExpressionRule() || action == grammarAccess.getAAdditiveExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAMultiplicativeExpressionRule() || action == grammarAccess.getAMultiplicativeExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAUnaryOperationRule() || rule == grammarAccess.getAUnitExpressionRule() || action == grammarAccess.getAUnitExpressionAccess().getAUnitExpressionExpressionAction_1_0() || rule == grammarAccess.getAPrimaryExpressionRule() || rule == grammarAccess.getAParenthesizedExpressionRule()) {
                    sequence_AUnitExpression(context, (AUnitExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getShowValueRule()) {
                    sequence_ShowValue(context, (AUnitExpression) semanticObject);
                    return;
                } else
                    break;
            case CommonPackage.AVARIABLE_REFERENCE:
                sequence_AVariableReference(context, (AVariableReference) semanticObject);
                return;
            case CommonPackage.COMPUTE_DECLARATION:
                sequence_ComputeDeclaration(context, (ComputeDeclaration) semanticObject);
                return;
            case CommonPackage.DESCRIPTION:
                sequence_Description(context, (Description) semanticObject);
                return;
            case CommonPackage.DESCRIPTION_ELEMENT:
                sequence_DescriptionElement(context, (DescriptionElement) semanticObject);
                return;
            case CommonPackage.IMAGE_REFERENCE:
                sequence_ImageReference(context, (ImageReference) semanticObject);
                return;
            case CommonPackage.MODEL_REF:
                sequence_TypeRef(context, (ModelRef) semanticObject);
                return;
            case CommonPackage.PROPERTY_REF:
                sequence_PropertyRef(context, (PropertyRef) semanticObject);
                return;
            case CommonPackage.RATIONALE:
                sequence_Rationale(context, (Rationale) semanticObject);
                return;
            case CommonPackage.TYPE_REF:
                sequence_TypeRef(context, (TypeRef) semanticObject);
                return;
            case CommonPackage.UNCERTAINTY:
                sequence_Uncertainty(context, (Uncertainty) semanticObject);
                return;
            case CommonPackage.VAL_DECLARATION:
                sequence_ValDeclaration(context, (ValDeclaration) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : AadlReal(org.osate.aadl2.AadlReal) ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) APropertyReference(org.osate.alisa.common.common.APropertyReference) BooleanLiteral(org.osate.aadl2.BooleanLiteral) AUnitExpression(org.osate.alisa.common.common.AUnitExpression) EPackage(org.eclipse.emf.ecore.EPackage) RealLiteral(org.osate.aadl2.RealLiteral) AadlBoolean(org.osate.aadl2.AadlBoolean) StringLiteral(org.osate.aadl2.StringLiteral) Parameter(org.eclipse.xtext.Parameter) AadlInteger(org.osate.aadl2.AadlInteger) AadlString(org.osate.aadl2.AadlString) IntegerLiteral(org.osate.aadl2.IntegerLiteral)

Aggregations

EPackage (org.eclipse.emf.ecore.EPackage)10 Action (org.eclipse.xtext.Action)10 Parameter (org.eclipse.xtext.Parameter)10 ParserRule (org.eclipse.xtext.ParserRule)10 BooleanLiteral (org.osate.aadl2.BooleanLiteral)10 IntegerLiteral (org.osate.aadl2.IntegerLiteral)10 RealLiteral (org.osate.aadl2.RealLiteral)10 StringLiteral (org.osate.aadl2.StringLiteral)10 ClassifierValue (org.osate.aadl2.ClassifierValue)9 Parameter (com.reprezen.kaizen.oasparser.model3.Parameter)8 AadlString (org.osate.aadl2.AadlString)7 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)7 ArrayRange (org.osate.aadl2.ArrayRange)6 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)6 ComputedValue (org.osate.aadl2.ComputedValue)6 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)6 Parameter (org.osate.aadl2.Parameter)6 ArrayList (java.util.ArrayList)5 DataAccess (org.osate.aadl2.DataAccess)5 FeatureGroup (org.osate.aadl2.FeatureGroup)5