use of org.eclipse.kapua.service.account.Organization in project kapua by eclipse.
the class AccountServiceTest method testUpdate.
@Test
public void testUpdate() throws Exception {
// KapuaPeid accountPeid = KapuaEidGenerator.generate();//
KapuaId scopeId = new KapuaEid(BigInteger.valueOf(1));
KapuaLocator locator = KapuaLocator.getInstance();
long accountSerial = (new Date()).getTime();
AccountCreator accountCreator = this.getTestAccountCreator(scopeId, accountSerial);
AccountService accountService = locator.getService(AccountService.class);
Account account = accountService.create(accountCreator);
account = accountService.find(account.getScopeId(), account.getId());
Organization org = account.getOrganization();
org.setAddressLine1("5th evenue, NY");
account.setOrganization(org);
Account accountUpd = accountService.update(account);
//
// Account asserts
assertNotNull(accountUpd);
assertNotNull(accountUpd.getId());
assertNotNull(accountUpd.getId().getId());
assertTrue(accountUpd.getOptlock() >= 0);
assertTrue(accountUpd.getId().equals(account.getId()));
assertTrue(accountUpd.getScopeId().equals(account.getScopeId()));
assertTrue(accountUpd.getName().equals(account.getName()));
assertNotNull(accountUpd.getOrganization());
assertTrue(accountUpd.getOrganization().getAddressLine1().equals(org.getAddressLine1()));
assertNotNull(accountUpd.getCreatedOn().equals(account.getCreatedOn()));
assertNotNull(accountUpd.getCreatedBy().equals(account.getCreatedBy()));
assertNotNull(account.getModifiedOn());
assertNotNull(account.getModifiedBy());
}
Aggregations