1 /* 2 * ==================================================================== 3 * 4 * This code is subject to the freebxml License, Version 1.1 5 * 6 * Copyright (c) 2002 freebxml.org. All rights reserved. 7 * 8 * ==================================================================== 9 */ 10 package com.sun.ebxml.registry.util; 11 12 import junit.framework.TestCase; 13 14 /*** 15 * @author Fabian Ritzmann 16 */ 17 public class XalanVersionTest extends TestCase { 18 19 private String endorsedDirs = null; 20 21 /*** 22 * Constructor for XalanVersionTest. 23 * @param name 24 */ 25 public XalanVersionTest(String name) { 26 super(name); 27 } 28 29 /*** 30 * @see TestCase#setUp() 31 */ 32 protected void setUp() throws Exception { 33 super.setUp(); 34 this.endorsedDirs = System.getProperty("java.endorsed.dirs"); 35 } 36 37 /*** 38 * @see TestCase#tearDown() 39 */ 40 protected void tearDown() throws Exception { 41 super.tearDown(); 42 } 43 44 public void testGetMajorVersion() { 45 try { 46 Integer version = XalanVersion.getMajorVersion(); 47 } catch (XalanVersionException e) { 48 fail("getMajorVersion triggered exception " + e.toString()); 49 } 50 } 51 52 public void testGetReleaseVersion() { 53 try { 54 Integer version = XalanVersion.getReleaseVersion(); 55 } catch (XalanVersionException e) { 56 fail("getReleaseVersion triggered exception " + e.toString()); 57 } 58 } 59 60 public void testGetDevelopmentVersion() { 61 try { 62 Integer version = XalanVersion.getDevelopmentVersion(); 63 } catch (XalanVersionException e) { 64 fail("getDevelopmentVersion triggered exception " + e.toString()); 65 } 66 } 67 68 public void testVerifyVersionSucceed() { 69 try { 70 // Make sure that we use the original system properties: 71 System.setProperty("java.endorsed.dirs", this.endorsedDirs); 72 XalanVersion.verifyVersion(); 73 } catch (XalanVersionException e) { 74 fail("verifyVersion triggered exception " + e.toString()); 75 } 76 } 77 78 /*** 79 * This doesn't work. Seems that java evaluates the java.endorsed.dirs 80 * property only once at startup. 81 public void testVerifyVersionFail() { 82 try { 83 // Don't use any endorsed dirs. This should make sure that 84 // we are using the old Xalan version that is bundled with 85 // J2SDK 1.4 and cause the check to fail. 86 System.setProperty("java.endorsed.dirs", "endor"); 87 XalanVersion.verifyVersion(); 88 fail("verifyVersion did not throw any exception."); 89 } catch (XalanVersionException e) { 90 } 91 } 92 */ 93 94 }

This page was automatically generated by Maven