blob: c6db11ad53d136f696d57df6a6d49d8c2160ca47 [file] [log] [blame]
/*
* Copyright (c) 2018 CEA, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eike Stepper - initial API and implementation
*/
package org.eclipse.uml2.uml.cdo.tests.compliance;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.uml2.uml.ActionExecutionSpecification;
import org.eclipse.uml2.uml.BehaviorExecutionSpecification;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.ConsiderIgnoreFragment;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Continuation;
import org.eclipse.uml2.uml.Dependency;
import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ElementImport;
import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
import org.eclipse.uml2.uml.GeneralOrdering;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.InteractionConstraint;
import org.eclipse.uml2.uml.InteractionOperand;
import org.eclipse.uml2.uml.InteractionUse;
import org.eclipse.uml2.uml.IntervalConstraint;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.OccurrenceSpecification;
import org.eclipse.uml2.uml.PackageImport;
import org.eclipse.uml2.uml.PackageableElement;
import org.eclipse.uml2.uml.PartDecomposition;
import org.eclipse.uml2.uml.StateInvariant;
import org.eclipse.uml2.uml.StringExpression;
import org.eclipse.uml2.uml.TimeConstraint;
/**
* @author Eike Stepper
*/
public class InteractionOperandTest
extends _Abstract_Compliance_Test_ {
public void testEAnnotations() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
EAnnotation eAnnotation = ECORE.createEAnnotation();
assertValid(eAnnotation);
interactionOperand.getEAnnotations().add(eAnnotation);
}
public void testOwnedComment() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
Comment comment = UML.createComment();
assertValid(comment);
interactionOperand.getOwnedComments().add(comment);
assertSuperset(interactionOperand.getOwnedElements().contains(comment));
}
public void testOwnedElement() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
EList<Element> elements = interactionOperand.getOwnedElements();
EList<Element> elements2 = interactionOperand.getOwnedElements();
assertSame(elements, elements2);
}
public void testClientDependency() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
EList<Dependency> dependencys = interactionOperand
.getClientDependencies();
EList<Dependency> dependencys2 = interactionOperand
.getClientDependencies();
assertSame(dependencys, dependencys2);
}
public void testNameExpression() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
StringExpression stringExpression = UML.createStringExpression();
assertValid(stringExpression);
interactionOperand.setNameExpression(stringExpression);
assertSuperset(
interactionOperand.getOwnedElements().contains(stringExpression));
}
public void testOwnedRule() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
IntervalConstraint intervalConstraint = UML.createIntervalConstraint();
assertValid(intervalConstraint);
interactionOperand.getOwnedRules().add(intervalConstraint);
assertSuperset(
interactionOperand.getOwnedMembers().contains(intervalConstraint));
TimeConstraint timeConstraint = UML.createTimeConstraint();
assertValid(timeConstraint);
interactionOperand.getOwnedRules().add(timeConstraint);
assertSuperset(
interactionOperand.getOwnedMembers().contains(timeConstraint));
InteractionConstraint interactionConstraint = UML
.createInteractionConstraint();
assertValid(interactionConstraint);
interactionOperand.getOwnedRules().add(interactionConstraint);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(interactionConstraint));
Constraint constraint = UML.createConstraint();
assertValid(constraint);
interactionOperand.getOwnedRules().add(constraint);
assertSuperset(
interactionOperand.getOwnedMembers().contains(constraint));
DurationConstraint durationConstraint = UML.createDurationConstraint();
assertValid(durationConstraint);
interactionOperand.getOwnedRules().add(durationConstraint);
assertSuperset(
interactionOperand.getOwnedMembers().contains(durationConstraint));
}
public void testElementImport() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
ElementImport elementImport = UML.createElementImport();
assertValid(elementImport);
interactionOperand.getElementImports().add(elementImport);
assertSuperset(
interactionOperand.getOwnedElements().contains(elementImport));
}
public void testPackageImport() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
PackageImport packageImport = UML.createPackageImport();
assertValid(packageImport);
interactionOperand.getPackageImports().add(packageImport);
assertSuperset(
interactionOperand.getOwnedElements().contains(packageImport));
}
public void testOwnedMember() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
EList<NamedElement> namedElements = interactionOperand
.getOwnedMembers();
EList<NamedElement> namedElements2 = interactionOperand
.getOwnedMembers();
assertSame(namedElements, namedElements2);
}
public void testImportedMember() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
EList<PackageableElement> packageableElements = interactionOperand
.getImportedMembers();
EList<PackageableElement> packageableElements2 = interactionOperand
.getImportedMembers();
assertSame(packageableElements, packageableElements2);
}
public void testMember() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
EList<NamedElement> namedElements = interactionOperand.getMembers();
EList<NamedElement> namedElements2 = interactionOperand.getMembers();
assertSame(namedElements, namedElements2);
}
public void testCovered() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
Lifeline lifeline = UML.createLifeline();
assertValid(lifeline);
interactionOperand.getCovereds().add(lifeline);
}
public void testEnclosingOperand() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
InteractionOperand interactionOperand2 = UML.createInteractionOperand();
assertValid(interactionOperand2);
interactionOperand.setEnclosingOperand(interactionOperand2);
assertSuperset(
interactionOperand.getNamespace() == interactionOperand2);
}
public void testEnclosingInteraction() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
Interaction interaction = UML.createInteraction();
assertValid(interaction);
interactionOperand.setEnclosingInteraction(interaction);
assertSuperset(interactionOperand.getNamespace() == interaction);
}
public void testGeneralOrdering() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
GeneralOrdering generalOrdering = UML.createGeneralOrdering();
assertValid(generalOrdering);
interactionOperand.getGeneralOrderings().add(generalOrdering);
assertSuperset(
interactionOperand.getOwnedElements().contains(generalOrdering));
}
public void testFragment() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
CombinedFragment combinedFragment = UML.createCombinedFragment();
assertValid(combinedFragment);
interactionOperand.getFragments().add(combinedFragment);
assertSuperset(
interactionOperand.getOwnedMembers().contains(combinedFragment));
StateInvariant stateInvariant = UML.createStateInvariant();
assertValid(stateInvariant);
interactionOperand.getFragments().add(stateInvariant);
assertSuperset(
interactionOperand.getOwnedMembers().contains(stateInvariant));
OccurrenceSpecification occurrenceSpecification = UML
.createOccurrenceSpecification();
assertValid(occurrenceSpecification);
interactionOperand.getFragments().add(occurrenceSpecification);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(occurrenceSpecification));
InteractionUse interactionUse = UML.createInteractionUse();
assertValid(interactionUse);
interactionOperand.getFragments().add(interactionUse);
assertSuperset(
interactionOperand.getOwnedMembers().contains(interactionUse));
BehaviorExecutionSpecification behaviorExecutionSpecification = UML
.createBehaviorExecutionSpecification();
assertValid(behaviorExecutionSpecification);
interactionOperand.getFragments().add(behaviorExecutionSpecification);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(behaviorExecutionSpecification));
ExecutionOccurrenceSpecification executionOccurrenceSpecification = UML
.createExecutionOccurrenceSpecification();
assertValid(executionOccurrenceSpecification);
interactionOperand.getFragments().add(executionOccurrenceSpecification);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(executionOccurrenceSpecification));
DestructionOccurrenceSpecification destructionOccurrenceSpecification = UML
.createDestructionOccurrenceSpecification();
assertValid(destructionOccurrenceSpecification);
interactionOperand.getFragments()
.add(destructionOccurrenceSpecification);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(destructionOccurrenceSpecification));
InteractionOperand interactionOperand2 = UML.createInteractionOperand();
assertValid(interactionOperand2);
interactionOperand.getFragments().add(interactionOperand2);
assertSuperset(
interactionOperand.getOwnedMembers().contains(interactionOperand2));
MessageOccurrenceSpecification messageOccurrenceSpecification = UML
.createMessageOccurrenceSpecification();
assertValid(messageOccurrenceSpecification);
interactionOperand.getFragments().add(messageOccurrenceSpecification);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(messageOccurrenceSpecification));
Interaction interaction = UML.createInteraction();
assertValid(interaction);
interactionOperand.getFragments().add(interaction);
assertSuperset(
interactionOperand.getOwnedMembers().contains(interaction));
PartDecomposition partDecomposition = UML.createPartDecomposition();
assertValid(partDecomposition);
interactionOperand.getFragments().add(partDecomposition);
assertSuperset(
interactionOperand.getOwnedMembers().contains(partDecomposition));
Continuation continuation = UML.createContinuation();
assertValid(continuation);
interactionOperand.getFragments().add(continuation);
assertSuperset(
interactionOperand.getOwnedMembers().contains(continuation));
ConsiderIgnoreFragment considerIgnoreFragment = UML
.createConsiderIgnoreFragment();
assertValid(considerIgnoreFragment);
interactionOperand.getFragments().add(considerIgnoreFragment);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(considerIgnoreFragment));
ActionExecutionSpecification actionExecutionSpecification = UML
.createActionExecutionSpecification();
assertValid(actionExecutionSpecification);
interactionOperand.getFragments().add(actionExecutionSpecification);
assertSuperset(interactionOperand.getOwnedMembers()
.contains(actionExecutionSpecification));
}
public void testGuard() {
InteractionOperand interactionOperand = UML.createInteractionOperand();
assertValid(interactionOperand);
InteractionConstraint interactionConstraint = UML
.createInteractionConstraint();
assertValid(interactionConstraint);
interactionOperand.setGuard(interactionConstraint);
assertSuperset(interactionOperand.getOwnedElements()
.contains(interactionConstraint));
}
}