Package org.objectweb.speedo.pobjects.map

Examples of org.objectweb.speedo.pobjects.map.AllMap


  }

    public void testNullMap() {
        PersistenceManager pm = pmf.getPersistenceManager();
        pm.currentTransaction().begin();
        AllMap am = new AllMap("testNullMap");
        pm.makePersistent(am);
        Object oid = pm.getObjectId(am);
        Assert.assertNotNull("The identifier is null", oid);
        am.setLong2Long(null);
        am.setlong2Ref(null);
        am.setProp(null);
        am.setStr2Long(null);
        am.setStr2Ref(null);
        pm.currentTransaction().commit();
        pm.close();
        pm = null;
        am = null;
        pm = pmf.getPersistenceManager();
        am = (AllMap) pm.getObjectById(oid, true);
        Assert.assertNotNull("No persistence found with the id " + oid, am);
        Assert.assertTrue("The Map (Long,Long) is not null",   am.getMap_Long2Long().isEmpty());
        Assert.assertTrue("The Map (Long,Ref) is not null",    am.getMap_Long2Ref().isEmpty());
        Assert.assertTrue("The Map (String,Long) is not null", am.getMap_str2Long().isEmpty());
        Assert.assertTrue("The Map (String,Ref) is not null",  am.getMap_str2Ref().isEmpty());

        Assert.assertTrue("The HashMap (Long,Long) is not null",   am.getHmap_Long2Long().isEmpty());
        Assert.assertTrue("The HashMap (Long,Ref) is not null",    am.getHmap_Long2Ref().isEmpty());
        Assert.assertTrue("The HashMap (String,Long) is not null", am.getHmap_str2Long().isEmpty());
        Assert.assertTrue("The HashMap (String,Ref) is not null",  am.getHmap_str2Ref().isEmpty());

        Assert.assertTrue("The Hashtable (Long,Long) is not null",   am.getHt_Long2Long().isEmpty());
        Assert.assertTrue("The Hashtable (Long,Ref) is not null",    am.getHt_Long2Ref().isEmpty());
        Assert.assertTrue("The Hashtable (String,Long) is not null", am.getHt_str2Long().isEmpty());
        Assert.assertTrue("The Hashtable (String,Ref) is not null",  am.getHt_str2Ref().isEmpty());

        Assert.assertNotNull("The Properties is not null",  am.getProp());
        pm.currentTransaction().begin();
        pm.deletePersistent(am);
        pm.currentTransaction().commit();
        pm.close();
    }
