/** * Creates a new account instance * * @return */ public Account newAccount() { return factory.newEntity(null); }
/** * Creates a new account creator instance * * @return */ public AccountCreator newAccountCreator() { return factory.newCreator(null); }
/** * Creates a new organization instance * * @return */ public Organization newOrganization() { return factory.newOrganization(); }
@When("^I try to delete account \"(.*)\"$") public void deleteAccount(String accountName) throws KapuaException { Account accountToDelete; accountToDelete = accountService.findByName(accountName); if (accountToDelete != null) { accountService.delete(accountToDelete.getScopeId(), accountToDelete.getId()); } }
@Given("^The default connection coupling mode for account \"(.+)\" is set to \"(.+)\"$") public void setDeviceConnectionCouplingMode(String name, String mode) throws KapuaException { KapuaSecurityUtils.doPrivileged(() -> { Account account = accountService.findByName(name); Map<String, Object> valueMap = new HashMap<>(); // valueMap.put("infiniteChildEntities", true); // valueMap.put("maxNumberChildEntities", 1000); valueMap.put("deviceConnectionUserCouplingDefaultMode", mode); deviceConnectionService.setConfigValues(account.getId(), account.getScopeId(), valueMap); }); }
public KapuaId getScopeId() throws KapuaException { return KapuaSecurityUtils.doPrivileged(() -> accountService.findByName(scope).getId()); }
Account createAccount(String name, String orgName, String orgEmail) throws KapuaException { configureAccountService(ROOT_SCOPE_ID, SYS_ID); AccountCreator accountCreator = accountFactory.newCreator(ROOT_SCOPE_ID, name); accountCreator.setOrganizationName(orgName); accountCreator.setOrganizationEmail(orgEmail); return accountService.create(accountCreator); }
@Given("^Account for \"(.*)\"$") public void getAccountForName(String accountName) throws KapuaException { Account account = accountService.findByName(accountName); stepData.put("LastAccount", account); }
@Override public Account create(AccountCreator creator) throws KapuaException { // TODO Auto-generated method stub AccountMock account = new AccountMock(creator.getScopeId(), creator.getName()); return account; }
@Override public AccountCreator newCreator(KapuaId scopeId, String name) { AccountCreator creator = newCreator(scopeId); creator.setName(name); return creator; }
public AccountQuery newQuery() { return factory.newQuery(null); } }
@When("I change the current account expiration date to \"(.+)\"") public void changeCurrentAccountExpirationDate(String newExpiration) throws Exception { Account currAcc = (Account) stepData.get("LastAccount"); Date newDate = parseDateString(newExpiration); try { primeException(); currAcc.setExpirationDate(newDate); Account tmpAcc = accountService.update(currAcc); stepData.put("LastAccount", tmpAcc); } catch (KapuaException e) { verifyException(e); } }
/** * Creates a new account list result instance * * @return */ public AccountListResult newAccountListResult() { return factory.newListResult(); }
@Override protected Map<String, Object> getConfigValues(Account entity) throws KapuaException { return super.getConfigValues(entity.getId()); } }
@When("^I select account \"(.*)\"$") public void selectAccount(String accountName) throws KapuaException { Account tmpAccount; tmpAccount = accountService.findByName(accountName); if (tmpAccount != null) { stepData.put("LastAccount", tmpAccount); } else { stepData.remove("LastAccount"); } }
@Override public AccountCreator newCreator(KapuaId scopeId, String name) { AccountCreator creator = newCreator(scopeId); creator.setName(name); return creator; }
@Override protected Map<String, Object> getConfigValues(Account entity) throws KapuaException { return super.getConfigValues(entity.getId()); } }
/** * Gets the scoped configuration values from the given {@link Account}. * This method defaults to {@link Account#getId()}, but implementations can change it to use other attributes. * * @param account The account from which get the id. * @return The scoped configurations for the given {@link Account}. * @throws KapuaException * @since 1.0.0 */ protected Map<String, Object> getConfigValues(Account account) throws KapuaException { return getConfigValues(account.getId()); }
/** * Gets the scoped configuration values from the given {@link Account}. * This method defaults to {@link Account#getId()}, but implementations can change it to use other attributes. * * @param account The account from which get the id. * @return The scoped configurations for the given {@link Account}. * @throws KapuaException * @since 1.0.0 */ protected Map<String, Object> getConfigValues(Account account) throws KapuaException { return getConfigValues(account.getId()); }