< prev index next >
test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 26,48 ****
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.transform.TransformerFactory;
import org.testng.Assert;
import org.testng.annotations.Test;
/*
* @summary Test creating TransformerFactory with ContextClassLoader.
*/
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
! @Test
! public void testFactoryFind() {
! try {
// System.setProperty("jaxp.debug", "true");
TransformerFactory factory = TransformerFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
--- 26,57 ----
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.transform.TransformerFactory;
+ import jaxp.library.JAXPTestUtilities;
+
import org.testng.Assert;
import org.testng.annotations.Test;
/*
* @summary Test creating TransformerFactory with ContextClassLoader.
*/
+ @Test(singleThreaded=true)
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
! public void runWithSecurityManager() throws Exception {
! JAXPTestUtilities.tryRunWithPolicyManager(() -> testFactoryFind());
! }
!
! public void runWithoutSecurityManager() throws Exception {
! testFactoryFind();
! }
!
! private void testFactoryFind() throws Exception {
// System.setProperty("jaxp.debug", "true");
TransformerFactory factory = TransformerFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
*** 54,67 ****
factory = TransformerFactory.newInstance();
if (System.getSecurityManager() == null)
Assert.assertTrue(myClassLoaderUsed);
else
Assert.assertFalse(myClassLoaderUsed);
- } catch (Exception ex) {
- Assert.fail(ex.toString());
- }
-
}
class MyClassLoader extends URLClassLoader {
public MyClassLoader() {
--- 63,72 ----
< prev index next >