20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jaxp.library;
24
25 import org.testng.ITestContext;
26 import org.testng.ITestListener;
27 import org.testng.ITestResult;
28
29 /**
30 * This policy includes default permissions.
31 * It should be used as one listener: either TestListener or MethodListener.
32 */
33 public class BasePolicy implements ITestListener {
34
35 @Override
36 public void onFinish(ITestContext arg0) {
37 try {
38 JAXPPolicyManager.teardownPolicyManager();
39 } catch (Exception e) {
40 throw new RuntimeException("Failed to teardonw the policy manager", e);
41 }
42 }
43
44 @Override
45 public void onStart(ITestContext arg0) {
46 // suppose to only run othervm mode
47 if (isRunWithSecurityManager())
48 JAXPPolicyManager.getJAXPPolicyManager(true);
49 }
50
51 @Override
52 public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
53 }
54
55 @Override
56 public void onTestFailure(ITestResult arg0) {
57 }
58
59 @Override
60 public void onTestSkipped(ITestResult arg0) {
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jaxp.library;
24
25 import org.testng.ITestContext;
26 import org.testng.ITestListener;
27 import org.testng.ITestResult;
28
29 /**
30 * This policy includes default permissions.
31 * It should be used as one listener: either TestListener or MethodListener.
32 */
33 public class BasePolicy implements ITestListener {
34
35 @Override
36 public void onFinish(ITestContext arg0) {
37 try {
38 JAXPPolicyManager.teardownPolicyManager();
39 } catch (Exception e) {
40 throw new RuntimeException("Failed to teardown the policy manager", e);
41 }
42 }
43
44 @Override
45 public void onStart(ITestContext arg0) {
46 // suppose to only run othervm mode
47 if (isRunWithSecurityManager())
48 JAXPPolicyManager.getJAXPPolicyManager(true);
49 }
50
51 @Override
52 public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
53 }
54
55 @Override
56 public void onTestFailure(ITestResult arg0) {
57 }
58
59 @Override
60 public void onTestSkipped(ITestResult arg0) {
|