Commit 75668aa4 authored by Saad bin Abid's avatar Saad bin Abid
Browse files

added new constraints as per Hernan's suggestions... Also changed the...

added new constraints as per Hernan's suggestions... Also changed the text/description of the constraints to be coherent.. extended the mira.ecore to have new constraints implemented. Added new constraints are 1) CheckListReviewConstraint (to check if the checklist attached with every requirement), 2) RequirementExistsConstraint (to check if the Requirement Package has the requirement) and 3) ComponentExistsConstraint (to check if the Component Architecture has components available).
parent d6783018
......@@ -19,6 +19,8 @@ package org.fortiss.af3.mira.ui;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.fortiss.af3.mira.constraints.AuthorConstraint;
import org.fortiss.af3.mira.constraints.CheckListReviewConstraint;
import org.fortiss.af3.mira.constraints.ComponentExistsConstraint;
import org.fortiss.af3.mira.constraints.DescriptionAndOrConstraint;
import org.fortiss.af3.mira.constraints.DescriptionConstraint;
import org.fortiss.af3.mira.constraints.GlossaryTermsDefinitionConstraint;
......@@ -30,12 +32,15 @@ import org.fortiss.af3.mira.constraints.OnlyOneSILConstraint;
import org.fortiss.af3.mira.constraints.ParameterTypeConstraint;
import org.fortiss.af3.mira.constraints.RationaleConstraint;
import org.fortiss.af3.mira.constraints.RequirementContainsTestSuiteConstraint;
import org.fortiss.af3.mira.constraints.RequirementExistsConstraint;
import org.fortiss.af3.mira.constraints.SignalConstraints.SignalInitialValueConstraint;
import org.fortiss.af3.mira.constraints.SignalConstraints.SignalTypeConstraint;
import org.fortiss.af3.mira.constraints.SignalConstraints.UniqueSignalNameConstraint;
import org.fortiss.af3.mira.constraints.SourceConstraint;
import org.fortiss.af3.mira.constraints.TraceNotEmptyConstraint;
import org.fortiss.af3.mira.ui.constraints.AuthorConstraintUI;
import org.fortiss.af3.mira.ui.constraints.CheckListReviewConstraintUI;
import org.fortiss.af3.mira.ui.constraints.ComponentExistsConstraintUI;
import org.fortiss.af3.mira.ui.constraints.DescriptionAndOrConstraintUI;
import org.fortiss.af3.mira.ui.constraints.DescriptionConstraintUI;
import org.fortiss.af3.mira.ui.constraints.GlossaryTermDefinitionConstraintUI;
......@@ -47,6 +52,7 @@ import org.fortiss.af3.mira.ui.constraints.OnlyOneSILConstraintUI;
import org.fortiss.af3.mira.ui.constraints.ParameterTypeConstraintUI;
import org.fortiss.af3.mira.ui.constraints.RationaleConstraintUI;
import org.fortiss.af3.mira.ui.constraints.RequirementContainsTestSuiteConstraintUI;
import org.fortiss.af3.mira.ui.constraints.RequirementExistsConstraintUI;
import org.fortiss.af3.mira.ui.constraints.SignalConstraintsUI.SignalInitialValueConstraintUI;
import org.fortiss.af3.mira.ui.constraints.SignalConstraintsUI.SignalTypeConstraintUI;
import org.fortiss.af3.mira.ui.constraints.SignalConstraintsUI.UniqueSignalNameConstraintUI;
......@@ -124,6 +130,12 @@ public class AF3MiraUIActivator extends AbstractUIPlugin {
IdentifiedInputOutputDefinedConstraint.class);
IConstraintUIService.getInstance().registerConstraintUI(
SignalInitialValueConstraintUI.class, SignalInitialValueConstraint.class);
IConstraintUIService.getInstance().registerConstraintUI(
RequirementExistsConstraintUI.class, RequirementExistsConstraint.class);
IConstraintUIService.getInstance().registerConstraintUI(CheckListReviewConstraintUI.class,
CheckListReviewConstraint.class);
IConstraintUIService.getInstance().registerConstraintUI(ComponentExistsConstraintUI.class,
ComponentExistsConstraint.class);
IConstraintUIService.getInstance().registerConstraintUI(TraceNotEmptyConstraintUI.class,
TraceNotEmptyConstraint.class);
}
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.constraints;
import org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck;
/**
* UI part of {@link org.fortiss.af3.mira.constraints.CheckListReviewConstraint}
*
* @author abid
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 6F29232CC159E38AACDBAFDD48EA0A62
*/
public class CheckListReviewConstraintUI extends ConstraintUIBaseAutocheck {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All requirements are reviewed as per the checklist";
}
/** {@inheritDoc} */
@Override
public boolean shouldBeManuallyActivated() {
return true;
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.constraints;
import org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck;
/**
* UI part of {@link org.fortiss.af3.mira.constraints.ComponentExistsConstraint}
*
* @author abid
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 6F29232CC159E38AACDBAFDD48EA0A62
*/
public class ComponentExistsConstraintUI extends ConstraintUIBaseAutocheck {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All component packages has atleast one component";
}
/** {@inheritDoc} */
@Override
public boolean shouldBeManuallyActivated() {
return true;
}
}
......@@ -45,7 +45,7 @@ public class GlossaryTermDefinitionConstraintUI extends ConstraintUIBaseAutochec
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All glossary terms used in the description must be fully defined";
return "All requirements having glossary terms that are fully defined";
}
/** {@inheritDoc} */
......
......@@ -41,7 +41,7 @@ public class ParameterTypeConstraintUI extends ConstraintUIBaseAutocheck {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All parameters have a type";
return "All requirements with parameters that have a type";
}
/** {@inheritDoc} */
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.constraints;
import org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck;
/**
* UI part of {@link org.fortiss.af3.mira.constraints.RequirementExistsConstraint}
*
* @author abid
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 6F29232CC159E38AACDBAFDD48EA0A62
*/
public class RequirementExistsConstraintUI extends ConstraintUIBaseAutocheck {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All requirement packages have atleast one requirement";
}
/** {@inheritDoc} */
@Override
public boolean shouldBeManuallyActivated() {
return true;
}
/** {@inheritDoc} */
// @Override
// public List<IFix> fixes(ConstraintInstance ci, IConstraintInstanceStatus status) {
// if(status instanceof FailedConstraintInstanceStatus) {
// /** get(0) get */
// RequirementsPackage reqpkg = (Requirement)ci.getConstraineds().get(0);
//
// /** Creates a {@link Requirement}. */
// if(req.getName().isEmpty() == false) {
// String splitFix = "Author field empty for requirement: " + req.getName();
// return Arrays.asList(new FixBase(splitFix, s -> req.getName().toString()));
// }
// }
// return super.fixes(ci, status);
// }
}
......@@ -54,7 +54,7 @@ public class SignalConstraintsUI {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All signals are uniquely defined";
return "All requirements have signals that are uniquely defined";
}
/** {@inheritDoc} */
......@@ -108,7 +108,7 @@ public class SignalConstraintsUI {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All signals have a type";
return "All requirements with signals defined have a type";
}
/** {@inheritDoc} */
......@@ -167,7 +167,7 @@ public class SignalConstraintsUI {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All signals should have initial value set and between ranges (i.e., [From,To]) for int data type and true/false for boolean data type";
return "All requirements with signals should have initial value set and between ranges (i.e., [From,To]) for int data type and true/false for boolean data type";
}
/** {@inheritDoc} */
......
......@@ -126,7 +126,7 @@ public class TraceConstraintUI extends ConstraintUIBases.ConstraintUIBase {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "All traces are up to date.";
return "All requirements traces are up to date.";
}
/** {@inheritDoc} */
......
......@@ -198,7 +198,7 @@
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="text" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementsPackage" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement">
<eClassifiers xsi:type="ecore:EClass" name="RequirementsPackage" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//constraints/IConstrained">
<eOperations name="getRequirementsList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsPackageStaticImpl.getRequirementsList(this);"/>
......@@ -221,7 +221,7 @@
</eGenericType>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementsContainer" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement">
<eClassifiers xsi:type="ecore:EClass" name="RequirementsContainer" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//constraints/IConstrained">
<eOperations name="getRequirementsPackagesList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementsContainerStaticImpl.getRequirementsPackagesList(this);"/>
......
......@@ -19,6 +19,8 @@ package org.fortiss.af3.mira;
import org.eclipse.core.runtime.Plugin;
import org.fortiss.af3.mira.constraints.AuthorConstraint;
import org.fortiss.af3.mira.constraints.CheckListReviewConstraint;
import org.fortiss.af3.mira.constraints.ComponentExistsConstraint;
import org.fortiss.af3.mira.constraints.DescriptionAndOrConstraint;
import org.fortiss.af3.mira.constraints.DescriptionConstraint;
import org.fortiss.af3.mira.constraints.GlossaryTermsDefinitionConstraint;
......@@ -30,6 +32,7 @@ import org.fortiss.af3.mira.constraints.OnlyOneSILConstraint;
import org.fortiss.af3.mira.constraints.ParameterTypeConstraint;
import org.fortiss.af3.mira.constraints.RationaleConstraint;
import org.fortiss.af3.mira.constraints.RequirementContainsTestSuiteConstraint;
import org.fortiss.af3.mira.constraints.RequirementExistsConstraint;
import org.fortiss.af3.mira.constraints.SignalConstraints.SignalInitialValueConstraint;
import org.fortiss.af3.mira.constraints.SignalConstraints.SignalTypeConstraint;
import org.fortiss.af3.mira.constraints.SignalConstraints.UniqueSignalNameConstraint;
......@@ -84,7 +87,11 @@ public class AF3MiraActivator extends Plugin {
IConstraintService.getInstance().registerConstraint(
IdentifiedInputOutputDefinedConstraint.class);
IConstraintService.getInstance().registerConstraint(SignalInitialValueConstraint.class);
IConstraintService.getInstance().registerConstraint(RequirementExistsConstraint.class);
IConstraintService.getInstance().registerConstraint(CheckListReviewConstraint.class);
IConstraintService.getInstance().registerConstraint(ComponentExistsConstraint.class);
IConstraintService.getInstance().registerConstraint(TraceNotEmptyConstraint.class);
}
/** {@inheritDoc} */
......
......@@ -38,7 +38,6 @@ public class AuthorConstraint extends AF3ProjectConstraintCheckerBase {
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
Requirement req = (Requirement)constrained;
return successIfTrue(!(req.getAuthor() == null || req.getAuthor().trim().isEmpty()));
}
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.constraints;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import java.util.ArrayList;
import java.util.List;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.verification.CheckItem;
import org.fortiss.af3.mira.model.verification.CheckList;
import org.fortiss.af3.project.utils.ConstraintsProjectUtils.AF3ProjectConstraintCheckerBase;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* Constraint to ensure that the Requirement has the checklist items being approved.
*
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: B0E3400E24B5C115D0CBA6EA0D9468D3
*/
public class CheckListReviewConstraint extends AF3ProjectConstraintCheckerBase {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
Requirement req = (Requirement)constrained;
List<Boolean> approvedList = new ArrayList<Boolean>();
for(IModelElementSpecification spec : req.getSpecifications()) {
if(spec instanceof CheckList) {
for(CheckItem checkItem : ((CheckList)spec).getItems()) {
if(checkItem.getStatus().toString().equalsIgnoreCase("Approved")) {
approvedList.add(true);
} else {
approvedList.add(false);
}
}
}
}
return successIfTrue(!(approvedList.contains(false)));
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof Requirement;
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.constraints;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.project.utils.ConstraintsProjectUtils.AF3ProjectConstraintCheckerBase;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* Constraint to ensure that the of a Component Architecture contains Components.
*
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: B0E3400E24B5C115D0CBA6EA0D9468D3
*/
public class ComponentExistsConstraint extends AF3ProjectConstraintCheckerBase {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
boolean componentAvailable = false;
ComponentArchitecture compArch = (ComponentArchitecture)constrained;
for(IHierarchicElement hirarchElement : compArch.getContainedElements()) {
if(hirarchElement instanceof Component) {
if(((Component)hirarchElement).getContainedElements().size() > 0) {
componentAvailable = true;
}
}
}
return successIfTrue(componentAvailable == true);
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof ComponentArchitecture;
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.constraints;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.mira.model.RequirementsContainer;
import org.fortiss.af3.project.utils.ConstraintsProjectUtils.AF3ProjectConstraintCheckerBase;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* Constraint to ensure that the Requirements folder has at least one requirements.
*
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: B0E3400E24B5C115D0CBA6EA0D9468D3
*/
public class RequirementExistsConstraint extends AF3ProjectConstraintCheckerBase {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
RequirementsContainer reqContainer = (RequirementsContainer)constrained;
return successIfTrue((reqContainer.getRequirementsList().size() > 0));
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof RequirementsContainer;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment