db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r327018 - in /db/derby/code/branches/10.1/java: drda/org/apache/derby/drda/ drda/org/apache/derby/impl/drda/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/derbynet/ testing/org/apa...
Date Thu, 20 Oct 2005 22:39:21 GMT
Author: kmarsden
Date: Thu Oct 20 15:39:09 2005
New Revision: 327018

URL: http://svn.apache.org/viewcvs?rev=327018&view=rev
Log:
DERBY-375 - Specification of incomplete server properties on command line causes NPE with
NetworkServerControl when starting the server.
merge from trunk
DERBY-613 - Change default tracing location to derby.system.home

svn merge -r 321273:321274 https://svn.apache.org/repos/asf/db/derby/code/trunk
svn merge -r 326288:326289 https://svn.apache.org/repos/asf/db/derby/code/trunk

Contributed by Deepa Remesh



Added:
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_sed.properties
  (props changed)
      - copied unchanged from r321274, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_sed.properties
Modified:
    db/derby/code/branches/10.1/java/drda/org/apache/derby/drda/NetworkServerControl.java
    db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/testProperties.out
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo_sed.properties
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy

Modified: db/derby/code/branches/10.1/java/drda/org/apache/derby/drda/NetworkServerControl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/drda/org/apache/derby/drda/NetworkServerControl.java?rev=327018&r1=327017&r2=327018&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/drda/org/apache/derby/drda/NetworkServerControl.java
(original)
+++ db/derby/code/branches/10.1/java/drda/org/apache/derby/drda/NetworkServerControl.java
Thu Oct 20 15:39:09 2005
@@ -87,7 +87,8 @@
 	This changes where new trace files will be placed. 
 	For sessions with tracing already turned on,  
 	trace files remain in the previous location. 
-	Default is clousdcape.system.home</LI>
+	Default is derby.system.home, if it is set. 
+	Otherwise the default is the current directory.</LI>
 
 	</UL>
 	<P>Properties can be set in the derby.properties file or on the command line.

Modified: db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?rev=327018&r1=327017&r2=327018&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Thu Oct 20 15:39:09 2005
@@ -292,8 +292,8 @@
 	// constructor
 	public NetworkServerControlImpl() throws Exception
 	{
-		getPropertyInfo();
 		init();
+		getPropertyInfo();
     }
 
 
@@ -306,12 +306,12 @@
 	 */
 	public NetworkServerControlImpl(InetAddress address, int portNumber) throws Exception
 	{
+		init();
 		getPropertyInfo();
 		this.hostAddress = address;
 		this.portNumber = (portNumber <= 0) ?
 			this.portNumber: portNumber;
 		this.hostArg = address.getHostAddress();
-		init();
 	}
 
     private void init() throws Exception
@@ -2456,29 +2456,51 @@
 															  "true"))  
 			setTraceAll(true);
 
-		setTraceDirectory(PropertyUtil.getSystemProperty( 
-			Property.DRDA_PROP_TRACEDIRECTORY));
+		//If the derby.system.home property has been set, it is the default. 
+		//Otherwise, the default is the current directory. 
+		//If derby.system.home is not set, directory will be null and trace files will get
+		//created in current directory.
+		propval = PropertyUtil.getSystemProperty(Property.DRDA_PROP_TRACEDIRECTORY,directory);
+		if(propval != null){
+			if(propval.equals(""))
+				propval = directory;
+			setTraceDirectory(propval);
+		}
 
+		//DERBY-375 If a system property is specified without any value, getProperty returns 
+		//an empty string. Use default values in such cases.
 		propval = PropertyUtil.getSystemProperty( 
 			Property.DRDA_PROP_MINTHREADS);
-		if (propval != null)
+		if (propval != null){
+			if(propval.equals(""))
+				propval = "0";
 			setMinThreads(getIntPropVal(Property.DRDA_PROP_MINTHREADS, propval));
+		}
 
 		propval = PropertyUtil.getSystemProperty( 
 			Property.DRDA_PROP_MAXTHREADS);
-		if (propval != null)
+		if (propval != null){
+			if(propval.equals(""))
+				propval = "0";
 			setMaxThreads(getIntPropVal(Property.DRDA_PROP_MAXTHREADS, propval));
+		}
 
 
 		propval = PropertyUtil.getSystemProperty( 
 			Property.DRDA_PROP_TIMESLICE);
