resetData();
}
public void testInsert() {
ERXEC ec = (ERXEC) ERXEC.newEditingContext();
ec.lock();
try {
City city = City.createCity(ec, "Washington");
city.setDistict("DC");
city.setPopulation(650000);
city.setDescription("This is some text to make sure long strings work");
log.debug(ERXModelGroup.prototypeEntityNameForModel(model));
//Employee emp = Employee.createEmployee(ec, "Bugs", "Bunny", false, Company.createCompany(ec, "Boston Opera"));
ec.saveChanges();
Integer cnt = ERXEOControlUtilities.objectCountWithQualifier(ec, City.ENTITY_NAME, City.DISTICT.eq("DC"));
assertNotNull(cnt);
assertEquals(Integer.valueOf(1), cnt);
Country country = Country.createCountry(ec, "USA", "United States of America");
country.setCapital(city);
try {
// make sure blobs work
NSData flag = new NSData(ERXFileUtilities.inputStreamForResourceNamed("us.png", null, null), 1024);
country.setFlag(flag);
} catch (IOException e) {
log.error(org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(e), e);
throw new RuntimeException(e.getMessage(), e);
}
ec.saveChanges();
cnt = ERXEOControlUtilities.objectCountWithQualifier(ec, Country.ENTITY_NAME, Country.CODE.eq("USA"));
assertNotNull(cnt);
assertEquals(Integer.valueOf(1), cnt);
} finally {
ec.unlock();
}
}