View Full Code Here


    }

    public void testEmptyMap() {
        PersistenceManager pm = pmf.getPersistenceManager();
        pm.currentTransaction().begin();
        AllMap am = new AllMap("testEmptyMap");
        pm.makePersistent(am);
        Object oid = pm.getObjectId(am);
        Assert.assertNotNull("The identifier is null", oid);
        am.setLong2Long(new HashMap());
        am.setlong2Ref(new HashMap());
        am.setProp(new HashMap());
        am.setStr2Long(new HashMap());
        am.setStr2Ref(new HashMap());
        pm.currentTransaction().commit();
        pm.close();
        pm = null;
        am = null;
        pm = pmf.getPersistenceManager();
        am = (AllMap) pm.getObjectById(oid, true);
        Assert.assertNotNull("No persistence found with the id " + oid, am);

        Assert.assertNotNull("The Map (Long,Long) ",   am.getMap_Long2Long());
        assertEquals("The Map (Long,Long) : bad size",    0, am.getMap_Long2Long().size());

        Assert.assertNotNull("The Map (Long,Ref) ",    am.getMap_Long2Ref());
        assertEquals("The Map (Long,Ref) : bad size",    0, am.getMap_Long2Ref().size());

        Assert.assertNotNull("The Map (String,Long) ", am.getMap_str2Long());
        assertEquals("The Map (String,Long) : bad size", 0, am.getMap_str2Long().size());

        Assert.assertNotNull("The Map (String,Ref) ",  am.getMap_str2Ref());
        assertEquals("The Map (String,Ref) : bad size"0, am.getMap_str2Ref().size());


        Assert.assertNotNull("The HashMap (Long,Long) ",   am.getHmap_Long2Long());
        assertEquals("The HashMap (Long,Long) : bad size",   0, am.getHmap_Long2Long().size());

        Assert.assertNotNull("The HashMap (Long,Ref) ",    am.getHmap_Long2Ref());
        assertEquals("The HashMap (Long,Ref) : bad size",    0, am.getHmap_Long2Ref().size());

        Assert.assertNotNull("The HashMap (String,Long) ", am.getHmap_str2Long());
        assertEquals("The HashMap (String,Long) : bad size", 0, am.getHmap_str2Long().size());

        Assert.assertNotNull("The HashMap (String,Ref) ",  am.getHmap_str2Ref());
        assertEquals("The HashMap (String,Ref) : bad size"0, am.getHmap_str2Ref().size());


        Assert.assertNotNull("The Hashtable (Long,Long) ",   am.getHt_Long2Long());
        assertEquals("The Hashtable (Long,Long) : bad size",   0, am.getHt_Long2Long().size());

        Assert.assertNotNull("The Hashtable (Long,Ref) ",    am.getHt_Long2Ref());
        assertEquals("The Hashtable (Long,Ref) : bad size",    0, am.getHt_Long2Ref().size());

        Assert.assertNotNull("The Hashtable (String,Long) ", am.getHt_str2Long());
        assertEquals("The Hashtable (String,Long) : bad size", 0, am.getHt_str2Long().size());

        Assert.assertNotNull("The Hashtable (String,Ref) ",  am.getHt_str2Ref());
        assertEquals("The Hashtable (String,Ref) : bad size"0, am.getHt_str2Ref().size());

        Assert.assertNotNull("The Properties ",  am.getProp());
        assertEquals("The Properties : bad size"0, am.getProp().size());
        pm.currentTransaction().begin();
        pm.deletePersistent(am);
        pm.currentTransaction().commit();
        pm.close();
    }
View Full Code Here


    public void testTwoElem() {
        PersistenceManager pm = pmf.getPersistenceManager();
        pm.currentTransaction().begin();
        AllMap am = new AllMap("testTwoElem");
        Map l2l = new HashMap();
        l2l.put(new Long(12), new Long(34));
        l2l.put(new Long(56), new Long(78));
        am.setLong2Long(l2l);

        Map l2r = new HashMap();
        l2r.put(new Long(12), am);
        am.setlong2Ref(l2r);

        Properties p = new Properties();
        p.put("a","b");
        p.put("c","d");
        am.setProp(p);

        Map s2l = new HashMap();
        s2l.put("a", new Long(12));
        s2l.put("b", new Long(34));
        am.setStr2Long(s2l);

        Map s2r = new HashMap();
        s2r.put("a", am);
        am.setStr2Ref(s2r);

        pm.makePersistent(am);
        Object oid = pm.getObjectId(am);
        Assert.assertNotNull("The identifier is null", oid);

        pm.currentTransaction().commit();
        pm.close();
        pm = null;
        am = null;
        pm = pmf.getPersistenceManager();
        am = (AllMap) pm.getObjectById(oid, true);
        Assert.assertNotNull("No persistence found with the id " + oid, am);

        Assert.assertNotNull("The Map (Long,Long) ",   am.getMap_Long2Long());
        assertEquals("The Map (Long,Long)", l2l, am.getMap_Long2Long());

        Assert.assertNotNull("The Map (Long,Ref) ",    am.getMap_Long2Ref());
        assertEquals("The Map (Long,Ref)", l2r, am.getMap_Long2Ref());

        Assert.assertNotNull("The Map (String,Long) ", am.getMap_str2Long());
        assertEquals("The Map (String,Long)", s2l, am.getMap_str2Long());

        Assert.assertNotNull("The Map (String,Ref) ",  am.getMap_str2Ref());
        assertEquals("The Map (String,Ref)",  s2r, am.getMap_str2Ref());


        Assert.assertNotNull("The HashMap (Long,Long) ",   am.getHmap_Long2Long());
        assertEquals("The HashMap (Long,Long)", l2l, am.getHmap_Long2Long());

        Assert.assertNotNull("The HashMap (Long,Ref) ",    am.getHmap_Long2Ref());
        assertEquals("The HashMap (Long,Ref) ",    l2r, am.getHmap_Long2Ref());

        Assert.assertNotNull("The HashMap (String,Long) ", am.getHmap_str2Long());
        assertEquals("The HashMap (String,Long) ", s2l, am.getHmap_str2Long());

        Assert.assertNotNull("The HashMap (String,Ref) ",  am.getHmap_str2Ref());
        assertEquals("The HashMap (String,Ref) ",  s2r, am.getHmap_str2Ref());


        Assert.assertNotNull("The Hashtable (Long,Long) ",   am.getHt_Long2Long());
        assertEquals("The Hashtable (Long,Long) ",   l2l, am.getHt_Long2Long());

        Assert.assertNotNull("The Hashtable (Long,Ref) ",    am.getHt_Long2Ref());
        assertEquals("The Hashtable (Long,Ref) ",    l2r, am.getHt_Long2Ref());

        Assert.assertNotNull("The Hashtable (String,Long) ", am.getHt_str2Long());
        assertEquals("The Hashtable (String,Long) ", s2l, am.getHt_str2Long());

        Assert.assertNotNull("The Hashtable (String,Ref) ",  am.getHt_str2Ref());
        assertEquals("The Hashtable (String,Ref) ",  s2r, am.getHt_str2Ref());

        Assert.assertNotNull("The Properties ",  am.getProp());
        assertEquals("The Properties ", p, am.getProp());
        pm.currentTransaction().begin();
        pm.deletePersistent(am);
        pm.currentTransaction().commit();
        pm.close();
    }
