Package org.apache.ojb.odmg.shared

Examples of org.apache.ojb.odmg.shared.Article


            tx1 = (TransactionImpl) odmg.newTransaction();

            tx1.begin();
            tx2.begin();

            obj = new Article();
            obj.setArticleId(333);

        }
        catch (ODMGException e)
        {
View Full Code Here


    public void testLockBasics() throws Exception
    {
        TransactionImpl tx1 = (TransactionImpl) odmg1.newTransaction();
        TransactionImpl tx2 = (TransactionImpl) odmg2.newTransaction();

        Article a = new Article();
        a.setArticleId(333);

        tx1.begin();
        tx2.begin();
        LockManager lm = LockManagerFactory.getLockManager();
        boolean success1 = lm.writeLock(tx1, a);
View Full Code Here

    public void testLockBasics2() throws Exception
    {
        TransactionImpl tx1 = (TransactionImpl) odmg1.newTransaction();
        TransactionImpl tx2 = (TransactionImpl) odmg2.newTransaction();

        Article a1 = new Article();
        a1.setArticleId(333);

        Article a2 = new Article();
        a2.setArticleId(333);

        tx1.begin();
        tx2.begin();
        LockManager lm = LockManagerFactory.getLockManager();
View Full Code Here

     * factory method that createa an PerformanceArticle
     * @return the created PerformanceArticle object
     */
    private Article createArticle(String name)
    {
        Article a = new Article();

        a.setArticleName(PRE + name);
        a.setMinimumStock(100);
        a.setOrderedUnits(17);
        a.setPrice(0.45);
        a.setProductGroupId(1);
        a.setStock(234);
        a.setSupplierId(4);
        a.setUnit("bottle");
        return a;
    }
View Full Code Here

    {
        int loops = 10;
        Article[] arr = new Article[loops];
        for (int i = 0; i < loops; i++)
        {
            Article a = createArticle("testLockLoop");
            arr[i] = a;
        }

        TransactionImpl tx = (TransactionImpl) odmg1.newTransaction();
        tx.begin();
View Full Code Here

            tx1 = (TransactionImpl) odmg.newTransaction();
            tx2 = (TransactionImpl) odmg.newTransaction();
            tx1.begin();
            tx2.begin();
            obj = new Article();
            obj.setArticleId(333);

        }
        catch (ODMGException e)
        {
View Full Code Here

    }

    protected Article createArticle(String name) throws Exception
    {

        Article a = new Article();
        a.setArticleName(productGroup.getName() + name);
        a.setStock(234);
        a.setProductGroup(productGroup);
        return a;
    }
View Full Code Here

        tx.begin();
        DMap map = odmg.newDMap();

        database.bind(map, namedObject);
        Article key1 = createArticle(name + "_key1");
        Article val1 = createArticle(name + "_val1");
        Article key2 = createArticle(name + "_key2");
        Article val2 = createArticle(name + "_val2");

        map.put(key1, val1);
        map.put(key2, val2);
        tx.commit();


        tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        tx.getBroker().clearCache();

        DMap mapA = (DMap) database.lookup(namedObject);
        assertNotNull(mapA);
        Article val1A = (Article) mapA.get(key1);
        assertNotNull(val1A);
        assertEquals(val1.getArticleId(), val1A.getArticleId());
        Article val2A = (Article) mapA.get(key2);
        assertNotNull(val2A);
        assertEquals(val2.getArticleId(), val2A.getArticleId());
        tx.commit();
    }
View Full Code Here

        tx.begin();
        DMap map = odmg.newDMap();

        database.bind(map, namedObject);
        Article key1 = createArticle(name + "_key1");
        Article val1 = createArticle(name + "_val1");
        Article key2 = createArticle(name + "_key2");
        Article val2 = createArticle(name + "_val2");

        map.put(key1, val1);
        map.put(key2, val2);
        tx.commit();


        tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        tx.getBroker().clearCache();

        DMap mapA = (DMap) database.lookup(namedObject);
        assertNotNull(mapA);
        Article val1A = (Article) mapA.get(key1);
        assertNotNull(val1A);
        assertEquals(val1.getArticleId(), val1A.getArticleId());
        Article val2A = (Article) mapA.get(key2);
        assertNotNull(val2A);
        assertEquals(val2.getArticleId(), val2A.getArticleId());
        tx.commit();

        tx.begin();
        mapA.remove(key1);

        tx.checkpoint();

        mapA = (DMap) database.lookup(namedObject);
        assertNotNull(mapA);
        val1A = (Article) mapA.get(key1);
        assertNull(val1A);
        val2A = (Article) mapA.get(key2);
        assertNotNull(val2A);
        assertEquals(val2.getArticleId(), val2A.getArticleId());
        tx.commit();

        tx.begin();
        mapA.remove(key2);
        mapA.put(key2, val2);

        tx.checkpoint();

        mapA = (DMap) database.lookup(namedObject);
        assertNotNull(mapA);
        val1A = (Article) mapA.get(key1);
        assertNull(val1A);
        val2A = (Article) mapA.get(key2);
        assertNotNull(val2A);
        assertEquals(val2.getArticleId(), val2A.getArticleId());
        tx.commit();

        tx.begin();
        mapA.remove(key2);
        tx.commit();
View Full Code Here

        tx.commit();
    }

    private Article createArticle()
    {
        Article example = new Article();
        example.setArticleName(testProductGroup.getName());
        example.setProductGroupId(testProductGroup.getId());
        return example;
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.odmg.shared.Article

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.