00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 package org.jaebi.test.server.core;
00012
00013 import org.jaebi.server.JAEBIServer;
00014 import org.jaebi.server.auth.Authenticator;
00015 import org.jaebi.server.auth.AuthenticatorImpl;
00016 import org.jaebi.server.auth.Session;
00017 import org.jaebi.server.exception.JAEBIServerExecException;
00018 import org.jaebi.server.exception.JAEBIServerInitException;
00019 import org.jaebi.server.exception.JAEBIServerUserRegistrationException;
00020 import org.jaebi.server.exception.JAEBIServerWrongSessionException;
00021
00026 public class MainTestJAEBIServer {
00027
00031 public static void main(String[] args) {
00032 String userNick = "Ivan";
00033 Session session;
00034 Authenticator authenticator;
00035 JAEBIServer coreServer = null;
00036 String request = "<xrequest xmlns='http://xml.netbeans.org/examples/targetNS' " +
00037 " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
00038 " xsi:schemaLocation='http://xml.netbeans.org/examples/targetNS xrequest.xsd' " +
00039 " type=\"select\">" +
00040 " <table>tabella001</table>" +
00041 "</xrequest>";
00042 String response = null;
00043
00044 authenticator = new AuthenticatorImpl();
00045 session = authenticator.getAuthentication(userNick);
00046
00047 try {
00048 coreServer = new JAEBIServer();
00049 coreServer.registerNewUser(userNick, session, "jsp");
00050 response = coreServer.executeRequest(session, request);
00051 } catch ( JAEBIServerInitException jsie ) {
00052 jsie.printStackTrace();
00053 } catch ( JAEBIServerUserRegistrationException ure ) {
00054 ure.printStackTrace();
00055 } catch ( JAEBIServerExecException jsee ) {
00056 jsee.printStackTrace();
00057 } catch ( JAEBIServerWrongSessionException jswse ) {
00058 jswse.printStackTrace();
00059 }
00060
00061 System.out.println("RESULT: \n" + response);
00062
00063 System.out.println("PWD: " + System.getProperty("user.dir") );
00064 System.out.println("SESSION HASHCODE: " + session.hashCode() );
00065
00066
00067 }
00068
00069 }