Package com.mobixess.jodb.tests.clientserver

Source Code of com.mobixess.jodb.tests.clientserver.StartServer

/*
Copyright (C) 2007  Mobixess Inc. http://www.java-objects-database.com

This file is part of the JODB (Java Objects Database) open source project.

JODB is free software; you can redistribute it and/or modify it under
the terms of version 2 of the GNU General Public License as published
by the Free Software Foundation.

JODB is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package com.mobixess.jodb.tests.clientserver;

import java.io.File;
import java.io.IOException;

import com.mobixess.jodb.core.JODB;
import com.mobixess.jodb.core.JodbIOException;
import com.mobixess.jodb.core.io.IOTicket;
import com.mobixess.jodb.core.io.rmi.JODBIOBaseProxy;
import com.mobixess.jodb.tests.SimpleAddTest;

public class StartServer {
   
    private static String TEST_DATA_DIR = "./testData/ClientServerTests/";
    private static int _testCounter = 0;

    /**
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        serverStart();
        runClient();
        while (true) {
           
        }
    }
   
    private static void serverStart() throws IOException{
        File testFileDir = new File(TEST_DATA_DIR);
        testFileDir.mkdirs();
        File testFile = new File(testFileDir,SimpleAddTest.class.getSimpleName()+(_testCounter++)+".jdb");
        testFile.delete();
        JODB.openServer(testFile);
    }
   
    private static void runClient() throws Exception{
        JODBIOBaseProxy baseProxy = new JODBIOBaseProxy(JODBIOBaseProxy.composeURI("//localhost",null));
        IOTicket ticket = baseProxy.getIOTicket(true, false);
        System.err.println(" "+ticket);
    }

}
TOP

Related Classes of com.mobixess.jodb.tests.clientserver.StartServer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.