portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/capability/src/java/META-INF capabilities-ojb.xml
Date Sat, 09 Apr 2005 18:46:49 GMT
taylor      2005/04/09 11:46:49

  Modified:    components/capability/src/test/org/apache/jetspeed/capabilities
                        TestCapability.java
               components/capability/src/java/org/apache/jetspeed/capabilities/impl
                        JetspeedCapabilities.java ClientImpl.java
               components/capability/src/java/META-INF capabilities-ojb.xml
  Log:
  http://issues.apache.org/jira/browse/JS2-230
  
  support ordering of capabilitiy search
  added EVAL_ORDER column
  
  Revision  Changes    Path
  1.5       +41 -5     jakarta-jetspeed-2/components/capability/src/test/org/apache/jetspeed/capabilities/TestCapability.java
  
  Index: TestCapability.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/capability/src/test/org/apache/jetspeed/capabilities/TestCapability.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestCapability.java	4 Jan 2005 16:35:05 -0000	1.4
  +++ TestCapability.java	9 Apr 2005 18:46:49 -0000	1.5
  @@ -63,37 +63,51 @@
       public void testCapability() throws Exception
       {
       }
  -    // TODO: FIXME: http://issues.apache.org/jira/browse/JS2-168
  -    public void XXXXtestCapability() throws Exception
  +    public void xtestCapability() throws Exception
       {
           assertNotNull("capabilities component is null", capabilities);
  -
  +        int lastOrder = 0;
  +        Iterator caps = capabilities.getClients();
  +        while (caps.hasNext())
  +        {
  +            Client client = (Client)caps.next();
  +            int evalOrder = client.getEvalOrder();
  +            if (lastOrder >= evalOrder)
  +            {
  +                assertTrue("Client result set is not ordered!", false);
  +            }
  +            lastOrder = evalOrder;
  +        }
  +        
           // Find specific client -- testing pattern matching
           String userAgent;
           System.out.println("Testing all supported Clients...");
  -
           userAgent = "Opera/7.0";
           System.out.println("Find pattern: " + userAgent);
           CapabilityMap cm = capabilities.getCapabilityMap(userAgent);
           assertNotNull("getCapabilityMap is null", cm);
  +        assertTrue("Opera", cm.getClient().getName().equals("opera7"));               

           capabilityMapReport(cm);
   
           userAgent = "Mozilla/4.0";
           System.out.println("Find pattern: " + userAgent);
           cm = capabilities.getCapabilityMap(userAgent);
           assertNotNull("getCapabilityMap is null", cm);
  +        assertTrue("Netscape/Mozilla4", cm.getClient().getName().equals("ns4"));      
                 
           capabilityMapReport(cm);
   
           userAgent = "MSIE 5.0";
           System.out.println("Find pattern: " + userAgent);
           cm = capabilities.getCapabilityMap(userAgent);
           assertNotNull("getCapabilityMap is null", cm);
  +        assertTrue("MSIE 5", cm.getClient().getName().equals("ie5"));                 
              
           capabilityMapReport(cm);
   
           userAgent = "Mozilla/5.0";
           System.out.println("Find pattern: " + userAgent);
           cm = capabilities.getCapabilityMap(userAgent);
           assertNotNull("getCapabilityMap is null", cm);
  +        assertTrue("Mozilla 5.0", cm.getClient().getName().equals("mozilla"));        
                               
           capabilityMapReport(cm);
   
           userAgent = "Lynx";
  @@ -107,6 +121,28 @@
           cm = capabilities.getCapabilityMap(userAgent);
           assertNotNull("getCapabilityMap is null", cm);
           capabilityMapReport(cm);
  +        
  +        userAgent = "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/125.5.6
(KHTML, like Gecko) Safari/125.12";
  +        System.out.println("Find pattern: " + userAgent);
  +        cm = capabilities.getCapabilityMap(userAgent);                
  +        assertNotNull("getCapabilityMap is null", cm);
  +        assertTrue("found Safari", cm.getClient().getName().equals("safari"));
  +        capabilityMapReport(cm);
  +        
  +        userAgent = "Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)";
  +        System.out.println("Find pattern: " + userAgent);
  +        cm = capabilities.getCapabilityMap(userAgent);                
  +        assertNotNull("getCapabilityMap is null", cm);
  +        assertTrue("stinking IE for Mac", cm.getClient().getName().equals("iemac"));  
     
  +        capabilityMapReport(cm);
  +        
  +        userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";
  +        System.out.println("Find pattern: " + userAgent);
  +        cm = capabilities.getCapabilityMap(userAgent);                
  +        assertNotNull("getCapabilityMap is null", cm);
  +        assertTrue("IE 6 Windows", cm.getClient().getName().equals("ie6"));        
  +        capabilityMapReport(cm);
  +        
   
       }
   
  
  
  
  1.4       +5 -4      jakarta-jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl/JetspeedCapabilities.java
  
  Index: JetspeedCapabilities.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl/JetspeedCapabilities.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JetspeedCapabilities.java	4 Jan 2005 15:52:02 -0000	1.3
  +++ JetspeedCapabilities.java	9 Apr 2005 18:46:49 -0000	1.4
  @@ -32,6 +32,7 @@
   import org.apache.jetspeed.capabilities.UnableToBuildCapabilityMapException;
   import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
   import org.apache.ojb.broker.query.Criteria;
  +import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.broker.query.QueryFactory;
   
  @@ -304,9 +305,9 @@
       {
           if (null == clients)
           {
  -                
  -            this.clients = getPersistenceBrokerTemplate().getCollectionByQuery(
  -                    QueryFactory.newQuery(clientClass, new Criteria()));
  +            QueryByCriteria query = QueryFactory.newQuery(clientClass, new Criteria());
  +            query.addOrderByAscending("evalOrder");
  +            this.clients = getPersistenceBrokerTemplate().getCollectionByQuery(query);
           }
   
           return this.clients.iterator();
  
  
  
  1.3       +16 -1     jakarta-jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl/ClientImpl.java
  
  Index: ClientImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/capability/src/java/org/apache/jetspeed/capabilities/impl/ClientImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClientImpl.java	19 Mar 2005 12:47:13 -0000	1.2
  +++ ClientImpl.java	9 Apr 2005 18:46:49 -0000	1.3
  @@ -41,6 +41,7 @@
       private int preferredMimeTypeId;
   
       private int clientId;
  +    private int evalOrder = 0;
   
       public ClientImpl()
       {
  @@ -246,4 +247,18 @@
           this.preferredMimeTypeId = mimeTypeId;
       }
   
  +    /**
  +     * @return Returns the evalOrder.
  +     */
  +    public int getEvalOrder()
  +    {
  +        return evalOrder;
  +    }
  +    /**
  +     * @param evalOrder The evalOrder to set.
  +     */
  +    public void setEvalOrder(int evalOrder)
  +    {
  +        this.evalOrder = evalOrder;
  +    }
   }
  
  
  
  1.2       +6 -0      jakarta-jetspeed-2/components/capability/src/java/META-INF/capabilities-ojb.xml
  
  Index: capabilities-ojb.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/capability/src/java/META-INF/capabilities-ojb.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- capabilities-ojb.xml	7 Nov 2004 18:44:44 -0000	1.1
  +++ capabilities-ojb.xml	9 Apr 2005 18:46:49 -0000	1.2
  @@ -95,6 +95,12 @@
            primarykey="true"
            autoincrement="true"         
          />
  +
  +      <field-descriptor
  +         name="evalOrder"
  +         column="EVAL_ORDER"
  +         jdbc-type="INTEGER"     
  +      />
         
           <field-descriptor
            name="name"
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message