View Full Code Here

        pm.close();
    }

    public void testPutSameElement() {
        PersistenceManager pm = pmf.getPersistenceManager();
        AllMap am = new AllMap("testTwoElem");
        Map l2l = new HashMap();
        l2l.put(new Long(12), new Long(34));
        l2l.put(new Long(56), new Long(78));
        am.setLong2Long(l2l);

        Properties p = new Properties();
        p.put("a","b");
        p.put("c","d");
        am.setProp(p);

        Map s2l = new HashMap();
        s2l.put("a", new Long(12));
        s2l.put("b", new Long(34));
        am.setStr2Long(s2l);

        pm.currentTransaction().begin();
        pm.makePersistent(am);
        checkAllMap(am, l2l, s2l, p);
        Object oid = pm.getObjectId(am);
        Assert.assertNotNull("The identifier is null", oid);
        checkAllMap(am, l2l, s2l, p);
        pm.currentTransaction().commit();

        pm.currentTransaction().begin();
        checkAllMap(am, l2l, s2l, p);
        pm.currentTransaction().commit();

        am = null;
        pm.evictAll();
        pm.currentTransaction().begin();
        am = (AllMap) pm.getObjectById(oid, false);
        checkAllMap(am, l2l, s2l, p);
        pm.currentTransaction().commit();

        pm.currentTransaction().begin();

        l2l.put(new Long(12), new Long(35));
        am.getMap_Long2Long().put(new Long(12), new Long(35));
        am.getHmap_Long2Long().put(new Long(12), new Long(35));
        am.getHt_Long2Long().put(new Long(12), new Long(35));

        l2l.put(new Long(13), new Long(38));
        am.getMap_Long2Long().put(new Long(13), new Long(38));
        am.getHmap_Long2Long().put(new Long(13), new Long(38));
        am.getHt_Long2Long().put(new Long(13), new Long(38));

        p.setProperty("a", "x");
        am.getProp().put("a", "x");
       
        p.setProperty("e", "f");
        am.getProp().put("e", "f");
       
        s2l.put("a", new Long(13));
        am.getMap_str2Long().put("a", new Long(13));
        am.getHmap_str2Long().put("a", new Long(13));
        am.getHt_str2Long().put("a", new Long(13));

        s2l.put("c", new Long(24));
        am.getMap_str2Long().put("c", new Long(24));
        am.getHmap_str2Long().put("c", new Long(24));
        am.getHt_str2Long().put("c", new Long(24));

        checkAllMap(am, l2l, s2l, p);
        pm.currentTransaction().commit();
       
       
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.map.AllMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.