websvc.restkit/test/qa-functional/src/org/netbeans/modules/ws/qaf/rest/JMakiTest.java
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common
8 * Development and Distribution License("CDDL") (collectively, the
9 * "License"). You may not use this file except in compliance with the
10 * License. You can obtain a copy of the License at
11 * http://www.netbeans.org/cddl-gplv2.html
12 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13 * specific language governing permissions and limitations under the
14 * License. When distributing the software, include this License Header
15 * Notice in each file and include the License file at
16 * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17 * particular file as subject to the "Classpath" exception as provided
18 * by Sun in the GPL Version 2 section of the License file that
19 * accompanied this code. If applicable, add the following below the
20 * License Header, with the fields enclosed by brackets [] replaced by
21 * your own identifying information:
22 * "Portions Copyrighted [year] [name of copyright owner]"
24 * If you wish your version of this file to be governed by only the CDDL
25 * or only the GPL Version 2, indicate your decision by adding
26 * "[Contributor] elects to include this software in this distribution
27 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28 * single choice of license, a recipient has the option to distribute
29 * your version of this file under either the CDDL, the GPL Version 2 or
30 * to extend the choice of license to its licensees as provided above.
31 * However, if you add GPL Version 2 code and therefore, elected the GPL
32 * Version 2 license, then the option applies only if the new code is
33 * made subject to such option by the copyright holder.
37 * Portions Copyrighted 2008 Sun Microsystems, Inc.
39 package org.netbeans.modules.ws.qaf.rest;
41 import junit.framework.Test;
42 import org.netbeans.jellytools.Bundle;
43 import org.netbeans.jellytools.NbDialogOperator;
44 import org.netbeans.jellytools.nodes.Node;
45 import org.netbeans.jemmy.operators.JButtonOperator;
46 import org.netbeans.jemmy.operators.JListOperator;
47 import org.netbeans.jemmy.operators.JTreeOperator;
48 import org.netbeans.junit.NbModuleSuite;
51 * Test jMaki client stub.
53 * Running of this test suite can be influenced by following system properties:
54 * "plugins.jmaki.skip=true"
55 * - skipping this suite and related preparation steps (un/installing of the jMaki plugin)
56 * "plugins.jmaki.nbm=/path/to/jmaki.nbm"
57 * - where to find jmaki.nbm (default is to download nbm from:
58 * https://ajax.dev.java.net/files/documents/3115/90944/org-netbeans-modules-sun-jmaki.nbm)
62 public class JMakiTest extends RestCStubsTest {
64 public JMakiTest(String name) {
69 public void setUp() throws Exception {
70 if (!Boolean.getBoolean("plugins.jmaki.skip")) {
73 Class.forName("org.netbeans.modules.sun.jmaki.Installer");
74 } catch (ClassNotFoundException ex) {
75 fail("jMaki is not installed.");
81 protected String getProjectName() {
82 return "JMakiClient"; //NOI18N
86 protected boolean useJMaki() {
91 * Test stubs creation from a foreign project
93 public void testCreateStubs() {
95 createStubs("FromEntities"); //NOI18N
99 * Dummy test for the case when we know that jMaki related tests will not run
101 public void testJMakiTestsSkipped() {
105 private void addJMakiFrameWork() {
106 // open project properties
107 getProjectRootNode().properties();
108 // "Project Properties"
109 String projectPropertiesTitle = Bundle.getStringTrimmed("org.netbeans.modules.web.project.ui.customizer.Bundle", "LBL_Customizer_Title");
110 NbDialogOperator propertiesDialogOper = new NbDialogOperator(projectPropertiesTitle);
111 // select "Frameworks" category
112 String frmLabel = Bundle.getStringTrimmed("org.netbeans.modules.web.project.ui.customizer.Bundle", "LBL_Config_Frameworks");
113 new Node(new JTreeOperator(propertiesDialogOper), frmLabel).select();
115 String addBtn = Bundle.getStringTrimmed("org.netbeans.modules.web.project.ui.customizer.Bundle", "LBL_AddFramework");
116 new JButtonOperator(propertiesDialogOper, addBtn).pushNoBlock();
118 String addFrameworkTitle = Bundle.getStringTrimmed("org.netbeans.modules.web.project.ui.customizer.Bundle", "LBL_SelectWebExtension_DialogTitle");
119 NbDialogOperator addFrameworkDialogOper = new NbDialogOperator(addFrameworkTitle);
120 new JListOperator(addFrameworkDialogOper).selectItem("jMaki"); //NOI18N
121 addFrameworkDialogOper.ok();
122 // confirm properties dialog
123 propertiesDialogOper.ok();
124 // if setting default server, it scans server jars; otherwise it continues immediatelly
129 * Creates suite from particular test cases. You can define order of testcases here.
131 public static Test suite() {
132 if (!Boolean.getBoolean("plugins.jmaki.skip")) { //NOI18N
133 return NbModuleSuite.create(addServerTests(NbModuleSuite.createConfiguration(JMakiTest.class),
137 ).enableModules(".*").clusters(".*"));
139 return NbModuleSuite.create(addServerTests(NbModuleSuite.createConfiguration(JMakiTest.class),
140 "testJMakiTestsSkipped"
141 ).enableModules(".*").clusters(".*"));