KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > deployment > impl > ServerInstanceTest


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.deployment.impl;
21
22 import junit.framework.*;
23 import org.netbeans.junit.*;
24
25 import javax.enterprise.deploy.spi.DeploymentManager JavaDoc;
26 import javax.enterprise.deploy.spi.Target JavaDoc;
27 import org.netbeans.modules.j2ee.deployment.plugins.api.ServerProgress;
28 import org.netbeans.tests.j2eeserver.plugin.jsr88.*;
29 import org.netbeans.modules.j2ee.deployment.impl.ui.*;
30 import org.openide.filesystems.*;
31
32 /**
33  *
34  * @author nn136682
35  */

36 public class ServerInstanceTest extends ServerRegistryTestBase {
37
38     public ServerInstanceTest(java.lang.String JavaDoc testName) {
39         super(testName);
40     }
41     
42     /**
43      * Test start instance make sure its running.
44      * Test stop instance make sure its stopped.
45      */

46     public void testStartStopInstance() throws java.io.IOException JavaDoc {
47         // setup
48
ServerRegistry registry = ServerRegistry.getInstance();
49         String JavaDoc url = "fooservice:testStartStopInstance";
50         registry.addInstance(url, "user", "password", "TestInstance");
51         ServerInstance instance = registry.getServerInstance(url);
52         ServerTarget target = instance.getServerTarget("Target 1");
53
54         //fail("");
55
}
56     
57     /**
58      * Test start target, case admin is also target make sure its started.
59      * Test stop target.
60      */

61 // public void testStartStopTarget() throws java.io.IOException {
62
// // setup
63
// ServerRegistry registry = ServerRegistry.getInstance();
64
// String url = "fooservice:testStartStopTarget";
65
// registry.addInstance(url, "user", "password", "TestInstance");
66
// ServerInstance instance = registry.getServerInstance(url);
67
// ServerTarget target = instance.getServerTarget("Target 1");
68
//
69
// // start target
70
// DeployProgressUI ui = new DeployProgressMonitor(false, true);
71
// ui.startProgressUI(10);
72
// boolean success = instance.startTarget(target.getTarget(), ui);
73
// ui.recordWork(10);
74
// if (! success)
75
// fail("Failed to start 'Target 1'");
76
// DepManager dm = (DepManager) instance.getDeploymentManager();
77
// if (dm.getState() != DepManager.RUNNING)
78
// fail("DepManager is not running after ServerInstance.startTarget() call!");
79
//
80
// /*
81
// // stop target
82
// ui = new DeployProgressMonitor(false, true);
83
// ui.startProgressUI(10);
84
// success = instance._test_stop(target.getTarget(), ui);
85
// ui.recordWork(10);
86
// if (! success)
87
// fail("Failed to stop target 'Target 1'");
88
// if (dm.getState() != DepManager.STOPPED)
89
// fail("DepManager is not stopped after ServerInstance.stopTarget() call");
90
// */
91
// // cleanup
92
// instance.remove();
93
// }
94
}
95
Popular Tags