Package er.erxtest.model

Examples of er.erxtest.model.Company


    cache.stop();
  }

  public void testFetchWithFetchInitialValuesAndTimeout() {
      ERXEnterpriseObjectCache<Company> cache = new ERXEnterpriseObjectCache<Company>(Company.ENTITY_NAME, Company.NAME_KEY, null, 100000);
      Company c1Test = cache.objectForKey(editingContext, c1.name());
      assertSame(c1, c1Test);
      cache.stop();
  }
View Full Code Here


  }

  public void testFetchNoFetchInitialValues() {
    ERXEnterpriseObjectCache<Company> cache = new ERXEnterpriseObjectCache<Company>(Company.ENTITY_NAME, Company.NAME_KEY, null, 0);
    cache.setFetchInitialValues(false);
    Company c1Test = cache.objectForKey(editingContext, c1.name());
    assertSame(c1, c1Test);
    cache.stop();
  }
View Full Code Here

  public void testFetchNoFetchInitialValuesAndTimeout() {

    ERXEnterpriseObjectCache<Company> cache = new ERXEnterpriseObjectCache<Company>(Company.ENTITY_NAME, Company.NAME_KEY, null, 100000);
    cache.setFetchInitialValues(false);
    Company c1Test = cache.objectForKey(editingContext, c1.name());
    assertSame(c1, c1Test);
    cache.stop();
  }
View Full Code Here

  }

  public void testFetchWithQualifier() {
    ERXEnterpriseObjectCache<Company> cache = new ERXEnterpriseObjectCache<Company>(Company.ENTITY_NAME, Company.NAME_KEY, Company.NAME.contains("Test"), 0);
    cache.setFetchInitialValues(false);
    Company c1Test = cache.objectForKey(editingContext, c1.name());
    assertNull(c1Test);
    Company c2Test = cache.objectForKey(editingContext, c2.name());
    assertSame(c2, c2Test);
    cache.stop();
  }
View Full Code Here

  }

  public void testUpdateWithQualifier() {
    ERXEnterpriseObjectCache<Company> cache = new ERXEnterpriseObjectCache<Company>(Company.ENTITY_NAME, Company.NAME_KEY, Company.NAME.contains("Test"), 0);
    cache.setFetchInitialValues(false);
    Company c1Test = cache.objectForKey(editingContext, c1.name());
    assertNull(c1Test);
    Company c2Test = cache.objectForKey(editingContext, c2.name());
    assertSame(c2, c2Test);

    String name1Update = "Another Test Company " + UUID.randomUUID().toString();
    c1.setName(name1Update);
    editingContext.saveChanges();

    Company c1UpdateTest = cache.objectForKey(editingContext, name1Update);
    assertSame(c1, c1UpdateTest);

    String name2Update = "Company 2 " + UUID.randomUUID().toString();
    c2.setName(name2Update);
    editingContext.saveChanges();

    Company c2UpdateTest = cache.objectForKey(editingContext, name2Update);
    assertNull(c2UpdateTest);

    cache.stop();
  }
View Full Code Here

  }

  public void testInsert(boolean fetchInitialValues) {
    ERXEnterpriseObjectCache<Company> cache = new ERXEnterpriseObjectCache<Company>(Company.ENTITY_NAME, Company.NAME_KEY, null, 0);
    cache.setFetchInitialValues(fetchInitialValues);
    Company c1Test = cache.objectForKey(editingContext, c1.name());
    assertSame(c1, c1Test);
    cache.stop();
  }
View Full Code Here

  public void testDelete(boolean fetchInitialValues) {
    ERXEnterpriseObjectCache<Company> cache = new ERXEnterpriseObjectCache<Company>(Company.ENTITY_NAME, Company.NAME_KEY, null, 0);
    cache.setFetchInitialValues(fetchInitialValues);
    String name = c1.name();
    Company c1Test = cache.objectForKey(editingContext, name);
    assertSame(c1, c1Test);
    c1.delete();
    editingContext.saveChanges();
    c1= null;
    Company c1DeleteTest = cache.objectForKey(editingContext, name);
    assertNull(c1DeleteTest);
    cache.stop();
  }
View Full Code Here

    String name2 = "Company " + UUID.randomUUID().toString();
    c1.setName(name2);
    editingContext.saveChanges();

    Company c1DeleteTest = cache.objectForKey(editingContext, name1);
    assertNull(c1DeleteTest);

    Company c2UpdateTest = cache.objectForKey(editingContext, name2);
    assertSame(c1, c2UpdateTest);
    cache.stop();
  }
View Full Code Here

  }
 
  public void testSetToOneImplicitToMany() {
    ERXGenericRecord.InverseRelationshipUpdater.setUpdateInverseRelationships(false);
    EOEditingContext editingContext = ERXEC.newEditingContext();
    Company company = Company.createCompany(editingContext, "XYZ");
    Employee p1 = (Employee) EOUtilities.createAndInsertInstance(editingContext, Employee.ENTITY_NAME);
    p1.setCompanyRelationship(company);

    assertEquals(company, p1.company());
    assertEquals(1, company.employees().count());
    assertEquals(p1, company.employees().objectAtIndex(0));
  }
View Full Code Here

  }

  public void testAddToToManyImplicitToOne() {
    ERXGenericRecord.InverseRelationshipUpdater.setUpdateInverseRelationships(false);
    EOEditingContext editingContext = ERXEC.newEditingContext();
    Company company = Company.createCompany(editingContext, "XYZ");
    Employee p1 = (Employee) EOUtilities.createAndInsertInstance(editingContext, Employee.ENTITY_NAME);
    company.addToEmployeesRelationship(p1);

    assertEquals(company, p1.company());
    assertEquals(1, company.employees().count());
    assertEquals(p1, company.employees().objectAtIndex(0));
  }
View Full Code Here

TOP

Related Classes of er.erxtest.model.Company

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.