KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > archive > xtests > CreateProjectsTest


1 /*
2  * CreateFromEar.java
3  *
4  * Created on June 5, 2006, 3:45 PM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package org.netbeans.modules.j2ee.archive.xtests;
11
12 import java.io.File JavaDoc;
13 import java.io.IOException JavaDoc;
14 import org.netbeans.api.project.Project;
15 import org.netbeans.api.project.ProjectManager;
16 import org.netbeans.junit.NbTestCase;
17 import org.netbeans.junit.NbTestSuite;
18 import org.netbeans.modules.j2ee.archive.project.ArchiveProjectProperties;
19 import org.netbeans.modules.j2ee.archive.ui.JavaEePlatformUiSupport;
20 import org.netbeans.modules.j2ee.archive.wizard.*;
21 import org.netbeans.spi.project.ui.CustomizerProvider;
22 import org.netbeans.spi.project.ui.support.ProjectChooser;
23 import org.openide.WizardDescriptor;
24 import org.openide.filesystems.FileObject;
25 import org.openide.filesystems.FileUtil;
26
27 /**
28  *
29  * @author vbk
30  */

31 public class CreateProjectsTest extends NbTestCase {
32     
33     /** Creates a new instance of CreateFromEar */
34     public CreateProjectsTest(String JavaDoc testName) {
35         super(testName);
36     }
37     
38     public void createFromOne4Ear() {
39         TestUtil.createProjectFromArchive("jbearwebbean.ear",
40                 ArchiveProjectProperties.PROJECT_TYPE_VALUE_EAR,15000);
41         File JavaDoc f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "jbearwebbean.ear");
42         if (!f.exists())
43             fail("directory missing: "+f.getAbsolutePath());
44         Project p = null;
45         try {
46             p = ProjectManager.getDefault().findProject(FileUtil.toFileObject(f));
47         } catch (IllegalArgumentException JavaDoc ex) {
48             fail(ex.getMessage());
49         } catch (IOException JavaDoc ex) {
50             fail(ex.getMessage());
51         }
52         CustomizerProvider cp =
53                 (CustomizerProvider) p.getLookup().lookup(CustomizerProvider.class);
54         //cp.
55
}
56     
57     public void createFromBadOne4Ear() {
58         TestUtil.createProjectFromArchive("BADcmpcustomer.ear",
59                 ArchiveProjectProperties.PROJECT_TYPE_VALUE_EAR,20000);
60         File JavaDoc f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "BADcmpcustomer.ear");
61         if (f.exists())
62             fail("directory wasn't deleted: "+f.getAbsolutePath());
63     }
64
65     public void createFromFiveEar() {
66         TestUtil.createProjectFromArchive("noddjavaee5.ear",
67                 ArchiveProjectProperties.PROJECT_TYPE_VALUE_EAR,15000);
68         File JavaDoc f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "noddjavaee5.ear");
69         if (!f.exists())
70             fail("directory missing: "+f.getAbsolutePath());
71     }
72
73     public void createFromOne4EjbJar() {
74         TestUtil.createProjectFromArchive("jbrejb14.jar",
75                 ArchiveProjectProperties.PROJECT_TYPE_VALUE_JAR,20000);
76         File JavaDoc f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "jbrejb14.jar");
77         if (!f.exists())
78             fail("directory missing: "+f.getAbsolutePath());
79         f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "jbrejb14.jar" +
80                 File.separator + "tmpproj" + File.separator + "src" + File.separator +
81                 "conf" + File.separator + "sun-ejb-jar.xml");
82         if (!f.exists())
83             fail("descriptor missing: "+f.getAbsolutePath());
84         if (f.length() < 300)
85             fail("descriptor is too short: "+f.length());
86             
87     }
88
89     public void createFromOne4War() {
90         TestUtil.createProjectFromArchive("tcwa14.war",
91                 ArchiveProjectProperties.PROJECT_TYPE_VALUE_WAR,15000);
92         File JavaDoc f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "tcwa14.war");
93         if (!f.exists())
94             fail("directory missing: "+f.getAbsolutePath());
95         f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "tcwa14.war" +
96                 File.separator + "tmpproj" + File.separator + "web" + File.separator +
97                 "WEB-INF" + File.separator + "sun-web.xml");
98         if (!f.exists())
99             fail("descriptor missing: "+f.getAbsolutePath());
100         if (f.length() < 300)
101             fail("descriptor is too short: "+f.length());
102     }
103
104     public void createFromRar() {
105         TestUtil.createProjectFromArchive("mailconnector.rar",
106                 ArchiveProjectProperties.PROJECT_TYPE_VALUE_RAR,15000);
107         File JavaDoc f = new File JavaDoc(System.getProperty("xtest.tmpdir") + File.separator + "mailconnector.rar");
108         if (!f.exists())
109             fail("directory missing: "+f.getAbsolutePath());
110     }
111
112     public static NbTestSuite suite() {
113         NbTestSuite suite = new NbTestSuite("CreateProjectsTest");
114         suite.addTest(new AddRemoveSjsasInstance4Test("addSjsasInstance"));
115         suite.addTest(new CreateProjectsTest("createFromOne4Ear"));
116         suite.addTest(new CreateProjectsTest("createFromBadOne4Ear"));
117         suite.addTest(new CreateProjectsTest("createFromFiveEar"));
118         suite.addTest(new CreateProjectsTest("createFromOne4EjbJar"));
119         suite.addTest(new CreateProjectsTest("createFromOne4War"));
120         suite.addTest(new CreateProjectsTest("createFromRar"));
121         return suite;
122     }
123 }
124
Popular Tags