1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
package test.wsdd;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.axis.configuration.XMLStringProvider;
import org.apache.axis.server.AxisServer;
import java.util.List;
public class TestGlobalConfiguration extends TestCase
{
static final String PARAM_NAME = "testParam";
static final String PARAM_VAL = "testValue";
static final String ROLE = "http://test-role1";
static final String ROLE2 = "http://test-role2";
String doc =
"<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\">\n" +
" <globalConfiguration>\n" +
" <parameter name=\"" + PARAM_NAME +
"\" value=\"" + PARAM_VAL + "\"/>\n" +
" <role>" + ROLE + "</role>\n" +
" <role>" + ROLE2 + "</role>\n" +
" </globalConfiguration>\n" +
"</deployment>";
public TestGlobalConfiguration (String name) {
super(name);
}
public static Test suite() {
return new TestSuite(TestGlobalConfiguration.class);
}
protected void setup() {
}
public void testEngineProperties() throws Exception
{
XMLStringProvider provider = new XMLStringProvider(doc);
AxisServer server = new AxisServer(provider);
Object optVal = server.getOption(PARAM_NAME);
assertNotNull("Option value was null!", optVal);
assertEquals("Option was not expected value", optVal, PARAM_VAL);
optVal = server.getOption("someOptionWhichIsntSet");
assertNull("Got value for bad option!", optVal);
List roles = server.getActorURIs();
assertTrue("Engine roles did not contain " + ROLE,
roles.contains(ROLE));
assertTrue("Engine roles did not contain " + ROLE2,
roles.contains(ROLE2));
}
public static void main(String[] args) throws Exception {
TestGlobalConfiguration tester = new TestGlobalConfiguration("foo");
tester.testEngineProperties();
}
}
|