-		if (propval != null)
+		if (propval != null){
+			if(propval.equals(""))
+				propval = "0";
 			setTimeSlice(getIntPropVal(Property.DRDA_PROP_TIMESLICE, propval));
+		}
 
 		propval = PropertyUtil.getSystemProperty( 
 			Property.DRDA_PROP_PORTNUMBER);
-		if (propval != null)
+		if (propval != null){
+			if(propval.equals(""))
+				propval = String.valueOf(NetworkServerControl.DEFAULT_PORTNUMBER);
 			portNumber = getIntPropVal(Property.DRDA_PROP_PORTNUMBER, propval);
+		}
 
 		propval = PropertyUtil.getSystemProperty( 
 			Property.DRDA_PROP_KEEPALIVE);
@@ -2488,9 +2510,12 @@
 		
 		propval = PropertyUtil.getSystemProperty( 
 			Property.DRDA_PROP_HOSTNAME);
-		if (propval != null)
-			hostArg = propval;
-
+		if (propval != null){
+			if(propval.equals(""))
+				hostArg = DEFAULT_HOST; 
+			else
+				hostArg = propval;
+		}	
 		propval = PropertyUtil.getSystemProperty(
 						 NetworkServerControlImpl.DRDA_PROP_DEBUG);
 		if (propval != null  && StringUtil.SQLEqualsIgnoreCase(propval, "true"))
@@ -3222,6 +3247,11 @@
 		retval.put(Property.DRDA_PROP_TIMESLICE, new  Integer(getTimeSlice()).toString());
 		retval.put(Property.DRDA_PROP_LOGCONNECTIONS, new Boolean(getLogConnections()).toString());
 		String startDRDA = PropertyUtil.getSystemProperty(Property.START_DRDA);
+		//DERBY-375 If a system property is specified without any value, getProperty returns 
+		//an empty string. Use default values in such cases.
+		if(startDRDA!=null && startDRDA.equals(""))
+			startDRDA = "false";
+		
 		retval.put(Property.START_DRDA, (startDRDA == null)? "false" : startDRDA);
 
 		//get the trace value for each session if tracing for all is not set

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/testProperties.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/testProperties.out?rev=327018&r1=327017&r2=327018&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/testProperties.out
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/testProperties.out
Thu Oct 20 15:39:09 2005
@@ -14,4 +14,22 @@
 Successfully Connected
 org.apache.derby.drda.NetworkServerControl shutdown -p 1530 
 Shutdown successful.
+Testing start server by specifying system properties without values
+First shutdown server started on default port by the test harness
+org.apache.derby.drda.NetworkServerControl shutdown -p 1527 
+Shutdown successful.
+-Dderby.drda.logConnections -Dderby.drda.traceAll -Dderby.drda.traceDirectory -Dderby.drda.keepAlive
-Dderby.drda.timeSlice -Dderby.drda.host -Dderby.drda.portNumber -Dderby.drda.minThreads -Dderby.drda.maxThreads
-Dderby.drda.startNetworkServer -Dderby.drda.debug org.apache.derby.drda.NetworkServerControl
start 
+-- listing properties --
+derby.drda.maxThreads=0
+derby.drda.keepAlive=true
+derby.drda.minThreads=0
+derby.drda.portNumber=1527
+derby.drda.logConnections=false
+derby.drda.timeSlice=0
+derby.drda.startNetworkServer=false
+derby.drda.host=localhost
+derby.drda.traceAll=false
+Successfully Connected
+org.apache.derby.drda.NetworkServerControl shutdown -p 1527 
+Shutdown successful.
 End test

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant?rev=327018&r1=327017&r2=327018&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
Thu Oct 20 15:39:09 2005
@@ -7,6 +7,7 @@
 dataSourcePermissions_net_sed.properties
 default_app.properties
 default_derby.properties
+getCurrentProperties_sed.properties
 runtimeinfo_sed.properties
 sysinfo_sed.properties
 testij.sql

Propchange: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_sed.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo_sed.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo_sed.properties?rev=327018&r1=327017&r2=327018&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo_sed.properties
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo_sed.properties
Thu Oct 20 15:39:09 2005
@@ -1 +1 @@
-delete=Version,version,Java,OS,[0-9*].[0-9*].[0-9*],JRE - JDBC
+delete=Version,version,Java,OS,[0-9*].[0-9*].[0-9*],JRE - JDBC,traceDirectory

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java?rev=327018&r1=327017&r2=327018&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
Thu Oct 20 15:39:09 2005
@@ -42,6 +42,9 @@
 	   default
 
 	   The command line should take precedence
+
+	It also tests start server by specifying system properties without values.
+	In this case the server will use default values.
 */
 
 public class testProperties
