Changed tas to spaces
This commit is contained in:
parent
a938b70d57
commit
b1c53d88ae
196 changed files with 14016 additions and 14035 deletions
|
|
@ -28,12 +28,12 @@ import java.io.IOException;
|
|||
|
||||
|
||||
public class ServerFindClientTest {
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
ServerFindClient client = new ServerFindClient(2000);
|
||||
System.out.println(client.find().getHostAddress());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
ServerFindClient client = new ServerFindClient(2000);
|
||||
System.out.println(client.find().getHostAddress());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ import java.io.IOException;
|
|||
|
||||
|
||||
public class ServerFindServerTest {
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
new ServerFind(2000);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
new ServerFind(2000);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,41 +34,41 @@ import static org.junit.Assert.assertEquals;
|
|||
|
||||
public class HttpURLTest {
|
||||
|
||||
@Test
|
||||
public void fullURLTest() {
|
||||
HttpURL url = new HttpURL();
|
||||
url.setProtocol("http");
|
||||
assertEquals( "http://127.0.0.1/", url.getURL() );
|
||||
|
||||
url.setHost("koc.se");
|
||||
assertEquals( "http://koc.se/", url.getURL() );
|
||||
|
||||
url.setPort( 80 );
|
||||
assertEquals( "http://koc.se:80/", url.getURL() );
|
||||
|
||||
url.setPath("test/index.html");
|
||||
assertEquals( "http://koc.se:80/test/index.html", url.getURL() );
|
||||
|
||||
url.setParameter("key", "value");
|
||||
assertEquals( "http://koc.se:80/test/index.html?key=value", url.getURL() );
|
||||
|
||||
url.setAnchor( "anch" );
|
||||
assertEquals( "http://koc.se:80/test/index.html?key=value#anch", url.getURL() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void urlParameterTest() {
|
||||
HttpURL url = new HttpURL();
|
||||
url.setParameter("key1", "value1");
|
||||
assertEquals( "key1=value1", url.getParameterString() );
|
||||
|
||||
url.setParameter("key1", "value1");
|
||||
assertEquals( "key1=value1", url.getParameterString() );
|
||||
|
||||
url.setParameter("key2", "value2");
|
||||
assertThat(url.getParameterString(), allOf(containsString("key2=value2"), containsString("key1=value1")));
|
||||
@Test
|
||||
public void fullURLTest() {
|
||||
HttpURL url = new HttpURL();
|
||||
url.setProtocol("http");
|
||||
assertEquals( "http://127.0.0.1/", url.getURL() );
|
||||
|
||||
}
|
||||
url.setHost("koc.se");
|
||||
assertEquals( "http://koc.se/", url.getURL() );
|
||||
|
||||
url.setPort( 80 );
|
||||
assertEquals( "http://koc.se:80/", url.getURL() );
|
||||
|
||||
url.setPath("test/index.html");
|
||||
assertEquals( "http://koc.se:80/test/index.html", url.getURL() );
|
||||
|
||||
url.setParameter("key", "value");
|
||||
assertEquals( "http://koc.se:80/test/index.html?key=value", url.getURL() );
|
||||
|
||||
url.setAnchor( "anch" );
|
||||
assertEquals( "http://koc.se:80/test/index.html?key=value#anch", url.getURL() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void urlParameterTest() {
|
||||
HttpURL url = new HttpURL();
|
||||
url.setParameter("key1", "value1");
|
||||
assertEquals( "key1=value1", url.getParameterString() );
|
||||
|
||||
url.setParameter("key1", "value1");
|
||||
assertEquals( "key1=value1", url.getParameterString() );
|
||||
|
||||
url.setParameter("key2", "value2");
|
||||
assertThat(url.getParameterString(), allOf(containsString("key2=value2"), containsString("key1=value1")));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,37 +40,37 @@ import static zutil.net.http.HttpServer.SESSION_KEY_ID;
|
|||
|
||||
public class HttpGuessTheNumber implements HttpPage {
|
||||
|
||||
private static final String SESSION_KEY_NUMBER = "random_number";
|
||||
private static final String REQUEST_KEY_GUESS = "guess";
|
||||
private static final String COOKIE_KEY_LOW = "low";
|
||||
private static final String COOKIE_KEY_HIGH = "high";
|
||||
private static final String SESSION_KEY_NUMBER = "random_number";
|
||||
private static final String REQUEST_KEY_GUESS = "guess";
|
||||
private static final String COOKIE_KEY_LOW = "low";
|
||||
private static final String COOKIE_KEY_HIGH = "high";
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException{
|
||||
public static void main(String[] args) throws IOException{
|
||||
LogUtil.setGlobalLevel(Level.ALL);
|
||||
LogUtil.setGlobalFormatter(new CompactLogFormatter());
|
||||
|
||||
//HttpServer server = new HttpServer("localhost", 443, FileFinder.find("keySSL"), "rootroot");//SSL
|
||||
HttpServer server = new HttpServer(8080);
|
||||
server.setDefaultPage(new HttpGuessTheNumber());
|
||||
server.run();
|
||||
}
|
||||
HttpServer server = new HttpServer(8080);
|
||||
server.setDefaultPage(new HttpGuessTheNumber());
|
||||
server.run();
|
||||
}
|
||||
|
||||
public void respond(HttpPrintStream out,
|
||||
HttpHeader client_info,
|
||||
Map<String, Object> session,
|
||||
Map<String, String> cookie,
|
||||
Map<String, String> request) throws IOException {
|
||||
public void respond(HttpPrintStream out,
|
||||
HttpHeader client_info,
|
||||
Map<String, Object> session,
|
||||
Map<String, String> cookie,
|
||||
Map<String, String> request) throws IOException {
|
||||
|
||||
out.enableBuffering(true);
|
||||
out.println("<html>");
|
||||
out.println("<H2>Welcome To The Number Guess Game!</H2>");
|
||||
out.enableBuffering(true);
|
||||
out.println("<html>");
|
||||
out.println("<H2>Welcome To The Number Guess Game!</H2>");
|
||||
|
||||
String low = cookie.get(COOKIE_KEY_LOW);
|
||||
String high = cookie.get(COOKIE_KEY_HIGH);
|
||||
String low = cookie.get(COOKIE_KEY_LOW);
|
||||
String high = cookie.get(COOKIE_KEY_HIGH);
|
||||
|
||||
if(session.containsKey(SESSION_KEY_NUMBER)){
|
||||
if (request.containsKey(REQUEST_KEY_GUESS)) {
|
||||
if(session.containsKey(SESSION_KEY_NUMBER)){
|
||||
if (request.containsKey(REQUEST_KEY_GUESS)) {
|
||||
int guess = Integer.parseInt(request.get(REQUEST_KEY_GUESS));
|
||||
int number = (Integer) session.get(SESSION_KEY_NUMBER);
|
||||
|
||||
|
|
@ -93,26 +93,26 @@ public class HttpGuessTheNumber implements HttpPage {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
session.put(SESSION_KEY_NUMBER, (int)(Math.random()*99+1));
|
||||
low = "0";
|
||||
high = "100";
|
||||
}
|
||||
else{
|
||||
session.put(SESSION_KEY_NUMBER, (int)(Math.random()*99+1));
|
||||
low = "0";
|
||||
high = "100";
|
||||
out.setCookie(COOKIE_KEY_LOW, low);
|
||||
out.setCookie(COOKIE_KEY_HIGH, high);
|
||||
}
|
||||
}
|
||||
|
||||
out.println("<form method='post'>");
|
||||
out.println(low+" < X < "+high+"<br>");
|
||||
out.println("Guess a number between 0 and 100:<br>");
|
||||
out.println("<input type='text' name='guess'>");
|
||||
out.println("<input type='hidden' name='test' value='test'>");
|
||||
out.println("<input type='submit' value='Guess'>");
|
||||
out.println("</form>");
|
||||
out.println("<script>document.all.guess.focus();</script>");
|
||||
out.println("<b>DEBUG: session_id="+session.get(SESSION_KEY_ID)+"</b><br>");
|
||||
out.println("<b>DEBUG: number="+session.get(SESSION_KEY_NUMBER)+"</b><br>");
|
||||
out.println("</html>");
|
||||
}
|
||||
out.println("<form method='post'>");
|
||||
out.println(low+" < X < "+high+"<br>");
|
||||
out.println("Guess a number between 0 and 100:<br>");
|
||||
out.println("<input type='text' name='guess'>");
|
||||
out.println("<input type='hidden' name='test' value='test'>");
|
||||
out.println("<input type='submit' value='Guess'>");
|
||||
out.println("</form>");
|
||||
out.println("<script>document.all.guess.focus();</script>");
|
||||
out.println("<b>DEBUG: session_id="+session.get(SESSION_KEY_ID)+"</b><br>");
|
||||
out.println("<b>DEBUG: number="+session.get(SESSION_KEY_NUMBER)+"</b><br>");
|
||||
out.println("</html>");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,35 +38,35 @@ import java.util.logging.Level;
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
public class NetworkClientTest {
|
||||
public static void main(String[] args) throws NoSuchAlgorithmException, InterruptedException {
|
||||
try {
|
||||
public static void main(String[] args) throws NoSuchAlgorithmException, InterruptedException {
|
||||
try {
|
||||
//LogUtil.setGlobalLevel(Level.ALL);
|
||||
LogUtil.setGlobalFormatter(new CompactLogFormatter());
|
||||
|
||||
int count = 0;
|
||||
long time = System.currentTimeMillis()+1000*60;
|
||||
NioClient client = new NioClient(InetAddress.getByName("localhost"), 6056);
|
||||
StandardWorker worker = new StandardWorker(client);
|
||||
client.setDefaultWorker(worker);
|
||||
long time = System.currentTimeMillis()+1000*60;
|
||||
NioClient client = new NioClient(InetAddress.getByName("localhost"), 6056);
|
||||
StandardWorker worker = new StandardWorker(client);
|
||||
client.setDefaultWorker(worker);
|
||||
|
||||
Thread.sleep(1000);
|
||||
while(time > System.currentTimeMillis()){
|
||||
PrintResponseHandler handler = new PrintResponseHandler();
|
||||
worker.send(client.getRemoteAddress(),
|
||||
while(time > System.currentTimeMillis()){
|
||||
PrintResponseHandler handler = new PrintResponseHandler();
|
||||
worker.send(client.getRemoteAddress(),
|
||||
new StringResponseMessage("StringResponseMessage: "+count),
|
||||
handler);
|
||||
handler.waitForResponse();
|
||||
//Thread.sleep(100);
|
||||
//System.out.println("sending..");
|
||||
count++;
|
||||
}
|
||||
client.close();
|
||||
|
||||
System.out.println("Message Count 1m: "+count);
|
||||
System.out.println("Message Count 1s: "+count/60);
|
||||
System.exit(0);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
handler.waitForResponse();
|
||||
//Thread.sleep(100);
|
||||
//System.out.println("sending..");
|
||||
count++;
|
||||
}
|
||||
client.close();
|
||||
|
||||
System.out.println("Message Count 1m: "+count);
|
||||
System.out.println("Message Count 1s: "+count/60);
|
||||
System.exit(0);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,19 +35,19 @@ import java.util.logging.Level;
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
public class NetworkServerTest {
|
||||
public static void main(String[] args) throws NoSuchAlgorithmException, InterruptedException {
|
||||
try {
|
||||
//LogUtil.setGlobalLevel(Level.ALL);
|
||||
LogUtil.setGlobalFormatter(new CompactLogFormatter());
|
||||
public static void main(String[] args) throws NoSuchAlgorithmException, InterruptedException {
|
||||
try {
|
||||
//LogUtil.setGlobalLevel(Level.ALL);
|
||||
LogUtil.setGlobalFormatter(new CompactLogFormatter());
|
||||
|
||||
NioServer server = new NioServer(6056);
|
||||
server.setDefaultWorker(new StandardWorker(server));
|
||||
NioServer server = new NioServer(6056);
|
||||
server.setDefaultWorker(new StandardWorker(server));
|
||||
|
||||
while(true){
|
||||
Thread.sleep(1000);
|
||||
while(true){
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,41 +33,41 @@ import java.util.logging.Level;
|
|||
|
||||
|
||||
public class UpdateClientTest implements ProgressListener<UpdateClient, FileInfo>{
|
||||
public static void main(String[] args){
|
||||
LogUtil.setLevel("zutil", Level.FINEST);
|
||||
LogUtil.setFormatter("zutil", new CompactLogFormatter());
|
||||
|
||||
UpdateClientTest client = new UpdateClientTest();
|
||||
client.start();
|
||||
}
|
||||
|
||||
public void start(){
|
||||
try {
|
||||
final UpdateClient client = new UpdateClient("localhost", 2000, "C:\\Users\\Ziver\\Desktop\\client");
|
||||
client.setProgressListener(new Zupdater());
|
||||
|
||||
//client.setProgressListener(this);
|
||||
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Zupdater gui = new Zupdater();
|
||||
client.setProgressListener(gui);
|
||||
gui.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
client.update();
|
||||
client.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void main(String[] args){
|
||||
LogUtil.setLevel("zutil", Level.FINEST);
|
||||
LogUtil.setFormatter("zutil", new CompactLogFormatter());
|
||||
|
||||
public void progressUpdate(UpdateClient source, FileInfo info, double percent) {
|
||||
System.out.println(info+": "+percent+"%");
|
||||
}
|
||||
UpdateClientTest client = new UpdateClientTest();
|
||||
client.start();
|
||||
}
|
||||
|
||||
public void start(){
|
||||
try {
|
||||
final UpdateClient client = new UpdateClient("localhost", 2000, "C:\\Users\\Ziver\\Desktop\\client");
|
||||
client.setProgressListener(new Zupdater());
|
||||
|
||||
//client.setProgressListener(this);
|
||||
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Zupdater gui = new Zupdater();
|
||||
client.setProgressListener(gui);
|
||||
gui.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
client.update();
|
||||
client.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void progressUpdate(UpdateClient source, FileInfo info, double percent) {
|
||||
System.out.println(info+": "+percent+"%");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ import java.util.logging.Level;
|
|||
|
||||
|
||||
public class UpdateServerTest {
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
LogUtil.setGlobalLevel(Level.FINEST);
|
||||
LogUtil.setGlobalFormatter(new CompactLogFormatter());
|
||||
|
||||
new UpdateServer(2000, "C:\\Users\\Ziver\\Desktop\\server");
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
LogUtil.setGlobalLevel(Level.FINEST);
|
||||
LogUtil.setGlobalFormatter(new CompactLogFormatter());
|
||||
|
||||
new UpdateServer(2000, "C:\\Users\\Ziver\\Desktop\\server");
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,28 +36,28 @@ import java.io.IOException;
|
|||
|
||||
|
||||
public class UPnPServerTest {
|
||||
|
||||
public static void main(String[] args) throws IOException{
|
||||
UPnPMediaServer upnp = new UPnPMediaServer("http://192.168.0.60:8080/");
|
||||
MultiPrintStream.out.println("UPNP Server running");
|
||||
|
||||
UPnPContentDirectory cds = new UPnPContentDirectory(new File("C:\\Users\\Ziver\\Desktop\\lan"));
|
||||
WebServiceDef ws = new WebServiceDef( UPnPContentDirectory.class );
|
||||
|
||||
HttpServer http = new HttpServer(8080);
|
||||
//http.setDefaultPage(upnp);
|
||||
http.setPage("/RootDesc", upnp );
|
||||
http.setPage("/SCP/ContentDir", cds );
|
||||
SOAPHttpPage soap = new SOAPHttpPage(ws);
|
||||
soap.setObject( cds );
|
||||
soap.enableSession( false );
|
||||
http.setPage("/Action/ContentDir", soap );
|
||||
http.start();
|
||||
MultiPrintStream.out.println("HTTP Server running");
|
||||
|
||||
SSDPServer ssdp = new SSDPServer();
|
||||
ssdp.addService( upnp );
|
||||
ssdp.start();
|
||||
MultiPrintStream.out.println("SSDP Server running");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException{
|
||||
UPnPMediaServer upnp = new UPnPMediaServer("http://192.168.0.60:8080/");
|
||||
MultiPrintStream.out.println("UPNP Server running");
|
||||
|
||||
UPnPContentDirectory cds = new UPnPContentDirectory(new File("C:\\Users\\Ziver\\Desktop\\lan"));
|
||||
WebServiceDef ws = new WebServiceDef( UPnPContentDirectory.class );
|
||||
|
||||
HttpServer http = new HttpServer(8080);
|
||||
//http.setDefaultPage(upnp);
|
||||
http.setPage("/RootDesc", upnp );
|
||||
http.setPage("/SCP/ContentDir", cds );
|
||||
SOAPHttpPage soap = new SOAPHttpPage(ws);
|
||||
soap.setObject( cds );
|
||||
soap.enableSession( false );
|
||||
http.setPage("/Action/ContentDir", soap );
|
||||
http.start();
|
||||
MultiPrintStream.out.println("HTTP Server running");
|
||||
|
||||
SSDPServer ssdp = new SSDPServer();
|
||||
ssdp.addService( upnp );
|
||||
ssdp.start();
|
||||
MultiPrintStream.out.println("SSDP Server running");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,20 +36,20 @@ import java.util.logging.Level;
|
|||
// TODO: COnvert to JUnit
|
||||
public class SOAPClientTest {
|
||||
|
||||
public static void main(String[] args) throws InstantiationException, IllegalAccessException, MalformedURLException {
|
||||
LogUtil.setGlobalLevel(Level.ALL);
|
||||
LogUtil.setFormatter("", new CompactLogFormatter());
|
||||
|
||||
TestClient intf = SOAPClientFactory.createClient(new URL("http://localhost:3289"), TestClient.class);
|
||||
intf.m();
|
||||
intf.c();
|
||||
}
|
||||
|
||||
|
||||
public interface TestClient extends WSInterface{
|
||||
public void m();
|
||||
|
||||
public void c();
|
||||
public static void main(String[] args) throws InstantiationException, IllegalAccessException, MalformedURLException {
|
||||
LogUtil.setGlobalLevel(Level.ALL);
|
||||
LogUtil.setFormatter("", new CompactLogFormatter());
|
||||
|
||||
}
|
||||
TestClient intf = SOAPClientFactory.createClient(new URL("http://localhost:3289"), TestClient.class);
|
||||
intf.m();
|
||||
intf.c();
|
||||
}
|
||||
|
||||
|
||||
public interface TestClient extends WSInterface{
|
||||
public void m();
|
||||
|
||||
public void c();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,116 +37,116 @@ import zutil.parser.wsdl.WSDLWriter;
|
|||
// TODO: Convert to JUnit
|
||||
public class SOAPTest {
|
||||
/************************* TEST CASES ************************/
|
||||
public static void main(String[] args){
|
||||
WebServiceDef wsDef = new WebServiceDef( MainSOAPClass.class );
|
||||
SOAPHttpPage soap = new SOAPHttpPage( wsDef );
|
||||
public static void main(String[] args){
|
||||
WebServiceDef wsDef = new WebServiceDef( MainSOAPClass.class );
|
||||
SOAPHttpPage soap = new SOAPHttpPage( wsDef );
|
||||
|
||||
System.out.println( "****************** WSDL *********************" );
|
||||
WSDLWriter wsdl = new WSDLWriter( wsDef );
|
||||
wsdl.write(System.out);
|
||||
|
||||
// Response
|
||||
try {
|
||||
System.out.println( "\n****************** REQUEST *********************" );
|
||||
String request = "<?xml version=\"1.0\"?>\n" +
|
||||
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
|
||||
" <soap:Body xmlns:m=\"http://www.example.org/stock\">\n" +
|
||||
" <m:stringArrayMethod>\n" +
|
||||
" <m:StringName>IBM</m:StringName>\n" +
|
||||
" </m:stringArrayMethod>\n" +
|
||||
System.out.println( "****************** WSDL *********************" );
|
||||
WSDLWriter wsdl = new WSDLWriter( wsDef );
|
||||
wsdl.write(System.out);
|
||||
|
||||
" <m:simpleReturnClassMethod>\n" +
|
||||
" <m:byte>IBM</m:byte>\n" +
|
||||
" </m:simpleReturnClassMethod>\n" +
|
||||
" </soap:Body>\n" +
|
||||
"</soap:Envelope>";
|
||||
System.out.println(request);
|
||||
// Response
|
||||
try {
|
||||
System.out.println( "\n****************** REQUEST *********************" );
|
||||
String request = "<?xml version=\"1.0\"?>\n" +
|
||||
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
|
||||
" <soap:Body xmlns:m=\"http://www.example.org/stock\">\n" +
|
||||
" <m:stringArrayMethod>\n" +
|
||||
" <m:StringName>IBM</m:StringName>\n" +
|
||||
" </m:stringArrayMethod>\n" +
|
||||
|
||||
" <m:simpleReturnClassMethod>\n" +
|
||||
" <m:byte>IBM</m:byte>\n" +
|
||||
" </m:simpleReturnClassMethod>\n" +
|
||||
" </soap:Body>\n" +
|
||||
"</soap:Envelope>";
|
||||
System.out.println(request);
|
||||
System.out.println( "\n****************** EXECUTION *********************" );
|
||||
Document document = soap.genSOAPResponse(request);
|
||||
System.out.println( "\n****************** RESPONSE *********************" );
|
||||
Document document = soap.genSOAPResponse(request);
|
||||
System.out.println( "\n****************** RESPONSE *********************" );
|
||||
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
XMLWriter writer = new XMLWriter( System.out, format );
|
||||
writer.write( document );
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
XMLWriter writer = new XMLWriter( System.out, format );
|
||||
writer.write( document );
|
||||
|
||||
System.out.println();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/************************* TEST CLASSES ************************/
|
||||
@SuppressWarnings("unused")
|
||||
public static class SpecialReturnClass extends WSReturnObject{
|
||||
@WSValueName(value="otherValue1")
|
||||
public String param1 = "otherValue1";
|
||||
@WSValueName("otherName2")
|
||||
public String param2 = "otherValue2";
|
||||
public byte[] b = new byte[]{0x12, 0x23};
|
||||
public InnerClass inner = new InnerClass();
|
||||
}
|
||||
public static class SpecialReturnClass extends WSReturnObject{
|
||||
@WSValueName(value="otherValue1")
|
||||
public String param1 = "otherValue1";
|
||||
@WSValueName("otherName2")
|
||||
public String param2 = "otherValue2";
|
||||
public byte[] b = new byte[]{0x12, 0x23};
|
||||
public InnerClass inner = new InnerClass();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static class InnerClass extends WSReturnObject{
|
||||
public String innerClassParam1 = "innerClass1";
|
||||
public String innerClassParam2 = "innerClass2";
|
||||
}
|
||||
public static class InnerClass extends WSReturnObject{
|
||||
public String innerClassParam1 = "innerClass1";
|
||||
public String innerClassParam2 = "innerClass2";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static class SimpleReturnClass extends WSReturnObject{
|
||||
@WSValueName("otherParam1")
|
||||
public String param1 = "param1";
|
||||
public String param2 = "param2";
|
||||
}
|
||||
public static class SimpleReturnClass extends WSReturnObject{
|
||||
@WSValueName("otherParam1")
|
||||
public String param1 = "param1";
|
||||
public String param2 = "param2";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@WSNamespace("http://test.se:8080/")
|
||||
public static class MainSOAPClass implements WSInterface{
|
||||
public MainSOAPClass(){}
|
||||
|
||||
@WSHeader()
|
||||
@WSDocumentation("Documentation of method exceptionMethod()")
|
||||
public void exceptionMethod(
|
||||
@WSParamName(value="otherParam1", optional=true) int param1,
|
||||
@WSParamName(value="otherParam2", optional=true) int param2) throws Exception{
|
||||
System.out.println("Executing method: exceptionMethod(int param1="+param1+", int param2="+param2+",)");
|
||||
throw new Exception("This is an Exception");
|
||||
}
|
||||
@WSNamespace("http://test.se:8080/")
|
||||
public static class MainSOAPClass implements WSInterface{
|
||||
public MainSOAPClass(){}
|
||||
|
||||
@WSReturnName("stringArray")
|
||||
@WSParamDocumentation("Documentation of stringArrayMethod()")
|
||||
public String[][] stringArrayMethod (
|
||||
@WSParamName("StringName") String str) throws Exception{
|
||||
System.out.println("Executing method: stringArrayMethod(String str='"+str+"')");
|
||||
return new String[][]{{"test","test2"},{"test3","test4"}};
|
||||
}
|
||||
@WSHeader()
|
||||
@WSDocumentation("Documentation of method exceptionMethod()")
|
||||
public void exceptionMethod(
|
||||
@WSParamName(value="otherParam1", optional=true) int param1,
|
||||
@WSParamName(value="otherParam2", optional=true) int param2) throws Exception{
|
||||
System.out.println("Executing method: exceptionMethod(int param1="+param1+", int param2="+param2+",)");
|
||||
throw new Exception("This is an Exception");
|
||||
}
|
||||
|
||||
@WSReturnName("specialReturnClass")
|
||||
@WSParamDocumentation("Documentation of specialReturnMethod()")
|
||||
public SpecialReturnClass[] specialReturnMethod (
|
||||
@WSParamName("StringName2") String str) throws Exception{
|
||||
System.out.println("Executing method: specialReturnMethod(String str='"+str+"')");
|
||||
return new SpecialReturnClass[]{new SpecialReturnClass(), new SpecialReturnClass()};
|
||||
}
|
||||
@WSReturnName("stringArray")
|
||||
@WSParamDocumentation("Documentation of stringArrayMethod()")
|
||||
public String[][] stringArrayMethod (
|
||||
@WSParamName("StringName") String str) throws Exception{
|
||||
System.out.println("Executing method: stringArrayMethod(String str='"+str+"')");
|
||||
return new String[][]{{"test","test2"},{"test3","test4"}};
|
||||
}
|
||||
|
||||
@WSReturnName("SimpleReturnClass")
|
||||
@WSParamDocumentation("null is the kala")
|
||||
public SimpleReturnClass simpleReturnClassMethod (
|
||||
@WSParamName("byte") String lol) throws Exception{
|
||||
System.out.println("Executing method: simpleReturnClassMethod()");
|
||||
SimpleReturnClass tmp = new SimpleReturnClass();
|
||||
tmp.param1 = "newParam1";
|
||||
tmp.param2 = "newParam2";
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@WSParamDocumentation("void method documentation")
|
||||
public void voidMethod (){ }
|
||||
|
||||
@WSIgnore()
|
||||
public void disabledMethod(){ }
|
||||
protected void protectedMethod(){ }
|
||||
@WSReturnName("specialReturnClass")
|
||||
@WSParamDocumentation("Documentation of specialReturnMethod()")
|
||||
public SpecialReturnClass[] specialReturnMethod (
|
||||
@WSParamName("StringName2") String str) throws Exception{
|
||||
System.out.println("Executing method: specialReturnMethod(String str='"+str+"')");
|
||||
return new SpecialReturnClass[]{new SpecialReturnClass(), new SpecialReturnClass()};
|
||||
}
|
||||
|
||||
private void privateMethod(){ }
|
||||
}
|
||||
@WSReturnName("SimpleReturnClass")
|
||||
@WSParamDocumentation("null is the kala")
|
||||
public SimpleReturnClass simpleReturnClassMethod (
|
||||
@WSParamName("byte") String lol) throws Exception{
|
||||
System.out.println("Executing method: simpleReturnClassMethod()");
|
||||
SimpleReturnClass tmp = new SimpleReturnClass();
|
||||
tmp.param1 = "newParam1";
|
||||
tmp.param2 = "newParam2";
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@WSParamDocumentation("void method documentation")
|
||||
public void voidMethod (){ }
|
||||
|
||||
@WSIgnore()
|
||||
public void disabledMethod(){ }
|
||||
protected void protectedMethod(){ }
|
||||
|
||||
private void privateMethod(){ }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue