@Given("^A full set of device privileges for account \"(.+)\"$") public void setAccountDevicePrivileges(String name) throws KapuaException { KapuaSecurityUtils.doPrivileged(() -> { Account account = accountService.findByName(name); Map<String, Object> valueMap = new HashMap<>(); valueMap.put("infiniteChildEntities", true); valueMap.put("maxNumberChildEntities", 1000); deviceRegistryService.setConfigValues(account.getId(), account.getScopeId(), valueMap); }); }
@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); }); }
@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("^I set the database to device timestamp indexing$") public void setDatabaseToDeviceTimestampIndexing() throws KapuaException { Account account = (Account) stepData.get("LastAccount"); updateConfiguration(messageStoreService, account.getId(), account.getScopeId(), DataIndexBy.DEVICE_TIMESTAMP, MetricsIndexBy.TIMESTAMP, 30, true); }
@Given("^I set the database to server timestamp indexing$") public void setDatabaseToServerTimestampIndexing() throws KapuaException { Account account = (Account) stepData.get("LastAccount"); updateConfiguration(messageStoreService, account.getId(), account.getScopeId(), DataIndexBy.SERVER_TIMESTAMP, MetricsIndexBy.TIMESTAMP, 30, true); }
@When("^I configure the device service$") public void setDeviceServiceConfig(List<TestConfig> testConfigs) throws Exception { Account tmpAccount = (Account) stepData.get("LastAccount"); Map<String, Object> valueMap = new HashMap<>(); for (TestConfig config : testConfigs) { config.addConfigToMap(valueMap); } try { primeException(); deviceRegistryService.setConfigValues(tmpAccount.getId(), tmpAccount.getScopeId(), valueMap); } catch (KapuaException ex) { verifyException(ex); } }
@When("^I configure the tag service$") public void setTagServiceConfig(List<TestConfig> testConfigs) throws Exception { Account tmpAccount = (Account) stepData.get("LastAccount"); Map<String, Object> valueMap = new HashMap<>(); for (TestConfig config : testConfigs) { config.addConfigToMap(valueMap); } try { primeException(); tagService.setConfigValues(tmpAccount.getId(), tmpAccount.getScopeId(), valueMap); } catch (KapuaException ex) { verifyException(ex); } }
userService.setConfigValues(account.getId(), account.getScopeId(), userValues); deviceRegistryService.setConfigValues(account.getId(), account.getScopeId(), deviceRegistryValues);
@Given("^Tag Service configuration$") public void setConfigurationValue(List<TestConfig> testConfigs) throws Exception { Account lastAcc = (Account) stepData.get("LastAccount"); KapuaId scopeId = DEFAULT_SCOPE_ID; KapuaId parentId = DEFAULT_SCOPE_ID; if (lastAcc != null) { scopeId = lastAcc.getId(); parentId = lastAcc.getScopeId(); } Map<String, Object> valueMap = new HashMap<>(); for (TestConfig config : testConfigs) { config.addConfigToMap(valueMap); } try { // stepData.put("isException", false); primeException(); tagService.setConfigValues(scopeId, parentId, valueMap); } catch (KapuaException ke) { // stepData.put("isException", true); // stepData.put("exception", ke); verifyException(ke); } }
@When("^I configure user service$") public void setUserServiceConfig(List<TestConfig> testConfigs) throws Exception { Map<String, Object> valueMap = new HashMap<>(); KapuaId accId; KapuaId scopeId; Account tmpAccount = (Account) stepData.get("LastAccount"); if (tmpAccount != null) { accId = tmpAccount.getId(); scopeId = tmpAccount.getScopeId(); } else { accId = new KapuaEid(BigInteger.ONE); scopeId = new KapuaEid(BigInteger.ONE); } for (TestConfig config : testConfigs) { config.addConfigToMap(valueMap); } primeException(); try { userService.setConfigValues(accId, scopeId, valueMap); } catch (KapuaException ex) { verifyException(ex); } }
@When("^I configure credential service$") public void setCredentialServiceConfig(List<TestConfig> testConfigs) throws Exception { Map<String, Object> valueMap = new HashMap<>(); KapuaId accId; KapuaId scopeId; Account tmpAccount = (Account) stepData.get("LastAccount"); if (tmpAccount != null) { accId = tmpAccount.getId(); scopeId = tmpAccount.getScopeId(); } else { accId = new KapuaEid(BigInteger.ONE); scopeId = new KapuaEid(BigInteger.ONE); } for (TestConfig config : testConfigs) { config.addConfigToMap(valueMap); } primeException(); try { credentialService.setConfigValues(accId, scopeId, valueMap); } catch (KapuaException ex) { verifyException(ex); } }
} else { authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.write, account.getScopeId())); if (oldAccount.getScopeId() != null) { parentAccount = KapuaSecurityUtils.doPrivileged(() -> find(oldAccount.getScopeId())); if (!Objects.equals(oldAccount.getScopeId(), account.getScopeId())) { throw new KapuaAccountException(KapuaAccountErrorCodes.ILLEGAL_ARGUMENT, null, "account.scopeId");
Account account = KapuaSecurityUtils.doPrivileged(() -> ACCOUNT_SERVICE.find(permission.getTargetScopeId())); if (account != null && account.getScopeId() != null) { String parentAccountPath = account.getParentAccountPath();
} else { authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.write, account.getScopeId())); if (oldAccount.getScopeId() != null) { parentAccount = KapuaSecurityUtils.doPrivileged(() -> find(oldAccount.getScopeId())); if (!Objects.equals(oldAccount.getScopeId(), account.getScopeId())) { throw new KapuaAccountException(KapuaAccountErrorCodes.ILLEGAL_ARGUMENT, null, "account.scopeId");
Account account = KapuaSecurityUtils.doPrivileged(() -> ACCOUNT_SERVICE.find(permission.getTargetScopeId())); if (account != null && account.getScopeId() != null) { String parentAccountPath = account.getParentAccountPath();
query.setScopeId(account.getScopeId()); endpointInfoCount = EndpointInfoDAO.count(em, query);
query.setScopeId(account.getScopeId()); endpointInfoListResult = EndpointInfoDAO.query(em, query);