KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > test > DomainEditorTest


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.j2ee.sun.test;
21
22 import java.io.File JavaDoc;
23 import javax.enterprise.deploy.spi.DeploymentManager JavaDoc;
24 import org.netbeans.junit.NbTestCase;
25 import org.netbeans.junit.NbTestSuite;
26 import org.netbeans.modules.j2ee.deployment.impl.ServerInstance;
27 import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry;
28 import org.netbeans.modules.j2ee.sun.ide.j2ee.DomainEditor;
29 import org.netbeans.modules.j2ee.sun.ide.j2ee.HttpProxyUpdater;
30 import org.netbeans.modules.j2ee.sun.ide.j2ee.ui.AddDomainWizardIterator;
31 import org.openide.WizardDescriptor;
32 import org.openide.WizardDescriptor.Panel;
33 import org.w3c.dom.Document JavaDoc;
34
35 /**
36  *
37  * @author Michal Mocnak
38  */

39 public class DomainEditorTest extends NbTestCase {
40     
41     private final int SLEEP = 10000;
42     
43     public DomainEditorTest(String JavaDoc testName) {
44         super(testName);
45     }
46     
47     public void poundOnEditor() {
48         ServerInstance inst = ServerRegistry.getInstance().getServerInstance(Util._URL);
49         DeploymentManager JavaDoc dm = inst.getDeploymentManager();
50         DomainEditor de = new DomainEditor(dm);
51         
52         String JavaDoc loc = de.getDomainLocation();
53         Document JavaDoc doc = de.getDomainDocument();
54         Document JavaDoc doc2 = de.getDomainDocument(loc);
55         de.addProfilerElements(doc,"/foo/bar/bas", new String JavaDoc[] { "aaaaaaaaaa", "bbbbbbbbbb", "ccccccccccc"});
56         de.removeProfilerElements(doc);
57         String JavaDoc oldProxyValues[] = de.getHttpProxyOptions();
58         String JavaDoc foo[] = new String JavaDoc[] {
59             HttpProxyUpdater.HTTPS_PROXY_HOST+"yyyyyyyyy",
60             HttpProxyUpdater.HTTP_PROXY_HOST+"zzzzzzzzz" };
61         de.setHttpProxyOptions(foo);
62         String JavaDoc tmp[] = de.getHttpProxyOptions();
63         de.setHttpProxyOptions(oldProxyValues);
64         if (tmp == null || tmp.length != 2) {
65             fail("not right length");
66         }
67         if (!foo[0].equals(tmp[0]) && !foo[0].equals(tmp[1])) {
68             fail(foo[0]);
69         }
70         if (!foo[1].equals(tmp[0]) && !foo[1].equals(tmp[1])) {
71             fail(foo[1]);
72         }
73         de.getSunDatasourcesFromXml();
74         de.getConnPoolsFromXml();
75         
76     }
77     public static NbTestSuite suite() {
78         NbTestSuite suite = new NbTestSuite("DomainEditorTest");
79         suite.addTest(new AddRemoveSjsasInstanceTest("addSjsasInstance"));
80         suite.addTest(new DomainEditorTest("poundOnEditor"));
81         suite.addTest(new AddRemoveSjsasInstanceTest("removeSjsasInstance"));
82         return suite;
83     }
84 }
Popular Tags