< prev index next >

test/java/security/Security/ClassLoader/DeprivilegedModuleLoaderTest.java

Print this page




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 











  24 import java.io.File;
  25 import java.util.ArrayList;
  26 import java.util.List;
  27 import javax.security.auth.kerberos.KeyTab;
  28 import javax.xml.crypto.KeySelectorException;
  29 import javax.xml.crypto.dsig.XMLSignatureFactory;
  30 import com.sun.security.auth.callback.TextCallbackHandler;
  31 import com.sun.security.jgss.AuthorizationDataEntry;
  32 
  33 /*
  34  * @test
  35  * @bug 8159964
  36  * @summary Classes from deprivileged modules should get loaded through
  37  *          Platform Classloader.
  38  * @run main DeprivilegedModuleLoaderTest
  39  */
  40 public class DeprivilegedModuleLoaderTest {
  41 
  42     public static void main(String[] args) {
  43 
  44         boolean pass = true;
  45         List<Class<?>> classes = getDeprivilegedClasses();
  46         for (Class<?> cls : classes) {
  47             try {
  48                 pass &= testPlatformClassLoader(cls);
  49             } catch (Exception exc) {
  50                 exc.printStackTrace(System.out);
  51                 pass = false;
  52             }
  53         }
  54 
  55         if (!pass) {
  56             throw new RuntimeException("Atleast one test failed.");
  57         }
  58     }
  59 




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8159964
  27  * @summary Classes from deprivileged modules should get loaded through
  28  *          Platform Classloader.
  29  * @modules java.xml.crypto
  30  *          jdk.security.auth
  31  *          jdk.security.jgss
  32  * @run main DeprivilegedModuleLoaderTest
  33  */
  34 
  35 import java.io.File;
  36 import java.util.ArrayList;
  37 import java.util.List;
  38 import javax.security.auth.kerberos.KeyTab;
  39 import javax.xml.crypto.KeySelectorException;
  40 import javax.xml.crypto.dsig.XMLSignatureFactory;
  41 import com.sun.security.auth.callback.TextCallbackHandler;
  42 import com.sun.security.jgss.AuthorizationDataEntry;
  43 







  44 public class DeprivilegedModuleLoaderTest {
  45 
  46     public static void main(String[] args) {
  47 
  48         boolean pass = true;
  49         List<Class<?>> classes = getDeprivilegedClasses();
  50         for (Class<?> cls : classes) {
  51             try {
  52                 pass &= testPlatformClassLoader(cls);
  53             } catch (Exception exc) {
  54                 exc.printStackTrace(System.out);
  55                 pass = false;
  56             }
  57         }
  58 
  59         if (!pass) {
  60             throw new RuntimeException("Atleast one test failed.");
  61         }
  62     }
  63 


< prev index next >