Examples of ProductGroup


Examples of org.apache.ojb.broker.ProductGroup

        if(ojbSkipKnownIssueProblem("Update by reachabilitiy doesn't work proper"))
        {
            return;
        }
        Transaction tx = null;
        ProductGroup pg;
        Article article;
        Article article2;
        org.apache.ojb.broker.Person person;
        org.apache.ojb.broker.Project project;
        Identity aOid = null;
        Identity aOid2 = null;
        Identity pgOid = null;
        Identity prsOid = null;
        Identity prjOid = null;

        //perform transaction
        try
        {
            tx = _kit.getTransaction(_conn);
            tx.begin();

            pg = new ProductGroup();
            pg.setId(new Integer(77777));
            pgOid = _conn.getIdentity(pg);
            pg.setName("1");
            _conn.makePersistent(pg);
            article = Article.createInstance();
            article.setArticleId(new Integer(77777));
            aOid = _conn.getIdentity(article);
            article.setStock(333);
            pg.add(article);
            article.setProductGroup(pg);
            article2 = Article.createInstance();
            article2.setArticleId(new Integer(77778));
            aOid2 = _conn.getIdentity(article2);
            article2.setStock(334);
            pg.add(article2);
            article2.setProductGroup(pg);
            _conn.makePersistent(article);
            _conn.makePersistent(article2);
            person = new org.apache.ojb.broker.Person(77777, "first", "last");
            prsOid = _conn.getIdentity(person);
            project = new org.apache.ojb.broker.Project(77777, "title", "desc");
            prjOid = _conn.getIdentity(project);
            _conn.makePersistent(person);
            _conn.makePersistent(project);
            tx.commit();


            tx = _kit.getTransaction(_conn);
            tx.begin();
            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
            InterfaceArticle articleNew1 = (InterfaceArticle) pg.getAllArticles().get(0);
            InterfaceArticle articleNew2 = (InterfaceArticle) pg.getAllArticles().get(1);
            if (!_conn.getIdentity(articleNew2).equals(aOid2))
            {
                articleNew2 = (InterfaceArticle) pg.getAllArticles().get(0);
                articleNew1 = (InterfaceArticle) pg.getAllArticles().get(1);
                if (!_conn.getIdentity(article2).equals(aOid2))
                {
                    fail("Missing the second article");
                }
            }
            articleNew1.setStock(433);
            articleNew2.setStock(434);
            pg.setName("2");
            tx.commit();

            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidateAll();
View Full Code Here

Examples of org.apache.ojb.broker.ProductGroup

    }

    public void testSwizzling() throws Throwable
    {
        Transaction tx = null;
        ProductGroup pg;
        Article article;
        Article article2;

        try
        {
            tx = _kit.getTransaction(_conn);
            tx.begin();

            pg = new ProductGroup();
            pg.setId(new Integer(77777));
            _conn.makePersistent(pg);
            article = Article.createInstance();
            article.setArticleId(new Integer(77777));
            article.setStock(333);
            pg.add(article);
            article.setProductGroup(pg);
            _conn.makePersistent(article);
            article2 = Article.createInstance();
            article2.setArticleId(article.getArticleId());
            article2.setStock(334);
            article2.setProductGroup(pg);
            _conn.makePersistent(article2);
            article = (Article) pg.getAllArticles().get(0);
            assertEquals("should be equal", 334, article.getStock());
        }
        finally
        {
            if (tx != null)
View Full Code Here

Examples of org.apache.ojb.broker.ProductGroup

  public void testProductGroup5()
  {
    resetStmtCount();
    myPB.clearCache();
    myPB.beginTransaction();
    ProductGroup pg =
            (ProductGroup)myPB.getObjectByIdentity(new Identity(null, ProductGroup.class, new Object[] {new Integer(5)}));
    assertStmtCount("getObjectByIdentity", 4);
    resetStmtCount();
    List articles = pg.getAllArticles();
    assertEquals(12, articles.size());
    assertStmtCount("getAllArticles", 0);
    resetStmtCount();
    for (Iterator articleIterator = articles.iterator(); articleIterator.hasNext(); )
    {
      InterfaceArticle article = (InterfaceArticle)articleIterator.next();
      logger.info("articleId " + article.getArticleId());
      // SELECT ... FROM Artikel WHERE Artikel_Nr = ...
    }
    assertStmtCount("collect ids: ", 1)// batch retrieval!
    resetStmtCount();
    String str = pg.toString();
    // SELECT ... FROM Kategorien WHERE Kategorie_Nr = '5'
    // SELECT ... FROM Artikel A0 WHERE Kategorie_Nr =  '5'
    // SELECT ... FROM BOOKS A0   WHERE Kategorie_Nr =  '5'
    // SELECT ... FROM CDS A0     WHERE Kategorie_Nr =  '5'
    assertStmtCount("toString", 4);
View Full Code Here

Examples of org.apache.ojb.broker.ProductGroup

      Collection results = myPB.getCollectionByQuery(q);
      assertEquals("Number of ProductGroups", 5, results.size());
      Collection articles = new ArrayList();
      for (Iterator it = results.iterator();it.hasNext();)
      {
          ProductGroup p = (ProductGroup) it.next();
          articles.addAll(p.getAllArticles());
      }
      assertEquals("Total number of Articles", 59, articles.size());
     
      //SELECT A0.KategorieName,A0.Kategorie_Nr,A0.Beschreibung FROM Kategorien A0 WHERE A0.Kategorie_Nr <=  '5'
      //SELECT ... FROM CDS A0 WHERE A0.Kategorie_Nr IN ( '1' , '4' , '2' , '5' , '3' )
View Full Code Here

Examples of org.apache.ojb.broker.ProductGroup

      Collection results = myPB.getCollectionByQuery(q);
      assertEquals("Number of ProductGroups", 5, results.size());
      Collection articles = new ArrayList();
      for (Iterator it = results.iterator();it.hasNext();)
      {
          ProductGroup p = (ProductGroup) it.next();
          articles.addAll(p.getAllArticles());
      }
      assertEquals("Total number of Articles", 59, articles.size());
     
      //SELECT A0.KategorieName,A0.Kategorie_Nr,A0.Beschreibung FROM Kategorien A0 WHERE A0.Kategorie_Nr <=  '5'
      //SELECT ... FROM CDS A0 WHERE A0.Kategorie_Nr =  '5'
View Full Code Here

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

    protected void setUp() throws Exception
    {
        super.setUp();
        Transaction tx = odmg.newTransaction();
        tx.begin();
        testProductGroup = new ProductGroup();
        testProductGroup.setGroupName("NamedRootsTest_" + System.currentTimeMillis());
        database.makePersistent(testProductGroup);
        tx.commit();
    }
View Full Code Here

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

    protected void setUp() throws Exception
    {
        super.setUp();
        Transaction tx = odmg.newTransaction();
        tx.begin();
        productGroup = new ProductGroup();
        productGroup.setName("DMapTest_" + System.currentTimeMillis() + "_");
        database.makePersistent(productGroup);
        tx.commit();
    }
View Full Code Here

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

        query.create("select aPG from " + ProductGroup.class.getName() + " where groupName like \"Fruit*\"");
        List check = (List) query.execute();
        if (check.size() < 1)
            fail("Could not found ProductGroup's for: " +
                    "select aPG from " + ProductGroup.class.getName() + " where groupName like \"Fruit*\"");
        ProductGroup pg = (ProductGroup) check.get(0);

        assertEquals(pg.getAllArticlesInGroup().size(), results.size());
        assertTrue((results.size() > 0));

        tx.commit();


View Full Code Here

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

        if(ojbSkipKnownIssueProblem()) return;

        Transaction tx = odmg.newTransaction();
        tx.begin();

        ProductGroup pg1 = new ProductGroup();
        pg1.setName("BatchModeTest ProductGroup #1");
        database.makePersistent(pg1);

        tx.checkpoint();

        Article a1 = Article.createInstance();
        a1.setArticleName("BatchModeTest Article #1");
        a1.setProductGroup(pg1);
        pg1.addArticle(a1);
        database.makePersistent(a1);

        ProductGroup pg2 = new ProductGroup();
        pg2.setName("BatchModeTest ProductGroup #2");
        database.makePersistent(pg2);

        Article a2 = Article.createInstance();
        a2.setArticleName("BatchModeTest Article #2");
        a2.setProductGroup(pg2);
        pg2.addArticle(a2);

        tx.checkpoint();

        database.deletePersistent(a1);
View Full Code Here

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

    protected void setUp() throws Exception
    {
        super.setUp();
        Transaction tx = odmg.newTransaction();
        tx.begin();
        productGroup = new ProductGroup();
        productGroup.setName("DMapTest_" + System.currentTimeMillis() + "_");
        database.makePersistent(productGroup);
        tx.commit();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.