blob: 1c41b7cf02c1e825f307d83dcd9dce5b927165d6 [file] [log] [blame]
/*
* Copyright (c) 2003, 2006 IBM Corporation 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:
* IBM - initial API and implementation
*
* $Id: DeploymentTargetTest.java,v 1.3 2006/05/29 17:27:34 khussey Exp $
*/
package org.eclipse.uml2.tests;
import org.eclipse.uml2.DeploymentTarget;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.uml2.Artifact;
import org.eclipse.uml2.Deployment;
import org.eclipse.uml2.Manifestation;
import org.eclipse.uml2.PackageableElement;
import org.eclipse.uml2.UML2Factory;
import org.eclipse.uml2.UML2Package;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Deployment Target</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are tested:
* <ul>
* <li>{@link org.eclipse.uml2.DeploymentTarget#getDeployedElements() <em>Deployed Element</em>}</li>
* </ul>
* </p>
* @generated
*/
public abstract class DeploymentTargetTest extends NamedElementTest {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Copyright (c) IBM Corporation and others."; //$NON-NLS-1$
/**
* Constructs a new Deployment Target test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DeploymentTargetTest(String name) {
super(name);
}
/**
* Returns the fixture for this Deployment Target test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private DeploymentTarget getFixture() {
return (DeploymentTarget)fixture;
}
/**
* Tests the '{@link org.eclipse.uml2.DeploymentTarget#getDeployedElements() <em>Deployed Element</em>}' feature getter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.uml2.DeploymentTarget#getDeployedElements()
* @generated
*/
public void testGetDeployedElementsGen() {
// TODO: implement this feature getter test method
// Ensure that you remove @generated or mark it @generated NOT
}
public void testGetDeployedElements() {
testGetDeployedElementsGen();
List packageableElements = new ArrayList();
for (Iterator eAllSubClasses = getEAllSubClasses(UML2Package.eINSTANCE.getPackageableElement()).iterator(); eAllSubClasses.hasNext();) {
packageableElements.add(UML2Factory.eINSTANCE.create((EClass) eAllSubClasses.next()));
}
for (Iterator utilizedElements = packageableElements.iterator(); utilizedElements.hasNext();) {
Deployment deployment = UML2Factory.eINSTANCE.createDeployment();
Artifact deployedArtifact = UML2Factory.eINSTANCE.createArtifact();
Manifestation manifestation = UML2Factory.eINSTANCE.createManifestation();
manifestation.setUtilizedElement((PackageableElement) utilizedElements.next());
deployedArtifact.getManifestations().add(manifestation);
deployment.getDeployedArtifacts().add(deployedArtifact);
getFixture().getDeployments().add(deployment);
}
assertTrue(getFixture().getDeployedElements().containsAll(packageableElements));
}
public void testGetOwnedElements() {
super.testGetOwnedElements();
assertTrue(getFixture().getOwnedElements().containsAll(getFixture().getDeployments()));
}
/* (non-Javadoc)
* @see org.eclipse.uml2.impl.tests.ElementImplTest#setUpOwnedElements()
*/
protected void setUpOwnedElements() {
super.setUpOwnedElements();
getFixture().getDeployments().add(UML2Factory.eINSTANCE.createDeployment());
getFixture().getDeployments().add(UML2Factory.eINSTANCE.createDeployment());
}
} //DeploymentTargetImplTest