@Override public ConfigurationSchemaDto findConfSchemaByAppIdAndVersion(String applicationId, int version) { return configurationService.findConfSchemaByAppIdAndVersion(applicationId, version); }
private void validateConfSchemaVersion(String appId, int schemaVersion) { ConfigurationSchemaDto confSchema = configurationService.findConfSchemaByAppIdAndVersion(appId, schemaVersion); validateNotNull(confSchema, "Configuration schema with provided version doesn't exists."); }
@Override public ConfigurationSchemaDto compute(AppVersionKey key) { LOG.debug("Fetching result for getConfSchemaByAppAndVersion"); ApplicationDto appDto = applicationService.findAppByApplicationToken( key.getApplicationToken()); ConfigurationSchemaDto value = configurationService.findConfSchemaByAppIdAndVersion( appDto.getId(), key.getVersion()); return value; } });
@Test public void testShouldDeleteByEndpointKeyHashAndConfSchemaVersion() { EndpointProfileDto profile = generateProfile(); profile.setConfigurationVersion(0); when(endpointServiceMock.findEndpointProfileByKeyHash(KEY)).thenReturn(profile); when(daoMock.findByEndpointKeyHashAndConfigurationVersion(KEY, CONF_VERSION)).thenReturn(configuration); when(configuration.toDto()).thenReturn(configurationDto); when(configurationServiceMock.findConfSchemaByAppIdAndVersion(APP_ID, CONF_VERSION)).thenReturn(new ConfigurationSchemaDto()); when(configurationDto.getConfigurationSchemaVersion()).thenReturn(CONF_VERSION); Assert.assertTrue(SERVICE.deleteByEndpointKeyHashAndConfSchemaVersion(KEY, CONF_VERSION).isPresent()); verify(endpointServiceMock).findEndpointProfileByKeyHash(KEY); verify(daoMock).findByEndpointKeyHashAndConfigurationVersion(KEY, CONF_VERSION); verify(daoMock).removeByEndpointKeyHashAndConfigurationVersion(KEY, CONF_VERSION); verify(configurationServiceMock).findConfSchemaByAppIdAndVersion(APP_ID, CONF_VERSION); }
@Override public Schema findEndpointConfigurationSchemaByEndpointKeyHash(String endpointKeyHash) throws KaaAdminServiceException { EndpointProfileDto endpointProfileDto = profileService .findEndpointProfileByEndpointKeyHash(endpointKeyHash); ConfigurationSchemaDto configurationSchemaDto = configurationService .findConfSchemaByAppIdAndVersion( endpointProfileDto.getApplicationId(), endpointProfileDto.getConfigurationVersion() ); CTLSchemaDto ctlSchemaDto = ctlService .findCtlSchemaById(configurationSchemaDto.getCtlSchemaId()); return ctlService.flatExportAsSchema(ctlSchemaDto); }
case CONFIGURATION_BASE_SCHEMA: confSchemaDto = configurationService .findConfSchemaByAppIdAndVersion(key.getApplicationId(), key.getSchemaVersion()); checkSchema(confSchemaDto, RecordFiles.CONFIGURATION_BASE_SCHEMA); schema = confSchemaDto.getBaseSchema(); case CONFIGURATION_OVERRIDE_SCHEMA: confSchemaDto = configurationService .findConfSchemaByAppIdAndVersion(key.getApplicationId(), key.getSchemaVersion()); checkSchema(confSchemaDto, RecordFiles.CONFIGURATION_OVERRIDE_SCHEMA); schema = confSchemaDto.getOverrideSchema();
@Test public void findConfSchemaByAppIdAndVersionTest() { String appId = generateApplicationDto().getId(); ConfigurationSchemaDto dto = configurationService.findConfSchemaByAppIdAndVersion(appId, 1); Assert.assertNotNull(dto); }
.findEndpointProfileByEndpointKeyHash(endpointKeyHash); ConfigurationSchemaDto configurationSchemaDto = configurationService .findConfSchemaByAppIdAndVersion( endpointProfileDto.getApplicationId(), endpointProfileDto.getConfigurationVersion()
.findConfSchemaByAppIdAndVersion(sdkProfile.getApplicationId(), sdkProfile.getConfigurationSchemaVersion()); if (configurationSchema == null) {