< prev index next >

test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java

Print this page




  37  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  38  * @run testng/othervm -DrunSecMngr=true xpath.ClassLoaderTest
  39  * @run testng/othervm xpath.ClassLoaderTest
  40  * @summary Test XPathFactory newInstance() with ContextClassLoader.
  41  */
  42 @Listeners({jaxp.library.BasePolicy.class})
  43 public class ClassLoaderTest {
  44 
  45     @Test
  46     public void testClassLoader() {
  47         MyClassLoader cl = runWithAllPerm(() -> new MyClassLoader());
  48         runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(cl));
  49         XPathFactory xPathFactory = XPathFactory.newInstance();
  50 
  51         if (!cl.isCalled()) {
  52             Assert.fail("Context class loader should be used.");
  53         }
  54 
  55     }
  56 }
  57 


  37  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  38  * @run testng/othervm -DrunSecMngr=true xpath.ClassLoaderTest
  39  * @run testng/othervm xpath.ClassLoaderTest
  40  * @summary Test XPathFactory newInstance() with ContextClassLoader.
  41  */
  42 @Listeners({jaxp.library.BasePolicy.class})
  43 public class ClassLoaderTest {
  44 
  45     @Test
  46     public void testClassLoader() {
  47         MyClassLoader cl = runWithAllPerm(() -> new MyClassLoader());
  48         runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(cl));
  49         XPathFactory xPathFactory = XPathFactory.newInstance();
  50 
  51         if (!cl.isCalled()) {
  52             Assert.fail("Context class loader should be used.");
  53         }
  54 
  55     }
  56 }

< prev index next >