use of org.osate.ge.tests.endToEnd.util.DiagramElementReference in project osate2 by osate.
the class BehaviorAnnexTest method testBehaviorAnnex.
// @Test
public void testBehaviorAnnex() {
prepareForTesting();
createAadlProject(BA_TEST);
// Create package
createNewPackageWithPackageDiagram(BA_TEST, BA_TEST);
// Create package for data classifier reference
createNewPackageWithPackageDiagram(BA_TEST, DATA_PKG);
// Create Data Type
createElementAndLayout(defaultDiagram(BA_TEST, DATA_PKG), packageElement(DATA_PKG), "Data Type", getClassifierRelativeReference("new_classifier"), DATA_CLASSIFIER);
// Create default diagram for testing classifiers
final DiagramReference diagram = defaultDiagram(BA_TEST, BA_TEST);
final DiagramElementReference pkgElement = packageElement(BA_TEST);
final RelativeBusinessObjectReference pkgRef = getRelativeReferenceForPackage(BA_TEST);
// Open text editor
doubleClickInAadlNavigator(BA_TEST, BA_TEST + ".aadl");
// Setup classifiers for testing
final String typeName = "Abstract_type";
final String modeName = "srcstate";
setupClassifiers(diagram, pkgElement, pkgRef, typeName, modeName);
// Use Open -> Behavior Annex Diagram command to create new behavior annex diagram
final BiFunction<DiagramElementReference, String, DiagramReference> openBehaviorAnnexDiagramCommand = (ref, diagramPrefix) -> openBehaviorSpecificationDiagramFromReference(ref, diagramPrefix);
// Run tests for type
testBehaviorSpecification(BehaviorAnnexReferenceUtil.getSpecificationRelativeReference(0), typeName, diagram, pkgRef, modeName, openBehaviorAnnexDiagramCommand);
// Test with editor closed
saveAndCloseTextEditorByTitle(BA_TEST + ".aadl");
// Use Open -> New Diagram... command to create new Behavior Annex diagram
final BiFunction<DiagramElementReference, String, DiagramReference> createDiagramCommand = (ref, newStatePrefix) -> createBehaviorSpecificationDiagramFromReference(ref, newStatePrefix);
// Run tests for impl
testBehaviorSpecification(BehaviorAnnexReferenceUtil.getSpecificationRelativeReference(1), typeName + ".impl2", diagram, pkgRef, modeName, createDiagramCommand);
}
use of org.osate.ge.tests.endToEnd.util.DiagramElementReference in project osate2 by osate.
the class BehaviorAnnexTest method editTransitionWithPropertiesView.
private static void editTransitionWithPropertiesView(final DiagramReference baDiagram, final String styledTextId, final String btnId, final String dlgTitle, final String newText, final RelativeBusinessObjectReference specRef, final RelativeBusinessObjectReference transitionRef) {
final DiagramElementReference specDiagramRef = element(specRef);
final DiagramElementReference transitionDiagramRef = specDiagramRef.join(transitionRef);
selectDiagramElements(baDiagram, transitionDiagramRef);
// Launch edit dialog
clickButtonByIdInPropertiesView("AADL", btnId);
waitForWindowWithTitle(dlgTitle);
final String originalText = getStyledTextWithIdText(EditEmbeddedTextDialog.WIDGET_ID_TEXT);
// Set condition text
typeInStyledText(EditEmbeddedTextDialog.WIDGET_ID_TEXT, newText);
// Perform undo on styled text
executeHandlerServiceCommandWithId("org.eclipse.ui.edit.undo", null);
// Check to see if undo was successful
waitForStyledTextToMatch(EditEmbeddedTextDialog.WIDGET_ID_TEXT, originalText);
// Perform redo on styled text
executeHandlerServiceCommandWithId("org.eclipse.ui.edit.redo", null);
// Check to see if undo was successful
waitForStyledTextToMatch(EditEmbeddedTextDialog.WIDGET_ID_TEXT, newText);
// Confirm new condition
clickButtonWithId(EditEmbeddedTextDialog.WIDGET_ID_CONFIRM);
// Clear selection
selectDiagramElements(baDiagram, specDiagramRef);
// Select transition
selectDiagramElements(baDiagram, transitionDiagramRef);
// Check styled text to see if update was successful
waitForStyledTextToMatch(styledTextId, newText);
}
use of org.osate.ge.tests.endToEnd.util.DiagramElementReference in project osate2 by osate.
the class BehaviorAnnexTest method testBehaviorSpecification.
/*
* - Create BA with initial state in classifier type
* - Set BA in mode
* - Create source Behavior State
* - Execute open diagram for ba
* - Create destination Behavior State
* - Create behavior variable with data classifier set as Base_Types::String
* - Set data classifier for variable to data classifier data_test::temp
* - Create a behavior transition between source and destination
* - Test state and transition properties for classifier
*/
private static void testBehaviorSpecification(final RelativeBusinessObjectReference behaviorSpecification, final String classifierName, final DiagramReference diagram, final RelativeBusinessObjectReference pkgRef, final String modeName, final BiFunction<DiagramElementReference, String, DiagramReference> openDiagram) {
final RelativeBusinessObjectReference classifierRef = getClassifierRelativeReference(classifierName);
final DiagramElementReference classifierDiagramRef = element(pkgRef, classifierRef);
// Create behavior specification
createBehaviorAnnexWithInitialState(diagram, classifierDiagramRef, behaviorSpecification, modeName);
// Hide all to test behavior specification filter
clickContextMenuOfDiagramElement(diagram, classifierDiagramRef, "Hide Contents", "All");
// Show behavior specifications for classifier
clickContextMenuOfDiagramElement(diagram, classifierDiagramRef, "Show Contents", "Behavior Specifications");
final DiagramElementReference specificationDiagramRef = new DiagramElementReference(pkgRef, classifierRef, behaviorSpecification);
// Set in mode
clickCheckboxInPropertiesView(diagram, "AADL", 0, specificationDiagramRef);
// Source state with same name as mode
final DiagramElementReference srcState = specificationDiagramRef.join(BehaviorAnnexReferenceUtil.getStateRelativeReference(modeName));
final DiagramReference baDiagram = openDiagram.apply(srcState, classifierName.replace(".", "_"));
// New specification reference for BA diagram
final DiagramElementReference baDiagramSpecRef = new DiagramElementReference(behaviorSpecification);
testBehaviorStates(baDiagram, baDiagramSpecRef);
testBehaviorVariable(baDiagram, baDiagramSpecRef);
testBehaviorTransition(new DiagramElementReference(behaviorSpecification, BehaviorAnnexReferenceUtil.getStateRelativeReference(modeName)), baDiagram, behaviorSpecification);
saveAndCloseDiagramEditor(baDiagram);
}
use of org.osate.ge.tests.endToEnd.util.DiagramElementReference in project osate2 by osate.
the class ErrorModelTest method testErrorFlows.
@Test
public void testErrorFlows() {
prepareForTesting();
createAadlProject(ERROR_FLOW_TEST);
// Create a package
createNewPackageWithPackageDiagram(ERROR_FLOW_TEST, ERROR_FLOW_TEST);
final DiagramReference diagram = defaultDiagram(ERROR_FLOW_TEST, ERROR_FLOW_TEST);
final DiagramElementReference pkgElement = packageElement(ERROR_FLOW_TEST);
final RelativeBusinessObjectReference pkgRef = getRelativeReferenceForPackage(ERROR_FLOW_TEST);
// Open text editor
doubleClickInAadlNavigator(ERROR_FLOW_TEST, ERROR_FLOW_TEST + ".aadl");
//
// Create system implementation to use as the subsystem
//
createImplementationWithNewType(diagram, pkgElement, "System Implementation", "impl", "subsystem");
final DiagramElementReference subsystemRef = element(pkgRef, getClassifierRelativeReference("subsystem.impl"));
// Create and rename propagation point
createElementAndLayout(diagram, subsystemRef, "Propagation Point", ErrorModelReferenceUtil.getRelativeReferenceForPropagationPoint("subsystem_impl_new_propagation_point"), "ss_pp1");
//
// Create top level system implementation
//
createImplementationWithNewType(diagram, pkgElement, "System Implementation", "impl", "test_system");
final DiagramElementReference sysImplElement = element(pkgRef, getClassifierRelativeReference("test_system.impl"));
//
// Create subsystem
//
createElementAndLayout(diagram, sysImplElement, "System Subcomponent", getSubcomponentRelativeReference("test_system_impl_new_subcomponent"), "sc1");
final DiagramElementReference sc1Ref = sysImplElement.join(getSubcomponentRelativeReference("sc1"));
setSubcomponentClassifierFromPropertiesView(diagram, ERROR_FLOW_TEST + "::subsystem.impl", sc1Ref);
showContentsAndLayout(diagram, sc1Ref);
final DiagramElementReference sc1Pp1Ref = sc1Ref.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagationPoint("ss_pp1"));
//
// Propagation Points
//
// Create and rename propagation point
createElementAndLayout(diagram, sysImplElement, "Propagation Point", ErrorModelReferenceUtil.getRelativeReferenceForPropagationPoint("test_system_impl_new_propagation_point"), "pp1");
// Create another propagation point and delete it.
createElementAndLayout(diagram, sysImplElement, "Propagation Point", ErrorModelReferenceUtil.getRelativeReferenceForPropagationPoint("test_system_impl_new_propagation_point"), "pp2");
deleteElement(diagram, sysImplElement.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagationPoint("pp2")));
//
// Feature Group Type
//
createElementAndLayout(diagram, pkgElement, "Feature Group Type", getClassifierRelativeReference("new_classifier"), "test_fgt");
createElementAndLayout(diagram, pkgElement.join(getClassifierRelativeReference("test_fgt")), "Data Port", getFeatureRelativeReference("test_fgt_new_feature"), "i1");
//
// Propagations
//
createElementAndLayout(diagram, sysImplElement, "Data Port", getFeatureRelativeReference("test_system_new_feature"), "o1");
createElementAndLayout(diagram, sysImplElement, "Feature Group", getFeatureRelativeReference("test_system_new_feature"), "fg1");
final DiagramElementReference fg1Element = sysImplElement.join(getFeatureRelativeReference("fg1"));
setExtendedOrFeatureClassifierFromPropertiesView(diagram, ERROR_FLOW_TEST + "::test_fgt", fg1Element);
// Show elements and propagation point keyword binding
final String bindingsKind = KeywordPropagationPointType.BINDINGS.getKind();
final RelativeBusinessObjectReference bindingsRef = ErrorModelReferenceUtil.getRelativeReferenceForKeywordPropagationPoint(bindingsKind);
configureDiagramToShowElement(diagram, sysImplElement, bindingsRef, "Aadl Package " + ERROR_FLOW_TEST, "System Implementation test_system.impl", "Propagation Point <" + bindingsKind + ">");
showContentsAndLayout(diagram, fg1Element);
// Create propagation for port
final DiagramElementReference o1Ref = sysImplElement.join(getFeatureRelativeReference("o1"));
createShapeElement(diagram, o1Ref, "Out Error Propagation", ErrorModelReferenceUtil.getRelativeReferenceForPropagation(false, DirectionType.OUT), ErrorModelTest::selectSingleErrorType);
final DiagramElementReference o1PropagationRef = o1Ref.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagation(false, DirectionType.OUT));
// Create propagation for feature group port
final DiagramElementReference i1Ref = fg1Element.join(getFeatureRelativeReference("i1"));
createShapeElement(diagram, i1Ref, "In Error Propagation", ErrorModelReferenceUtil.getRelativeReferenceForPropagation(false, DirectionType.IN), ErrorModelTest::selectSingleErrorType);
final DiagramElementReference i1PropagationRef = i1Ref.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagation(false, DirectionType.IN));
// Create propagation for propagation point
final DiagramElementReference pp1Ref = sysImplElement.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagationPoint("pp1"));
createShapeElement(diagram, pp1Ref, "Out Error Containment", ErrorModelReferenceUtil.getRelativeReferenceForPropagation(true, DirectionType.OUT), ErrorModelTest::selectSingleErrorType);
final DiagramElementReference pp1PropagationRef = pp1Ref.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagation(true, DirectionType.OUT));
// Create propagation for binding reference
createShapeElement(diagram, sysImplElement.join(bindingsRef), "In Error Containment", ErrorModelReferenceUtil.getRelativeReferenceForPropagation(true, DirectionType.IN), ErrorModelTest::selectSingleErrorType);
// Verify error propagation type set is correct and can be set using the property section
{
openAadlPropertiesTab(diagram, o1PropagationRef);
addTypeToSelectedPropagationTypeSet();
}
// Select two not-identical type sets and confirm label
openAadlPropertiesTab(diagram, o1PropagationRef, pp1PropagationRef);
waitUntilBorderedCLabelWithIdTextMatches(ErrorPropagationPropertySection.WIDGET_ID_TYPE_TOKENS_LABEL, "<Multiple Type Sets Selected>");
// Select two other propagations with identical type sets and change
openAadlPropertiesTab(diagram, i1PropagationRef, pp1PropagationRef);
addTypeToSelectedPropagationTypeSet();
layoutDiagram(diagram, sysImplElement);
//
// Propagation Path
//
createConnectionAndLayout(diagram, o1Ref, sc1Pp1Ref, "Propagation Path", sysImplElement, ErrorModelReferenceUtil.getRelativeReferenceForPropagationPath("test_system_impl_new_propagation_path"), "test_propagation_path1");
deleteElement(diagram, sysImplElement.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagationPath("test_propagation_path1")));
//
// Error Flows
//
createConnectionAndLayout(diagram, i1Ref, o1Ref, "Error Path", sysImplElement, ErrorModelReferenceUtil.getRelativeReferenceForErrorFlow("test_system_impl_new_error_flow"), "epath1");
final DiagramElementReference errorPathElement = sysImplElement.join(ErrorModelReferenceUtil.getRelativeReferenceForErrorFlow("epath1"));
createFlowIndicatorAndLayout(diagram, sysImplElement, "Error Source", o1Ref, ErrorModelReferenceUtil.getRelativeReferenceForErrorFlow("test_system_impl_new_error_flow"), "esrc1");
final DiagramElementReference errorSourceElement = sysImplElement.join(ErrorModelReferenceUtil.getRelativeReferenceForErrorFlow("esrc1"));
createFlowIndicatorAndLayout(diagram, sysImplElement, "Error Sink", i1Ref, ErrorModelReferenceUtil.getRelativeReferenceForErrorFlow("test_system_impl_new_error_flow"), "esnk1");
// Error Type Set - Add
{
openAadlPropertiesTab(diagram, errorPathElement);
// Select the error type set for the error flow
clickButtonWithId(ErrorFlowPropertySection.WIDGET_ID_ERROR_TYPE_SET_TOKENS_CHOOSE_BUTTON);
waitForWindowWithTitle("Edit Type Set");
clickButton("Add Error Type(s)");
waitForWindowWithTitle("Add Types");
selectListItems(0, "ErrorLibrary::AboveRange");
clickButton("OK");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorFlowPropertySection.WIDGET_ID_ERROR_TYPE_SET_TOKENS_LABEL, "ErrorLibrary::AboveRange");
}
// Error Type Set - Clear
{
openAadlPropertiesTab(diagram, errorPathElement);
// Select the error type set for the error flow
clickButtonWithId(ErrorFlowPropertySection.WIDGET_ID_ERROR_TYPE_SET_TOKENS_CHOOSE_BUTTON);
waitForWindowWithTitle("Edit Type Set");
selectListItems(0, "ErrorLibrary::AboveRange");
clickButton("Remove");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorFlowPropertySection.WIDGET_ID_ERROR_TYPE_SET_TOKENS_LABEL, "");
}
// Target Error Type Instance - Add
{
openAadlPropertiesTab(diagram, errorPathElement);
// Select the error type set for the error flow
clickButtonWithId(ErrorPathPropertySection.WIDGET_ID_ERROR_TARGET_ERROR_TYPE_INSTANCE_CHOOSE_BUTTON);
waitForWindowWithTitle("Edit Type Set");
clickButton("Add Error Type(s)");
waitForWindowWithTitle("Add Types");
selectListItems(0, "ErrorLibrary::AboveRange");
clickButton("OK");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorPathPropertySection.WIDGET_ID_ERROR_TARGET_ERROR_TYPE_INSTANCE_LABEL, "ErrorLibrary::AboveRange");
}
// Target Error Type Instance - Clear
{
openAadlPropertiesTab(diagram, errorPathElement);
// Select the error type set for the error flow
clickButtonWithId(ErrorPathPropertySection.WIDGET_ID_ERROR_TARGET_ERROR_TYPE_INSTANCE_CHOOSE_BUTTON);
waitForWindowWithTitle("Edit Type Set");
selectListItems(0, "ErrorLibrary::AboveRange");
clickButton("Remove");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorPathPropertySection.WIDGET_ID_ERROR_TARGET_ERROR_TYPE_INSTANCE_LABEL, "");
}
// Set the error behavior of the classifier. This is needed to select a state for the error source
{
openAadlPropertiesTab(diagram, sysImplElement);
// Select button to choose the error behavior
clickButtonWithId(ErrorModelSubclausePropertySection.WIDGET_ID_BEHAVIOR_CHOOSE_BUTTON);
waitForWindowWithTitle("Select Error Behavior State Machine");
selectListItem(0, "ErrorLibrary::FailAndRecover");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorModelSubclausePropertySection.WIDGET_ID_BEHAVIOR_VALUE_LABEL, "ErrorLibrary::FailAndRecover");
}
// Fault Source - Text Description
{
openAadlPropertiesTab(diagram, errorSourceElement);
// Select button to choose the error behavior
clickButtonWithId(ErrorSourcePropertySection.WIDGET_ID_FAULT_SOURCE_CHOOSE_BUTTON);
waitForWindowWithTitle("Edit Fault Source");
clickRadioButton("Description");
setTextFieldWithIdText(FaultSourceEditorDialog.WIDGET_ID_DESCRIPTION_TEXT, "Test Fault Source");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorSourcePropertySection.WIDGET_ID_FAULT_SOURCE_LABEL, "Test Fault Source");
}
// Fault Source - Error Type Set
{
openAadlPropertiesTab(diagram, errorSourceElement);
// Select button to choose the error behavior
clickButtonWithId(ErrorSourcePropertySection.WIDGET_ID_FAULT_SOURCE_CHOOSE_BUTTON);
waitForWindowWithTitle("Edit Fault Source");
clickRadioButton("Error Type Set");
// Select the Error Behavior State
clickButtonWithId(FaultSourceEditorDialog.WIDGET_ID_STATE_MODIFY_BUTTON);
waitForWindowWithTitle("Select");
selectListItem(0, "Failed");
clickButton("OK");
// Select the Type Set
clickButtonWithId(FaultSourceEditorDialog.WIDGET_ID_TYPE_SET_MODIFY_BUTTON);
waitForWindowWithTitle("Edit Type Set");
clickButton("Add Error Type(s)");
waitForWindowWithTitle("Add Types");
selectListItems(0, "ErrorLibrary::BadValue");
clickButton("OK");
clickButton("OK");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorSourcePropertySection.WIDGET_ID_FAULT_SOURCE_LABEL, "Failed {ErrorLibrary::BadValue}");
}
// Set the fault condition
{
openAadlPropertiesTab(diagram, errorSourceElement);
setFocusToTextFieldWithId(ErrorSourcePropertySection.WIDGET_ID_FAULT_CONDITION_TEXT);
final String faultCondition = "Test Fault Condition";
setTextFieldWithIdText(ErrorSourcePropertySection.WIDGET_ID_FAULT_CONDITION_TEXT, "Test Fault Condition");
focusDiagramEditor(diagram);
waitForDiagramElementCondition(diagram, errorSourceElement, "Fault condition does not match '" + faultCondition + "'", de -> {
return de.getBusinessObject(ErrorSource.class).map(s -> s.getFlowcondition() == null ? null : s.getFlowcondition().getDescription()).filter(d -> Objects.equals(d, faultCondition)).isPresent();
});
}
//
// Delete error flows
//
deleteElement(diagram, errorSourceElement);
deleteElement(diagram, sysImplElement.join(ErrorModelReferenceUtil.getRelativeReferenceForErrorFlow("epath1")));
//
// Delete a propagation
//
deleteElement(diagram, o1Ref.join(ErrorModelReferenceUtil.getRelativeReferenceForPropagation(false, DirectionType.OUT)));
saveAndCloseDiagramEditor(diagram);
}
use of org.osate.ge.tests.endToEnd.util.DiagramElementReference in project osate2 by osate.
the class ErrorModelTest method testErrorModelLibrary.
@Test
public void testErrorModelLibrary() {
prepareForTesting();
createAadlProject(EMV2_TEST);
// Create package
createNewPackageWithPackageDiagram(EMV2_TEST, EMV2_TEST);
final DiagramReference diagram = defaultDiagram(EMV2_TEST, EMV2_TEST);
final RelativeBusinessObjectReference pkgRef = getRelativeReferenceForPackage(EMV2_TEST);
final DiagramElementReference pkgElement = packageElement(EMV2_TEST);
// Open text editor
doubleClickInAadlNavigator(EMV2_TEST, EMV2_TEST + ".aadl");
// Create several error types
createElementAndLayout(diagram, pkgElement, "Error Type", ErrorModelReferenceUtil.getRelativeReferenceForErrorType("new_error_type"), "t1");
createElementAndLayout(diagram, pkgElement, "Error Type", ErrorModelReferenceUtil.getRelativeReferenceForErrorType("new_error_type"), "t2");
createElementAndLayout(diagram, pkgElement, "Error Type", ErrorModelReferenceUtil.getRelativeReferenceForErrorType("new_error_type"), "t3");
createElementAndLayout(diagram, pkgElement, "Error Type", ErrorModelReferenceUtil.getRelativeReferenceForErrorType("new_error_type"), "t4");
// Create error type extension
createElementAndLayout(diagram, pkgElement, "Error Type", ErrorModelReferenceUtil.getRelativeReferenceForErrorType("new_error_type"), "t1_ext");
final DiagramElementReference t1ExtElement = element(pkgRef, ErrorModelReferenceUtil.getRelativeReferenceForErrorType("t1_ext"));
createConnectionAndLayout(diagram, t1ExtElement, element(pkgRef, ErrorModelReferenceUtil.getRelativeReferenceForErrorType("t1")), "Error Type Extension", t1ExtElement, ErrorModelReferenceUtil.getRelativeReferenceForErrorTypeExtension(), null);
// Create error type alias
createElementAndLayout(diagram, pkgElement, "Error Type Alias", ErrorModelReferenceUtil.getRelativeReferenceForErrorType("new_error_type_alias"), "ta1", () -> {
waitForWindowWithTitle("Select Error Type to Alias");
selectListItem(0, "emv2_test::t1");
clickButton("OK");
});
// Verify the aliased error type and adjust it using the property section
{
openAadlPropertiesTab(diagram, element(pkgRef, ErrorModelReferenceUtil.getRelativeReferenceForErrorType("ta1")));
// Check label to ensure that the aliased type matches the expected value
waitUntilBorderedCLabelWithIdTextMatches(ErrorTypeAliasPropertySection.WIDGET_ID_ALIASED_TYPE_LABEL, "emv2_test::t1");
clickButtonWithId(ErrorTypeAliasPropertySection.WIDGET_ID_ALIASED_TYPE_CHOOSE_BUTTON);
waitForWindowWithTitle("Select Aliased Type");
selectListItem(0, "emv2_test::t2");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(ErrorTypeAliasPropertySection.WIDGET_ID_ALIASED_TYPE_LABEL, "emv2_test::t2");
}
// Create error type set
createElementAndLayout(diagram, pkgElement, "Error Type Set", ErrorModelReferenceUtil.getRelativeReferenceForTypeSet("new_error_type_set"), "ts1", () -> {
waitForWindowWithTitle("Select Type Tokens");
// Add types
clickButton("Add Error Type(s)");
waitForWindowWithTitle("Add Types");
selectListItems(0, "ErrorLibrary::AboveRange", "emv2_test::t1");
clickButton("OK");
// Add type product
clickButton("Add Type Product");
waitForWindowWithTitle("Select Error Types for Product");
selectListItems(0, "emv2_test::t2", "emv2_test::t3");
clickButton("OK");
// Add type product
clickButton("Add Type Product");
waitForWindowWithTitle("Select Error Types for Product");
selectListItems(0, "emv2_test::t2", "emv2_test::t3", "emv2_test::t4");
clickButton("OK");
// Remove the type product
selectListItems(0, "emv2_test::t2 * emv2_test::t3 * emv2_test::t4");
clickButton("Remove");
// Add type product
selectListItems(0, "emv2_test::t2 * emv2_test::t3");
clickButton("Edit Type Product");
waitForWindowWithTitle("Select Error Types for Product");
selectListItems(0, "emv2_test::t2", "emv2_test::t4");
clickButton("OK");
clickButton("OK");
});
// Verify error type set and add additional types using the property section
{
openAadlPropertiesTab(diagram, element(pkgRef, ErrorModelReferenceUtil.getRelativeReferenceForTypeSet("ts1")));
// Check label to ensure that the types match the expected value
waitUntilBorderedCLabelWithIdTextMatches(TypeSetPropertySection.WIDGET_ID_TYPE_TOKENS_LABEL, "emv2_test::t1, ErrorLibrary::AboveRange, emv2_test::t2 * emv2_test::t4");
clickButtonWithId(TypeSetPropertySection.WIDGET_ID_TYPE_TOKENS_CHOOSE_BUTTON);
waitForWindowWithTitle("Edit Type Set");
// Add types
clickButton("Add Error Type(s)");
waitForWindowWithTitle("Add Types");
selectListItems(0, "emv2_test::t1", "emv2_test::t3");
clickButton("OK");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(TypeSetPropertySection.WIDGET_ID_TYPE_TOKENS_LABEL, "emv2_test::t1, ErrorLibrary::AboveRange, emv2_test::t2 * emv2_test::t4, emv2_test::t1, emv2_test::t3");
}
// Create a second type set
createElementAndLayout(diagram, pkgElement, "Error Type Set", ErrorModelReferenceUtil.getRelativeReferenceForTypeSet("new_error_type_set"), "ts2", () -> {
waitForWindowWithTitle("Select Type Tokens");
// Add types
clickButton("Add Error Type(s)");
waitForWindowWithTitle("Add Types");
selectListItems(0, "emv2_test::t1");
clickButton("OK");
clickButton("OK");
});
// Create type set alias
createElementAndLayout(diagram, pkgElement, "Error Type Set Alias", ErrorModelReferenceUtil.getRelativeReferenceForTypeSet("new_error_type_set_alias"), "tsa1", () -> {
waitForWindowWithTitle("Select Type Set to Alias");
selectListItem(0, "emv2_test::ts1");
clickButton("OK");
});
// Verify the aliased type set and adjust it using the property section
{
openAadlPropertiesTab(diagram, element(pkgRef, ErrorModelReferenceUtil.getRelativeReferenceForTypeSet("tsa1")));
// Check label to ensure that the aliased type set matches the expected value
waitUntilBorderedCLabelWithIdTextMatches(TypeSetAliasPropertySection.WIDGET_ID_ALIASED_TYPE_SET_LABEL, "emv2_test::ts1");
clickButtonWithId(TypeSetAliasPropertySection.WIDGET_ID_ALIASED_TYPE_SET_CHOOSE_BUTTON);
waitForWindowWithTitle("Select Aliased Type Set");
selectListItem(0, "emv2_test::ts2");
clickButton("OK");
// Check the label to ensure it reflects the changes
waitUntilBorderedCLabelWithIdTextMatches(TypeSetAliasPropertySection.WIDGET_ID_ALIASED_TYPE_SET_LABEL, "emv2_test::ts2");
}
// Create package to which an error type library will be added.
createNewPackageWithPackageDiagram(EMV2_TEST, OTHER);
final DiagramReference otherDiagram = defaultDiagram(EMV2_TEST, OTHER);
final RelativeBusinessObjectReference otherPkgRef = getRelativeReferenceForPackage(OTHER);
final DiagramElementReference otherPkgElement = packageElement(OTHER);
// Create an error type. This will create the error type library
createElementAndLayout(otherDiagram, otherPkgElement, "Error Type", ErrorModelReferenceUtil.getRelativeReferenceForErrorType("new_error_type"), "ot1");
// Set an extended library, verify, and then remove it.
{
openAadlPropertiesTab(otherDiagram, otherPkgElement);
// Check current value of the list
waitUntilListWithIdItemsExists(ErrorModelLibraryPropertySection.WIDGET_ID_EXTENDED_LIBRARIES_LIST);
clickButtonWithId(ErrorModelLibraryPropertySection.WIDGET_ID_EXTENDED_LIBRARIES_ADD_BUTTON);
waitForWindowWithTitle("Select Error Library to Extend");
selectListItems(0, EMV2_TEST);
clickButton("OK");
// Wait until the extended library appears in the list
waitUntilListWithIdItemsExists(ErrorModelLibraryPropertySection.WIDGET_ID_EXTENDED_LIBRARIES_LIST, EMV2_TEST);
// Remove the extension
selectListWithIdItem(ErrorModelLibraryPropertySection.WIDGET_ID_EXTENDED_LIBRARIES_LIST, EMV2_TEST);
clickButtonWithId(ErrorModelLibraryPropertySection.WIDGET_ID_EXTENDED_LIBRARIES_REMOVE_BUTTON);
waitUntilListWithIdItemsExists(ErrorModelLibraryPropertySection.WIDGET_ID_EXTENDED_LIBRARIES_LIST);
}
// Create a state machine
createElementAndLayout(otherDiagram, otherPkgElement, "Error Behavior State Machine", ErrorModelReferenceUtil.getRelativeReferenceForStateMachine("new_state_machine"), "esm1");
final RelativeBusinessObjectReference esm1Ref = ErrorModelReferenceUtil.getRelativeReferenceForStateMachine("esm1");
final DiagramElementReference esm1Element = element(otherPkgRef, esm1Ref);
// Create states
createElementAndLayout(otherDiagram, esm1Element, "Error State", ErrorModelReferenceUtil.getRelativeReferenceForState("new_state"), "s1");
createElementAndLayout(otherDiagram, esm1Element, "Error State", ErrorModelReferenceUtil.getRelativeReferenceForState("new_state"), "s2");
createElementAndLayout(otherDiagram, esm1Element, "Error State", ErrorModelReferenceUtil.getRelativeReferenceForState("new_state"), "s3");
// Create Events
createElementAndLayout(otherDiagram, esm1Element, "Error Event", ErrorModelReferenceUtil.getRelativeReferenceForEvent("new_event"), "e1");
createElementAndLayout(otherDiagram, esm1Element, "Repair Event", ErrorModelReferenceUtil.getRelativeReferenceForEvent("new_event"), "e2");
createElementAndLayout(otherDiagram, esm1Element, "Recover Event", ErrorModelReferenceUtil.getRelativeReferenceForEvent("new_event"), "e3");
// Create a basic transition
final DiagramElementReference s1Element = element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForState("s1"));
final DiagramElementReference s2Element = element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForState("s2"));
final DiagramElementReference s3Element = element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForState("s3"));
createConnectionAndLayout(otherDiagram, s1Element, s2Element, "Error Behavior Transition", esm1Element, ErrorModelReferenceUtil.getRelativeReferenceForNamedTransition("new_transition"), "t1", () -> {
waitForWindowWithTitle("Select Event");
selectListItems(0, "e2");
clickButton("OK");
});
// Create a transition branch
final DiagramElementReference t1Element = element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForNamedTransition("t1"));
createConnectionAndLayout(otherDiagram, t1Element, s3Element, "Error Behavior Transition", t1Element, ErrorModelReferenceUtil.getRelativeReferenceForTransitionBranch("s3", 0), null);
// Set the initial state
{
openAadlPropertiesTab(otherDiagram, element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForState("s1")));
// Check the initial box
waitUntilCheckboxCheckedState("Initial", false);
clickCheckbox("Initial");
// Verify
selectDiagramElements(otherDiagram, otherPkgElement);
openAadlPropertiesTab(otherDiagram, element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForState("s1")));
waitUntilCheckboxCheckedState("Initial", true);
}
// Set the value of the probability for branches
{
openAadlPropertiesTab(otherDiagram, element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForNamedTransition("t1"), ErrorModelReferenceUtil.getRelativeReferenceForTransitionBranch("s2", 0)));
setTextFieldWithIdText(TransitionBranchPropertySection.WIDGET_ID_PROBABILITY, "0.3");
// Value is saved when focus changes
focusDiagramEditor(otherDiagram);
openAadlPropertiesTab(otherDiagram, element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForNamedTransition("t1"), ErrorModelReferenceUtil.getRelativeReferenceForTransitionBranch("s3", 0)));
setTextFieldWithIdText(TransitionBranchPropertySection.WIDGET_ID_PROBABILITY, "0.7");
// Value is saved when focus changes
focusDiagramEditor(otherDiagram);
// Select another element
selectDiagramElements(otherDiagram, otherPkgElement);
// Verify
openAadlPropertiesTab(otherDiagram, element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForNamedTransition("t1"), ErrorModelReferenceUtil.getRelativeReferenceForTransitionBranch("s2", 0)));
waitUntilTextFieldWithIdTextMatches(TransitionBranchPropertySection.WIDGET_ID_PROBABILITY, "0.3");
openAadlPropertiesTab(otherDiagram, element(otherPkgRef, esm1Ref, ErrorModelReferenceUtil.getRelativeReferenceForNamedTransition("t1"), ErrorModelReferenceUtil.getRelativeReferenceForTransitionBranch("s3", 0)));
waitUntilTextFieldWithIdTextMatches(TransitionBranchPropertySection.WIDGET_ID_PROBABILITY, "0.7");
}
}
Aggregations