db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r240291 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/dcl.out master/jdk15/dcl.out tests/lang/dcl.sql tests/lang/dcl_emc1.jar
Date Fri, 26 Aug 2005 17:07:32 GMT
Author: djd
Date: Fri Aug 26 10:07:28 2005
New Revision: 240291

URL: http://svn.apache.org/viewcvs?rev=240291&view=rev
Log:
DERBY-538 Add testing of of fetching resources from a jar file installed in a database.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dcl.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk15/dcl.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl.sql
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl_emc1.jar

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dcl.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dcl.out?rev=240291&r1=240290&r2=240291&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dcl.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dcl.out
Fri Aug 26 10:07:28 2005
@@ -1,5 +1,6 @@
 ij> -- test database class loading.
-create schema emc;
+maximumdisplaywidth 300;
+ij> create schema emc;
 0 rows inserted/updated/deleted
 ij> set schema emc;
 0 rows inserted/updated/deleted
@@ -10,6 +11,11 @@
 external name 'org.apache.derbyTesting.databaseclassloader.emc.addContact'
 language java parameter style java;
 0 rows inserted/updated/deleted
+ij> create function EMC.GETARTICLE(path VARCHAR(40)) RETURNS VARCHAR(256)
+NO SQL
+external name 'org.apache.derbyTesting.databaseclassloader.emc.getArticle'
+language java parameter style java;
+0 rows inserted/updated/deleted
 ij> -- fails because no class in classpath, 
 CALL EMC.ADDCONTACT(1, 'bill@somecompany.com');
 ERROR 42X51: The class 'org.apache.derbyTesting.databaseclassloader.emc' does not exist or
is inaccessible. This can happen if the class is not public.
@@ -36,6 +42,38 @@
 ------------------------------------------
 1          |bill@ruletheworld.com         
 2          |penguin@antartic.com          
