commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prick...@apache.org
Subject cvs commit: jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/test/org/apache/commons/periodicity/database DriverServiceGetInitTest.java
Date Sat, 30 Nov 2002 03:35:06 GMT
prickett    2002/11/29 19:35:05

  Modified:    periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database
                        DriverContentHandler.java DriverMetaDataImpl.java
               periodicity/src/plugins-build/database/src/test/org/apache/commons/periodicity/database
                        DriverServiceGetInitTest.java
  Log:
  Removed getLogMessage from GetInitTest
  
  Added code to DriverContentHandler to set the protocol name.
  
  Added logging code to addProtocol in DriverMetaDataImpl
  
  Revision  Changes    Path
  1.10      +11 -3     jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverContentHandler.java
  
  Index: DriverContentHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverContentHandler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DriverContentHandler.java	30 Nov 2002 02:25:51 -0000	1.9
  +++ DriverContentHandler.java	30 Nov 2002 03:35:05 -0000	1.10
  @@ -200,6 +200,14 @@
                   throw new SAXException("UNEXPECTED EXCEPTION 2");
               }
           }
  +        else if(lookForDrivers && qName != null &&
  +               qName.equals(PROTOCOL_ELEMENT_QNAME))
  +        {
  +            if(attributes != null)
  +            {
  +                protocolName = attributes.getValue(NAME_QNAME_ATTRIBUTE);
  +            }
  +        }    
           else if(lookForDrivers && qName != null) 
           {
               buffy = new StringBuffer();
  
  
  
  1.11      +35 -4     jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverMetaDataImpl.java
  
  Index: DriverMetaDataImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverMetaDataImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DriverMetaDataImpl.java	30 Nov 2002 02:25:51 -0000	1.10
  +++ DriverMetaDataImpl.java	30 Nov 2002 03:35:05 -0000	1.11
  @@ -69,6 +69,8 @@
   import java.util.Set;
   import java.util.Iterator;
   import java.util.Collection;
  +import org.apache.log4j.Logger;
  +import org.apache.log4j.LogManager;
   
   public class DriverMetaDataImpl implements DriverMetaData
   {
  @@ -95,6 +97,8 @@
       /** A variable to store the properties of the driver */
       private Map driverMap = null;
   
  +    private static Logger logger = null;
  +
       /**
        * The purpose of this method is to create a new driver meta data
        * implementation given a name and a set of properties.
  @@ -240,13 +244,30 @@
        */
       void addProtocol(DriverProtocol newval) throws Exception
       {
  +        if(getLogger() != null)
  +        {
  +            getLogger().debug("Adding a protocol...");
  +        }    
           if(newval != null)
           {
  +            if(getLogger() != null)
  +            {
  +                getLogger().debug(newval.toString());
  +            }    
               if(protocols == null)
               {
  +                if(getLogger() != null)
  +                {
  +                    getLogger().debug("protocols == null");
  +                }    
                   protocols = new Hashtable();
               }
               protocols.put(newval.getName(), newval);
  +            if(getLogger() != null)
  +            {
  +                getLogger().debug("protocols.size()" + String.valueOf(
  +                       protocols.size()));
  +            }           
           }
           else if(newval == null)
           {
  @@ -470,10 +491,12 @@
           buffy.append(getWebUrl());
           buffy.append("\"\ngetClassName()=\"");
           buffy.append(getClassName());
  -        buffy.append("\"\n    PROTOCOLS\n");
  +        buffy.append("\"\n    ");
           Collection protocols = getProtocols();
           if(protocols != null)
           {
  +            buffy.append(String.valueOf(protocols.size()));
  +            buffy.append(" PROTOCOLS\n");
               Iterator iter = protocols.iterator();
               if(iter != null)
               {
  @@ -547,6 +570,14 @@
           return buffy.toString();
       }    
   
  +    private Logger getLogger()
  +    {
  +        if(logger == null)
  +        {
  +            logger = LogManager.getRootLogger();
  +        }
  +        return logger;
  +    }    
       
   }    
       
  
  
  
  1.9       +3 -57     jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/test/org/apache/commons/periodicity/database/DriverServiceGetInitTest.java
  
  Index: DriverServiceGetInitTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/test/org/apache/commons/periodicity/database/DriverServiceGetInitTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DriverServiceGetInitTest.java	30 Nov 2002 02:25:51 -0000	1.8
  +++ DriverServiceGetInitTest.java	30 Nov 2002 03:35:05 -0000	1.9
  @@ -161,60 +161,6 @@
           }
       }    
       
  -    private String getLogMessage(DriverMetaData meta)
  -    {
  -        if(meta != null)
  -        {
  -            StringBuffer buffy = new StringBuffer();
  -            buffy.append(meta.getName());
  -            buffy.append("\n");
  -            buffy.append("getShortDescription()=\"");
  -            buffy.append(meta.getShortDescription());
  -            buffy.append("\"\ngetDescription()=\"");
  -            buffy.append(meta.getDescription());
  -            buffy.append("\"\ngetWebUrl()=\"");
  -            buffy.append(meta.getWebUrl());
  -            buffy.append("\"\ngetClassName()=\"");
  -            buffy.append(meta.getClassName());
  -            buffy.append("\"\n    PROTOCOLS\n");
  -            DriverMetaDataImpl dimple = (DriverMetaDataImpl) meta;
  -            Collection protocols = dimple.getProtocols();
  -            if(protocols != null)
  -            {
  -                Iterator iter = protocols.iterator();
  -                if(iter != null)
  -                {
  -                    while(iter.hasNext())
  -                    {
  -                        Object protocol = iter.next();
  -                        if(protocol instanceof DriverProtocol)
  -                        {
  -                            DriverProtocol refinedProtocol = 
  -                                   (DriverProtocol) protocol;
  -                            buffy.append("    getName()=\"");
  -                            buffy.append(refinedProtocol.getName());
  -                            buffy.append("\n    getScheme()=\"");
  -                            buffy.append(refinedProtocol.getScheme());
  -                            buffy.append("\n    getUrl()=\"");
  -                            buffy.append(refinedProtocol.getUrl());
  -                            buffy.append("\n    getAdminUrl()=\"");
  -                            buffy.append(refinedProtocol.getAdminUrl());
  -                            buffy.append("\n\n");
  -                        }
  -                    }
  -                }    
  -            }    
  -            buffy.append("    END PROTOCOLS"); 
  -            return buffy.toString();
  -        }
  -        else
  -        {
  -            return null;
  -        }
  -    }    
  -            
  -                        
  -
       public static Test suite()
       {
           return new DriverServiceGetInitTest(TEST_NAME);
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message