private void syncEndpointConfiguration(String appToken, String endpointId, EndpointProfileDto profile) throws GetDeltaException { ConfigurationCacheEntry configurationCache = deltaService.getConfiguration( appToken, endpointId, profile); byte[] configurationHash = configurationCache.getHash().getData(); if (LOG.isTraceEnabled()) { LOG.trace("[{}][{}] Result configuration hash is {}", appToken, endpointId, Arrays.toString(configurationHash)); } profile.setConfigurationHash(configurationHash); EndpointObjectHash userConfigHash = configurationCache.getUserConfigurationHash(); profile.setUserConfigurationHash(userConfigHash == null ? null : userConfigHash.getData()); EndpointObjectHash epsConfigHash = configurationCache.getEpsConfigurationHash(); profile.setEpsConfigurationHash(epsConfigHash == null ? null : epsConfigHash.getData()); }
@Override public SyncContext syncConfigurationHashes(SyncContext context, byte[] ucfHash, byte[] epsConfigHash) { EndpointProfileDto profile = context.getEndpointProfile(); profile.setUserConfigurationHash(ucfHash); profile.setEpsConfigurationHash(epsConfigHash); syncProfileState(context.getAppToken(), context.getEndpointKey(), profile, true); return context; }
if (updateConfiguration) { storedProfile.setUserConfigurationHash(newProfile.getUserConfigurationHash()); storedProfile.setEpsConfigurationHash(newProfile.getEpsConfigurationHash());
protected EndpointProfileDto generateEndpointProfileDtoWithSchemaVersion(String appId, int schemaVersion, String srvProfileBody) { EndpointProfileDto profileDto = new EndpointProfileDto(); profileDto.setApplicationId(appId); profileDto.setServerProfileVersion(schemaVersion); profileDto.setEndpointKeyHash("TEST_KEY_HASH".getBytes()); profileDto.setEpsConfigurationHash(EPS_CONFIG_HASH); try { profileDto.setClientProfileBody(readSchemaFileAsString(TEST_PROFILE_BODY_PATH)); } catch (IOException e) { LOG.error("Can't set client-side EP body {}", e); } profileDto.setSdkToken(UUID.randomUUID().toString()); profileDto.setServerProfileBody(srvProfileBody); return endpointService.saveEndpointProfile(profileDto); }
protected EndpointProfileDto generateEndpointProfileDto(String appId, List<String> topicIds) { if (isBlank(appId)) { appId = generateApplicationDto().getId(); } EndpointProfileDto profileDto = new EndpointProfileDto(); profileDto.setApplicationId(appId); profileDto.setSubscriptions(topicIds); profileDto.setEndpointKeyHash("TEST_KEY_HASH".getBytes()); profileDto.setServerProfileBody("{\"serverTitle\": \"SERVER_TEST\"}"); profileDto.setEpsConfigurationHash(EPS_CONFIG_HASH); try { profileDto.setClientProfileBody(readSchemaFileAsString(TEST_PROFILE_BODY_PATH)); } catch (IOException e) { LOG.error("Can't set client-side EP body {}", e); } profileDto.setSdkToken(UUID.randomUUID().toString()); return endpointService.saveEndpointProfile(profileDto); }
protected EndpointProfileDto generateEndpointProfileForTestUpdate(String id, byte[] keyHash, List<EndpointGroupStateDto> cfGroupState) { EndpointProfileDto profileDto = new EndpointProfileDto(); profileDto.setId(id); profileDto.setEndpointKeyHash(keyHash); profileDto.setApplicationId(generateStringId()); profileDto.setAccessToken(generateStringId()); profileDto.setGroupState(cfGroupState); profileDto.setSdkToken(UUID.randomUUID().toString()); profileDto.setEpsConfigurationHash(EPS_CONFIG_HASH); return profileDto; }
protected EndpointProfileDto generateEndpointProfileWithEndpointGroupId(String appId) { byte[] keyHash = generateBytes(); if (appId == null) { appId = generateStringId(); } EndpointProfileDto profileDto = new EndpointProfileDto(); profileDto.setApplicationId(appId); profileDto.setEndpointKeyHash(keyHash); profileDto.setAccessToken(generateStringId()); profileDto.setClientProfileBody("test profile"); profileDto.setServerProfileBody("test server-side profile"); profileDto.setEpsConfigurationHash(EPS_CONFIG_HASH); List<EndpointGroupStateDto> groupState = new ArrayList<>(); groupState.add(new EndpointGroupStateDto(TEST_ENDPOINT_GROUP_ID, null, null)); profileDto.setGroupState(groupState); profileDto.setSdkToken(UUID.randomUUID().toString()); return endpointProfileDao.save(new CassandraEndpointProfile(profileDto)).toDto(); }
dto.setConfigurationHash(configurationHash); dto.setUserConfigurationHash(userConfigurationHash); dto.setEpsConfigurationHash(epsConfigurationHash); dto.setConfigurationVersion(configurationVersion); dto.setApplicationId(applicationId);
protected EndpointProfileDto generateEndpointProfile(String appId, String sdkToken, String accessToken, List<String> topicIds, CtlDataDto ctlDataDto) { byte[] keyHash = generateBytes(); if (appId == null) { appId = generateStringId(); } if (sdkToken == null) { sdkToken = generateStringId(); } if (accessToken == null) { accessToken = generateStringId(); } EndpointProfileDto profileDto = new EndpointProfileDto(); profileDto.setApplicationId(appId); profileDto.setSdkToken(sdkToken); profileDto.setSubscriptions(topicIds); profileDto.setEndpointKeyHash(keyHash); profileDto.setAccessToken(accessToken); profileDto.setEpsConfigurationHash(EPS_CONFIG_HASH); if (ctlDataDto != null) { profileDto.setServerProfileBody(ctlDataDto.getBody()); profileDto.setServerProfileVersion(ctlDataDto.getServerProfileVersion()); } return endpointProfileDao.save(new CassandraEndpointProfile(profileDto)).toDto(); }
dto.setUseConfigurationRawSchema(useConfigurationRawSchema); dto.setVersion(version); dto.setEpsConfigurationHash(getBytes(epsConfigurationHash)); return dto;