Package org.apache.derby.drda

Examples of org.apache.derby.drda.NetworkServerControl


                serverHost.equalsIgnoreCase("localhost"));
       
        System.setProperty("derby.system.home", fullDbDirPath);
        System.setProperty("user.dir", fullDbDirPath);
       
        NetworkServerControl server = new NetworkServerControl(
                InetAddress.getByName(interfacesToListenOn), serverPort);
       
        server.start(null);
        pingServer(serverHost, serverPort, 150);
       
        Properties sp = server.getCurrentProperties();
        sp.setProperty("noSecurityManager",
                securityOption.equalsIgnoreCase("-noSecurityManager")?"true":"false");
        // derby.log for both master and slave ends up in masters system!
        // Both are run in the same VM! Not a good idea?
        return server;
View Full Code Here


   
    private void pingServer( String hostName, int port, int iterations)
    throws Exception
    {
        util.DEBUG("+++ pingServer");
        ping( new NetworkServerControl(InetAddress.getByName(hostName),port), iterations);
        util.DEBUG("--- pingServer");
    }
View Full Code Here

        return new InetSocketAddress(getHost(), getPort());
    }

    public void doStart() throws Exception {
        InetAddress address = InetAddress.getByName(host);
        network = new NetworkServerControl(address, port);
        network.start(null); // todo work out how to add this to our log stream
        log.debug("Started on host " + host + ':' + port);
    }
View Full Code Here

    }
   
  public void startDerbyInServerMode() {
    try {
            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
                    getPort(jdbcURl),
                    jdbcUser, jdbcPassword);
            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
            server.start(consoleWriter);
        } catch (IOException e) {
View Full Code Here

    }

    public static void startDerbyInServerMode() {
        try {
            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
                    getPort(jdbcURl),
                    jdbcUser, jdbcPassword);
            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
            server.start(consoleWriter);
        } catch (IOException e) {
View Full Code Here

    }

    public static void startDerbyInServerMode() {
        try {
            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
                    getPort(jdbcURl),
                    jdbcUser, jdbcPassword);
            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
            server.start(consoleWriter);
        } catch (IOException e) {
View Full Code Here

    }

    private void startDerbyInServerMode() {
        try {
            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
                    getPort(jdbcUrl),
                    jdbcUser, jdbcPassword);
            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
            server.start(consoleWriter);
        } catch (IOException e) {
View Full Code Here

     /**
     * @throws Exception
     */
    public void test_02_TraceCommands() throws Exception
    {
        NetworkServerControl nsctrl = NetworkServerTestSetup.getNetworkServerControl();
        String derbySystemHome = getSystemProperty("derby.system.home");
        nsctrl.setTraceDirectory(derbySystemHome);
      
        nsctrl.trace(true);
        nsctrl.ping();
        assertTrue(fileExists(derbySystemHome+"/Server3.trace"));
        nsctrl.trace(false);
       
        // now try on a directory where we don't have permission
        // this won't actually cause a failure until we turn on tracing.
        // assume we don't have permission to write to root.
        nsctrl.setTraceDirectory("/");
       
        // attempt to turn on tracing to location where we don't have permisson
        try {
            nsctrl.trace(true);
            fail("Should have gotten an exception turning on tracing");
        } catch (Exception e) {
            // expected exception
        }
        // make sure we can still ping
        nsctrl.ping();
   
                       
    }
View Full Code Here

     */
    public void test_03_Ping() throws Exception
    {
        String currentHost = TestConfiguration.getCurrent().getHostName();
       
        NetworkServerControl nsctrl = NetworkServerTestSetup.getNetworkServerControl();
        nsctrl.ping();
       
        // Note:Cannot test ping with unknown host because it fails in
        // InetAddress.getByName()
       
        nsctrl = new NetworkServerControl(privInetAddressGetByName(currentHost), 9393);
        try {       
          nsctrl.ping();
          fail("Should not have been able to ping on port 9393");
        }catch (Exception e){
          // expected exception
        }
    }
View Full Code Here

        return suite;
    }

     // test fixtures from maxthreads
    public void test_04_MaxThreads_0() throws Exception {
        NetworkServerControl server = new NetworkServerControl(InetAddress.getLocalHost(),TestConfiguration.getCurrent().getPort());
        String[] maxthreadsCmd1 = new String[]{"org.apache.derby.drda.NetworkServerControl",
                "maxthreads", "0","-p", String.valueOf(TestConfiguration.getCurrent().getPort())};
        // test maxthreads 0
        assertExecJavaCmdAsExpected(new String[]
                {"Max threads changed to 0."}, maxthreadsCmd1, 0);
        int maxValue = server.getMaxThreads();
        assertEquals("Fail! Max threads value incorrect!", 0, maxValue);
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.drda.NetworkServerControl

Copyright © 2018 www.massapicom. 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.