Package org.openbravo.model.common.businesspartner

Examples of org.openbravo.model.common.businesspartner.Category


    addReadWriteAccess(Category.class);
    final OBCriteria<Category> obc = OBDal.getInstance().createCriteria(Category.class);
    obc.add(Expression.eq("name", "Standard"));
    final List<Category> bogs = obc.list();
    assertEquals(1, bogs.size());
    final Category bp = bogs.get(0);
    bp.setDescription(bp.getDescription() + "A");
    // switch usercontext to force exception
    setUserContext("1000019");
    try {
      commitTransaction();
    } catch (final OBException e) {
View Full Code Here


   * removed in a later test.
   */
  public void testCreateBPGroup() {
    setUserContext("1000000");
    addReadWriteAccess(Category.class);
    final Category bpg = OBProvider.getInstance().get(Category.class);
    bpg.setDefault(true);
    bpg.setDescription("testdescription");
    bpg.setName("testname");
    bpg.setSearchKey("testvalue");
    bpg.setActive(true);
    OBDal.getInstance().save(bpg);
  }
View Full Code Here

    addReadWriteAccess(CategoryAccounts.class);
    final OBCriteria<Category> obCriteria = OBDal.getInstance().createCriteria(Category.class);
    obCriteria.add(Expression.eq(Category.PROPERTY_NAME, "testname"));
    final List<Category> bpgs = obCriteria.list();
    assertEquals(1, bpgs.size());
    final Category bpg = bpgs.get(0);
    final OBContext obContext = OBContext.getOBContext();
    assertEquals(obContext.getUser().getId(), bpg.getCreatedBy().getId());
    assertEquals(obContext.getUser().getId(), bpg.getUpdatedBy().getId());
    // update and create have occured less than one second ago
    // note that if the delete fails for other reasons that you will have a
    // Category in the database which has for sure a created/updated time
    // longer in the past, You need to manually delete the currency record
    if (false) {
      assertTrue("Created time not updated", (System.currentTimeMillis() - bpg.getCreationDate()
          .getTime()) < 3000);
      assertTrue("Updated time not updated", (System.currentTimeMillis() - bpg.getUpdated()
          .getTime()) < 3000);
    }

    // first delete the related accounts
    final OBCriteria<CategoryAccounts> obc2 = OBDal.getInstance().createCriteria(
View Full Code Here

    addReadWriteAccess(CategoryAccounts.class);
    final OBCriteria<Category> obc = OBDal.getInstance().createCriteria(Category.class);
    obc.add(Expression.eq(Category.PROPERTY_NAME, "hello world"));
    final List<Category> bpgs = obc.list();
    assertEquals(1, bpgs.size());
    final Category bog = bpgs.get(0);
    final OBContext obContext = OBContext.getOBContext();
    assertEquals(obContext.getUser().getId(), bog.getCreatedBy().getId());
    assertEquals(obContext.getUser().getId(), bog.getUpdatedBy().getId());
    // update and create have occured less than one second ago
    // note that if the delete fails for other reasons that you will have a
    // currency in the database which has for sure a created/updated time
    // longer in the past, You need to manually delete the currency record
    // NOTE: disabled for now as it is to sensitive if there is time between a
    // failed testcase and a retry
    if (false) {
      assertTrue("Created time not updated", (System.currentTimeMillis() - bog.getCreationDate()
          .getTime()) < 2000);
      assertTrue("Updated time not updated", (System.currentTimeMillis() - bog.getUpdated()
          .getTime()) < 2000);
    }

    // first delete the related accounts
    final OBCriteria<CategoryAccounts> obc2 = OBDal.getInstance().createCriteria(
View Full Code Here

   * Test creates a new {@link Category} and saves it. The new object is removed in the next test.
   */
  public void testCreateBPGroup() {
    setUserContext("1000000");
    addReadWriteAccess(Category.class);
    final Category bpg = OBProvider.getInstance().get(Category.class);
    bpg.setDefault(true);
    bpg.setDescription("testdescription");
    bpg.setName("testname");
    bpg.setSearchKey("testvalue");
    bpg.setActive(true);
    OBDal.getInstance().save(bpg);
  }
View Full Code Here

    addReadWriteAccess(CategoryAccounts.class);
    final OBQuery<Category> obQuery = OBDal.getInstance().createQuery(Category.class,
        Category.PROPERTY_NAME + "='testname' or " + Category.PROPERTY_SEARCHKEY + "='testvalue'");
    final List<Category> bpgs = obQuery.list();
    assertEquals(1, bpgs.size());
    final Category bpg = bpgs.get(0);
    final OBContext obContext = OBContext.getOBContext();
    assertEquals(obContext.getUser().getId(), bpg.getCreatedBy().getId());
    assertEquals(obContext.getUser().getId(), bpg.getUpdatedBy().getId());
    // update and create have occured less than one second ago
    // note that if the delete fails for other reasons that you will have a
    // currency in the database which has for sure a created/updated time
    // longer in the past, You need to manually delete the currency record
    if (false) {
      assertTrue("Created time not updated", (System.currentTimeMillis() - bpg.getCreationDate()
          .getTime()) < 2000);
      assertTrue("Updated time not updated", (System.currentTimeMillis() - bpg.getUpdated()
          .getTime()) < 2000);
    }

    // first delete the related accounts
    final List<Object> parameters = new ArrayList<Object>();
View Full Code Here

TOP

Related Classes of org.openbravo.model.common.businesspartner.Category

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.