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: * If you wish your version of this file to be governed by only the CDDL
025: * or only the GPL Version 2, indicate your decision by adding
026: * "[Contributor] elects to include this software in this distribution
027: * under the [CDDL or GPL Version 2] license." If you do not indicate a
028: * single choice of license, a recipient has the option to distribute
029: * your version of this file under either the CDDL, the GPL Version 2 or
030: * to extend the choice of license to its licensees as provided above.
031: * However, if you add GPL Version 2 code and therefore, elected the GPL
032: * Version 2 license, then the option applies only if the new code is
033: * made subject to such option by the copyright holder.
034: *
035: * Contributor(s):
036: *
037: * Portions Copyrighted 2008 Sun Microsystems, Inc.
038: */
039: package org.netbeans.modules.ws.qaf;
040:
041: import java.io.IOException;
042: import junit.framework.TestSuite;
043: import junit.textui.TestRunner;
044: import org.netbeans.jellytools.Bundle;
045: import org.netbeans.junit.NbTestSuite;
046:
047: /**
048: *
049: * @author lukas
050: */
051: public class WebServiceSamplesTest extends WebServicesTestBase {
052:
053: private static boolean[] deployedApps = { false, false, false,
054: false };
055:
056: public WebServiceSamplesTest(String name) {
057: super (name);
058: }
059:
060: @Override
061: protected String getProjectName() {
062: return getName().substring(4);
063: }
064:
065: @Override
066: protected ProjectType getProjectType() {
067: return ProjectType.SAMPLE;
068: }
069:
070: @Override
071: protected String getSamplesCategoryName() {
072: return Bundle.getStringTrimmed(
073: "org.netbeans.modules.websvc.metro.samples.Bundle",
074: "Templates/Project/Samples/Metro");
075: }
076:
077: public void testCalculatorApp() throws IOException {
078: String sampleName = Bundle.getStringTrimmed(
079: "org.netbeans.modules.websvc.metro.samples.Bundle",
080: "Templates/Project/Samples/Metro/Calculator");
081: createProject(sampleName, getProjectType(), null);
082: deployProject("CalculatorApp"); //NOI18N
083: deployedApps[0] = true;
084: deployProject("CalculatorClientApp"); //NOI18N
085: deployedApps[1] = true;
086: }
087:
088: public void testSecureCalculatorApp() throws IOException {
089: String sampleName = Bundle.getStringTrimmed(
090: "org.netbeans.modules.websvc.metro.samples.Bundle",
091: "Templates/Project/Samples/Metro/SecureCalculator");
092: createProject(sampleName, getProjectType(), null);
093: deployProject("SecureCalculatorApp"); //NOI18N
094: deployedApps[2] = true;
095: deployProject("SecureCalculatorClientApp"); //NOI18N
096: deployedApps[3] = true;
097: }
098:
099: public void testUndeployAll() throws IOException {
100: if (deployedApps[0]) {
101: undeployProject("CalculatorApp"); //NOI18N
102: }
103: if (deployedApps[1]) {
104: undeployProject("CalculatorClientApp"); //NOI18N
105: }
106: if (deployedApps[2]) {
107: undeployProject("SecureCalculatorApp"); //NOI18N
108: }
109: if (deployedApps[3]) {
110: undeployProject("SecureCalculatorClientApp"); //NOI18N
111: }
112: }
113:
114: /** Creates suite from particular test cases. You can define order of testcases here. */
115: public static TestSuite suite() {
116: TestSuite suite = new NbTestSuite();
117: suite.addTest(new WebServiceSamplesTest("testCalculatorApp"));
118: suite.addTest(new WebServiceSamplesTest(
119: "testSecureCalculatorApp"));
120: suite.addTest(new WebServiceSamplesTest("testUndeployAll"));
121: return suite;
122: }
123:
124: /* Method allowing test execution directly from the IDE. */
125: public static void main(java.lang.String[] args) {
126: // run whole suite
127: TestRunner.run(suite());
128: }
129: }
|