/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.cache;


import java.util.ArrayList;
import java.util.HashMap;




/**
 *
 * @author Bela Ban
 * @version $Revision: 1.1.2.1 $
 */
public class CacheImplTest {


    public static void main(String[] args) {
        CacheImpl c=new CacheImpl();


        // c.setCacheMode(Options.TRANSIENT);


        try {
            System.out.println("-- creating replicated cache");
            c.createService();

            System.out.println("-- starting cache");
            c.startService();


            c.put("name", "Bela Ban");
            System.out.println("cache size is " + c.size());
            System.out.println("value for \"name\" is " + c.get("name"));

            CacheKey k1, k2;
            k1=new CacheKey("name");
            k2=new CacheKey("name");

            HashMap map=new HashMap();

            if(k1.equals(k2))
                System.out.println("is equal");
            else
                System.out.println("not equals");

            map.put(k1, "value for k1");
            map.put(k2, "value for k2");

            System.out.println("size(): " + map.size() + ", value for \"name\": " + map.get("name"));

            ArrayList l=new ArrayList();
            if(!l.contains(k1))
                l.add(k1);

            if(!l.contains(k2))
                l.add(k2);

            System.out.println("size(): " + l.size() + ", first element: " + l.get(0));
        }
        catch(TimeoutException e) {
        }
        catch(LockingException e) {
        }
        catch(Throwable t) {
            System.err.println("exception is " + t);
        }
    }
}