@@ -52,6 +55,21 @@
 	private static Vector vCmd;
     private static  BufferedOutputStream bos = null;
 
+    //Command to start server specifying system properties without values
+    private static String[] startServerCmd =
+					new String[] {  "-Dderby.drda.logConnections",
+    								"-Dderby.drda.traceAll",
+									"-Dderby.drda.traceDirectory",
+									"-Dderby.drda.keepAlive",
+									"-Dderby.drda.timeSlice",
+									"-Dderby.drda.host",
+									"-Dderby.drda.portNumber",
+									"-Dderby.drda.minThreads",
+									"-Dderby.drda.maxThreads",
+									"-Dderby.drda.startNetworkServer",
+									"-Dderby.drda.debug",
+									"org.apache.derby.drda.NetworkServerControl",
+									"start"};
 
 	/**
 	 * Execute the given command and dump the results to standard out
@@ -160,6 +178,14 @@
         }
 	}
 
+	private static void listProperties(String portString) throws Exception{
+		int port = Integer.parseInt(portString);
+		NetworkServerControl derbyServer = new NetworkServerControl( InetAddress.getByName("localhost"),
+													port);
+		Properties p = derbyServer.getCurrentProperties();
+		p.list(System.out);
+	}
+
 	public static void main (String args[]) throws Exception
 	{
 		if ((System.getProperty("java.vm.name") != null) && System.getProperty("java.vm.name").equals("J9"))
@@ -204,6 +230,22 @@
 			System.out.println("Successfully Connected");
 			//shutdown - with command line option
 			derbyServerCmd("shutdown","1530");
+
+			/**********************************************************************
+			 *  Test start server specifying system properties without values
+			 *********************************************************************/
+			System.out.println("Testing start server by specifying system properties without values");
+			System.out.println("First shutdown server started on default port by the test harness");
+
+			//Shutdown the server started by test
+			derbyServerCmd("shutdown","1527");
+			execCmd(startServerCmd);
+			waitForStart("1527",15000);
+			//check that default properties are used
+			listProperties("1527");
+			System.out.println("Successfully Connected");
+			derbyServerCmd("shutdown","1527");
+
 			System.out.println("End test");
 			bos.close();
 		}

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy?rev=327018&r1=327017&r2=327018&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
Thu Oct 20 15:39:09 2005
@@ -50,10 +50,8 @@
   permission java.net.SocketPermission "${csinfo.serverhost}", "accept";
   permission java.net.SocketPermission "${csinfo.trustedhost}", "accept";
     
-  // tracing files - BUG DERBY-613 default location for tracing
-  // file is meant to be ${derby.system.home} but instead is ${user.dir}
-  // Changes DERBY-613 may require modifying this permission.
-  permission java.io.FilePermission "${user.dir}${/}*", "write";  
+  // tracing files default to derby.system.home, derbynet/getCurrentProperties.java 
+  permission java.io.FilePermission "${derby.system.home}${/}*", "write";  
   
   // BUG DERBY-622 derbynet/sysinfo.java
   permission java.io.FilePermission "${csinfo.codedir}${/}*", "read";
@@ -65,6 +63,8 @@
   permission java.util.PropertyPermission "derby.monitor.verbose", "read";
   permission java.util.PropertyPermission "derby.debug.*", "read";
   
+  // sane=true, jdbcapi/secureUsers1.sql
+  permission java.io.FilePermission "${user.dir}${/}CloudLDAP.out", "write"; 
 };
 
 //
@@ -85,15 +85,13 @@
   permission java.net.SocketPermission "${csinfo.serverhost}", "accept";
   permission java.net.SocketPermission "${csinfo.trustedhost}", "accept";   
 
-  // tracing files - BUG DERBY-613 default location for tracing
-  // file is meant to be ${derby.system.home} but instead is ${user.dir}
-  // Changes DERBY-613 may require modifying this permission.
-  permission java.io.FilePermission "${user.dir}${/}*", "write"; 
-  
   // Import/export and other support files from these locations in tests
   permission java.io.FilePermission "${user.dir}${/}extin${/}*", "read";
   permission java.io.FilePermission "${user.dir}${/}extinout${/}*", "read, write";
   permission java.io.FilePermission "${user.dir}${/}extout${/}*", "write"; 
+  
+  // sane=true, jdbcapi/secureUsers1.sql
+  permission java.io.FilePermission "${user.dir}${/}CloudLDAP.out", "write"; 
 };
 
 



Mime
View raw message