db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r161022 - in incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: tests/derbynet/dataSourcePermissions_net.java util/TestUtil.java
Date Tue, 12 Apr 2005 06:21:19 GMT
Author: kmarsden
Date: Mon Apr 11 23:21:18 2005
New Revision: 161022

URL: http://svn.apache.org/viewcvs?view=rev&rev=161022
Log:
Test setDescription for network server


Modified:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java?view=diff&r1=161021&r2=161022
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java
Mon Apr 11 23:21:18 2005
@@ -245,6 +245,7 @@
 	public void testClientDataSourceProperties() throws SQLException
 	{
 		testRetrieveMessageText();
+		testDescription();
 	}
 
 	/**
@@ -280,6 +281,39 @@
 		catch (Exception e)
 		{
 			System.out.println("FAIL: testRetrieveMessageText() Unexpected Exception " + e.getMessage());
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Test description property
+	 */
+	public void testDescription() throws SQLException
+	{
+		String descriptionProperty = "description";
+		Class[] argType = { String.class};
+		String setterMethodName = TestUtil.getSetterName(descriptionProperty);
+		String getterMethodName = TestUtil.getGetterName(descriptionProperty);
+
+		Object[] args;
+
+		try {
+			String setDescription = "Everything you ever wanted to know about this datasource";
+			DataSource ds = getDS("wombat", "EDWARD", "noodle");
+			// Set the description
+			Method sh = ds.getClass().getMethod(setterMethodName, argType);
+			args = new Object[] { new String(setDescription) };
+			sh.invoke(ds, args);
+			// Now check it
+			sh = ds.getClass().getMethod(getterMethodName, null);
+			String getDescription = (String) sh.invoke(ds, null);
+			if (!setDescription.equals(getDescription))
+				throw new Exception("getDescription() " + getDescription + 
+									" does not match setDescription() ");
+		}
+		catch (Exception e)
+		{
+			System.out.println("FAIL: testDescription() Unexpected Exception " + e.getMessage());
 			e.printStackTrace();
 		}
 	}

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java?view=diff&r1=161021&r2=161022
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
Mon Apr 11 23:21:18 2005
@@ -376,6 +376,11 @@
 	}
 
 	
+	public static String  getGetterName(String attribute)
+	{
+		return "get" + Character.toUpperCase(attribute.charAt(0)) + attribute.substring(1);
+	}
+
 	// Some methods for test output.
 	public static void dumpSQLExceptions(SQLException sqle) {
 		TestUtil.dumpSQLExceptions(sqle, false);



Mime
View raw message