blob: 36b2e1528bb02e7e16b86bba68784418c6d30cf6 [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.Abstraction;
import org.eclipse.uml2.uml.Collaboration;
import org.eclipse.uml2.uml.CollaborationUse;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.ComponentRealization;
import org.eclipse.uml2.uml.Dependency;
import org.eclipse.uml2.uml.Deployment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.InterfaceRealization;
import org.eclipse.uml2.uml.Manifestation;
import org.eclipse.uml2.uml.Realization;
import org.eclipse.uml2.uml.StringExpression;
import org.eclipse.uml2.uml.Substitution;
import org.eclipse.uml2.uml.Usage;
/**
* @author Eike Stepper
*/
public class CollaborationUseTest
extends _Abstract_Compliance_Test_ {
public void testEAnnotations() {
CollaborationUse collaborationUse = UML.createCollaborationUse();
assertValid(collaborationUse);
EAnnotation eAnnotation = ECORE.createEAnnotation();
assertValid(eAnnotation);
collaborationUse.getEAnnotations().add(eAnnotation);
}
public void testOwnedComment() {
CollaborationUse collaborationUse = UML.createCollaborationUse();
assertValid(collaborationUse);
Comment comment = UML.createComment();
assertValid(comment);
collaborationUse.getOwnedComments().add(comment);
assertSuperset(collaborationUse.getOwnedElements().contains(comment));
}
public void testOwnedElement() {
CollaborationUse collaborationUse = UML.createCollaborationUse();
assertValid(collaborationUse);
EList<Element> elements = collaborationUse.getOwnedElements();
EList<Element> elements2 = collaborationUse.getOwnedElements();
assertSame(elements, elements2);
}
public void testClientDependency() {
CollaborationUse collaborationUse = UML.createCollaborationUse();
assertValid(collaborationUse);
EList<Dependency> dependencys = collaborationUse
.getClientDependencies();
EList<Dependency> dependencys2 = collaborationUse
.getClientDependencies();
assertSame(dependencys, dependencys2);
}
public void testNameExpression() {
CollaborationUse collaborationUse = UML.createCollaborationUse();
assertValid(collaborationUse);
StringExpression stringExpression = UML.createStringExpression();
assertValid(stringExpression);
collaborationUse.setNameExpression(stringExpression);
assertSuperset(
collaborationUse.getOwnedElements().contains(stringExpression));
}
public void testRoleBinding() {
CollaborationUse collaborationUse = UML.createCollaborationUse();
assertValid(collaborationUse);
Deployment deployment = UML.createDeployment();
assertValid(deployment);
collaborationUse.getRoleBindings().add(deployment);
assertSuperset(
collaborationUse.getOwnedElements().contains(deployment));
Dependency dependency = UML.createDependency();
assertValid(dependency);
collaborationUse.getRoleBindings().add(dependency);
assertSuperset(
collaborationUse.getOwnedElements().contains(dependency));
Realization realization = UML.createRealization();
assertValid(realization);
collaborationUse.getRoleBindings().add(realization);
assertSuperset(
collaborationUse.getOwnedElements().contains(realization));
ComponentRealization componentRealization = UML
.createComponentRealization();
assertValid(componentRealization);
collaborationUse.getRoleBindings().add(componentRealization);
assertSuperset(
collaborationUse.getOwnedElements().contains(componentRealization));
Abstraction abstraction = UML.createAbstraction();
assertValid(abstraction);
collaborationUse.getRoleBindings().add(abstraction);
assertSuperset(
collaborationUse.getOwnedElements().contains(abstraction));
Usage usage = UML.createUsage();
assertValid(usage);
collaborationUse.getRoleBindings().add(usage);
assertSuperset(collaborationUse.getOwnedElements().contains(usage));
InterfaceRealization interfaceRealization = UML
.createInterfaceRealization();
assertValid(interfaceRealization);
collaborationUse.getRoleBindings().add(interfaceRealization);
assertSuperset(
collaborationUse.getOwnedElements().contains(interfaceRealization));
Manifestation manifestation = UML.createManifestation();
assertValid(manifestation);
collaborationUse.getRoleBindings().add(manifestation);
assertSuperset(
collaborationUse.getOwnedElements().contains(manifestation));
Substitution substitution = UML.createSubstitution();
assertValid(substitution);
collaborationUse.getRoleBindings().add(substitution);
assertSuperset(
collaborationUse.getOwnedElements().contains(substitution));
}
public void testType() {
CollaborationUse collaborationUse = UML.createCollaborationUse();
assertValid(collaborationUse);
Collaboration collaboration = UML.createCollaboration();
assertValid(collaboration);
collaborationUse.setType(collaboration);
}
}