CAS Unit Tests
Clover coverage report - CAS Unit Tests
Coverage timestamp: Mon Jul 4 2005 18:13:17 CDT
file stats: LOC: 65   Methods: 3
NCLOC: 38   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TestNamespaceData.java - 0% 0% 0%
coverage
 1    /*
 2    * Portions of this file Copyright 1999-2005 University of Chicago
 3    * Portions of this file Copyright 1999-2005 The University of Southern California.
 4    *
 5    * This file or a portion of this file is licensed under the
 6    * terms of the Globus Toolkit Public License, found at
 7    * http://www.globus.org/toolkit/download/license.html.
 8    * If you redistribute this file, with or without
 9    * modifications, you must include this notice in the file.
 10    */
 11    package org.globus.cas.impl.databaseAccess;
 12   
 13    import junit.framework.Test;
 14    import junit.framework.TestCase;
 15    import junit.framework.TestSuite;
 16   
 17    import org.globus.cas.types.NamespaceData;
 18   
 19    import org.apache.commons.logging.Log;
 20    import org.apache.commons.logging.LogFactory;
 21   
 22    public class TestNamespaceData extends TestCase {
 23   
 24    static Log logger =
 25    LogFactory.getLog(TestNamespaceData.class.getName());
 26   
 27  0 public TestNamespaceData(String name){
 28  0 super(name);
 29    }
 30   
 31  0 public static Test suite() {
 32  0 return new TestSuite(TestNamespaceData.class);
 33    }
 34   
 35  0 public void testNamespaceData() throws Exception {
 36   
 37  0 String nickname = "nickname";
 38  0 String basename = "basename";
 39  0 String compAlg = "compAlg";
 40   
 41    // Store name space data
 42  0 NamespaceData nsData = new NamespaceData();
 43  0 nsData.setNickname(nickname);
 44  0 nsData.setBasename(basename);
 45  0 nsData.setComparisonAlg(compAlg);
 46  0 NamespaceDataHandler.storeObject(nsData);
 47  0 logger.debug("Store object went through " + nsData.toString());
 48   
 49    // List of all namespaces
 50  0 String[] namespaceList = NamespaceDataHandler.list();
 51  0 assertTrue(namespaceList!=null);
 52  0 logger.debug("Name space list is " + namespaceList);
 53   
 54    // Ensure that the stored and retrieved objects are the same
 55  0 NamespaceData retrieveNSData = (NamespaceData)NamespaceDataHandler.retrieveObject(nickname);
 56  0 assertTrue(retrieveNSData!=null);
 57  0 logger.debug("Retrieved trust anchor " + retrieveNSData.toString());
 58  0 assertTrue(retrieveNSData.equals(nsData));
 59   
 60    // Delete name space data
 61  0 NamespaceDataHandler.deleteObject(nickname);
 62  0 NamespaceData deletedData = (NamespaceData)NamespaceDataHandler.retrieveObject(nickname);
 63  0 assertTrue(deletedData == null);
 64    }
 65    }