KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > core > client > wizard > WebServiceClientCreatorTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.core.client.wizard;
21
22 import java.io.File JavaDoc;
23 import java.io.IOException JavaDoc;
24 import org.netbeans.api.project.FileOwnerQuery;
25 import org.netbeans.api.project.Project;
26 import org.netbeans.junit.MockServices;
27 import org.netbeans.junit.NbTestCase;
28 import org.netbeans.modules.websvc.core.ClientCreator;
29 import org.netbeans.modules.websvc.core.ClientWizardProperties;
30 import org.netbeans.modules.websvc.core.CreatorProvider;
31 import org.netbeans.modules.websvc.core.testutils.RepositoryImpl;
32 import org.openide.WizardDescriptor;
33 import org.openide.WizardDescriptor.Panel;
34 import org.openide.filesystems.FileObject;
35 import org.openide.filesystems.FileUtil;
36
37 /**
38  *
39  * @author Lukas Jungmann
40  */

41 public class WebServiceClientCreatorTest extends NbTestCase {
42     
43     private WizardDescriptor wd;
44     
45     public WebServiceClientCreatorTest(String JavaDoc testName) {
46         super(testName);
47     }
48     
49     protected void setUp() throws Exception JavaDoc {
50         clearWorkDir();
51     }
52     
53     protected void tearDown() throws Exception JavaDoc {
54     }
55     
56     public void testJ2SEonJdk6() throws Exception JavaDoc {
57         System.setProperty("websvc.core.test.repo.root", this.getWorkDirPath());
58         MockServices.setServices(RepositoryImpl.class);
59         File JavaDoc projectRoot = new File JavaDoc(getDataDir(), "projects/j2se_16");
60         FileObject projectDir = FileUtil.toFileObject(FileUtil.normalizeFile(projectRoot));
61         Project p = FileOwnerQuery.getOwner(projectDir);
62         assert p != null : "null Project";
63         wd = new WizardDescriptor(new Panel[] {new WebServiceClientWizardDescriptor()});
64           
65         wd.putProperty(ClientWizardProperties.JAX_VERSION, ClientWizardProperties.JAX_WS);
66         wd.putProperty(ClientWizardProperties.WSDL_FILE_PATH, FileUtil.normalizeFile(new File JavaDoc(getDataDir(), "wsdl/MyWebService.wsdl")).getAbsolutePath());
67         wd.putProperty(ClientWizardProperties.WSDL_PACKAGE_NAME, "client.jaxws");
68         ClientCreator creator = CreatorProvider.getClientCreator(p, wd);
69         if (creator!=null) {
70             try {
71                 creator.createClient();
72             } catch (IOException JavaDoc ex) {
73                 ex.printStackTrace();
74             }
75             ((JaxWsClientCreator)creator).task.waitFinished();
76         }
77         //some checks...
78

79     }
80     
81     /**
82      * Test of create method, of class org.netbeans.modules.websvc.core.client.wizard.WebServiceClientCreator.
83      */

84     public void testCreate() {
85 // Thread.yield();
86
// System.out.println("create");
87

88 // org.netbeans.modules.websvc.core.client.wizard.WebServiceClientCreator instance = null;
89
//
90
// Set expResult = null;
91
// Set result = instance.create();
92
// assertEquals(expResult, result);
93
//
94
// TODO review the generated test code and remove the default call to fail.
95
// fail("The test case is a prototype.");
96
}
97     
98     /**
99      * Test of getJavaSourceGroups method, of class org.netbeans.modules.websvc.core.client.wizard.WebServiceClientCreator.
100      */

101     public void testGetJavaSourceGroups() {
102 // System.out.println("getJavaSourceGroups");
103

104 // Project project = null;
105
//
106
// SourceGroup[] expResult = null;
107
// SourceGroup[] result = org.netbeans.modules.websvc.core.client.wizard.WebServiceClientCreator.getJavaSourceGroups(project);
108
// assertEquals(expResult, result);
109

110         // TODO review the generated test code and remove the default call to fail.
111
// fail("The test case is a prototype.");
112
}
113     
114 }
115
Popular Tags