< prev index next >
test/javax/xml/jaxp/unittest/stream/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.
*** 34,61 ****
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.testng.Assert;
! import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/*
* @summary Test SaTX factory using factory property and using ContextClassLoader.
*/
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
! @BeforeClass
! public void setup(){
! policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
! }
! @Test
public void testFactoryFindUsingStaxProperties() {
// If property is defined, will take precendence so this test
// is ignored :(
if (System.getProperty(FACTORY_KEY) != null) {
return;
--- 34,62 ----
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.testng.Assert;
! import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @summary Test SaTX factory using factory property and using ContextClassLoader.
*/
+ @Listeners({jaxp.library.FilePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
! // @BeforeClass
! // public void setup(){
! // policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
! // }
! @Test(enabled=false)
public void testFactoryFindUsingStaxProperties() {
// If property is defined, will take precendence so this test
// is ignored :(
if (System.getProperty(FACTORY_KEY) != null) {
return;
*** 105,114 ****
--- 106,116 ----
factory = XMLInputFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
Thread.currentThread().setContextClassLoader(new MyClassLoader());
factory = XMLInputFactory.newInstance();
+ // because it's decided by having sm or not in FactoryFind code
if (System.getSecurityManager() == null)
Assert.assertTrue(myClassLoaderUsed);
else
Assert.assertFalse(myClassLoaderUsed);
< prev index next >