[jboss-cvs] JBossAS SVN: r107252 - in projects/cluster/hibernate-jbc-cacheprovider/trunk: src/main/java/org/jboss/hibernate/jbc/cacheprovider and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Aug 1 20:20:05 EDT 2010


Author: galder.zamarreno at jboss.com
Date: 2010-08-01 20:20:04 -0400 (Sun, 01 Aug 2010)
New Revision: 107252

Modified:
   projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CustomerContactDAO.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTestCase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTestCase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticQueryCacheInvalidationTestCase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationNoLocalPutsOnlyTestCase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTestCase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTestCase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticQueryCacheInvalidationTestCase.java
   projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java
Log:
[JBCLUSTER-287] (Make Hibernate-JBossCache second level cache code compatible with JDK 1.4 runtimes) Done.

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/pom.xml	2010-08-02 00:20:04 UTC (rev 107252)
@@ -76,6 +76,13 @@
     
     <plugins>
       <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.4</source>
+          <target>1.4</target>
+        </configuration>
+      </plugin>
+      <plugin>
         <artifactId>maven-release-plugin</artifactId>
         <configuration>
           <!-- The tagBase property is needed during the release process so that

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -72,8 +72,10 @@
       this.regionFqn = Fqn.fromString(SecondLevelCacheUtil.createRegionFqn(regionName, this.cacheProperties.getCacheRegionPrefix()));
       this.transactionManager = transactionManager;
 
