001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.test.uml.dependencydiagram;
043:
044: import org.netbeans.jemmy.EventTool;
045: import org.netbeans.jemmy.JemmyProperties;
046: import org.netbeans.junit.NbTestSuite;
047: import org.netbeans.test.uml.dependencydiagram.utils.DependencyDiagramVerifier;
048: import org.netbeans.test.uml.dependencydiagram.utils.DependencyUtils;
049: import org.netbeans.test.umllib.DiagramOperator;
050: import org.netbeans.test.umllib.ElementTypes;
051: import org.netbeans.test.umllib.LinkTypes;
052: import org.netbeans.test.umllib.NewDiagramWizardOperator;
053: import org.netbeans.test.umllib.testcases.UMLTestCase;
054:
055: public class ClassDiagramAssociationLinksTests extends UMLTestCase {
056: private final String projectName = "Depend_uml_cldA";
057: private final String diagramNamePrefix = "test_diagram";
058: public static int COUNT = 0;
059: //public static boolean initialized = false;
060:
061: private static final String workDir = System
062: .getProperty("xtest.workdir");
063: private DiagramOperator diagram = null;
064: private DependencyDiagramVerifier verifier = null;
065:
066: private EventTool eventTool = new EventTool();
067:
068: public ClassDiagramAssociationLinksTests(String name) {
069: super (name);
070: }
071:
072: public static NbTestSuite suite() {
073: NbTestSuite suite = new NbTestSuite(
074: ClassDiagramAssociationLinksTests.class);
075: return suite;
076: }
077:
078: // Association link tests
079: public void testSrcClassClassAssociation() {
080:
081: verifier.testSrcOf2LinkedElements(ElementTypes.CLASS,
082: ElementTypes.CLASS, LinkTypes.ASSOCIATION);
083:
084: }
085:
086: public void testSrcInterfaceInterfaceAssociation() {
087:
088: verifier.testSrcOf2LinkedElements(ElementTypes.INTERFACE,
089: ElementTypes.INTERFACE, LinkTypes.ASSOCIATION);
090:
091: }
092:
093: public void testSrcEnumEnumAssociation() {
094:
095: verifier.testSrcOf2LinkedElements(ElementTypes.ENUMERATION,
096: ElementTypes.ENUMERATION, LinkTypes.ASSOCIATION);
097:
098: }
099:
100: public void testSrcNodeNodeAssociation() {
101:
102: verifier.testSrcOf2LinkedElements(ElementTypes.NODE,
103: ElementTypes.NODE, LinkTypes.ASSOCIATION);
104:
105: }
106:
107: public void testSrcDatatypeDatatypeAssociation() {
108:
109: verifier.testSrcOf2LinkedElements(ElementTypes.DATATYPE,
110: ElementTypes.DATATYPE, LinkTypes.ASSOCIATION);
111:
112: }
113:
114: public void testSrcArtifactArtifactAssociation() {
115:
116: verifier.testSrcOf2LinkedElements(ElementTypes.ARTIFACT,
117: ElementTypes.ARTIFACT, LinkTypes.ASSOCIATION);
118:
119: }
120:
121: public void testSrcAliasedAliasedAssociation() {
122:
123: verifier.testSrcOf2LinkedElements(ElementTypes.ALIASED,
124: ElementTypes.ALIASED, LinkTypes.ASSOCIATION);
125:
126: }
127:
128: public void testSrcUtilityUtilityAssociation() {
129:
130: verifier.testSrcOf2LinkedElements(ElementTypes.UTILITY_CLASS,
131: ElementTypes.UTILITY_CLASS, LinkTypes.ASSOCIATION);
132:
133: }
134:
135: public void testSrcActorActorAssociation() {
136:
137: verifier.testSrcOf2LinkedElements(ElementTypes.ACTOR,
138: ElementTypes.ACTOR, LinkTypes.ASSOCIATION);
139:
140: }
141:
142: // Composition link tests
143: public void testSrcClassClassComposition() {
144:
145: verifier.testSrcOf2LinkedElements(ElementTypes.CLASS,
146: ElementTypes.CLASS, LinkTypes.COMPOSITION);
147:
148: }
149:
150: public void testSrcInterfaceInterfaceComposition() {
151:
152: verifier.testSrcOf2LinkedElements(ElementTypes.INTERFACE,
153: ElementTypes.INTERFACE, LinkTypes.COMPOSITION);
154:
155: }
156:
157: public void testSrcEnumEnumComposition() {
158:
159: verifier.testSrcOf2LinkedElements(ElementTypes.ENUMERATION,
160: ElementTypes.ENUMERATION, LinkTypes.COMPOSITION);
161:
162: }
163:
164: public void testSrcNodeNodeComposition() {
165:
166: verifier.testSrcOf2LinkedElements(ElementTypes.NODE,
167: ElementTypes.NODE, LinkTypes.COMPOSITION);
168:
169: }
170:
171: public void testSrcDatatypeDatatypeComposition() {
172:
173: verifier.testSrcOf2LinkedElements(ElementTypes.DATATYPE,
174: ElementTypes.DATATYPE, LinkTypes.COMPOSITION);
175:
176: }
177:
178: public void testSrcArtifactArtifactComposition() {
179:
180: verifier.testSrcOf2LinkedElements(ElementTypes.ARTIFACT,
181: ElementTypes.ARTIFACT, LinkTypes.COMPOSITION);
182:
183: }
184:
185: public void testSrcAliasedAliasedComposition() {
186:
187: verifier.testSrcOf2LinkedElements(ElementTypes.ALIASED,
188: ElementTypes.ALIASED, LinkTypes.COMPOSITION);
189:
190: }
191:
192: public void testSrcUtilityUtilityComposition() {
193:
194: verifier.testSrcOf2LinkedElements(ElementTypes.UTILITY_CLASS,
195: ElementTypes.UTILITY_CLASS, LinkTypes.COMPOSITION);
196:
197: }
198:
199: public void testSrcActorActorComposition() {
200:
201: verifier.testSrcOf2LinkedElements(ElementTypes.ACTOR,
202: ElementTypes.ACTOR, LinkTypes.COMPOSITION);
203:
204: }
205:
206: // Aggregation link tests
207: public void testSrcClassClassAggregation() {
208:
209: verifier.testSrcOf2LinkedElements(ElementTypes.CLASS,
210: ElementTypes.CLASS, LinkTypes.AGGREGATION);
211:
212: }
213:
214: public void testSrcInterfaceInterfaceAggregation() {
215:
216: verifier.testSrcOf2LinkedElements(ElementTypes.INTERFACE,
217: ElementTypes.INTERFACE, LinkTypes.AGGREGATION);
218:
219: }
220:
221: public void testSrcEnumEnumAggregation() {
222:
223: verifier.testSrcOf2LinkedElements(ElementTypes.ENUMERATION,
224: ElementTypes.ENUMERATION, LinkTypes.AGGREGATION);
225:
226: }
227:
228: public void testSrcNodeNodeAggregation() {
229:
230: verifier.testSrcOf2LinkedElements(ElementTypes.NODE,
231: ElementTypes.NODE, LinkTypes.AGGREGATION);
232:
233: }
234:
235: public void testSrcDatatypeDatatypeAggregation() {
236:
237: verifier.testSrcOf2LinkedElements(ElementTypes.DATATYPE,
238: ElementTypes.DATATYPE, LinkTypes.AGGREGATION);
239:
240: }
241:
242: public void testSrcArtifactArtifactAggregation() {
243:
244: verifier.testSrcOf2LinkedElements(ElementTypes.ARTIFACT,
245: ElementTypes.ARTIFACT, LinkTypes.AGGREGATION);
246:
247: }
248:
249: public void testSrcAliasedAliasedAggregation() {
250:
251: verifier.testSrcOf2LinkedElements(ElementTypes.ALIASED,
252: ElementTypes.ALIASED, LinkTypes.AGGREGATION);
253:
254: }
255:
256: public void testSrcUtilityUtilityAggregation() {
257:
258: verifier.testSrcOf2LinkedElements(ElementTypes.UTILITY_CLASS,
259: ElementTypes.UTILITY_CLASS, LinkTypes.AGGREGATION);
260:
261: }
262:
263: public void testSrcActorActorAggregation() {
264:
265: verifier.testSrcOf2LinkedElements(ElementTypes.ACTOR,
266: ElementTypes.ACTOR, LinkTypes.AGGREGATION);
267:
268: }
269:
270: protected void setUp() {
271: JemmyProperties.setCurrentTimeout(
272: "DialogWaiter.WaitDialogTimeout", 5000);
273: JemmyProperties.setCurrentTimeout("Waiter.WaitingTime", 3000);
274: JemmyProperties.setCurrentTimeout(
275: "DiagramElementOperator.WaitDiagramElementTime", 5000);
276: //if (!initialized) { DependencyUtils.setDefaultPreferences(); initialized=true;}
277: COUNT++;
278: String diagramName = this .diagramNamePrefix + COUNT;
279: diagram = DependencyUtils.openDiagram(projectName, diagramName,
280: NewDiagramWizardOperator.CLASS_DIAGRAM, workDir);
281: if (diagram == null)
282: fail("Can't open diagram '" + diagramName + "', project '"
283: + projectName + "'.");
284:
285: verifier = new DependencyDiagramVerifier(diagram, this .getLog());
286: }
287:
288: public void tearDown() {
289: closeAllModal();
290: org.netbeans.test.umllib.util.Utils.tearDown();
291: new EventTool().waitNoEvent(1000);
292:
293: //close opened diagrams
294: diagram.closeAllDocuments();
295:
296: new EventTool().waitNoEvent(1000);
297: }
298:
299: }
|