+ij> -- Test resource loading from the jar file
+-- Simple path should be prepended with the package name
+-- of the class executing the code to find
+-- /org/apache/derbyTesting/databaseclassloader/graduation.txt
+VALUES EMC.GETARTICLE('graduate.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+The Apache Foundation has released the first version of the open-source Derby database, which
also gained support from Sun Microsystems.                                               
                                                                                         
                          
+ij> -- now an absolute path
+VALUES EMC.GETARTICLE('/article/release.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+The Apache Derby development community is pleased to announce its first release after graduating
from the Apache Incubator, Apache Derby 10.1.1.0.                                        
                                                                                         
                       
+ij> -- no such resources
+VALUES EMC.GETARTICLE('/article/fred.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
+ij> VALUES EMC.GETARTICLE('barney.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
+ij> -- try to read the class file should be disallowed
+-- by returning null
+VALUES EMC.GETARTICLE('emc.class');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
+ij> VALUES EMC.GETARTICLE('/org/apache/derbyTesting/databaseclassloader/emc.class');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
 ij> -- now the application needs to track if e-mails are valid
 ALTER TABLE EMC.CONTACTS ADD COLUMN OK SMALLINT;
 0 rows inserted/updated/deleted
@@ -106,9 +144,9 @@
 0 rows inserted/updated/deleted
 ij> -- at this point the jar is not signed, NULL expected
 VALUES EMC.GETSIGNERS('org.apache.derbyTesting.databaseclassloader.emc');
-1                                                                                       
                                       
---------------------------------------------------------------------------------------------------------------------------------
-NULL                                                                                    
                                       
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
 ij> -- Replace with a signed jar
 -- (self signed certificate)
 --
@@ -121,14 +159,14 @@
 CALL SQLJ.REPLACE_JAR('file:extin/dcl_emc2s.jar', 'EMC.MAIL_APP');
 0 rows inserted/updated/deleted
 ij> VALUES EMC.GETSIGNERS('org.apache.derbyTesting.databaseclassloader.emc');
-1                                                                                       
                                       
---------------------------------------------------------------------------------------------------------------------------------
-CN=EMC CTO, OU=EMC APP, O=Easy Mail Company, C=US                                       
                                       
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+CN=EMC CTO, OU=EMC APP, O=Easy Mail Company, C=US                                       
                                                                                         
                                                                                         
                               
 ij> -- other jar should not be signed
 VALUES EMC.GETSIGNERS('org.apache.derbyTesting.databaseclassloader.addon.vendor.util');
-1                                                                                       
                                       
---------------------------------------------------------------------------------------------------------------------------------
-NULL                                                                                    
                                       
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
 ij> -- replace with a hacked jar file, emc.class modified to diable
 -- valid e-mail address check but using same signatures.
 -- ie direct replacement of the .class file.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk15/dcl.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk15/dcl.out?rev=240291&r1=240290&r2=240291&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk15/dcl.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk15/dcl.out
Fri Aug 26 10:07:28 2005
@@ -1,5 +1,6 @@
 ij> -- test database class loading.
-create schema emc;
+maximumdisplaywidth 300;
+ij> create schema emc;
 0 rows inserted/updated/deleted
 ij> set schema emc;
 0 rows inserted/updated/deleted
@@ -10,6 +11,11 @@
 external name 'org.apache.derbyTesting.databaseclassloader.emc.addContact'
 language java parameter style java;
 0 rows inserted/updated/deleted
+ij> create function EMC.GETARTICLE(path VARCHAR(40)) RETURNS VARCHAR(256)
+NO SQL
+external name 'org.apache.derbyTesting.databaseclassloader.emc.getArticle'
+language java parameter style java;
+0 rows inserted/updated/deleted
 ij> -- fails because no class in classpath, 
 CALL EMC.ADDCONTACT(1, 'bill@somecompany.com');
 ERROR 42X51: The class 'org.apache.derbyTesting.databaseclassloader.emc' does not exist or
is inaccessible. This can happen if the class is not public.
@@ -36,6 +42,38 @@
 ------------------------------------------
 1          |bill@ruletheworld.com         
 2          |penguin@antartic.com          
+ij> -- Test resource loading from the jar file
+-- Simple path should be prepended with the package name
+-- of the class executing the code to find
+-- /org/apache/derbyTesting/databaseclassloader/graduation.txt
+VALUES EMC.GETARTICLE('graduate.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+The Apache Foundation has released the first version of the open-source Derby database, which
also gained support from Sun Microsystems.                                               
                                                                                         
                          
+ij> -- now an absolute path
+VALUES EMC.GETARTICLE('/article/release.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+The Apache Derby development community is pleased to announce its first release after graduating
from the Apache Incubator, Apache Derby 10.1.1.0.                                        
                                                                                         
                       
+ij> -- no such resources
+VALUES EMC.GETARTICLE('/article/fred.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
+ij> VALUES EMC.GETARTICLE('barney.txt');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
+ij> -- try to read the class file should be disallowed
+-- by returning null
+VALUES EMC.GETARTICLE('emc.class');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
+ij> VALUES EMC.GETARTICLE('/org/apache/derbyTesting/databaseclassloader/emc.class');
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
 ij> -- now the application needs to track if e-mails are valid
 ALTER TABLE EMC.CONTACTS ADD COLUMN OK SMALLINT;
 0 rows inserted/updated/deleted
@@ -106,9 +144,9 @@
 0 rows inserted/updated/deleted
 ij> -- at this point the jar is not signed, NULL expected
 VALUES EMC.GETSIGNERS('org.apache.derbyTesting.databaseclassloader.emc');
-1                                                                                       
                                       
---------------------------------------------------------------------------------------------------------------------------------
-NULL                                                                                    
                                       
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
 ij> -- Replace with a signed jar
 -- (self signed certificate)
 --
@@ -121,14 +159,14 @@
 CALL SQLJ.REPLACE_JAR('file:extin/dcl_emc2s.jar', 'EMC.MAIL_APP');
 0 rows inserted/updated/deleted
 ij> VALUES EMC.GETSIGNERS('org.apache.derbyTesting.databaseclassloader.emc');
-1                                                                                       
                                       
---------------------------------------------------------------------------------------------------------------------------------
-CN=EMC CTO, OU=EMC APP, O=Easy Mail Company, C=US                                       
                                       
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+CN=EMC CTO, OU=EMC APP, O=Easy Mail Company, C=US                                       
                                                                                         
                                                                                         
                               
 ij> -- other jar should not be signed
 VALUES EMC.GETSIGNERS('org.apache.derbyTesting.databaseclassloader.addon.vendor.util');
-1                                                                                       
                                       
---------------------------------------------------------------------------------------------------------------------------------
-NULL                                                                                    
                                       
+1                                                                                       
                                                                                         
                                                                                         
                               
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL                                                                                    
                                                                                         
                                                                                         
                               
 ij> -- replace with a hacked jar file, emc.class modified to diable
 -- valid e-mail address check but using same signatures.
 -- ie direct replacement of the .class file.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl.sql?rev=240291&r1=240290&r2=240291&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl.sql
Fri Aug 26 10:07:28 2005
@@ -1,6 +1,6 @@
 -- test database class loading.
 
-
+maximumdisplaywidth 300;
 create schema emc;
 set schema emc;
 create table contacts (id int primary key, e_mail varchar(30));
@@ -10,6 +10,11 @@
 external name 'org.apache.derbyTesting.databaseclassloader.emc.addContact'
 language java parameter style java;
 
+create function EMC.GETARTICLE(path VARCHAR(40)) RETURNS VARCHAR(256)
+NO SQL
+external name 'org.apache.derbyTesting.databaseclassloader.emc.getArticle'
+language java parameter style java;
+
 -- fails because no class in classpath, 
 CALL EMC.ADDCONTACT(1, 'bill@somecompany.com');
 
@@ -29,6 +34,21 @@
 CALL EMC.ADDCONTACT(1, 'bill@ruletheworld.com');
 CALL EMC.ADDCONTACT(2, 'penguin@antartic.com');
 SELECT id, e_mail from EMC.CONTACTS;
+
+-- Test resource loading from the jar file
+-- Simple path should be prepended with the package name
+-- of the class executing the code to find
+-- /org/apache/derbyTesting/databaseclassloader/graduation.txt
+VALUES EMC.GETARTICLE('graduate.txt');
+-- now an absolute path
+VALUES EMC.GETARTICLE('/article/release.txt');
+-- no such resources
+VALUES EMC.GETARTICLE('/article/fred.txt');
+VALUES EMC.GETARTICLE('barney.txt');
+-- try to read the class file should be disallowed
+-- by returning null
+VALUES EMC.GETARTICLE('emc.class');
+VALUES EMC.GETARTICLE('/org/apache/derbyTesting/databaseclassloader/emc.class');
 
 -- now the application needs to track if e-mails are valid
 ALTER TABLE EMC.CONTACTS ADD COLUMN OK SMALLINT;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl_emc1.jar
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dcl_emc1.jar?rev=240291&r1=240290&r2=240291&view=diff
==============================================================================
Binary files - no diff available.



Mime
View raw message