epugh 2004/02/14 08:34:46 Modified: security/nt/src/test/org/apache/fulcrum/security/nt/dynamic NTDynamicModelManagerTest.java NTUserManagerTest.java NTBasicModelManagerTest.java NTBasicACLTest.java Added: security/nt/src/test/org/apache/fulcrum/security/nt/dynamic TestConstants.java Log: Catch error if not connected to proper NT network. Revision Changes Path 1.2 +8 -2 jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTDynamicModelManagerTest.java Index: NTDynamicModelManagerTest.java =================================================================== RCS file: /home/cvs/jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTDynamicModelManagerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NTDynamicModelManagerTest.java 5 Dec 2003 23:22:18 -0000 1.1 +++ NTDynamicModelManagerTest.java 14 Feb 2004 16:34:45 -0000 1.2 @@ -60,15 +60,18 @@ import org.apache.fulcrum.security.entity.Group; import org.apache.fulcrum.security.entity.User; import org.apache.fulcrum.security.model.dynamic.DynamicModelManager; +import org.apache.fulcrum.security.util.DataBackendException; import org.apache.fulcrum.security.util.UnknownEntityException; import org.apache.fulcrum.testcontainer.BaseUnitTest; /** - * @author Eric Pugh * * Test the NT implementation of the user manager. This test traps some exceptions that can be * thrown if there is NO nt dll. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Eric Pugh</a> + * @version $Id$ */ -public class NTDynamicModelManagerTest extends BaseUnitTest +public class NTDynamicModelManagerTest extends BaseUnitTest implements TestConstants { private static Log log = LogFactory.getLog(NTDynamicModelManagerTest.class); private static final String ERROR_MSG = "Not supported by NT User Manager"; @@ -117,6 +120,9 @@ user.setPassword("rob"); modelManager.revokeAll(user); fail("Should throw runtime exception"); + } + catch(DataBackendException dbe){ + assertTrue(dbe.getMessage().indexOf(SCB_INVALID)>-1); } catch (UnknownEntityException re) { 1.3 +8 -2 jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTUserManagerTest.java Index: NTUserManagerTest.java =================================================================== RCS file: /home/cvs/jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTUserManagerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NTUserManagerTest.java 10 Jan 2004 16:15:17 -0000 1.2 +++ NTUserManagerTest.java 14 Feb 2004 16:34:45 -0000 1.3 @@ -59,15 +59,18 @@ import org.apache.fulcrum.security.acl.AccessControlList; import org.apache.fulcrum.security.model.dynamic.entity.DynamicUser; import org.apache.fulcrum.security.model.test.AbstractUserManagerTest; +import org.apache.fulcrum.security.util.DataBackendException; import com.tagish.auth.win32.NTSystem; /** - * @author Eric Pugh * * Test the NT implementation of the user manager. This test traps some exceptions that can be * thrown if there is NO nt dll. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Eric Pugh</a> + * @version $Id$ */ -public class NTUserManagerTest extends AbstractUserManagerTest +public class NTUserManagerTest extends AbstractUserManagerTest implements TestConstants { private static Log log = LogFactory.getLog(NTUserManagerTest.class); private static final String ERROR_MSG = "Not supported by NT User Manager"; @@ -111,6 +114,9 @@ user = userManager.getUser(GUESTUSER, ""); user.setPassword(""); assertTrue(userManager.checkExists(user)); + } + catch(DataBackendException dbe){ + assertTrue(dbe.getMessage().indexOf(SCB_INVALID)>-1); } catch (UnsatisfiedLinkError ule) { 1.2 +8 -2 jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTBasicModelManagerTest.java Index: NTBasicModelManagerTest.java =================================================================== RCS file: /home/cvs/jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTBasicModelManagerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NTBasicModelManagerTest.java 5 Dec 2003 23:22:18 -0000 1.1 +++ NTBasicModelManagerTest.java 14 Feb 2004 16:34:45 -0000 1.2 @@ -60,15 +60,18 @@ import org.apache.fulcrum.security.entity.Group; import org.apache.fulcrum.security.entity.User; import org.apache.fulcrum.security.model.basic.BasicModelManager; +import org.apache.fulcrum.security.util.DataBackendException; import org.apache.fulcrum.security.util.UnknownEntityException; import org.apache.fulcrum.testcontainer.BaseUnitTest; /** - * @author Eric Pugh * * Test the NT implementation of the user manager. This test traps some exceptions that can be * thrown if there is NO nt dll. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Eric Pugh</a> + * @version $Id$ */ -public class NTBasicModelManagerTest extends BaseUnitTest +public class NTBasicModelManagerTest extends BaseUnitTest implements TestConstants { private static Log log = LogFactory.getLog(NTBasicModelManagerTest.class); private static final String ERROR_MSG = "Not supported by NT User Manager"; @@ -117,6 +120,9 @@ user.setPassword("rob"); modelManager.revokeAll(user); fail("Should throw runtime exception"); + } + catch(DataBackendException dbe){ + assertTrue(dbe.getMessage().indexOf(SCB_INVALID)>-1); } catch (UnknownEntityException re) { 1.2 +8 -2 jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTBasicACLTest.java Index: NTBasicACLTest.java =================================================================== RCS file: /home/cvs/jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTBasicACLTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NTBasicACLTest.java 5 Dec 2003 23:22:18 -0000 1.1 +++ NTBasicACLTest.java 14 Feb 2004 16:34:46 -0000 1.2 @@ -61,15 +61,18 @@ import org.apache.fulcrum.security.entity.User; import org.apache.fulcrum.security.model.basic.BasicAccessControlList; import org.apache.fulcrum.security.model.basic.BasicModelManager; +import org.apache.fulcrum.security.util.DataBackendException; import org.apache.fulcrum.security.util.UnknownEntityException; import org.apache.fulcrum.testcontainer.BaseUnitTest; /** - * @author Eric Pugh * * Test the NT implementation of the user manager. This test traps some exceptions that can be * thrown if there is NO nt dll. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Eric Pugh</a> + * @version $Id$ */ -public class NTBasicACLTest extends BaseUnitTest +public class NTBasicACLTest extends BaseUnitTest implements TestConstants { private static Log log = LogFactory.getLog(NTBasicACLTest.class); private static final String ERROR_MSG = "Not supported by NT User Manager"; @@ -123,6 +126,9 @@ assertTrue(bacl.hasGroup("Guests")); assertTrue(bacl.hasGroup("gUEsts")); + } + catch(DataBackendException dbe){ + assertTrue(dbe.getMessage().indexOf(SCB_INVALID)>-1); } catch (UnknownEntityException re) { 1.1 jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/TestConstants.java Index: TestConstants.java =================================================================== package org.apache.fulcrum.security.nt.dynamic; /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Turbine" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Turbine", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ /** * Test constants * * @author <a href="mailto:[EMAIL PROTECTED]">Eric Pugh</a> * @version $Id: TestConstants.java,v 1.1 2004/02/14 16:34:45 epugh Exp $ */ public interface TestConstants { public static final String SCB_INVALID="The storage control block address is invalid."; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]