-      this.queryCacheLocalWritesOnly = this.cacheProperties.isQueryCacheLocalWritesOnly() && regionName.contains(StandardQueryCache.class.getName());
-      this.localPutsOnly = this.cacheProperties.isLocalPutsOnly() && (regionName.contains(UpdateTimestampsCache.class.getName()) == false);
+      this.queryCacheLocalWritesOnly = this.cacheProperties.isQueryCacheLocalWritesOnly()
+        && regionName.indexOf(StandardQueryCache.class.getName()) != -1;
+      this.localPutsOnly = this.cacheProperties.isLocalPutsOnly()
+        && regionName.indexOf(UpdateTimestampsCache.class.getName()) == -1;
 
       if (cache.getUseRegionBasedMarshalling())
       {

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -72,10 +72,12 @@
       this.cacheProperties = cacheProperties;
       this.regionFqn = Fqn.fromString(SecondLevelCacheUtil.createRegionFqn(regionName, this.cacheProperties.getCacheRegionPrefix()));
 
-      this.queryCacheLocalWritesOnly = this.cacheProperties.isQueryCacheLocalWritesOnly() && regionName.contains(StandardQueryCache.class.getName());
-      this.localPutsOnly = this.cacheProperties.isLocalPutsOnly() && (regionName.contains(UpdateTimestampsCache.class.getName()) == false);
+      this.queryCacheLocalWritesOnly = this.cacheProperties.isQueryCacheLocalWritesOnly()
+        && regionName.indexOf(StandardQueryCache.class.getName()) != -1;
+      this.localPutsOnly = this.cacheProperties.isLocalPutsOnly()
+        && regionName.indexOf(UpdateTimestampsCache.class.getName()) == -1;
 
-      if (cache.getUseRegionBasedMarshalling())
+    if (cache.getUseRegionBasedMarshalling())
       {
          boolean fetchState = cache.getFetchInMemoryState();
          try

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CacheTestCaseBase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -23,25 +23,12 @@
  */
 package org.jboss.hibernate.jbc.cacheprovider.functional;
 
-import java.util.Properties;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-import javax.transaction.TransactionManager;
-
 import org.hibernate.cfg.Configuration;
 import org.hibernate.cfg.Environment;
 import org.hibernate.cfg.Mappings;
 import org.hibernate.dialect.Dialect;
 import org.hibernate.junit.functional.FunctionalTestCase;
-import org.hibernate.transaction.TransactionManagerLookup;
-import org.hibernate.transaction.TransactionManagerLookupFactory;
-import org.jboss.cache.PropertyConfigurator;
-import org.jboss.cache.TreeCache;
 import org.jboss.hibernate.jbc.cacheprovider.CacheProperties;
-import org.jboss.hibernate.jbc.cacheprovider.JmxBoundTreeCacheProvider;
-import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeTestUtil;
 import org.jboss.hibernate.jbc.cacheprovider.functional.util.TestCacheInstanceManager;
 import org.jboss.logging.Logger;
 
@@ -118,7 +105,7 @@
     /**
      * Apply any region-factory specific configurations.LoggerFactory.getLogger( 
      * 
-     * @param the Configuration to update.
+     * @param cfg the Configuration to update.
      */
     protected void configureCacheFactory(Configuration cfg)
     {

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Contact.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -24,9 +24,6 @@
 package org.jboss.hibernate.jbc.cacheprovider.functional;
 
 import java.io.Serializable;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
 
 /**
  * Entity that has a many-to-one relationship to a Customer
@@ -46,7 +43,6 @@
       
    }
    
-   @Id
    public Integer getId()
    {
       return id;
@@ -77,8 +73,6 @@
       this.tlf = tlf;
    }
    
-   @ManyToOne
-   @JoinColumn(name="CUST_ID")
    public Customer getCustomer()
    {
       return customer;

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/Customer.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -26,8 +26,6 @@
 import java.io.Serializable;
 import java.util.Set;
 
-import javax.persistence.Id;
-
 /**
  * Company customer
  *
@@ -41,13 +39,12 @@
    Integer id;
    String name;
 
-   private transient Set<Contact> contacts;
+   private transient Set contacts;
 
    public Customer()
    {
    }
 
-   @Id
    public Integer getId()
    {
       return id;
@@ -68,12 +65,12 @@
       name = string;
    }
 
-   public Set<Contact> getContacts()
+   public Set getContacts()
    {
       return contacts;
    }
 
-   public void setContacts(Set<Contact> contacts)
+   public void setContacts(Set contacts)
    {
       this.contacts = contacts;
    }

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CustomerContactDAO.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CustomerContactDAO.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/CustomerContactDAO.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -57,7 +57,7 @@
          
          Customer customer = new Customer();
          customer.setName("JBoss");
-         Set<Contact> contacts = new HashSet<Contact>();
+         Set contacts = new HashSet();
          
          Contact kabir = new Contact();
          kabir.setCustomer(customer);
@@ -78,7 +78,7 @@
          
          IdContainer ids = new IdContainer();
          ids.customerId = customer.getId();
-         Set<Integer> contactIds = new HashSet<Integer>();
+         Set contactIds = new HashSet();
          contactIds.add(kabir.getId());
          contactIds.add(bill.getId());
          ids.contactIds = contactIds;
@@ -113,7 +113,7 @@
          Session session = sessionFactory.getCurrentSession();
          Customer customer = (Customer) session.get(Customer.class, id);
          // Access all the contacts
-         for (Iterator<Contact> it = customer.getContacts().iterator(); it.hasNext();) {
+         for (Iterator it = customer.getContacts().iterator(); it.hasNext();) {
             ((Contact) it.next()).getName();
          }
          tm.commit();
@@ -174,8 +174,7 @@
       
    }
    
-   @SuppressWarnings("unchecked")
-   public List<Integer> getContactsForCustomer(Integer customerId, SessionFactory sessionFactory, TransactionManager tm) throws Exception
+   public List getContactsForCustomer(Integer customerId, SessionFactory sessionFactory, TransactionManager tm) throws Exception
    {
       System.out.println("GET CONTACTS FOR CUSTOMER");
       String selectHQL = "select contact.id from Contact contact";
@@ -187,10 +186,10 @@
       {
          Session session = sessionFactory.getCurrentSession();
          
-         List<Integer> results = (List<Integer>) session.createQuery(selectHQL)
-                                                        .setFlushMode(FlushMode.AUTO)
-                                                        .setParameter("cId", customerId)
-                                                        .setCacheable(true).list();
+         List results = session.createQuery(selectHQL)
+                        .setFlushMode(FlushMode.AUTO)
+                        .setParameter("cId", customerId)
+                        .setCacheable(true).list();
          
          tm.commit();
          
@@ -215,10 +214,11 @@
       
    }
    
-   public void cleanup(Set<Integer> customerIds, SessionFactory sessionFactory, TransactionManager tm) throws Exception
+   public void cleanup(Set customerIds, SessionFactory sessionFactory, TransactionManager tm) throws Exception
    {
-      for (Integer customerId : customerIds)
+      for (Iterator customerIt = customerIds.iterator(); customerIt.hasNext();)
       {
+         Integer customerId = (Integer) customerIt.next();
          tm.begin();
          try
          {
@@ -226,8 +226,11 @@
             Customer c = (Customer) session.get(Customer.class, customerId);
             if (c != null)
             {
-               for (Contact contact :  c.getContacts())
+               for (Iterator contactIt = c.getContacts().iterator(); contactIt.hasNext();)
+               {
+                  Contact contact = (Contact) contactIt.next();
                   session.delete(contact);
+               }
                c.setContacts(null);
                session.delete(c);
             }
@@ -251,6 +254,6 @@
    public class IdContainer 
    {
       Integer customerId;
-      Set<Integer> contactIds;
+      Set contactIds;
    }
 }

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/DualNodeTestCaseBase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -22,7 +22,6 @@
 import org.hibernate.engine.SessionFactoryImplementor;
 import org.hibernate.junit.functional.ExecutionEnvironment;
 import org.jboss.hibernate.jbc.cacheprovider.CacheProperties;
-import org.jboss.hibernate.jbc.cacheprovider.JmxBoundTreeCacheProvider;
 import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeConnectionProviderImpl;
 import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeJtaTransactionManagerImpl;
 import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeTestUtil;
@@ -57,7 +56,6 @@
       super(x, cacheMode);
    }
 
-   @Override
    public void configure(Configuration cfg)
    {
       configureFirstNode(cfg);
@@ -71,7 +69,7 @@
    /**
     * Apply any node-specific configurations to our first node.
     * 
-    * @param the Configuration to update.
+    * @param cfg the Configuration to update.
     */
    protected void configureFirstNode(Configuration cfg)
    {
@@ -83,7 +81,7 @@
    /**
     * Apply any node-specific configurations to our second node.
     * 
-    * @param the Configuration to update.
+    * @param cfg the Configuration to update.
     */
    protected void configureSecondNode(Configuration cfg)
    {
@@ -93,22 +91,18 @@
             TestCacheInstanceManager.CACHE_MBEAN_NAME_STARTS_WITH + DualNodeTestUtil.REMOTE);
    }
    
-   @Override
    protected Class getConnectionProviderClass() {
        return DualNodeConnectionProviderImpl.class;
    }
    
-   @Override
    protected Class getTransactionManagerLookupClass() {
        return DualNodeTransactionManagerLookup.class;
    }   
    
-   @Override
    protected Class getTransactionFactoryClass() {
        return CMTTransactionFactory.class;
    }
 
-   @Override
    protected void prepareTest() throws Exception
    {
       log.info( "Building second node locally managed execution env" );
@@ -118,7 +112,6 @@
       super.prepareTest();
    }
    
-   @Override
    protected void runTest() throws Throwable
    {
       try {
@@ -141,7 +134,6 @@
       }
    }
 
-   @Override
    protected void cleanupTest() throws Exception
    {
       try {

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTestCase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticEntityReplicationTestCase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -42,7 +42,6 @@
       super(name);
    }
 
-   @Override
    protected void configureCacheFactory(Configuration cfg)
    {
       cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, OptimisticJBossCacheTestCase.JBC_CONFIG);

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTestCase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticJBossCacheTestCase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -59,9 +59,8 @@
     /**
      * Apply any region-factory specific configurations.
      * 
-     * @param the Configuration to update.
+     * @param cfg the Configuration to update.
      */
-    @Override
     protected void configureCacheFactory(Configuration cfg) 
     {
        super.configureCacheFactory(cfg);

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticQueryCacheInvalidationTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticQueryCacheInvalidationTestCase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/OptimisticQueryCacheInvalidationTestCase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -35,15 +35,13 @@
    /**
     * Create a new OptimisticQueryCacheInvalidationTestCase.
     * 
-    * @param x
-    * @param cacheMode
+    * @param name
     */
    public OptimisticQueryCacheInvalidationTestCase(String name)
    {
       super(name);
    }
 
-   @Override
    protected void configureCacheFactory(Configuration cfg)
    {
       cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, OptimisticJBossCacheTestCase.JBC_CONFIG);

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationNoLocalPutsOnlyTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationNoLocalPutsOnlyTestCase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationNoLocalPutsOnlyTestCase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -47,7 +47,6 @@
       super(name);
    }
    
-   @Override
    protected void configureCacheFactory(Configuration cfg)
    {
       cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, PessimisticJBossCacheTestCase.JBC_CONFIG);
@@ -77,7 +76,7 @@
       SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
       
       CustomerContactDAO dao = new CustomerContactDAO();
-      Set<Integer> createdCustomerIds = new HashSet<Integer>();
+      Set createdCustomerIds = new HashSet();
       
       try
       {

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTestCase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticEntityReplicationTestCase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -61,13 +61,11 @@
       super(name, TreeCache.REPL_SYNC);
    }
 
-   @Override
    protected boolean getUseQueryCache()
    {
       return false;
    }
 
-   @Override
    protected void configureCacheFactory(Configuration cfg)
    {
       cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, PessimisticJBossCacheTestCase.JBC_CONFIG);
@@ -96,7 +94,7 @@
       SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
       
       CustomerContactDAO dao = new CustomerContactDAO();
-      Set<Integer> createdCustomerIds = new HashSet<Integer>();
+      Set createdCustomerIds = new HashSet();
       try
       {
          System.out.println("Create node 0");
@@ -163,14 +161,13 @@
    //@CacheListener
    public class MyListener extends AbstractTreeCacheListener
    {
-      HashSet<String> visited = new HashSet<String>(); 
+      HashSet visited = new HashSet(); 
       
       public void clear()
       {
          visited.clear();
       }
 
-      @Override
       public void nodeVisited(Fqn fqn)
       {
          super.nodeVisited(fqn);

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTestCase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticJBossCacheTestCase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -29,7 +29,6 @@
 import org.hibernate.cfg.Environment;
 import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
 import org.jboss.cache.TreeCache;
-import org.jboss.hibernate.jbc.cacheprovider.JmxBoundTreeCacheProvider;
 
 /**
  * Basic functional test of a pessimistic locking entity + query cache.
@@ -58,7 +57,7 @@
    /**
     * Apply any region-factory specific configurations.
     * 
-    * @param the Configuration to update.
+    * @param cfg the Configuration to update.
     */
    protected void configureCacheFactory(Configuration cfg) 
    {
@@ -67,4 +66,4 @@
       cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, JBC_CONFIG);
       cfg.setProperty(Environment.CACHE_PROVIDER, JBC_CACHE_PROVIDER);
    }
-}
\ No newline at end of file
+}

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticQueryCacheInvalidationTestCase.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticQueryCacheInvalidationTestCase.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/PessimisticQueryCacheInvalidationTestCase.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -23,20 +23,19 @@
 package org.jboss.hibernate.jbc.cacheprovider.functional;
 
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
 import javax.transaction.TransactionManager;
 
 import org.hibernate.SessionFactory;
-import org.hibernate.cache.StandardQueryCache;
 import org.hibernate.cfg.Configuration;
 import org.hibernate.cfg.Environment;
 import org.jboss.cache.AbstractTreeCacheListener;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.TreeCache;
 import org.jboss.hibernate.jbc.cacheprovider.functional.CustomerContactDAO.IdContainer;
-import org.jboss.hibernate.jbc.cacheprovider.functional.PessimisticEntityReplicationTestCase.MyListener;
 import org.jboss.hibernate.jbc.cacheprovider.functional.util.DualNodeTestUtil;
 import org.jboss.hibernate.jbc.cacheprovider.functional.util.TestCacheInstanceManager;
 import org.jboss.logging.Logger;
@@ -51,28 +50,23 @@
 
    protected static final long SLEEP_TIME = 50l;
    
-   private static final Integer CUSTOMER_ID = new Integer(1);
-   
    static int test = 0;
 
    /**
     * Create a new PessimisticQueryCacheInvalidationTestCase.
     * 
-    * @param x
-    * @param cacheMode
+    * @param name
     */
    public PessimisticQueryCacheInvalidationTestCase(String name)
    {
       super(name, TreeCache.REPL_SYNC);
    }
 
-   @Override
    protected boolean getUseQueryCache()
    {
       return true;
    }
 
-   @Override
    protected void configureCacheFactory(Configuration cfg)
    {
       cfg.setProperty(Environment.CACHE_PROVIDER_CONFIG, PessimisticJBossCacheTestCase.JBC_CONFIG);
@@ -97,7 +91,7 @@
       SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
       
       CustomerContactDAO dao = new CustomerContactDAO();
-      Set<Integer> createdCustomerIds = new HashSet<Integer>();
+      Set createdCustomerIds = new HashSet();
       
       try
       {
@@ -114,14 +108,14 @@
          Customer customer1 = dao.getCustomer(ids1.customerId, localFactory, localTM);
          
          // Execute and cache a query on remote node
-         List<Integer> contactIdList = dao.getContactsForCustomer(ids0.customerId, remoteFactory, remoteTM);
+         List contactIdList = dao.getContactsForCustomer(ids0.customerId, remoteFactory, remoteTM);
          assertEquals("No query cache visit", 0, remoteListener.visited.size());
          
-         Set<Integer> contactIds0 = new HashSet<Integer>(contactIdList);
+         Set contactIds0 = new HashSet(contactIdList);
          assertEquals("Query correct", ids0.contactIds, contactIds0);
          
          // Change a contact
-         Contact contact0A = customer0.getContacts().iterator().next();         
+         Contact contact0A = (Contact) customer0.getContacts().iterator().next();         
          dao.updateCustomerForContact(contact0A, customer1, localFactory, localTM);
          
          // Sleep a bit to let async timestamp update propagate.
@@ -134,7 +128,7 @@
          contactIdList = dao.getContactsForCustomer(ids0.customerId, remoteFactory, remoteTM);
          assertEquals("Had a query cache visit", 1, remoteListener.visited.size());
          
-         contactIds0 = new HashSet<Integer>(contactIdList);
+         contactIds0 = new HashSet(contactIdList);
          assertFalse("contact removed from customer 0", contactIds0.contains(contact0A.getId()));
          
          // Validate the query result
@@ -143,7 +137,7 @@
          
          // Validate a query for customer 1s contacts
          contactIdList = dao.getContactsForCustomer(ids1.customerId, remoteFactory, remoteTM);
-         Set<Integer> contactIds1 = new HashSet<Integer>(contactIdList);
+         Set contactIds1 = new HashSet(contactIdList);
          ids1.contactIds.add(contact0A.getId());
          assertEquals(ids1.contactIds, contactIds1);
       }
@@ -157,23 +151,23 @@
    }
    public class MyListener extends AbstractTreeCacheListener
    {
-      HashSet<String> visited = new HashSet<String>(); 
+      HashSet visited = new HashSet(); 
       
       public void clear()
       {
          visited.clear();
       }
 
-      @Override
       public void nodeVisited(Fqn fqn)
       {
          super.nodeVisited(fqn);
          
          log.info("MyListener - Visiting node " + fqn.toString());
          boolean foundStdQuery = false;
-         for (Object element : fqn.peekElements())
+         for (Iterator it = fqn.peekElements().iterator(); it.hasNext();)
          {
-            if (element.toString().contains(StandardQueryCache.class.getSimpleName()))
+            Object element = it.next();
+            if (element.toString().indexOf("StandardQueryCache") != -1)
             {
                foundStdQuery = true;
             }

Modified: projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java
===================================================================
--- projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java	2010-08-01 14:59:25 UTC (rev 107251)
+++ projects/cluster/hibernate-jbc-cacheprovider/trunk/src/test/java/org/jboss/hibernate/jbc/cacheprovider/functional/util/TestCacheInstanceManager.java	2010-08-02 00:20:04 UTC (rev 107252)
@@ -24,7 +24,9 @@
 package org.jboss.hibernate.jbc.cacheprovider.functional.util;
 
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Properties;
+import java.util.Map.Entry;
 
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
@@ -39,7 +41,6 @@
 import org.jboss.cache.PropertyConfigurator;
 import org.jboss.cache.TreeCache;
 import org.jboss.hibernate.jbc.cacheprovider.CacheProperties;
-import org.jboss.hibernate.jbc.cacheprovider.JmxBoundTreeCacheProvider;
 import org.jboss.logging.Logger;
 
 /**
@@ -54,7 +55,7 @@
 {   
    private static final Logger log = Logger.getLogger(TestCacheInstanceManager.class);
     
-   private static final Hashtable<String, TreeCache> cacheInstances = new Hashtable<String, TreeCache>();
+   private static final Hashtable cacheInstances = new Hashtable();
    
    private static final MBeanServer mbs = MBeanServerFactory.createMBeanServer("jboss");
    
@@ -64,18 +65,18 @@
     
    public static TreeCache getTreeCache(String name) 
    {
-      return cacheInstances.get(name);
+      return (TreeCache) cacheInstances.get(name);
    }
     
    public static void clearCacheManagers() 
    {
-      while(cacheInstances.keys().hasMoreElements())
+      for (Iterator it = cacheInstances.entrySet().iterator(); it.hasNext();)
       {
-         String id = cacheInstances.keys().nextElement();
-         TreeCache cache = null;
+         Entry entry = (Entry) it.next();
+         String id = (String) entry.getKey();
+         TreeCache cache = (TreeCache) entry.getValue();
          try
          {
-            cache = cacheInstances.get(id);
             cache.stopService();          
             mbs.unregisterMBean(new ObjectName(CACHE_MBEAN_NAME_STARTS_WITH + id));
          }
@@ -145,7 +146,6 @@
       {
          TreeCache cache = new TreeCache()
          {
-            @Override
             protected void registerChannelInJmx()
             {
             }



More information about the jboss-cvs-commits mailing list