From f688c7414132d140d1cc7e3536cce94e282acfc5 Mon Sep 17 00:00:00 2001 From: Sasha Didukh Date: Fri, 30 Sep 2016 20:04:37 +0300 Subject: [PATCH] KAA-1279: Change CtlSchemaDto class name --- .../kaa/server/common/admin/AdminClient.java | 21 +++-- .../kaa/server/common/dao/CTLService.java | 48 +++++------ .../common/dao/model/sql/CTLSchema.java | 22 ++--- .../dao/service/ApplicationServiceImpl.java | 12 +-- .../common/dao/service/CTLServiceImpl.java | 72 ++++++++-------- .../dao/service/ConfigurationServiceImpl.java | 4 +- .../dao/service/EndpointServiceImpl.java | 4 +- .../kaa/server/common/dao/AbstractTest.java | 18 ++-- .../impl/sql/HibernateCTLSchemaDaoTest.java | 20 ++--- .../dao/service/AbstractServiceImplTest.java | 8 +- .../dao/service/CTLServiceImplTest.java | 82 +++++++++---------- .../{CTLSchemaDto.java => CtlSchemaDto.java} | 47 +++++++---- .../dao/NotificationServiceImplTest.java | 4 +- .../admin/client/mvp/data/DataSource.java | 8 +- .../admin/controller/CtlController.java | 8 +- .../admin/services/AbstractAdminService.java | 6 +- .../admin/services/CacheServiceImpl.java | 4 +- .../services/ConfigurationServiceImpl.java | 6 +- .../server/admin/services/CtlServiceImpl.java | 64 +++++++-------- .../services/DeviceManagementServiceImpl.java | 4 +- .../admin/services/EventServiceImpl.java | 8 +- .../admin/services/GroupServiceImpl.java | 4 +- .../admin/services/LoggingServiceImpl.java | 6 +- .../services/NotificationServiceImpl.java | 6 +- .../admin/services/ProfileServiceImpl.java | 10 +-- .../services/schema/CtlSchemaParser.java | 18 ++-- .../admin/shared/schema/CtlSchemaFormDto.java | 6 +- .../admin/shared/services/CtlService.java | 14 ++-- .../control/service/ControlService.java | 32 ++++---- .../service/DefaultControlService.java | 60 +++++++------- .../ApplicationLogActorMessageProcessor.java | 6 +- .../service/cache/CacheService.java | 4 +- .../concurrent/ConcurrentCacheService.java | 12 +-- .../logs/DefaultLogAppenderService.java | 4 +- .../control/AbstractTestControlServer.java | 18 ++-- .../control/ControlServerCTLSchemaIT.java | 62 +++++++------- .../control/ControlServerProfileFilterIT.java | 4 +- .../control/ControlServerProfileSchemaIT.java | 6 +- .../service/akka/DefaultAkkaServiceTest.java | 6 +- ...plicationLogActorMessageProcessorTest.java | 12 +-- .../actors/core/ApplicationLogActorTest.java | 6 +- .../service/delta/DeltaServiceIT.java | 10 +-- .../service/event/ESTestCacheService.java | 4 +- .../logs/DefaultLogAppenderServiceTest.java | 4 +- .../service/profile/ProfileServiceIT.java | 6 +- 45 files changed, 400 insertions(+), 390 deletions(-) rename server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/ctl/{CTLSchemaDto.java => CtlSchemaDto.java} (81%) diff --git a/server/common/admin-rest-client/src/main/java/org/kaaproject/kaa/server/common/admin/AdminClient.java b/server/common/admin-rest-client/src/main/java/org/kaaproject/kaa/server/common/admin/AdminClient.java index b6b4662bfb..3d48946f8a 100644 --- a/server/common/admin-rest-client/src/main/java/org/kaaproject/kaa/server/common/admin/AdminClient.java +++ b/server/common/admin-rest-client/src/main/java/org/kaaproject/kaa/server/common/admin/AdminClient.java @@ -56,7 +56,7 @@ import org.kaaproject.kaa.common.dto.admin.UserProfileUpdateDto; import org.kaaproject.kaa.common.dto.credentials.CredentialsDto; import org.kaaproject.kaa.common.dto.credentials.CredentialsStatus; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.event.AefMapInfoDto; @@ -97,7 +97,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -942,7 +941,7 @@ public FileData downloadSdk(SdkProfileDto key) throws Exception { return data; } - public FileData downloadCtlSchemaByAppToken(CTLSchemaDto ctlSchemaDto, + public FileData downloadCtlSchemaByAppToken(CtlSchemaDto ctlSchemaDto, CTLSchemaExportMethod method, String appToken) { FileDataResponseExtractor extractor = new FileDataResponseExtractor(); MultiValueMap parameters = new LinkedMultiValueMap<>(); @@ -962,7 +961,7 @@ public void flushSdkCache() throws Exception { } - public CTLSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId, + public CtlSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId, String applicationToken) { MultiValueMap params = new LinkedMultiValueMap<>(); params.add("body", body); @@ -973,7 +972,7 @@ public CTLSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId, params.add("applicationToken", applicationToken); } return restTemplate.postForObject(restTemplate.getUrl() + "CTL/saveSchema", - params, CTLSchemaDto.class); + params, CtlSchemaDto.class); } public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, @@ -992,27 +991,27 @@ public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, restTemplate.postForLocation(restTemplate.getUrl() + "CTL/deleteSchema", params); } - public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken( + public CtlSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken( String fqn, Integer version, String tenantId, String applicationToken) { if (tenantId != null && applicationToken != null) { return restTemplate.getForObject( restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}" + "&applicationToken={applicationToken}", - CTLSchemaDto.class, fqn, version, tenantId, applicationToken); + CtlSchemaDto.class, fqn, version, tenantId, applicationToken); } else if (tenantId != null) { return restTemplate.getForObject( restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}", - CTLSchemaDto.class, fqn, version, tenantId); + CtlSchemaDto.class, fqn, version, tenantId); } else { return restTemplate.getForObject( restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}", - CTLSchemaDto.class, fqn, version); + CtlSchemaDto.class, fqn, version); } } - public CTLSchemaDto getCTLSchemaById(String id) { + public CtlSchemaDto getCTLSchemaById(String id) { return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchemaById?id={id}", - CTLSchemaDto.class, id); + CtlSchemaDto.class, id); } public boolean checkFqnExistsWithAppToken(String fqn, String tenantId, diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CTLService.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CTLService.java index 2ce32144f5..234f16a3a8 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CTLService.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CTLService.java @@ -17,7 +17,7 @@ package org.kaaproject.kaa.server.common.dao; import org.apache.avro.Schema; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.file.FileData; @@ -35,17 +35,17 @@ public interface CTLService { * Get or create empty CTL schema with system scope. * * @param createdUsername the name of user. - * @return CTLSchemaDto the empty schema with system scope. + * @return CtlSchemaDto the empty schema with system scope. */ - CTLSchemaDto getOrCreateEmptySystemSchema(String createdUsername); + CtlSchemaDto getOrCreateEmptySystemSchema(String createdUsername); /** * Update existing CTL schema by the given CTL schema object. * * @param ctlSchema the CTL schema object. - * @return CTLSchemaDto the updated object. + * @return CtlSchemaDto the updated object. */ - CTLSchemaDto updateCTLSchema(CTLSchemaDto ctlSchema); + CtlSchemaDto updateCTLSchema(CtlSchemaDto ctlSchema); /** * Update existing CTL schema meta info scope by the given CTL schema meta info object. @@ -81,17 +81,17 @@ public interface CTLService { * Find a CTL schema with the given identifier. * * @param schemaId the CTL schema identifier. - * @return CTLSchemaDto the CTL schema with the given identifier. + * @return CtlSchemaDto the CTL schema with the given identifier. */ - CTLSchemaDto findCTLSchemaById(String schemaId); + CtlSchemaDto findCTLSchemaById(String schemaId); /** * Saves the given CTL schema to the database. * * @param ctlSchemaDto the CTL schema to save. - * @return CTLSchemaDto the saved CTL schema. + * @return CtlSchemaDto the saved CTL schema. */ - CTLSchemaDto saveCTLSchema(CTLSchemaDto ctlSchemaDto); + CtlSchemaDto saveCTLSchema(CtlSchemaDto ctlSchemaDto); /** * Find CTL schema with the given meta info id and version. @@ -100,7 +100,7 @@ public interface CTLService { * @param version the schema version. * @return the CTL schema with the given meta info id and version. */ - CTLSchemaDto findByMetaInfoIdAndVer(String metaInfoId, Integer version); + CtlSchemaDto findByMetaInfoIdAndVer(String metaInfoId, Integer version); /** * Find a CTL schema of the given tenant or application with the given fully qualified name @@ -112,7 +112,7 @@ public interface CTLService { * @param applicationId the application identifier. * @return the CTL schema with the given fully qualified name and version number. */ - CTLSchemaDto findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId); + CtlSchemaDto findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId); /** * Find any CTL schema of the given tenant or application with the given fully qualified name @@ -124,14 +124,14 @@ public interface CTLService { * @param applicationId the application identifier. * @return the any CTL schema with the given fully qualified name and version number. */ - CTLSchemaDto findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId); + CtlSchemaDto findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId); /** * Find system CTL schemas available in the database. * * @return the list of available system CTL schemas in the database. */ - List findSystemCTLSchemas(); + List findSystemCTLSchemas(); /** * Find system CTL schemas meta info available in the database. @@ -169,7 +169,7 @@ public interface CTLService { * @return the latest version of CTL schema with the given fully qualified name, tenant and * application identifier. */ - CTLSchemaDto findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId); + CtlSchemaDto findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId); /** * Find the last version of CTL schema with the given meta info id. @@ -177,7 +177,7 @@ public interface CTLService { * @param metaInfoId the id of meta info object. * @return the latest version of CTL schema with the given meta info id. */ - CTLSchemaDto findLatestByMetaInfoId(String metaInfoId); + CtlSchemaDto findLatestByMetaInfoId(String metaInfoId); /** * Find all available versions of CTL schema with the given fully qualified name, tenant and @@ -189,14 +189,14 @@ public interface CTLService { * @return the list of available versions of CTL schema with the given fully qualified name, * tenant and application identifier. */ - List findAllCTLSchemasByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId); + List findAllCTLSchemasByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId); /** * Find CTL schemas available in the database. * * @return the list of available CTL schemas in the database. */ - List findCTLSchemas(); + List findCTLSchemas(); /** * Find the dependents CTL schemas from CTL schema with the given schema @@ -205,7 +205,7 @@ public interface CTLService { * @param schemaId the schema identifier. * @return the list of dependents CTL schemas from CTL schema with the given identifier. */ - List findCTLSchemaDependents(String schemaId); + List findCTLSchemaDependents(String schemaId); /** * Find the dependents CTL schemas from CTL schema with the given tenant, application, @@ -218,7 +218,7 @@ public interface CTLService { * @return the list of dependents CTL schemas from CTL schema with the given tenant, application, * fully qualified name and version. */ - List findCTLSchemaDependents(String fqn, Integer version, String tenantId, String applicationId); + List findCTLSchemaDependents(String fqn, Integer version, String tenantId, String applicationId); /** * Exports the body of a CTL schema. @@ -226,7 +226,7 @@ public interface CTLService { * @param schema A CTL schema to export * @return A file containing the body of a CTL schema */ - FileData shallowExport(CTLSchemaDto schema); + FileData shallowExport(CtlSchemaDto schema); /** * Exports the body of a CTL schema with all dependencies inline, @@ -235,7 +235,7 @@ public interface CTLService { * @param schema A CTL schema to export * @return A string containing the body of a CTL schema with all dependencies inline, recursively */ - String flatExportAsString(CTLSchemaDto schema); + String flatExportAsString(CtlSchemaDto schema); /** * Exports the body of a CTL schema with all dependencies inline, @@ -245,7 +245,7 @@ public interface CTLService { * @return A Schema object containing the body of a CTL schema with all dependencies inline, * recursively */ - Schema flatExportAsSchema(CTLSchemaDto schema); + Schema flatExportAsSchema(CtlSchemaDto schema); /** * Exports the body of a CTL schema with all dependencies inline, @@ -254,7 +254,7 @@ public interface CTLService { * @param schema A CTL schema to export * @return A file containing the body of a CTL schema with all dependencies inline, recursively */ - FileData flatExport(CTLSchemaDto schema); + FileData flatExport(CtlSchemaDto schema); /** * Exports the body of a CTL schema with all dependencies as different @@ -264,5 +264,5 @@ public interface CTLService { * @return An archive containing the body of a CTL schema as a file and all dependencies as * different files, recursively. */ - FileData deepExport(CTLSchemaDto schema); + FileData deepExport(CtlSchemaDto schema); } diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/model/sql/CTLSchema.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/model/sql/CTLSchema.java index 09d0c36653..e86a478f2f 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/model/sql/CTLSchema.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/model/sql/CTLSchema.java @@ -32,7 +32,7 @@ import static org.kaaproject.kaa.server.common.dao.DaoConstants.CTL_SCHEMA_VERSION; import static org.kaaproject.kaa.server.common.dao.model.sql.ModelUtils.getLongId; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.common.dao.impl.DaoUtil; import java.io.Serializable; @@ -54,7 +54,7 @@ @Entity @Table(name = CTL_SCHEMA_TABLE_NAME, uniqueConstraints = @UniqueConstraint(columnNames = {CTL_SCHEMA_META_INFO_ID, CTL_SCHEMA_VERSION}, name = CTL_SCHEMA_UNIQUE_CONSTRAINT)) -public class CTLSchema extends GenericModel implements Serializable { +public class CTLSchema extends GenericModel implements Serializable { private static final long serialVersionUID = -1179381742235545494L; @@ -87,7 +87,7 @@ public CTLSchema(Long id) { this.id = id; } - public CTLSchema(CTLSchemaDto dto) { + public CTLSchema(CtlSchemaDto dto) { this.id = getLongId(dto.getId()); this.metaInfo = new CTLSchemaMetaInfo(dto.getMetaInfo()); this.version = dto.getVersion(); @@ -96,12 +96,12 @@ public CTLSchema(CTLSchemaDto dto) { update(dto); } - public void update(CTLSchemaDto dto) { + public void update(CtlSchemaDto dto) { this.body = dto.getBody(); this.defaultRecord = dto.getDefaultRecord(); - Set dependencies = dto.getDependencySet(); + Set dependencies = dto.getDependencySet(); if (dependencies != null && !dependencies.isEmpty()) { - for (CTLSchemaDto dependency : dependencies) { + for (CtlSchemaDto dependency : dependencies) { dependencySet.add(new CTLSchema(dependency)); } } @@ -164,18 +164,18 @@ public void setCreatedTime(long createdTime) { } @Override - protected CTLSchemaDto createDto() { - return new CTLSchemaDto(); + protected CtlSchemaDto createDto() { + return new CtlSchemaDto(); } @Override - protected GenericModel newInstance(Long id) { + protected GenericModel newInstance(Long id) { return new CTLSchema(id); } @Override - public CTLSchemaDto toDto() { - CTLSchemaDto ctlSchemaDto = createDto(); + public CtlSchemaDto toDto() { + CtlSchemaDto ctlSchemaDto = createDto(); ctlSchemaDto.setId(getStringId()); ctlSchemaDto.setMetaInfo(metaInfo.toDto()); ctlSchemaDto.setVersion(version); diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ApplicationServiceImpl.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ApplicationServiceImpl.java index 811b7ce186..038123cec1 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ApplicationServiceImpl.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ApplicationServiceImpl.java @@ -34,7 +34,7 @@ import org.kaaproject.kaa.common.dto.NotificationSchemaDto; import org.kaaproject.kaa.common.dto.NotificationTypeDto; import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.logs.LogSchemaDto; import org.kaaproject.kaa.server.common.dao.ApplicationService; import org.kaaproject.kaa.server.common.dao.CTLService; @@ -225,7 +225,7 @@ private EndpointGroupDto createDefaultGroup(String appId, String createdUsername private EndpointProfileSchemaDto createDefaultProfileSchema(String appId, String createdUsername) { EndpointProfileSchemaDto profileSchemaDto = new EndpointProfileSchemaDto(); profileSchemaDto.setApplicationId(appId); - CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); + CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); profileSchemaDto.setCtlSchemaId(ctlSchema.getId()); profileSchemaDto.setName(DEFAULT_SCHEMA_NAME); profileSchemaDto.setCreatedUsername(createdUsername); @@ -239,7 +239,7 @@ private EndpointProfileSchemaDto createDefaultProfileSchema(String appId, String private ConfigurationDto createDefaultConfigurationWithSchema(String appId, String groupId, String createdUsername) { ConfigurationSchemaDto schema = new ConfigurationSchemaDto(); schema.setApplicationId(appId); - CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); + CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); schema.setCtlSchemaId(ctlSchema.getId()); schema.setName(DEFAULT_SCHEMA_NAME); schema.setCreatedUsername(createdUsername); @@ -255,7 +255,7 @@ private ConfigurationDto createDefaultConfigurationWithSchema(String appId, Stri private ServerProfileSchemaDto createDefaultServerProfileSchema(String appId, String createdUsername) { ServerProfileSchemaDto serverProfileSchemaDto = new ServerProfileSchemaDto(); serverProfileSchemaDto.setApplicationId(appId); - CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); + CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); serverProfileSchemaDto.setCtlSchemaId(ctlSchema.getId()); serverProfileSchemaDto.setName(DEFAULT_SCHEMA_NAME); serverProfileSchemaDto.setCreatedUsername(createdUsername); @@ -265,7 +265,7 @@ private ServerProfileSchemaDto createDefaultServerProfileSchema(String appId, St private NotificationSchemaDto createDefaultNotificationSchema(String appId, String createdUsername) { NotificationSchemaDto notificationSchemaDto = new NotificationSchemaDto(); notificationSchemaDto.setApplicationId(appId); - CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); + CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); notificationSchemaDto.setCtlSchemaId(ctlSchema.getId()); notificationSchemaDto.setName(DEFAULT_SCHEMA_NAME); notificationSchemaDto.setCreatedUsername(createdUsername); @@ -280,7 +280,7 @@ private NotificationSchemaDto createDefaultNotificationSchema(String appId, Stri private LogSchemaDto createDefaultLogSchema(String appId, String createdUsername) { LogSchemaDto schema = new LogSchemaDto(); schema.setApplicationId(appId); - CTLSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); + CtlSchemaDto ctlSchema = ctlService.getOrCreateEmptySystemSchema(createdUsername); schema.setCtlSchemaId(ctlSchema.getId()); schema.setName(DEFAULT_SCHEMA_NAME); schema.setCreatedUsername(createdUsername); diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImpl.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImpl.java index 3c3851e168..283d6ceec0 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImpl.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImpl.java @@ -35,7 +35,7 @@ import org.hibernate.LockMode; import org.hibernate.LockOptions; import org.kaaproject.kaa.common.avro.GenericAvroConverter; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto; import org.kaaproject.kaa.common.dto.file.FileData; @@ -86,14 +86,14 @@ public class CTLServiceImpl implements CTLService { /** * A template for naming exported CTL schemas. * - * @see #shallowExport(CTLSchemaDto) - * @see #flatExport(CTLSchemaDto) + * @see #shallowExport(CtlSchemaDto) + * @see #flatExport(CtlSchemaDto) */ private static final String CTL_EXPORT_TEMPLATE = "{0}.v{1}.avsc"; /** * The name of the archive to put exported CTL schemas into. * - * @see #deepExport(CTLSchemaDto) + * @see #deepExport(CtlSchemaDto) */ private static final String CTL_EXPORT_ZIP_NAME = "schemas.zip"; /** @@ -108,16 +108,16 @@ public class CTLServiceImpl implements CTLService { private CTLSchemaMetaInfoDao ctlSchemaMetaInfoDao; @Override - public CTLSchemaDto getOrCreateEmptySystemSchema(String createdUsername) { - CTLSchemaDto ctlSchema = findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(DEFAULT_SYSTEM_EMPTY_SCHEMA_FQN, DEFAULT_SYSTEM_EMPTY_SCHEMA_VERSION, + public CtlSchemaDto getOrCreateEmptySystemSchema(String createdUsername) { + CtlSchemaDto ctlSchema = findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(DEFAULT_SYSTEM_EMPTY_SCHEMA_FQN, DEFAULT_SYSTEM_EMPTY_SCHEMA_VERSION, null, null); if (ctlSchema == null) { - ctlSchema = new CTLSchemaDto(); + ctlSchema = new CtlSchemaDto(); CTLSchemaMetaInfoDto metaInfo = new CTLSchemaMetaInfoDto(DEFAULT_SYSTEM_EMPTY_SCHEMA_FQN); ctlSchema.setMetaInfo(metaInfo); ctlSchema.setVersion(DEFAULT_SYSTEM_EMPTY_SCHEMA_VERSION); ctlSchema.setCreatedUsername(createdUsername); - ctlSchema.setDependencySet(new HashSet()); + ctlSchema.setDependencySet(new HashSet()); String body = getStringFromFile(DEFAULT_SYSTEM_EMPTY_SCHEMA_FILE, CTLServiceImpl.class); if (!body.isEmpty()) { ctlSchema.setBody(body); @@ -130,7 +130,7 @@ public CTLSchemaDto getOrCreateEmptySystemSchema(String createdUsername) { } @Override - public CTLSchemaDto saveCTLSchema(CTLSchemaDto unSavedSchema) { + public CtlSchemaDto saveCTLSchema(CtlSchemaDto unSavedSchema) { validateCTLSchemaObject(unSavedSchema); if (unSavedSchema.getDefaultRecord() == null) { unSavedSchema = generateDefaultRecord(unSavedSchema); @@ -139,7 +139,7 @@ public CTLSchemaDto saveCTLSchema(CTLSchemaDto unSavedSchema) { } if (isBlank(unSavedSchema.getId())) { CTLSchemaMetaInfoDto metaInfo = unSavedSchema.getMetaInfo(); - CTLSchemaDto dto; + CtlSchemaDto dto; synchronized (this) { List existingFqns = ctlSchemaMetaInfoDao.findExistingFqns(metaInfo.getFqn(), metaInfo.getTenantId(), metaInfo.getApplicationId()); if (existingFqns != null && !existingFqns.isEmpty()) { @@ -166,7 +166,7 @@ public CTLSchemaDto saveCTLSchema(CTLSchemaDto unSavedSchema) { } } - private void validateDefaultRecord(CTLSchemaDto unSavedSchema) { + private void validateDefaultRecord(CtlSchemaDto unSavedSchema) { try { String schemaBody = flatExportAsString(unSavedSchema); GenericAvroConverter converter = new GenericAvroConverter(schemaBody); @@ -177,7 +177,7 @@ private void validateDefaultRecord(CTLSchemaDto unSavedSchema) { } } - private CTLSchemaDto generateDefaultRecord(CTLSchemaDto unSavedSchema) { + private CtlSchemaDto generateDefaultRecord(CtlSchemaDto unSavedSchema) { try { String schemaBody = flatExportAsString(unSavedSchema); LOG.debug("Generating default record for flat schema: {}", schemaBody); @@ -197,7 +197,7 @@ private CTLSchemaDto generateDefaultRecord(CTLSchemaDto unSavedSchema) { } @Override - public CTLSchemaDto updateCTLSchema(CTLSchemaDto ctlSchema) { + public CtlSchemaDto updateCTLSchema(CtlSchemaDto ctlSchema) { validateCTLSchemaObject(ctlSchema); LOG.debug("Update ctl schema with id [{}]", ctlSchema.getId()); CTLSchema schema = ctlSchemaDao.findById(ctlSchema.getId()); @@ -311,14 +311,14 @@ public void removeCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, In } @Override - public CTLSchemaDto findCTLSchemaById(String schemaId) { + public CtlSchemaDto findCTLSchemaById(String schemaId) { validateSqlId(schemaId, "Incorrect schema id for ctl request " + schemaId); LOG.debug("Find ctl schema by id [{}]", schemaId); return DaoUtil.getDto(ctlSchemaDao.findById(schemaId)); } @Override - public CTLSchemaDto findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId) { + public CtlSchemaDto findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId) { if (isBlank(fqn) || version == null) { throw new IncorrectParameterException("Incorrect parameters for ctl schema request."); } @@ -327,7 +327,7 @@ public CTLSchemaDto findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String f } @Override - public CTLSchemaDto findByMetaInfoIdAndVer(String metaInfoId, Integer version) { + public CtlSchemaDto findByMetaInfoIdAndVer(String metaInfoId, Integer version) { if (isBlank(metaInfoId) || version == null) { throw new IncorrectParameterException("Incorrect parameters for ctl schema request."); } @@ -336,7 +336,7 @@ public CTLSchemaDto findByMetaInfoIdAndVer(String metaInfoId, Integer version) { } @Override - public CTLSchemaDto findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, + public CtlSchemaDto findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId) { if (isBlank(fqn) || version == null) { throw new IncorrectParameterException("Incorrect parameters for ctl schema request."); @@ -346,7 +346,7 @@ public CTLSchemaDto findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(Strin } @Override - public List findSystemCTLSchemas() { + public List findSystemCTLSchemas() { LOG.debug("Find system ctl schemas"); return convertDtoList(ctlSchemaDao.findSystemSchemas()); } @@ -370,37 +370,37 @@ public List findAvailableCTLSchemasMetaInfoForApplication( } @Override - public CTLSchemaDto findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId) { + public CtlSchemaDto findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId) { validateString(fqn, "Incorrect fqn for ctl schema request."); LOG.debug("Find latest ctl schema by fqn {}, tenantId {} and applicationId {}", fqn, tenantId, applicationId); return DaoUtil.getDto(ctlSchemaDao.findLatestByFqnAndTenantIdAndApplicationId(fqn, tenantId, applicationId)); } @Override - public CTLSchemaDto findLatestByMetaInfoId(String metaInfoId) { + public CtlSchemaDto findLatestByMetaInfoId(String metaInfoId) { validateString(metaInfoId, "Incorrect meta info id for ctl schema request."); LOG.debug("Find latest ctl schema by meta info id {}", metaInfoId); return DaoUtil.getDto(ctlSchemaDao.findLatestByMetaInfoId(metaInfoId)); } @Override - public List findAllCTLSchemasByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId) { + public List findAllCTLSchemasByFqnAndTenantIdAndApplicationId(String fqn, String tenantId, String applicationId) { validateString(fqn, "Incorrect fqn for ctl schema request."); LOG.debug("Find all ctl schemas by fqn {}, tenantId {} and applicationId {}", fqn, tenantId, applicationId); return convertDtoList(ctlSchemaDao.findAllByFqnAndTenantIdAndApplicationId(fqn, tenantId, applicationId)); } @Override - public List findCTLSchemas() { + public List findCTLSchemas() { LOG.debug("Find all ctl schemas"); return convertDtoList(ctlSchemaDao.find()); } @Override - public List findCTLSchemaDependents(String schemaId) { + public List findCTLSchemaDependents(String schemaId) { validateSqlId(schemaId, "Incorrect schema id for ctl schema request."); LOG.debug("Find dependents schemas for schema with id [{}]", schemaId); - List list = Collections.emptyList(); + List list = Collections.emptyList(); CTLSchema schemaDto = ctlSchemaDao.findById(schemaId); if (schemaDto != null) { list = convertDtoList(ctlSchemaDao.findDependentSchemas(schemaDto.getStringId())); @@ -409,12 +409,12 @@ public List findCTLSchemaDependents(String schemaId) { } @Override - public List findCTLSchemaDependents(String fqn, Integer version, String tenantId, String applicationId) { + public List findCTLSchemaDependents(String fqn, Integer version, String tenantId, String applicationId) { if (isBlank(fqn) || version == null) { throw new IncorrectParameterException("Incorrect parameters for ctl schema request."); } LOG.debug("Find dependents schemas for schema with fqn {} version {}, tenantId {} and applicationId ()", fqn, version, tenantId, applicationId); - List schemas = Collections.emptyList(); + List schemas = Collections.emptyList(); CTLSchema schema = ctlSchemaDao.findByFqnAndVerAndTenantIdAndApplicationId(fqn, version, tenantId, applicationId); if (schema != null) { schemas = convertDtoList(ctlSchemaDao.findDependentSchemas(schema.getStringId())); @@ -422,7 +422,7 @@ public List findCTLSchemaDependents(String fqn, Integer version, S return schemas; } - private void validateCTLSchemaObject(CTLSchemaDto ctlSchema) { + private void validateCTLSchemaObject(CtlSchemaDto ctlSchema) { validateObject(ctlSchema, "Incorrect ctl schema object"); CTLSchemaMetaInfoDto metaInfo = ctlSchema.getMetaInfo(); if (metaInfo == null) { @@ -457,7 +457,7 @@ private List getMetaInfoFromCTLSchema(List sche } @Override - public FileData shallowExport(CTLSchemaDto schema) { + public FileData shallowExport(CtlSchemaDto schema) { try { FileData result = new FileData(); result.setContentType(JSON); @@ -474,7 +474,7 @@ public FileData shallowExport(CTLSchemaDto schema) { } @Override - public Schema flatExportAsSchema(CTLSchemaDto schema) { + public Schema flatExportAsSchema(CtlSchemaDto schema) { try { return this.parseDependencies(schema, new Schema.Parser()); } catch (Exception cause) { @@ -484,12 +484,12 @@ public Schema flatExportAsSchema(CTLSchemaDto schema) { } @Override - public String flatExportAsString(CTLSchemaDto schema) { + public String flatExportAsString(CtlSchemaDto schema) { return flatExportAsSchema(schema).toString(); } @Override - public FileData flatExport(CTLSchemaDto schema) { + public FileData flatExport(CtlSchemaDto schema) { try { FileData result = new FileData(); result.setContentType(JSON); @@ -509,7 +509,7 @@ public FileData flatExport(CTLSchemaDto schema) { } @Override - public FileData deepExport(CTLSchemaDto schema) { + public FileData deepExport(CtlSchemaDto schema) { try { ByteArrayOutputStream content = new ByteArrayOutputStream(); ZipOutputStream out = new ZipOutputStream(content); @@ -531,9 +531,9 @@ public FileData deepExport(CTLSchemaDto schema) { } } - private Schema parseDependencies(CTLSchemaDto schema, final Schema.Parser parser) throws Exception { + private Schema parseDependencies(CtlSchemaDto schema, final Schema.Parser parser) throws Exception { if (schema.getDependencySet() != null) { - for (CTLSchemaDto dependency : schema.getDependencySet()) { + for (CtlSchemaDto dependency : schema.getDependencySet()) { this.parseDependencies(dependency, parser); } } @@ -543,7 +543,7 @@ private Schema parseDependencies(CTLSchemaDto schema, final Schema.Parser parser return parser.parse(body); } - private List recursiveShallowExport(List files, CTLSchemaDto parent) throws Exception { + private List recursiveShallowExport(List files, CtlSchemaDto parent) throws Exception { files.add(this.shallowExport(parent)); ObjectNode object = new ObjectMapper().readValue(parent.getBody(), ObjectNode.class); ArrayNode dependencies = (ArrayNode) object.get(DEPENDENCIES); @@ -552,7 +552,7 @@ private List recursiveShallowExport(List files, CTLSchemaDto ObjectNode dependency = (ObjectNode) node; String fqn = dependency.get(FQN).getTextValue(); Integer version = dependency.get(VERSION).getIntValue(); - CTLSchemaDto child = this.findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId( + CtlSchemaDto child = this.findAnyCTLSchemaByFqnAndVerAndTenantIdAndApplicationId( fqn, version, parent.getMetaInfo().getTenantId(), parent.getMetaInfo().getApplicationId()); Validate.notNull(child, MessageFormat.format("The dependency [{0}] was not found!", fqn)); this.recursiveShallowExport(files, child); diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ConfigurationServiceImpl.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ConfigurationServiceImpl.java index f68c40de88..1d870c32c3 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ConfigurationServiceImpl.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/ConfigurationServiceImpl.java @@ -41,7 +41,7 @@ import org.kaaproject.kaa.common.dto.HistoryDto; import org.kaaproject.kaa.common.dto.UpdateStatus; import org.kaaproject.kaa.common.dto.VersionDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.common.core.algorithms.AvroUtils; import org.kaaproject.kaa.server.common.core.algorithms.generation.DefaultRecordGenerationAlgorithm; import org.kaaproject.kaa.server.common.core.algorithms.generation.DefaultRecordGenerationAlgorithmImpl; @@ -510,7 +510,7 @@ private ChangeNotificationDto createNotification(ConfigurationDto configurationD } private void generateSchemas(ConfigurationSchemaDto schema) throws SchemaCreationException { - CTLSchemaDto ctlSchema = ctlService.findCTLSchemaById(schema.getCtlSchemaId()); + CtlSchemaDto ctlSchema = ctlService.findCTLSchemaById(schema.getCtlSchemaId()); String sch = ctlService.flatExportAsString(ctlSchema); DataSchema dataSchema = new DataSchema(sch); if (!dataSchema.isEmpty()) { diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/EndpointServiceImpl.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/EndpointServiceImpl.java index c142eeabf0..9d2bfc321c 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/EndpointServiceImpl.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/service/EndpointServiceImpl.java @@ -44,7 +44,7 @@ import org.kaaproject.kaa.common.dto.TopicDto; import org.kaaproject.kaa.common.dto.TopicListEntryDto; import org.kaaproject.kaa.common.dto.UpdateNotificationDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.hash.Sha1HashUtils; import org.kaaproject.kaa.server.common.dao.CTLService; import org.kaaproject.kaa.server.common.dao.EndpointService; @@ -292,7 +292,7 @@ public EndpointProfileDto saveEndpointProfile(EndpointProfileDto endpointProfile validateHash(keyHash, "Incorrect key hash for endpoint profile."); if (endpointProfileDto.getServerProfileBody() == null) { ServerProfileSchemaDto serverProfileSchemaDto = serverProfileService.findLatestServerProfileSchema(endpointProfileDto.getApplicationId()); - CTLSchemaDto schemaDto = ctlService.findCTLSchemaById(serverProfileSchemaDto.getCtlSchemaId()); + CtlSchemaDto schemaDto = ctlService.findCTLSchemaById(serverProfileSchemaDto.getCtlSchemaId()); LOG.debug("Set latest server profile schema [{}] and default record {} for endpoint with key [{}]", serverProfileSchemaDto.getVersion(), schemaDto.getBody(), keyHash); endpointProfileDto.setServerProfileVersion(serverProfileSchemaDto.getVersion()); diff --git a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/AbstractTest.java b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/AbstractTest.java index 488c933d80..50c4121508 100644 --- a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/AbstractTest.java +++ b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/AbstractTest.java @@ -44,7 +44,7 @@ import org.kaaproject.kaa.common.dto.TopicTypeDto; import org.kaaproject.kaa.common.dto.UpdateNotificationDto; import org.kaaproject.kaa.common.dto.UserDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.logs.LogAppenderDto; import org.kaaproject.kaa.common.dto.logs.LogHeaderStructureDto; @@ -325,7 +325,7 @@ protected List generateConfSchemaDto(String tenantId, St } ConfigurationSchemaDto schemaDto; - CTLSchemaDto ctlSchemaDto = ctlService.saveCTLSchema(generateCTLSchemaDto(tenantId)); + CtlSchemaDto ctlSchemaDto = ctlService.saveCTLSchema(generateCTLSchemaDto(tenantId)); schemas = new ArrayList<>(count); for (int i = 0; i < count; i++) { @@ -399,7 +399,7 @@ protected List generateProfSchemaDto(String tenantId, appId = generateApplicationDto(tenantId).getId(); } EndpointProfileSchemaDto schemaDto; - CTLSchemaDto ctlSchemaDto = ctlService.saveCTLSchema(generateCTLSchemaDto(tenantId)); + CtlSchemaDto ctlSchemaDto = ctlService.saveCTLSchema(generateCTLSchemaDto(tenantId)); schemas = new ArrayList<>(count); for (int i = 0; i < count; i++) { schemaDto = new EndpointProfileSchemaDto(); @@ -491,7 +491,7 @@ protected List generateLogSchemaDto(String appId, int count) { for (int i = 0; i < count; i++) { schemaDto = new LogSchemaDto(); schemaDto.setApplicationId(appId); - CTLSchemaDto ctlSchema = null; + CtlSchemaDto ctlSchema = null; try { ctlSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(app.getTenantId())); } catch (DatabaseProcessingException e) { @@ -586,7 +586,7 @@ protected NotificationSchemaDto generateNotificationSchemaDto(String appId, Noti schema.setApplicationId(appId); schema.setName(NOTIFICATION_SCHEMA_NAME); schema.setType(type != null ? type : NotificationTypeDto.USER); - CTLSchemaDto ctlSchema = null; + CtlSchemaDto ctlSchema = null; try { ctlSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(app.getTenantId())); } catch (DatabaseProcessingException e) { @@ -782,12 +782,12 @@ protected EndpointProfileDto generateEndpointProfileWithGroupIdDto(String endpoi return endpointService.saveEndpointProfile(profileDto); } - protected CTLSchemaDto generateCTLSchemaDto(String tenantId) { + protected CtlSchemaDto generateCTLSchemaDto(String tenantId) { return generateCTLSchemaDto(DEFAULT_FQN, tenantId, null, 100); } - protected CTLSchemaDto generateCTLSchemaDto(String fqn, String tenantId, String applicationId, int version) { - CTLSchemaDto ctlSchema = new CTLSchemaDto(); + protected CtlSchemaDto generateCTLSchemaDto(String fqn, String tenantId, String applicationId, int version) { + CtlSchemaDto ctlSchema = new CtlSchemaDto(); ctlSchema.setMetaInfo(new CTLSchemaMetaInfoDto(fqn, tenantId, applicationId)); ctlSchema.setVersion(version); String name = fqn.substring(fqn.lastIndexOf(".") + 1); @@ -819,7 +819,7 @@ protected ServerProfileSchemaDto generateServerProfileSchema(String appId, Strin schemaDto.setApplicationId(appId); schemaDto.setCreatedTime(System.currentTimeMillis()); - CTLSchemaDto ctlSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(ctlRandomFqn(), tenantId, appId, version)); + CtlSchemaDto ctlSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(ctlRandomFqn(), tenantId, appId, version)); schemaDto.setCtlSchemaId(ctlSchema.getId()); return serverProfileService.saveServerProfileSchema(schemaDto); } diff --git a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/impl/sql/HibernateCTLSchemaDaoTest.java b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/impl/sql/HibernateCTLSchemaDaoTest.java index 909acaab4a..ec26c17a8f 100644 --- a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/impl/sql/HibernateCTLSchemaDaoTest.java +++ b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/impl/sql/HibernateCTLSchemaDaoTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.kaaproject.kaa.common.dto.TenantDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.common.dao.CTLService; import org.kaaproject.kaa.server.common.dao.model.sql.CTLSchema; import org.kaaproject.kaa.server.common.dao.model.sql.CTLSchemaMetaInfo; @@ -54,12 +54,12 @@ public class HibernateCTLSchemaDaoTest extends HibernateAbstractTest { @Autowired private CTLService ctlService; private TenantDto tenant; - private CTLSchemaDto firstSchema; - private CTLSchemaDto secondSchema; - private CTLSchemaDto thirdSchema; - private CTLSchemaDto fourthSchema; - private CTLSchemaDto mainSchema; - private CTLSchemaDto systemSchema; + private CtlSchemaDto firstSchema; + private CtlSchemaDto secondSchema; + private CtlSchemaDto thirdSchema; + private CtlSchemaDto fourthSchema; + private CtlSchemaDto mainSchema; + private CtlSchemaDto systemSchema; @Before public void before() { @@ -72,7 +72,7 @@ public void before() { tenant = userService.saveTenant(tn); } } - Set dependency = new HashSet<>(); + Set dependency = new HashSet<>(); firstSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN + 1, tenant.getId(), null, 1)); dependency.add(firstSchema); secondSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN + 2, tenant.getId(), null, 2)); @@ -109,9 +109,9 @@ private CTLSchema generateCTLSchema(String fqn, Tenant tenant, int version, Stri @Test public void saveCTLSchemaWithDependency() throws InterruptedException { - List dep = convertDtoList(ctlSchemaDao.findDependentSchemas(mainSchema.getId())); + List dep = convertDtoList(ctlSchemaDao.findDependentSchemas(mainSchema.getId())); Assert.assertTrue(dep.isEmpty()); - List expected = Arrays.asList(mainSchema); + List expected = Arrays.asList(mainSchema); dep = convertDtoList(ctlSchemaDao.findDependentSchemas(firstSchema.getId())); Assert.assertEquals(expected.size(), dep.size()); dep = convertDtoList(ctlSchemaDao.findDependentSchemas(secondSchema.getId())); diff --git a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/AbstractServiceImplTest.java b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/AbstractServiceImplTest.java index 84a51b3e90..4d54f595cf 100644 --- a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/AbstractServiceImplTest.java +++ b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/AbstractServiceImplTest.java @@ -25,7 +25,7 @@ import org.kaaproject.kaa.common.dto.KaaAuthorityDto; import org.kaaproject.kaa.common.dto.TenantDto; import org.kaaproject.kaa.common.dto.UserDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.server.common.dao.ApplicationService; import org.kaaproject.kaa.server.common.dao.CTLService; @@ -114,8 +114,8 @@ protected String readSchemaFileAsString(String filePath) throws IOException { return null; } - protected CTLSchemaDto generateCTLSchemaDto(String fqn, String tenantId, int version) { - CTLSchemaDto ctlSchema = new CTLSchemaDto(); + protected CtlSchemaDto generateCTLSchemaDto(String fqn, String tenantId, int version) { + CtlSchemaDto ctlSchema = new CtlSchemaDto(); CTLSchemaMetaInfoDto metaInfoDto = new CTLSchemaMetaInfoDto(fqn, tenantId); ctlSchema.setMetaInfo(metaInfoDto); ctlSchema.setVersion(version); @@ -132,7 +132,7 @@ protected List generateProfSchema(String tenantId, Str if (isBlank(applicationId)) { applicationId = generateApplication(tenantId).getId(); } - CTLSchemaDto ctlSchemaDto = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN, tenantId, 1)); + CtlSchemaDto ctlSchemaDto = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN, tenantId, 1)); EndpointProfileSchemaDto schemaDto; schemas = new ArrayList<>(count); for (int i = 0; i < count; i++) { diff --git a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImplTest.java b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImplTest.java index a2c2d7300c..f8ce0e8485 100644 --- a/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImplTest.java +++ b/server/common/dao/src/test/java/org/kaaproject/kaa/server/common/dao/service/CTLServiceImplTest.java @@ -25,7 +25,7 @@ import org.kaaproject.kaa.common.dto.ApplicationDto; import org.kaaproject.kaa.common.dto.HasId; import org.kaaproject.kaa.common.dto.TenantDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.server.common.dao.AbstractTest; import org.kaaproject.kaa.server.common.dao.exception.DatabaseProcessingException; @@ -55,22 +55,22 @@ public class CTLServiceImplTest extends AbstractTest { private TenantDto tenant; private ApplicationDto appDto; private ApplicationDto appDto2; - private CTLSchemaDto firstSchema; - private CTLSchemaDto secondSchema; - private CTLSchemaDto thirdSchema; - private CTLSchemaDto fourthSchema; - private CTLSchemaDto mainSchema; - private CTLSchemaDto defaultSystemSchema; - private CTLSchemaDto systemSchema; - private CTLSchemaDto tenantSchema; - private CTLSchemaDto tenantSchema2; - private CTLSchemaDto appSchema; - private CTLSchemaDto app2Schema; - private CTLSchemaDto appSchema2; - private CTLSchemaDto appSchema3; - private CTLSchemaDto alpha; - private CTLSchemaDto beta; - private CTLSchemaDto gamma; + private CtlSchemaDto firstSchema; + private CtlSchemaDto secondSchema; + private CtlSchemaDto thirdSchema; + private CtlSchemaDto fourthSchema; + private CtlSchemaDto mainSchema; + private CtlSchemaDto defaultSystemSchema; + private CtlSchemaDto systemSchema; + private CtlSchemaDto tenantSchema; + private CtlSchemaDto tenantSchema2; + private CtlSchemaDto appSchema; + private CtlSchemaDto app2Schema; + private CtlSchemaDto appSchema2; + private CtlSchemaDto appSchema3; + private CtlSchemaDto alpha; + private CtlSchemaDto beta; + private CtlSchemaDto gamma; @Before public void before() throws Exception { @@ -83,11 +83,11 @@ public void before() throws Exception { tenant = userService.saveTenant(tn); appDto = generateApplicationDto(tenant.getId(), "The app 1"); appDto2 = generateApplicationDto(tenant.getId(), "The app 2"); - List ctlSchemas = ctlService.findSystemCTLSchemas(); + List ctlSchemas = ctlService.findSystemCTLSchemas(); defaultSystemSchema = ctlSchemas.get(0); } } - Set dependency = new HashSet<>(); + Set dependency = new HashSet<>(); firstSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN + 1, tenant.getId(), null, 1)); dependency.add(firstSchema); secondSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN + 2, tenant.getId(), null, 2)); @@ -102,7 +102,7 @@ public void before() throws Exception { systemSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN + 6, null, null, 50)); tenantSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN + 7, tenant.getId(), null, 77)); tenantSchema2 = ctlService.saveCTLSchema(generateCTLSchemaDto(DEFAULT_FQN + 7, tenant.getId(), null, 78)); - CTLSchemaDto unsaved = generateCTLSchemaDto(DEFAULT_FQN + 8, tenant.getId(), appDto.getId(), 80); + CtlSchemaDto unsaved = generateCTLSchemaDto(DEFAULT_FQN + 8, tenant.getId(), appDto.getId(), 80); appSchema = ctlService.saveCTLSchema(unsaved); unsaved = generateCTLSchemaDto(DEFAULT_FQN + 8, tenant.getId(), appDto.getId(), 81); appSchema2 = ctlService.saveCTLSchema(unsaved); @@ -111,7 +111,7 @@ public void before() throws Exception { unsaved = generateCTLSchemaDto(DEFAULT_FQN + 8, tenant.getId(), appDto2.getId(), 11); app2Schema = ctlService.saveCTLSchema(unsaved); - gamma = new CTLSchemaDto(); + gamma = new CtlSchemaDto(); CTLSchemaMetaInfoDto gammaMetaInfo = new CTLSchemaMetaInfoDto("org.kaaproject.kaa.Gamma", tenant.getId()); gamma.setMetaInfo(gammaMetaInfo); gamma.setVersion(1); @@ -120,11 +120,11 @@ public void before() throws Exception { gamma = ctlService.findCTLSchemaById(gamma.getId()); - beta = new CTLSchemaDto(); + beta = new CtlSchemaDto(); CTLSchemaMetaInfoDto betaMetaInfo = new CTLSchemaMetaInfoDto("org.kaaproject.kaa.Beta", tenant.getId()); beta.setMetaInfo(betaMetaInfo); beta.setVersion(1); - Set betaDependencies = new HashSet<>(); + Set betaDependencies = new HashSet<>(); betaDependencies.add(gamma); beta.setDependencySet(betaDependencies); beta.setBody(readSchemaFileAsString(TEST_CTL_SCHEMA_BETA)); @@ -132,11 +132,11 @@ public void before() throws Exception { beta = ctlService.findCTLSchemaById(beta.getId()); - alpha = new CTLSchemaDto(); + alpha = new CtlSchemaDto(); CTLSchemaMetaInfoDto alphaMetaInfo = new CTLSchemaMetaInfoDto("org.kaaproject.kaa.Alpha", tenant.getId()); alpha.setMetaInfo(alphaMetaInfo); alpha.setVersion(1); - Set alphaDependencies = new HashSet<>(); + Set alphaDependencies = new HashSet<>(); alphaDependencies.add(beta); alpha.setDependencySet(alphaDependencies); alpha.setBody(readSchemaFileAsString(TEST_CTL_SCHEMA_ALPHA)); @@ -165,20 +165,20 @@ public void testRemoveCTLSchemaByFqnAndVerAndWithoutTenantId() { @Test public void testFindCTLSchemaByFqnAndVerAndTenantIdAndApplicationId() { CTLSchemaMetaInfoDto metaInfo = firstSchema.getMetaInfo(); - CTLSchemaDto found = ctlService.findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(metaInfo.getFqn(), + CtlSchemaDto found = ctlService.findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(metaInfo.getFqn(), firstSchema.getVersion(), metaInfo.getTenantId(), metaInfo.getApplicationId()); Assert.assertEquals(firstSchema, found); } @Test public void testFindCTLSchemaById() { - CTLSchemaDto found = ctlService.findCTLSchemaById(firstSchema.getId()); + CtlSchemaDto found = ctlService.findCTLSchemaById(firstSchema.getId()); Assert.assertEquals(firstSchema, found); } @Test public void testFindSystemCTLSchemas() { - List appSchemas = ctlService.findSystemCTLSchemas(); + List appSchemas = ctlService.findSystemCTLSchemas(); Assert.assertEquals(getIdsDto(Arrays.asList(defaultSystemSchema, systemSchema)), getIdsDto(appSchemas)); } @@ -199,9 +199,9 @@ public int compare(HasId o1, HasId o2) { @Test public void testFindLatestCTLSchemaByFqn() { - CTLSchemaDto latestTenantScope = ctlService.findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(DEFAULT_FQN + 7, tenant.getId(), null); + CtlSchemaDto latestTenantScope = ctlService.findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(DEFAULT_FQN + 7, tenant.getId(), null); Assert.assertEquals(Integer.valueOf(78), latestTenantScope.getVersion()); - CTLSchemaDto latestAppScope = ctlService.findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(DEFAULT_FQN + 8, tenant.getId(), appDto.getId()); + CtlSchemaDto latestAppScope = ctlService.findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(DEFAULT_FQN + 8, tenant.getId(), appDto.getId()); Assert.assertEquals(Integer.valueOf(81), latestAppScope.getVersion()); } @@ -210,7 +210,7 @@ public void testScopeUpdate() { CTLSchemaMetaInfoDto metaInfo = appSchema3.getMetaInfo(); metaInfo.setApplicationId(null); ctlService.updateCTLSchemaMetaInfoScope(metaInfo); - CTLSchemaDto found = ctlService.findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(metaInfo.getFqn(), appSchema3.getVersion(), metaInfo.getTenantId(), null); + CtlSchemaDto found = ctlService.findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(metaInfo.getFqn(), appSchema3.getVersion(), metaInfo.getTenantId(), null); Assert.assertEquals(appSchema3, found); } @@ -233,7 +233,7 @@ public void testFindSiblingsFqns() { @Test public void testFindCTLSchemaDependentsByFqnVersionTenantId() { - List appSchemas = ctlService.findCTLSchemaDependents(firstSchema.getMetaInfo().getFqn(), firstSchema.getVersion(), + List appSchemas = ctlService.findCTLSchemaDependents(firstSchema.getMetaInfo().getFqn(), firstSchema.getVersion(), tenant.getId(), null); Assert.assertEquals(Arrays.asList(mainSchema), appSchemas); @@ -253,12 +253,12 @@ public void testFindCTLSchemaDependentsByFqnVersionTenantId() { @Test public void multiThreadCTLSchemaSaveTest() throws InterruptedException, ExecutionException { - List> list = new ArrayList<>(); + List> list = new ArrayList<>(); for (int i = 0; i < 100; i++) { - list.add(executorService.submit(new Callable() { + list.add(executorService.submit(new Callable() { @Override - public CTLSchemaDto call() { - CTLSchemaDto sch = null; + public CtlSchemaDto call() { + CtlSchemaDto sch = null; try { sch = ctlService.saveCTLSchema(generateCTLSchemaDto(generateTenantDto().getId())); } catch (Throwable t) { @@ -268,18 +268,18 @@ public CTLSchemaDto call() { } })); } - Iterator> iterator = list.iterator(); - List schemas = new ArrayList<>(); + Iterator> iterator = list.iterator(); + List schemas = new ArrayList<>(); while (iterator.hasNext()) { - Future f = iterator.next(); + Future f = iterator.next(); while (!f.isDone()) { } schemas.add(f.get()); iterator.remove(); } Assert.assertEquals(100, schemas.size()); - for (CTLSchemaDto schema : schemas) { - CTLSchemaDto savedSchema = ctlService.findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(DEFAULT_FQN, 100, schema.getMetaInfo().getTenantId(), null); + for (CtlSchemaDto schema : schemas) { + CtlSchemaDto savedSchema = ctlService.findCTLSchemaByFqnAndVerAndTenantIdAndApplicationId(DEFAULT_FQN, 100, schema.getMetaInfo().getTenantId(), null); Assert.assertNotNull(savedSchema); Assert.assertEquals(schema, savedSchema); } diff --git a/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/ctl/CTLSchemaDto.java b/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/ctl/CtlSchemaDto.java similarity index 81% rename from server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/ctl/CTLSchemaDto.java rename to server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/ctl/CtlSchemaDto.java index e3cf49d364..a760223bcd 100644 --- a/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/ctl/CTLSchemaDto.java +++ b/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/ctl/CtlSchemaDto.java @@ -26,7 +26,7 @@ * * @since v0.8.0 */ -public class CTLSchemaDto implements HasId, Serializable { +public class CtlSchemaDto implements HasId, Serializable { private static final long serialVersionUID = -7601241323233814152L; @@ -37,9 +37,9 @@ public class CTLSchemaDto implements HasId, Serializable { private String defaultRecord; private String createdUsername; private long createdTime; - private Set dependencySet; + private Set dependencySet; - public CTLSchemaDto() { + public CtlSchemaDto() { } @Override @@ -100,11 +100,11 @@ public void setCreatedTime(long createdTime) { this.createdTime = createdTime; } - public Set getDependencySet() { + public Set getDependencySet() { return dependencySet; } - public void setDependencySet(Set dependencySet) { + public void setDependencySet(Set dependencySet) { this.dependencySet = dependencySet; } @@ -120,37 +120,48 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; - CTLSchemaDto other = (CTLSchemaDto) obj; + } + CtlSchemaDto other = (CtlSchemaDto) obj; if (id == null) { - if (other.id != null) + if (other.id != null) { return false; - } else if (!id.equals(other.id)) + } + } else if (!id.equals(other.id)) { return false; + } if (dependencySet == null) { - if (other.dependencySet != null) + if (other.dependencySet != null) { return false; - } else if (!dependencySet.equals(other.dependencySet)) + } + } else if (!dependencySet.equals(other.dependencySet)) { return false; + } if (metaInfo == null) { - if (other.metaInfo != null) + if (other.metaInfo != null) { return false; - } else if (!metaInfo.equals(other.metaInfo)) + } + } else if (!metaInfo.equals(other.metaInfo)) { return false; + } if (version == null) { - if (other.version != null) + if (other.version != null) { return false; - } else if (!version.equals(other.version)) + } + } else if (!version.equals(other.version)) { return false; + } return true; } @@ -158,7 +169,7 @@ public boolean equals(Object obj) { @Override public String toString() { StringBuilder builder = new StringBuilder(); - builder.append("CTLSchemaDto [id="); + builder.append("CtlSchemaDto [id="); builder.append(id); builder.append(", metaInfo="); builder.append(metaInfo); diff --git a/server/common/nosql/mongo-dao/src/test/java/org/kaaproject/kaa/server/common/nosql/mongo/dao/NotificationServiceImplTest.java b/server/common/nosql/mongo-dao/src/test/java/org/kaaproject/kaa/server/common/nosql/mongo/dao/NotificationServiceImplTest.java index 01231a59f2..7d4a132834 100644 --- a/server/common/nosql/mongo-dao/src/test/java/org/kaaproject/kaa/server/common/nosql/mongo/dao/NotificationServiceImplTest.java +++ b/server/common/nosql/mongo-dao/src/test/java/org/kaaproject/kaa/server/common/nosql/mongo/dao/NotificationServiceImplTest.java @@ -36,7 +36,7 @@ import org.kaaproject.kaa.common.dto.TopicTypeDto; import org.kaaproject.kaa.common.dto.UpdateNotificationDto; import org.kaaproject.kaa.common.dto.VersionDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.common.dao.exception.IncorrectParameterException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,7 +79,7 @@ public void findNotificationsByIdWithExpiredTimeTest() { NotificationSchemaDto notificationSchemaDto = new NotificationSchemaDto(); notificationSchemaDto.setApplicationId(app.getId()); - CTLSchemaDto ctlSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(app.getTenantId())); + CtlSchemaDto ctlSchema = ctlService.saveCTLSchema(generateCTLSchemaDto(app.getTenantId())); notificationSchemaDto.setCtlSchemaId(ctlSchema.getId()); if (notificationSchemaDto == null) { throw new RuntimeException("Can't save default profile schema "); //NOSONAR diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/client/mvp/data/DataSource.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/client/mvp/data/DataSource.java index a9f17b0da6..eae05eed43 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/client/mvp/data/DataSource.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/client/mvp/data/DataSource.java @@ -48,7 +48,7 @@ import org.kaaproject.kaa.common.dto.admin.SdkProfileViewDto; import org.kaaproject.kaa.common.dto.admin.UserDto; import org.kaaproject.kaa.common.dto.admin.UserProfileUpdateDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.event.AefMapInfoDto; @@ -1519,11 +1519,11 @@ protected void onResult(List result) { * @param callback callback which should be called with a result */ public void getCtlSchemaById(String ctlSchemaId, - final AsyncCallback callback) { + final AsyncCallback callback) { ctlRpcService.getCtlSchemaById(ctlSchemaId, - new DataCallback(callback) { + new DataCallback(callback) { @Override - protected void onResult(CTLSchemaDto result) { + protected void onResult(CtlSchemaDto result) { } }); } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/CtlController.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/CtlController.java index f8e87ef045..7d2e3a4963 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/CtlController.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/CtlController.java @@ -22,7 +22,7 @@ import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.file.FileData; @@ -70,7 +70,7 @@ public class CtlController extends AbstractAdminController { @ApiResponse(code = 500, message = "An unexpected error occurred on the server side")}) @RequestMapping(value = "CTL/saveSchema", params = {"body"}, method = RequestMethod.POST) @ResponseBody - public CTLSchemaDto saveCTLSchemaWithAppToken( + public CtlSchemaDto saveCTLSchemaWithAppToken( @ApiParam(name = "body", value = "The CTL schema structure", required = true) @RequestParam String body, @ApiParam(name = "tenantId", value = "A unique tenant identifier", required = false) @@ -131,7 +131,7 @@ public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken( @ApiResponse(code = 500, message = "An unexpected error occurred on the server side")}) @RequestMapping(value = "CTL/getSchema", params = {"fqn", "version"}, method = RequestMethod.GET) @ResponseBody - public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken( + public CtlSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken( @ApiParam(name = "fqn", value = "The fully qualified name of the CTL schema", required = true) @RequestParam String fqn, @ApiParam(name = "version", value = "The version number of the CTL schema", required = true) @@ -160,7 +160,7 @@ public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken( @ApiResponse(code = 500, message = "An unexpected error occurred on the server side")}) @RequestMapping(value = "CTL/getSchemaById", params = {"id"}, method = RequestMethod.GET) @ResponseBody - public CTLSchemaDto getCTLSchemaById( + public CtlSchemaDto getCTLSchemaById( @ApiParam(name = "id", value = "A unique CTL schema identifier", required = true) @RequestParam String id) throws KaaAdminServiceException { return ctlService.getCtlSchemaById(id); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/AbstractAdminService.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/AbstractAdminService.java index e443878976..90dae5a76f 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/AbstractAdminService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/AbstractAdminService.java @@ -34,7 +34,7 @@ import org.kaaproject.kaa.common.dto.EndpointGroupDto; import org.kaaproject.kaa.common.dto.KaaAuthorityDto; import org.kaaproject.kaa.common.dto.UserDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.plugin.PluginDto; import org.kaaproject.kaa.server.admin.services.cache.CacheService; import org.kaaproject.kaa.server.admin.services.dao.PropertiesFacade; @@ -303,7 +303,7 @@ RecordField createRecordFieldFromCtlSchemaAndBody(String ctlSchemaId, String bod throws KaaAdminServiceException { try { RecordField recordField; - CTLSchemaDto ctlSchema = controlService.getCtlSchemaById(ctlSchemaId); + CtlSchemaDto ctlSchema = controlService.getCtlSchemaById(ctlSchemaId); Schema schema = controlService.exportCtlSchemaFlatAsSchema(ctlSchema); if (!isEmpty(body)) { GenericAvroConverter converter = new GenericAvroConverter<>(schema); @@ -430,7 +430,7 @@ void setPluginRawConfigurationFromJson(PluginDto plugin, PluginType type) { plugin.setRawConfiguration(rawConfiguration); } - CtlSchemaFormDto toCtlSchemaForm(CTLSchemaDto ctlSchema, ConverterType converterType) + CtlSchemaFormDto toCtlSchemaForm(CtlSchemaDto ctlSchema, ConverterType converterType) throws KaaAdminServiceException { try { CtlSchemaFormDto ctlSchemaForm = new CtlSchemaFormDto(ctlSchema); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CacheServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CacheServiceImpl.java index 76827785ca..468394a691 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CacheServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CacheServiceImpl.java @@ -19,7 +19,7 @@ import net.sf.ehcache.Ehcache; import org.kaaproject.kaa.common.dto.admin.RecordKey; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.file.FileData; import org.kaaproject.kaa.server.admin.services.cache.CacheService; import org.kaaproject.kaa.server.admin.services.util.Utils; @@ -124,7 +124,7 @@ public FileData getRecordData(RecordKey key) throws KaaAdminServiceException { public FileData getExportedCtlSchema(CtlSchemaExportKey key) throws KaaAdminServiceException { try { - CTLSchemaDto schemaFound = controlService.getCtlSchemaById(key.getCtlSchemaId()); + CtlSchemaDto schemaFound = controlService.getCtlSchemaById(key.getCtlSchemaId()); Utils.checkNotNull(schemaFound); switch (key.getExportMethod()) { case SHALLOW: diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ConfigurationServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ConfigurationServiceImpl.java index 53da9c6f26..e51728f37a 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ConfigurationServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ConfigurationServiceImpl.java @@ -35,7 +35,7 @@ import org.kaaproject.kaa.common.dto.KaaAuthorityDto; import org.kaaproject.kaa.common.dto.StructureRecordDto; import org.kaaproject.kaa.common.dto.VersionDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.admin.services.util.Utils; import org.kaaproject.kaa.server.admin.shared.config.ConfigurationRecordFormDto; import org.kaaproject.kaa.server.admin.shared.config.ConfigurationRecordViewDto; @@ -153,7 +153,7 @@ public ConfigurationSchemaViewDto saveConfigurationSchemaView( if (isEmpty(ctlSchemaId)) { if (confSchemaView.useExistingCtlSchema()) { CtlSchemaReferenceDto metaInfo = confSchemaView.getExistingMetaInfo(); - CTLSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( metaInfo.getMetaInfo().getFqn(), metaInfo.getVersion(), metaInfo.getMetaInfo().getTenantId(), @@ -179,7 +179,7 @@ public ConfigurationSchemaViewDto getConfigurationSchemaView(String configuratio checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { ConfigurationSchemaDto confSchema = getConfigurationSchema(configurationSchemaId); - CTLSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(confSchema.getCtlSchemaId()); + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(confSchema.getCtlSchemaId()); return new ConfigurationSchemaViewDto( confSchema, toCtlSchemaForm( ctlSchemaDto, ConverterType.CONFIGURATION_FORM_AVRO_CONVERTER)); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CtlServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CtlServiceImpl.java index 0c5dbd5ad1..01bf463a27 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CtlServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/CtlServiceImpl.java @@ -27,7 +27,7 @@ import org.kaaproject.avro.ui.shared.FqnVersion; import org.kaaproject.avro.ui.shared.RecordField; import org.kaaproject.kaa.common.dto.KaaAuthorityDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto; @@ -58,7 +58,7 @@ public class CtlServiceImpl extends AbstractAdminService implements CtlService { @Override - public CTLSchemaDto saveCtlSchema(CTLSchemaDto schema) throws KaaAdminServiceException { + public CtlSchemaDto saveCtlSchema(CtlSchemaDto schema) throws KaaAdminServiceException { this.checkAuthority(KaaAuthorityDto.values()); try { Utils.checkNotNull(schema); @@ -68,10 +68,10 @@ public CTLSchemaDto saveCtlSchema(CTLSchemaDto schema) throws KaaAdminServiceExc // Check if the schema dependencies are present in the database List missingDependencies = new ArrayList<>(); - Set dependencies = new HashSet<>(); + Set dependencies = new HashSet<>(); if (schema.getDependencySet() != null) { - for (CTLSchemaDto dependency : schema.getDependencySet()) { - CTLSchemaDto schemaFound = + for (CtlSchemaDto dependency : schema.getDependencySet()) { + CtlSchemaDto schemaFound = controlService.getAnyCtlSchemaByFqnVersionTenantIdAndApplicationId( dependency.getMetaInfo().getFqn(), dependency.getVersion(), schema.getMetaInfo().getTenantId(), schema.getMetaInfo().getApplicationId()); @@ -94,7 +94,7 @@ public CTLSchemaDto saveCtlSchema(CTLSchemaDto schema) throws KaaAdminServiceExc controlService, schema.getMetaInfo().getTenantId()); parser.validate(schema); - CTLSchemaDto result = controlService.saveCtlSchema(schema); + CtlSchemaDto result = controlService.saveCtlSchema(schema); return result; } catch (Exception cause) { throw Utils.handleException(cause); @@ -102,17 +102,17 @@ public CTLSchemaDto saveCtlSchema(CTLSchemaDto schema) throws KaaAdminServiceExc } @Override - public CTLSchemaDto saveCtlSchema(String body, String tenantId, String applicationId) + public CtlSchemaDto saveCtlSchema(String body, String tenantId, String applicationId) throws KaaAdminServiceException { this.checkAuthority(KaaAuthorityDto.values()); try { checkCtlSchemaEditScope(tenantId, applicationId); CtlSchemaParser parser = new CtlSchemaParser(controlService, tenantId); - CTLSchemaDto schema = parser.parse(body, applicationId); + CtlSchemaDto schema = parser.parse(body, applicationId); checkCtlSchemaVersion(schema.getVersion()); // Check if the schema body is valid parser.validate(schema); - CTLSchemaDto result = controlService.saveCtlSchema(schema); + CtlSchemaDto result = controlService.saveCtlSchema(schema); return result; } catch (Exception cause) { throw Utils.handleException(cause); @@ -120,7 +120,7 @@ public CTLSchemaDto saveCtlSchema(String body, String tenantId, String applicati } @Override - public CTLSchemaDto saveCtlSchemaWithAppToken(String body, + public CtlSchemaDto saveCtlSchemaWithAppToken(String body, String tenantId, String applicationToken) throws KaaAdminServiceException { @@ -157,12 +157,12 @@ public void deleteCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, if (!isEmpty(applicationId)) { this.checkApplicationId(applicationId); } - CTLSchemaDto schemaFound = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schemaFound = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( fqn, version, tenantId, applicationId); Utils.checkNotNull(schemaFound); checkCtlSchemaEditScope( schemaFound.getMetaInfo().getTenantId(), schemaFound.getMetaInfo().getApplicationId()); - List schemaDependents = controlService.getCtlSchemaDependents( + List schemaDependents = controlService.getCtlSchemaDependents( fqn, version, tenantId, applicationId); if (schemaDependents != null && !schemaDependents.isEmpty()) { String message = "Can't delete the common type version as it is referenced" @@ -179,7 +179,7 @@ public void deleteCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, } @Override - public CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, + public CtlSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, Integer version, String tenantId, String applicationToken) @@ -192,7 +192,7 @@ public CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationToken(String f } @Override - public CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, + public CtlSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId) @@ -204,7 +204,7 @@ public CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, if (!isEmpty(applicationId)) { this.checkApplicationId(applicationId); } - CTLSchemaDto schemaFound = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schemaFound = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( fqn, version, tenantId, applicationId); Utils.checkNotNull(schemaFound); checkCtlSchemaReadScope( @@ -216,11 +216,11 @@ public CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, } @Override - public CTLSchemaDto getCtlSchemaById(String schemaId) throws KaaAdminServiceException { + public CtlSchemaDto getCtlSchemaById(String schemaId) throws KaaAdminServiceException { this.checkAuthority(KaaAuthorityDto.values()); try { this.checkCtlSchemaId(schemaId); - CTLSchemaDto schemaFound = controlService.getCtlSchemaById(schemaId); + CtlSchemaDto schemaFound = controlService.getCtlSchemaById(schemaId); Utils.checkNotNull(schemaFound); checkCtlSchemaReadScope( schemaFound.getMetaInfo().getTenantId(), schemaFound.getMetaInfo().getApplicationId()); @@ -280,7 +280,7 @@ public CTLSchemaMetaInfoDto promoteScopeToTenant(String applicationId, String fq checkCtlSchemaEditScope(tenantId, applicationId); try { - Set dependencies = new HashSet<>(); + Set dependencies = new HashSet<>(); List versions = controlService.getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( fqn, tenantId, applicationId); @@ -297,9 +297,9 @@ public CTLSchemaMetaInfoDto promoteScopeToTenant(String applicationId, String fq // get dep of all versions for (Integer version : versions) { - CTLSchemaDto schema = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schema = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( fqn, version, tenantId, applicationId); - Set schemaDependents = schema.getDependencySet(); + Set schemaDependents = schema.getDependencySet(); dependencies.addAll(schemaDependents.stream() .filter(dep -> dep.getMetaInfo().getScope() == CTLSchemaScopeDto.APPLICATION) .collect(Collectors.toList())); @@ -413,7 +413,7 @@ public FileData exportCtlSchema(String fqn, int version, this.checkCtlSchemaFqn(fqn); this.checkCtlSchemaVersion(version); String tenantId = getCurrentUser().getTenantId(); - CTLSchemaDto schemaFound = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schemaFound = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( fqn, version, tenantId, applicationId); Utils.checkNotNull(schemaFound); checkCtlSchemaReadScope( @@ -441,7 +441,7 @@ public CtlSchemaFormDto saveCtlSchemaForm(CtlSchemaFormDto ctlSchemaForm, checkAuthority(KaaAuthorityDto.values()); try { AuthUserDto currentUser = getCurrentUser(); - CTLSchemaDto ctlSchema = null; + CtlSchemaDto ctlSchema = null; if (!isEmpty(ctlSchemaForm.getId())) { ctlSchema = getCtlSchemaById(ctlSchemaForm.getId()); if (ctlSchema == null) { @@ -450,7 +450,7 @@ public CtlSchemaFormDto saveCtlSchemaForm(CtlSchemaFormDto ctlSchemaForm, ServiceErrorCode.ITEM_NOT_FOUND); } } else { - ctlSchema = new CTLSchemaDto(); + ctlSchema = new CtlSchemaDto(); } if (isEmpty(ctlSchema.getId())) { ctlSchema.setCreatedUsername(currentUser.getUsername()); @@ -460,10 +460,10 @@ public CtlSchemaFormDto saveCtlSchemaForm(CtlSchemaFormDto ctlSchemaForm, ctlSchema.getMetaInfo().setTenantId(currentUser.getTenantId()); ctlSchema.setVersion(schemaForm.getVersion()); List dependenciesList = schemaForm.getContext().getCtlDependenciesList(); - Set dependencies = new HashSet<>(); + Set dependencies = new HashSet<>(); List missingDependencies = new ArrayList<>(); for (FqnVersion fqnVersion : dependenciesList) { - CTLSchemaDto dependency = + CtlSchemaDto dependency = controlService.getAnyCtlSchemaByFqnVersionTenantIdAndApplicationId( fqnVersion.getFqnString(), fqnVersion.getVersion(), ctlSchema.getMetaInfo().getTenantId(), ctlSchema.getMetaInfo().getApplicationId()); @@ -487,7 +487,7 @@ public CtlSchemaFormDto saveCtlSchemaForm(CtlSchemaFormDto ctlSchemaForm, ctlSchema.setBody(schemaBody); } - CTLSchemaDto savedCtlSchema = saveCtlSchema(ctlSchema); + CtlSchemaDto savedCtlSchema = saveCtlSchema(ctlSchema); if (savedCtlSchema != null) { return toCtlSchemaForm(savedCtlSchema, converterType); } @@ -529,7 +529,7 @@ public CtlSchemaFormDto getLatestCtlSchemaForm(String metaInfoId) checkAuthority(KaaAuthorityDto.values()); try { this.checkCtlSchemaMetaInfoId(metaInfoId); - CTLSchemaDto ctlSchema = controlService.getLatestCtlSchemaByMetaInfoId(metaInfoId); + CtlSchemaDto ctlSchema = controlService.getLatestCtlSchemaByMetaInfoId(metaInfoId); Utils.checkNotNull(ctlSchema); checkCtlSchemaReadScope( ctlSchema.getMetaInfo().getTenantId(), ctlSchema.getMetaInfo().getApplicationId()); @@ -546,7 +546,7 @@ public CtlSchemaFormDto getCtlSchemaFormByMetaInfoIdAndVer(String metaInfoId, in try { this.checkCtlSchemaMetaInfoId(metaInfoId); this.checkCtlSchemaVersion(version); - CTLSchemaDto schemaFound = controlService.getCtlSchemaByMetaInfoIdAndVer( + CtlSchemaDto schemaFound = controlService.getCtlSchemaByMetaInfoIdAndVer( metaInfoId, version); Utils.checkNotNull(schemaFound); checkCtlSchemaReadScope( @@ -626,7 +626,7 @@ public String prepareCtlSchemaExport(String ctlSchemaId, throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.values()); try { - CTLSchemaDto schemaFound = controlService.getCtlSchemaById(ctlSchemaId); + CtlSchemaDto schemaFound = controlService.getCtlSchemaById(ctlSchemaId); Utils.checkNotNull(schemaFound); checkCtlSchemaReadScope( schemaFound.getMetaInfo().getTenantId(), schemaFound.getMetaInfo().getApplicationId()); @@ -755,10 +755,10 @@ private void checkCtlSchemaReadScope(String tenantId, String applicationId) * @return A string that contains fully qualified names and version numbers of the given CTL * schemas */ - private String asText(Collection types) { + private String asText(Collection types) { StringBuilder message = new StringBuilder(); if (types != null) { - for (CTLSchemaDto type : types) { + for (CtlSchemaDto type : types) { CTLSchemaMetaInfoDto details = type.getMetaInfo(); message.append("\n").append("FQN: ") .append(details.getFqn()) @@ -774,7 +774,7 @@ public CtlSchemaReferenceDto getLastCtlSchemaReferenceDto(String ctlSchemaId) throws KaaAdminServiceException { try { if (!isEmpty(ctlSchemaId)) { - CTLSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(ctlSchemaId); + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(ctlSchemaId); CtlSchemaReferenceDto ctlSchemaReference = getAvailableApplicationCtlSchemaReferences(null).stream() .filter(ctlSchemaReferenceDto -> ctlSchemaReferenceDto.getMetaInfo() diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/DeviceManagementServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/DeviceManagementServiceImpl.java index 4d4c4a9476..b98345b269 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/DeviceManagementServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/DeviceManagementServiceImpl.java @@ -24,7 +24,7 @@ import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; import org.kaaproject.kaa.common.dto.credentials.CredentialsDto; import org.kaaproject.kaa.common.dto.credentials.CredentialsStatus; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.admin.services.util.Utils; import org.kaaproject.kaa.server.admin.shared.services.DeviceManagementService; import org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException; @@ -158,7 +158,7 @@ private ServerProfileSchemaDto getServerProfileSchema(String applicationId, private void validateServerProfile(ServerProfileSchemaDto serverProfileSchema, String serverProfileBody) throws Exception { - CTLSchemaDto commonType = this.controlService.getCtlSchemaById( + CtlSchemaDto commonType = this.controlService.getCtlSchemaById( serverProfileSchema.getCtlSchemaId()); Schema typeSchema = this.controlService.exportCtlSchemaFlatAsSchema(commonType); try { diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/EventServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/EventServiceImpl.java index 82ef09f46b..13e2a8bf4a 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/EventServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/EventServiceImpl.java @@ -22,7 +22,7 @@ import org.apache.avro.Schema; import org.kaaproject.avro.ui.shared.RecordField; import org.kaaproject.kaa.common.dto.KaaAuthorityDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.event.AefMapInfoDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto; import org.kaaproject.kaa.common.dto.event.EcfInfoDto; @@ -263,7 +263,7 @@ public EventClassViewDto getEventClassView(String eventClassId) throws KaaAdminS KaaAuthorityDto.TENANT_ADMIN); try { EventClassDto eventClassDto = getEventClass(eventClassId); - CTLSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(eventClassDto.getCtlSchemaId()); + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(eventClassDto.getCtlSchemaId()); EventClassViewDto eventClassViewDto = new EventClassViewDto( eventClassDto, toCtlSchemaForm(ctlSchemaDto, ConverterType.FORM_AVRO_CONVERTER)); return eventClassViewDto; @@ -276,7 +276,7 @@ public EventClassViewDto getEventClassView(String eventClassId) throws KaaAdminS public EventClassViewDto getEventClassViewByCtlSchemaId(EventClassDto eventClassDto) throws KaaAdminServiceException { try { - CTLSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(eventClassDto.getCtlSchemaId()); + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(eventClassDto.getCtlSchemaId()); Utils.checkNotNull(ctlSchemaDto); EventClassViewDto eventClassViewDto = new EventClassViewDto( eventClassDto, toCtlSchemaForm(ctlSchemaDto, ConverterType.FORM_AVRO_CONVERTER)); @@ -306,7 +306,7 @@ public EventClassViewDto saveEventClassView(EventClassViewDto eventClassViewDto) if (isEmpty(ctlSchemaId)) { if (eventClassViewDto.useExistingCtlSchema()) { CtlSchemaReferenceDto metaInfo = eventClassViewDto.getExistingMetaInfo(); - CTLSchemaDto schema = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schema = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( metaInfo.getMetaInfo().getFqn(), metaInfo.getVersion(), metaInfo.getMetaInfo().getTenantId(), diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/GroupServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/GroupServiceImpl.java index 420c83ba37..873a4540ad 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/GroupServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/GroupServiceImpl.java @@ -32,7 +32,7 @@ import org.kaaproject.kaa.common.dto.ProfileFilterRecordDto; import org.kaaproject.kaa.common.dto.ProfileVersionPairDto; import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.admin.services.util.Utils; import org.kaaproject.kaa.server.admin.shared.services.GroupService; import org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException; @@ -326,7 +326,7 @@ private void validateProfileFilterBody(String endpointProfileSchemaId, } private GenericRecord getDefaultRecordFromCtlSchema(String ctlSchemaId) throws Exception { - CTLSchemaDto ctlSchema = controlService.getCtlSchemaById(ctlSchemaId); + CtlSchemaDto ctlSchema = controlService.getCtlSchemaById(ctlSchemaId); Schema schema = controlService.exportCtlSchemaFlatAsSchema(ctlSchema); GenericAvroConverter converter = new GenericAvroConverter<>(schema); GenericRecord defaultRecord = converter.decodeJson(ctlSchema.getDefaultRecord()); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/LoggingServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/LoggingServiceImpl.java index e88b2217bf..13f5ef320f 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/LoggingServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/LoggingServiceImpl.java @@ -22,7 +22,7 @@ import org.kaaproject.kaa.common.dto.ApplicationDto; import org.kaaproject.kaa.common.dto.KaaAuthorityDto; import org.kaaproject.kaa.common.dto.VersionDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.logs.LogAppenderDto; import org.kaaproject.kaa.common.dto.logs.LogSchemaDto; import org.kaaproject.kaa.server.admin.services.util.Utils; @@ -127,7 +127,7 @@ public LogSchemaViewDto getLogSchemaView(String logSchemaId) throws KaaAdminServ checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { LogSchemaDto logSchema = getLogSchema(logSchemaId); - CTLSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(logSchema.getCtlSchemaId()); + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(logSchema.getCtlSchemaId()); LogSchemaViewDto logSchemaViewDto = new LogSchemaViewDto( logSchema, toCtlSchemaForm(ctlSchemaDto, ConverterType.FORM_AVRO_CONVERTER)); return logSchemaViewDto; @@ -148,7 +148,7 @@ public LogSchemaViewDto saveLogSchemaView(LogSchemaViewDto logSchemaView) if (isEmpty(ctlSchemaId)) { if (logSchemaView.useExistingCtlSchema()) { CtlSchemaReferenceDto metaInfo = logSchemaView.getExistingMetaInfo(); - CTLSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( metaInfo.getMetaInfo().getFqn(), metaInfo.getVersion(), metaInfo.getMetaInfo().getTenantId(), diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/NotificationServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/NotificationServiceImpl.java index 933195e193..aa72384f49 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/NotificationServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/NotificationServiceImpl.java @@ -34,7 +34,7 @@ import org.kaaproject.kaa.common.dto.NotificationTypeDto; import org.kaaproject.kaa.common.dto.TopicDto; import org.kaaproject.kaa.common.dto.VersionDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.admin.services.util.Utils; import org.kaaproject.kaa.server.admin.shared.schema.ConverterType; import org.kaaproject.kaa.server.admin.shared.schema.CtlSchemaFormDto; @@ -376,7 +376,7 @@ public NotificationSchemaViewDto getNotificationSchemaView(String notificationSc checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { NotificationSchemaDto notificationSchema = getNotificationSchema(notificationSchemaId); - CTLSchemaDto ctlSchemaDto = + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(notificationSchema.getCtlSchemaId()); NotificationSchemaViewDto notificationSchemaViewDto = new NotificationSchemaViewDto( notificationSchema, toCtlSchemaForm(ctlSchemaDto, @@ -399,7 +399,7 @@ public NotificationSchemaViewDto saveNotificationSchemaView( if (isEmpty(ctlSchemaId)) { if (notificationSchemaView.useExistingCtlSchema()) { CtlSchemaReferenceDto metaInfo = notificationSchemaView.getExistingMetaInfo(); - CTLSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( metaInfo.getMetaInfo().getFqn(), metaInfo.getVersion(), metaInfo.getMetaInfo().getTenantId(), diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ProfileServiceImpl.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ProfileServiceImpl.java index 1c416f6571..04eccfe163 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ProfileServiceImpl.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/ProfileServiceImpl.java @@ -34,7 +34,7 @@ import org.kaaproject.kaa.common.dto.KaaAuthorityDto; import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; import org.kaaproject.kaa.common.dto.TopicDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.admin.services.util.Utils; import org.kaaproject.kaa.server.admin.shared.endpoint.EndpointProfileViewDto; import org.kaaproject.kaa.server.admin.shared.schema.ConverterType; @@ -314,7 +314,7 @@ public ProfileSchemaViewDto saveProfileSchemaView(ProfileSchemaViewDto profileSc if (isEmpty(ctlSchemaId)) { if (profileSchemaView.useExistingCtlSchema()) { CtlSchemaReferenceDto metaInfo = profileSchemaView.getExistingMetaInfo(); - CTLSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( metaInfo.getMetaInfo().getFqn(), metaInfo.getVersion(), metaInfo.getMetaInfo().getTenantId(), @@ -359,7 +359,7 @@ public ProfileSchemaViewDto getProfileSchemaView(String profileSchemaId) checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { EndpointProfileSchemaDto profileSchema = getProfileSchema(profileSchemaId); - CTLSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(profileSchema.getCtlSchemaId()); + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById(profileSchema.getCtlSchemaId()); return new ProfileSchemaViewDto( profileSchema, toCtlSchemaForm(ctlSchemaDto, ConverterType.FORM_AVRO_CONVERTER)); } catch (Exception ex) { @@ -425,7 +425,7 @@ public ServerProfileSchemaViewDto getServerProfileSchemaView(String serverProfil checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { ServerProfileSchemaDto serverProfileSchema = getServerProfileSchema(serverProfileSchemaId); - CTLSchemaDto ctlSchemaDto = controlService.getCtlSchemaById( + CtlSchemaDto ctlSchemaDto = controlService.getCtlSchemaById( serverProfileSchema.getCtlSchemaId()); return new ServerProfileSchemaViewDto( serverProfileSchema, toCtlSchemaForm(ctlSchemaDto, ConverterType.FORM_AVRO_CONVERTER)); @@ -446,7 +446,7 @@ public ServerProfileSchemaViewDto saveServerProfileSchemaView( if (isEmpty(ctlSchemaId)) { if (serverProfileSchemaView.useExistingCtlSchema()) { CtlSchemaReferenceDto metaInfo = serverProfileSchemaView.getExistingMetaInfo(); - CTLSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto schema = ctlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( metaInfo.getMetaInfo().getFqn(), metaInfo.getVersion(), metaInfo.getMetaInfo().getTenantId(), diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/schema/CtlSchemaParser.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/schema/CtlSchemaParser.java index 936e25b378..cfef9a85e9 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/schema/CtlSchemaParser.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/services/schema/CtlSchemaParser.java @@ -25,7 +25,7 @@ import org.codehaus.jackson.node.ObjectNode; import org.kaaproject.avro.ui.shared.Fqn; import org.kaaproject.avro.ui.shared.FqnVersion; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.server.admin.services.util.Utils; import org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException; @@ -48,7 +48,7 @@ * * @author Bohdan Khablenko * @see #parse(String, String) - * @see #validate(CTLSchemaDto) + * @see #validate(CtlSchemaDto) * @since v0.8.0 */ public class CtlSchemaParser { @@ -111,9 +111,9 @@ public static Schema parseStringCtlSchema(String avroSchema) throws Exception { return parser.parse(avroSchema); } - public CTLSchemaDto parse(String body, String applicationId) + public CtlSchemaDto parse(String body, String applicationId) throws ControlServiceException, JsonParseException, JsonMappingException, IOException { - CTLSchemaDto schema = new CTLSchemaDto(); + CtlSchemaDto schema = new CtlSchemaDto(); CTLSchemaMetaInfoDto metaInfo = new CTLSchemaMetaInfoDto(); String fqn = null; @@ -139,7 +139,7 @@ public CTLSchemaDto parse(String body, String applicationId) } schema.setVersion(object.get(VERSION).asInt()); - Set dependencies = new HashSet<>(); + Set dependencies = new HashSet<>(); List missingDependencies = new ArrayList<>(); if (!object.has(DEPENDENCIES)) { schema.setDependencySet(dependencies); @@ -154,7 +154,7 @@ public CTLSchemaDto parse(String body, String applicationId) String dependencyFqn = child.get(FQN).asText(); int dependencyVersion = child.get(VERSION).asInt(); - CTLSchemaDto dependency = + CtlSchemaDto dependency = controlService.getAnyCtlSchemaByFqnVersionTenantIdAndApplicationId( dependencyFqn, dependencyVersion, tenantId, applicationId); if (dependency != null) { @@ -185,11 +185,11 @@ public CTLSchemaDto parse(String body, String applicationId) * @throws KaaAdminServiceException - if the given CTL schema is invalid and thus cannot be * parsed. */ - public Schema validate(CTLSchemaDto schema) throws KaaAdminServiceException { + public Schema validate(CtlSchemaDto schema) throws KaaAdminServiceException { if (schema.getDependencySet() != null) { - for (CTLSchemaDto dependency : schema.getDependencySet()) { + for (CtlSchemaDto dependency : schema.getDependencySet()) { try { - CTLSchemaDto dependencySchema = + CtlSchemaDto dependencySchema = controlService.getCtlSchemaByFqnVersionTenantIdAndApplicationId( dependency.getMetaInfo().getFqn(), dependency.getVersion(), dependency.getMetaInfo().getTenantId(), diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/schema/CtlSchemaFormDto.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/schema/CtlSchemaFormDto.java index 28742f32e0..30e282485d 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/schema/CtlSchemaFormDto.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/schema/CtlSchemaFormDto.java @@ -17,9 +17,9 @@ package org.kaaproject.kaa.server.admin.shared.schema; import org.kaaproject.avro.ui.shared.RecordField; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; -public class CtlSchemaFormDto extends CTLSchemaDto { +public class CtlSchemaFormDto extends CtlSchemaDto { private static final long serialVersionUID = -5383847121615543863L; @@ -30,7 +30,7 @@ public CtlSchemaFormDto() { super(); } - public CtlSchemaFormDto(CTLSchemaDto ctlSchema) { + public CtlSchemaFormDto(CtlSchemaDto ctlSchema) { super(); setId(ctlSchema.getId()); setMetaInfo(ctlSchema.getMetaInfo()); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/services/CtlService.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/services/CtlService.java index 92b8afacec..cdd4e9784b 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/services/CtlService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/shared/services/CtlService.java @@ -20,7 +20,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import org.kaaproject.avro.ui.shared.RecordField; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.file.FileData; @@ -34,12 +34,12 @@ @RemoteServiceRelativePath("springGwtServices/ctlService") public interface CtlService extends RemoteService { - CTLSchemaDto saveCtlSchema(CTLSchemaDto schema) throws KaaAdminServiceException; + CtlSchemaDto saveCtlSchema(CtlSchemaDto schema) throws KaaAdminServiceException; - CTLSchemaDto saveCtlSchema(String body, String tenantId, String applicationId) + CtlSchemaDto saveCtlSchema(String body, String tenantId, String applicationId) throws KaaAdminServiceException; - CTLSchemaDto saveCtlSchemaWithAppToken(String body, String tenantId, String applicationToken) + CtlSchemaDto saveCtlSchemaWithAppToken(String body, String tenantId, String applicationToken) throws KaaAdminServiceException; void deleteCtlSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, Integer version, @@ -53,19 +53,19 @@ void deleteCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, String applicationId) throws KaaAdminServiceException; - CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, + CtlSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId) throws KaaAdminServiceException; - CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, + CtlSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, Integer version, String tenantId, String applicationToken) throws KaaAdminServiceException; - CTLSchemaDto getCtlSchemaById(String schemaId) throws KaaAdminServiceException; + CtlSchemaDto getCtlSchemaById(String schemaId) throws KaaAdminServiceException; boolean checkFqnExists(String fqn, String tenantId, String applicationId) throws KaaAdminServiceException; diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/ControlService.java b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/ControlService.java index 2838e3e30d..273dd4f841 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/ControlService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/ControlService.java @@ -47,7 +47,7 @@ import org.kaaproject.kaa.common.dto.admin.SdkPlatform; import org.kaaproject.kaa.common.dto.admin.SdkProfileDto; import org.kaaproject.kaa.common.dto.credentials.CredentialsDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.event.AefMapInfoDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto; @@ -1179,7 +1179,7 @@ EndpointProfileDto updateServerProfile(String endpointKeyHash, int version, Stri * @return The saved CTL schema * @throws ControlServiceException - if an exception occures. */ - CTLSchemaDto saveCtlSchema(CTLSchemaDto schema) throws ControlServiceException; + CtlSchemaDto saveCtlSchema(CtlSchemaDto schema) throws ControlServiceException; /** * Deletes a CTL schema from the database by its fully qualified name, @@ -1203,7 +1203,7 @@ void deleteCtlSchemaByFqnAndVersionTenantIdAndApplicationId(String fqn, int vers * @return A CTL schema with the given identifier * @throws ControlServiceException - if an exception occures. */ - CTLSchemaDto getCtlSchemaById(String schemaId) throws ControlServiceException; + CtlSchemaDto getCtlSchemaById(String schemaId) throws ControlServiceException; /** * Returns a CTL schema by its fully qualified name, version number, @@ -1217,7 +1217,7 @@ void deleteCtlSchemaByFqnAndVersionTenantIdAndApplicationId(String fqn, int vers * application identifier * @throws ControlServiceException - if an exception occures. */ - CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, + CtlSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, int version, String tenantId, String applicationId) @@ -1230,7 +1230,7 @@ CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, * @param version the schema version. * @return the CTL schema with the given meta info id and version. */ - CTLSchemaDto getCtlSchemaByMetaInfoIdAndVer(String metaInfoId, Integer version); + CtlSchemaDto getCtlSchemaByMetaInfoIdAndVer(String metaInfoId, Integer version); /** * Returns any CTL schema by its fully qualified name, version number, @@ -1244,7 +1244,7 @@ CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, * application identifier * @throws ControlServiceException - if an exception occures. */ - CTLSchemaDto getAnyCtlSchemaByFqnVersionTenantIdAndApplicationId( + CtlSchemaDto getAnyCtlSchemaByFqnVersionTenantIdAndApplicationId( String fqn, int version, String tenantId, String applicationId) throws ControlServiceException; @@ -1318,7 +1318,7 @@ Map> getAvailableCtlSchemaVersionsForApplication( * @return CTL schemas that reference a CTL schema with the given identifier * @throws ControlServiceException - if an exception occures. */ - List getCtlSchemaDependents(String schemaId) throws ControlServiceException; + List getCtlSchemaDependents(String schemaId) throws ControlServiceException; /** * Returns CTL schemas that reference a CTL schema with the given fully @@ -1332,11 +1332,11 @@ Map> getAvailableCtlSchemaVersionsForApplication( * version number, tenant and application identifier * @throws ControlServiceException - if an exception occures. */ - List getCtlSchemaDependents(String fqn, int version, + List getCtlSchemaDependents(String fqn, int version, String tenantId, String applicationId) throws ControlServiceException; - CTLSchemaDto getLatestCtlSchemaByFqnTenantIdAndApplicationId( + CtlSchemaDto getLatestCtlSchemaByFqnTenantIdAndApplicationId( String fqn, String tenantId, String applicationId) throws ControlServiceException; List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( @@ -1348,7 +1348,7 @@ List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( * @param metaInfoId the id of meta info object. * @return the latest version of CTL schema with the given meta info id. */ - CTLSchemaDto getLatestCtlSchemaByMetaInfoId(String metaInfoId); + CtlSchemaDto getLatestCtlSchemaByMetaInfoId(String metaInfoId); /** * Exports the body of a CTL schema. @@ -1357,7 +1357,7 @@ List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( * @return A file containing the body of a CTL schema * @throws ControlServiceException - if an exception occures. */ - FileData exportCtlSchemaShallow(CTLSchemaDto schema) throws ControlServiceException; + FileData exportCtlSchemaShallow(CtlSchemaDto schema) throws ControlServiceException; /** * Exports the body of a CTL schema with all dependencies inline, @@ -1367,7 +1367,7 @@ List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( * @return A file containing the body of a CTL schema with all dependencies inline, recursively * @throws ControlServiceException - if an exception occures. */ - FileData exportCtlSchemaFlat(CTLSchemaDto schema) throws ControlServiceException; + FileData exportCtlSchemaFlat(CtlSchemaDto schema) throws ControlServiceException; /** * Exports the body of a CTL schema as java library with all dependencies @@ -1378,7 +1378,7 @@ List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( * dependencies inline, recursively * @throws ControlServiceException the control service exception */ - FileData exportCtlSchemaFlatAsLibrary(CTLSchemaDto schema) throws ControlServiceException; + FileData exportCtlSchemaFlatAsLibrary(CtlSchemaDto schema) throws ControlServiceException; /** * Exports the body of a CTL schema with all dependencies inline, @@ -1388,7 +1388,7 @@ List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( * @return A string containing the body of a CTL schema with all dependencies inline, recursively * @throws ControlServiceException - if an exception occures. */ - String exportCtlSchemaFlatAsString(CTLSchemaDto schema) throws ControlServiceException; + String exportCtlSchemaFlatAsString(CtlSchemaDto schema) throws ControlServiceException; /** * Exports the CTL schema as avro schema with all dependencies inline, @@ -1398,7 +1398,7 @@ List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( * @return An avro schema of a CTL schema with all dependencies inline, recursively * @throws ControlServiceException - if an exception occures. */ - Schema exportCtlSchemaFlatAsSchema(CTLSchemaDto schema) throws ControlServiceException; + Schema exportCtlSchemaFlatAsSchema(CtlSchemaDto schema) throws ControlServiceException; /** * Exports the body of a CTL schema with all dependencies as different @@ -1409,7 +1409,7 @@ List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( * different files, recursively. * @throws ControlServiceException - if an exception occures. */ - FileData exportCtlSchemaDeep(CTLSchemaDto schema) throws ControlServiceException; + FileData exportCtlSchemaDeep(CtlSchemaDto schema) throws ControlServiceException; /** * Gets SdkProfileDto object by sdk profile id. diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java index 4e3e0aa308..712a4f27af 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java @@ -65,7 +65,7 @@ import org.kaaproject.kaa.common.dto.credentials.CredentialsDto; import org.kaaproject.kaa.common.dto.credentials.CredentialsStatus; import org.kaaproject.kaa.common.dto.credentials.EndpointRegistrationDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.event.AefMapInfoDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto; @@ -200,7 +200,7 @@ public class DefaultControlService implements ControlService { /** * A template for naming exported CTL library schemas. * - * @see #exportCtlSchemaFlatAsLibrary(CTLSchemaDto) + * @see #exportCtlSchemaFlatAsLibrary(CtlSchemaDto) */ private static final String CTL_LIBRARY_EXPORT_TEMPLATE = "{0}.v{1}"; @@ -1178,15 +1178,15 @@ public FileData generateSdk(SdkProfileDto sdkProfile, SdkPlatform platform) throw new NotFoundException("Log schema not found!"); } - CTLSchemaDto logCtlSchema = getCtlSchemaById(logSchema.getCtlSchemaId()); + CtlSchemaDto logCtlSchema = getCtlSchemaById(logSchema.getCtlSchemaId()); String logSchemaBodyString = ctlService.flatExportAsString(logCtlSchema); - CTLSchemaDto profileCtlSchema = getCtlSchemaById(profileSchema.getCtlSchemaId()); + CtlSchemaDto profileCtlSchema = getCtlSchemaById(profileSchema.getCtlSchemaId()); - CTLSchemaDto notificationCtlSchema = getCtlSchemaById(notificationSchema.getCtlSchemaId()); + CtlSchemaDto notificationCtlSchema = getCtlSchemaById(notificationSchema.getCtlSchemaId()); - CTLSchemaDto confCtlSchema = getCtlSchemaById(configurationSchema.getCtlSchemaId()); + CtlSchemaDto confCtlSchema = getCtlSchemaById(configurationSchema.getCtlSchemaId()); String notificationSchemaBodyString = ctlService.flatExportAsString(notificationCtlSchema); String profileSchemaBodyString = ctlService.flatExportAsString(profileCtlSchema); @@ -1235,7 +1235,7 @@ public FileData generateSdk(SdkProfileDto sdkProfile, SdkPlatform platform) null); efm.setRecords(records); - List ctlDtos = new ArrayList<>(); + List ctlDtos = new ArrayList<>(); List flatEventClassCtlSchemas = new ArrayList<>(); records.forEach(rec -> ctlDtos.add(ctlService.findCTLSchemaById(rec.getCtlSchemaId()))); ctlDtos.forEach( @@ -1288,7 +1288,7 @@ public FileData generateRecordStructureLibrary(String applicationId, int logSche throw new NotFoundException("Log schema not found!"); } try { - CTLSchemaDto logCtlSchema = getCtlSchemaById(logSchema.getCtlSchemaId()); + CtlSchemaDto logCtlSchema = getCtlSchemaById(logSchema.getCtlSchemaId()); Schema recordWrapperSchema = RecordWrapperSchemaGenerator .generateRecordWrapperSchema(getFlatSchemaByCtlSchemaId(logCtlSchema.getId())); @@ -1385,7 +1385,7 @@ public LogSchemaDto saveLogSchema(LogSchemaDto logSchemaDto) throws ControlServi */ @Override public String getFlatSchemaByCtlSchemaId(String schemaId) throws ControlServiceException { - CTLSchemaDto ctlSchemaDto = getCtlSchemaById(schemaId); + CtlSchemaDto ctlSchemaDto = getCtlSchemaById(schemaId); return ctlService.flatExportAsString(ctlSchemaDto); } @@ -2164,7 +2164,7 @@ public FileData getRecordStructureSchema(String applicationId, int logSchemaVers Schema recordWrapperSchema = null; try { - CTLSchemaDto logCtlSchema = getCtlSchemaById(logSchema.getCtlSchemaId()); + CtlSchemaDto logCtlSchema = getCtlSchemaById(logSchema.getCtlSchemaId()); recordWrapperSchema = RecordWrapperSchemaGenerator .generateRecordWrapperSchema(logCtlSchema.getBody()); } catch (IOException ex) { @@ -2315,7 +2315,7 @@ private void checkSchema(VersionDto schemaDto, RecordFiles file) throws NotFound } @Override - public CTLSchemaDto saveCtlSchema(CTLSchemaDto schema) throws ControlServiceException { + public CtlSchemaDto saveCtlSchema(CtlSchemaDto schema) throws ControlServiceException { return ctlService.saveCTLSchema(schema); } @@ -2329,8 +2329,8 @@ public void deleteCtlSchemaByFqnAndVersionTenantIdAndApplicationId(String fqn, i } @Override - public CTLSchemaDto getCtlSchemaById(String schemaId) throws ControlServiceException { - CTLSchemaDto ctlSchemaDto = ctlService.findCTLSchemaById(schemaId); + public CtlSchemaDto getCtlSchemaById(String schemaId) throws ControlServiceException { + CtlSchemaDto ctlSchemaDto = ctlService.findCTLSchemaById(schemaId); if (ctlSchemaDto == null) { LOG.error("CTL schema with Id [{}] not found!", schemaId); throw new NotFoundException("CTL schema not found!"); @@ -2339,7 +2339,7 @@ public CTLSchemaDto getCtlSchemaById(String schemaId) throws ControlServiceExcep } @Override - public CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, int version, + public CtlSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, int version, String tenantId, String applicationId) throws ControlServiceException { @@ -2348,12 +2348,12 @@ public CTLSchemaDto getCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, } @Override - public CTLSchemaDto getCtlSchemaByMetaInfoIdAndVer(String metaInfoId, Integer version) { + public CtlSchemaDto getCtlSchemaByMetaInfoIdAndVer(String metaInfoId, Integer version) { return ctlService.findByMetaInfoIdAndVer(metaInfoId, version); } @Override - public CTLSchemaDto getAnyCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, int version, + public CtlSchemaDto getAnyCtlSchemaByFqnVersionTenantIdAndApplicationId(String fqn, int version, String tenantId, String applicationId) throws ControlServiceException { @@ -2424,52 +2424,52 @@ private Map> extractCtlSchemaVersionsInfo( } @Override - public List getCtlSchemaDependents(String schemaId) throws ControlServiceException { + public List getCtlSchemaDependents(String schemaId) throws ControlServiceException { return ctlService.findCTLSchemaDependents(schemaId); } @Override - public List getCtlSchemaDependents(String fqn, int version, + public List getCtlSchemaDependents(String fqn, int version, String tenantId, String applicationId) throws ControlServiceException { return ctlService.findCTLSchemaDependents(fqn, version, tenantId, applicationId); } @Override - public CTLSchemaDto getLatestCtlSchemaByFqnTenantIdAndApplicationId( + public CtlSchemaDto getLatestCtlSchemaByFqnTenantIdAndApplicationId( String fqn, String tenantId, String applicationId) throws ControlServiceException { return ctlService.findLatestCTLSchemaByFqnAndTenantIdAndApplicationId(fqn, tenantId, applicationId); } @Override - public CTLSchemaDto getLatestCtlSchemaByMetaInfoId(String metaInfoId) { + public CtlSchemaDto getLatestCtlSchemaByMetaInfoId(String metaInfoId) { return ctlService.findLatestByMetaInfoId(metaInfoId); } @Override public List getAllCtlSchemaVersionsByFqnTenantIdAndApplicationId( String fqn, String tenantId, String applicationId) throws ControlServiceException { - List schemas = ctlService.findAllCTLSchemasByFqnAndTenantIdAndApplicationId(fqn, + List schemas = ctlService.findAllCTLSchemasByFqnAndTenantIdAndApplicationId(fqn, tenantId, applicationId); List versions = new ArrayList<>(schemas.size()); - for (CTLSchemaDto schema : schemas) { + for (CtlSchemaDto schema : schemas) { versions.add(schema.getVersion()); } return versions; } - public FileData exportCtlSchemaShallow(CTLSchemaDto schema) throws ControlServiceException { + public FileData exportCtlSchemaShallow(CtlSchemaDto schema) throws ControlServiceException { return ctlService.shallowExport(schema); } @Override - public FileData exportCtlSchemaFlat(CTLSchemaDto schema) throws ControlServiceException { + public FileData exportCtlSchemaFlat(CtlSchemaDto schema) throws ControlServiceException { return ctlService.flatExport(schema); } @Override - public FileData exportCtlSchemaFlatAsLibrary(CTLSchemaDto schema) throws ControlServiceException { + public FileData exportCtlSchemaFlatAsLibrary(CtlSchemaDto schema) throws ControlServiceException { try { Schema avroSchema = ctlService.flatExportAsSchema(schema); String fileName = MessageFormat.format(CTL_LIBRARY_EXPORT_TEMPLATE, @@ -2482,17 +2482,17 @@ public FileData exportCtlSchemaFlatAsLibrary(CTLSchemaDto schema) throws Control } @Override - public String exportCtlSchemaFlatAsString(CTLSchemaDto schema) throws ControlServiceException { + public String exportCtlSchemaFlatAsString(CtlSchemaDto schema) throws ControlServiceException { return ctlService.flatExportAsString(schema); } @Override - public Schema exportCtlSchemaFlatAsSchema(CTLSchemaDto schema) throws ControlServiceException { + public Schema exportCtlSchemaFlatAsSchema(CtlSchemaDto schema) throws ControlServiceException { return ctlService.flatExportAsSchema(schema); } @Override - public FileData exportCtlSchemaDeep(CTLSchemaDto schema) throws ControlServiceException { + public FileData exportCtlSchemaDeep(CtlSchemaDto schema) throws ControlServiceException { return ctlService.deepExport(schema); } @@ -2680,7 +2680,7 @@ public String findEndpointConfigurationByEndpointKeyHash(String endpointKeyHash) endpointProfileDto.getConfigurationVersion() ); - CTLSchemaDto ctlSchemaDto = ctlService + CtlSchemaDto ctlSchemaDto = ctlService .findCTLSchemaById(configurationSchemaDto.getCtlSchemaId()); String schema = ctlService.flatExportAsString(ctlSchemaDto); String endConf = null; @@ -2717,7 +2717,7 @@ public Schema findEndpointConfigurationSchemaByEndpointKeyHash(String endpointKe endpointProfileDto.getApplicationId(), endpointProfileDto.getConfigurationVersion() ); - CTLSchemaDto ctlSchemaDto = ctlService + CtlSchemaDto ctlSchemaDto = ctlService .findCTLSchemaById(configurationSchemaDto.getCtlSchemaId()); return ctlService.flatExportAsSchema(ctlSchemaDto); } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessor.java b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessor.java index 5514139d7e..816487a7b2 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessor.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessor.java @@ -22,7 +22,7 @@ import org.kaaproject.kaa.common.dto.EndpointProfileDataDto; import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto; import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.server.common.dao.CTLService; import org.kaaproject.kaa.server.common.log.shared.appender.LogAppender; import org.kaaproject.kaa.server.common.log.shared.appender.LogDeliveryCallback; @@ -175,7 +175,7 @@ private void fetchSchemas(LogEventPackMessage message) { BaseSchemaInfo schemaInfo = clientProfileSchemas.get(key); if (schemaInfo == null) { EndpointProfileSchemaDto profileSchema = cacheService.getProfileSchemaByAppAndVersion(key); - CTLSchemaDto ctlSchemaDto = cacheService.getCtlSchemaById(profileSchema.getCtlSchemaId()); + CtlSchemaDto ctlSchemaDto = cacheService.getCtlSchemaById(profileSchema.getCtlSchemaId()); String schema = ctlService.flatExportAsString(ctlSchemaDto); schemaInfo = new BaseSchemaInfo(ctlSchemaDto.getId(), schema); clientProfileSchemas.put(key, schemaInfo); @@ -188,7 +188,7 @@ private void fetchSchemas(LogEventPackMessage message) { BaseSchemaInfo schemaInfo = serverProfileSchemas.get(key); if (schemaInfo == null) { ServerProfileSchemaDto serverProfileSchema = cacheService.getServerProfileSchemaByAppAndVersion(key); - CTLSchemaDto ctlSchemaDto = cacheService.getCtlSchemaById(serverProfileSchema.getCtlSchemaId()); + CtlSchemaDto ctlSchemaDto = cacheService.getCtlSchemaById(serverProfileSchema.getCtlSchemaId()); String schema = ctlService.flatExportAsString(ctlSchemaDto); schemaInfo = new BaseSchemaInfo(ctlSchemaDto.getId(), schema); serverProfileSchemas.put(key, schemaInfo); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/CacheService.java b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/CacheService.java index 93bf3bea92..9ccf1e9822 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/CacheService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/CacheService.java @@ -27,7 +27,7 @@ import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; import org.kaaproject.kaa.common.dto.TopicDto; import org.kaaproject.kaa.common.dto.admin.SdkProfileDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto; import org.kaaproject.kaa.common.hash.EndpointObjectHash; import org.kaaproject.kaa.server.common.core.configuration.BaseData; @@ -409,7 +409,7 @@ public interface CacheService { void resetGroup(String key); - CTLSchemaDto getCtlSchemaById(String id); + CtlSchemaDto getCtlSchemaById(String id); String getFlatCtlSchemaById(String id); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/concurrent/ConcurrentCacheService.java b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/concurrent/ConcurrentCacheService.java index c3927348b9..4c110cd9b8 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/concurrent/ConcurrentCacheService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cache/concurrent/ConcurrentCacheService.java @@ -32,7 +32,7 @@ import org.kaaproject.kaa.common.dto.TopicDto; import org.kaaproject.kaa.common.dto.TopicListEntryDto; import org.kaaproject.kaa.common.dto.admin.SdkProfileDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventAction; import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventMapDto; @@ -156,7 +156,7 @@ public class ConcurrentCacheService implements CacheService { /** * The ctl schema memorizer. */ - private final CacheTemporaryMemorizer ctlSchemaMemorizer = new CacheTemporaryMemorizer<>(); + private final CacheTemporaryMemorizer ctlSchemaMemorizer = new CacheTemporaryMemorizer<>(); /** * The ctl schema body memorizer. */ @@ -637,10 +637,10 @@ public ServerProfileSchemaDto compute(AppVersionKey key) { @Override @Cacheable("ctlSchemas") - public CTLSchemaDto getCtlSchemaById(String key) { - return ctlSchemaMemorizer.compute(key, new Computable() { + public CtlSchemaDto getCtlSchemaById(String key) { + return ctlSchemaMemorizer.compute(key, new Computable() { @Override - public CTLSchemaDto compute(String key) { + public CtlSchemaDto compute(String key) { LOG.debug("Fetching result for ctl schemas"); return ctlService.findCTLSchemaById(key); } @@ -654,7 +654,7 @@ public String getFlatCtlSchemaById(String key) { @Override public String compute(String key) { LOG.debug("Fetching result for ctl schemas"); - CTLSchemaDto ctlSchema = ctlService.findCTLSchemaById(key); + CtlSchemaDto ctlSchema = ctlService.findCTLSchemaById(key); return ctlService.flatExportAsString(ctlSchema); } }); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/logs/DefaultLogAppenderService.java b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/logs/DefaultLogAppenderService.java index 2b925dfbf0..dbd0ebf184 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/logs/DefaultLogAppenderService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/logs/DefaultLogAppenderService.java @@ -16,7 +16,7 @@ package org.kaaproject.kaa.server.operations.service.logs; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.logs.LogAppenderDto; import org.kaaproject.kaa.common.dto.logs.LogSchemaDto; import org.kaaproject.kaa.server.common.dao.CTLService; @@ -110,7 +110,7 @@ public LogSchema getLogSchema(String applicationId, int logSchemaVersion) { LOG.debug("Fetching log schema for application {} and version {}", applicationId, logSchemaVersion); LogSchema logSchema = null; LogSchemaDto logSchemaDto = logSchemaService.findLogSchemaByAppIdAndVersion(applicationId, logSchemaVersion); - CTLSchemaDto ctlSchema = ctlService.findCTLSchemaById(logSchemaDto.getCtlSchemaId()); + CtlSchemaDto ctlSchema = ctlService.findCTLSchemaById(logSchemaDto.getCtlSchemaId()); String logFlatSchema = ctlService.flatExportAsString(ctlSchema); if (logSchemaDto != null) { logSchema = new LogSchema(logSchemaDto, logFlatSchema); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/AbstractTestControlServer.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/AbstractTestControlServer.java index 61b71da8e8..9bcb85588c 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/AbstractTestControlServer.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/AbstractTestControlServer.java @@ -51,7 +51,7 @@ import org.kaaproject.kaa.common.dto.UpdateStatus; import org.kaaproject.kaa.common.dto.VersionDto; import org.kaaproject.kaa.common.dto.admin.UserDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventAction; import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventMapDto; @@ -706,7 +706,7 @@ protected ConfigurationSchemaDto createConfigurationSchema(String applicationId, } if (strIsEmpty(ctlSchemaId)) { - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); configurationSchema.setCtlSchemaId(ctlSchema.getId()); } else { configurationSchema.setCtlSchemaId(ctlSchemaId); @@ -745,7 +745,7 @@ protected EndpointProfileSchemaDto createEndpointProfileSchema(String applicatio profileSchema.setApplicationId(applicationId); } if (strIsEmpty(ctlSchemaId)) { - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); profileSchema.setCtlSchemaId(ctlSchema.getId()); } else { profileSchema.setCtlSchemaId(ctlSchemaId); @@ -774,7 +774,7 @@ protected ServerProfileSchemaDto createServerProfileSchema(String applicationId, profileSchema.setApplicationId(applicationId); } if (strIsEmpty(ctlSchemaId)) { - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); profileSchema.setCtlSchemaId(ctlSchema.getId()); } loginTenantDeveloper(tenantDeveloperDto.getUsername()); @@ -998,7 +998,7 @@ protected NotificationSchemaDto createNotificationSchema(String appId, Notificat } else { notificationSchema.setApplicationId(appId); } - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); notificationSchema.setCtlSchemaId(ctlSchema.getId()); loginTenantDeveloper(tenantDeveloperDto.getUsername()); @@ -1023,7 +1023,7 @@ protected NotificationSchemaDto createUserNotificationSchema(String appId) throw } else { notificationSchema.setApplicationId(appId); } - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); notificationSchema.setCtlSchemaId(ctlSchema.getId()); loginTenantDeveloper(tenantDeveloperDto.getUsername()); NotificationSchemaDto savedSchema = client @@ -1059,7 +1059,7 @@ protected LogSchemaDto createLogSchema(String applicationId) throws Exception { logSchema.setApplicationId(applicationId); } - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); logSchema.setCtlSchemaId(ctlSchema.getId()); loginTenantDeveloper(tenantDeveloperDto.getUsername()); @@ -1229,7 +1229,7 @@ protected EventClassFamilyVersionDto createEventClassFamilyVersion(String tenant List records = new ArrayList<>(); String className = "Test" + random.nextInt(1000); - CTLSchemaDto ctlSchema = this.createCTLSchema(className, EVENT_CLASS_FAMILY_NAMESPACE, 1, tenantId, null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(className, EVENT_CLASS_FAMILY_NAMESPACE, 1, tenantId, null, null, null); EventClassDto ec = new EventClassDto(); ec.setFqn(EVENT_CLASS_FAMILY_NAMESPACE + "." + className); ec.setType(EventClassType.EVENT); @@ -1316,7 +1316,7 @@ protected String ctlRandomFieldType() { return CTL_DEFAULT_TYPE + random.nextInt(100000); } - protected CTLSchemaDto createCTLSchema(String name, String namespace, int version, + protected CtlSchemaDto createCTLSchema(String name, String namespace, int version, String tenantId, String applicationToken, Set dependencies, Map fields) throws Exception { diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerCTLSchemaIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerCTLSchemaIT.java index d232834037..6534070e90 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerCTLSchemaIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerCTLSchemaIT.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.kaaproject.avro.ui.shared.FqnVersion; import org.kaaproject.kaa.common.dto.ApplicationDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto; @@ -50,11 +50,11 @@ public class ControlServerCTLSchemaIT extends AbstractTestControlServer { @Test public void saveCTLSchemaTest() throws Exception { this.loginKaaAdmin(); - CTLSchemaDto beta = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_BETA), null, null); + CtlSchemaDto beta = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_BETA), null, null); Assert.assertNotNull(beta.getId()); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto alpha = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_ALPHA), tenantDeveloperDto.getTenantId(), null); + CtlSchemaDto alpha = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_ALPHA), tenantDeveloperDto.getTenantId(), null); Assert.assertNotNull(alpha.getId()); } @@ -64,7 +64,7 @@ public void saveCTLSchemaTest() throws Exception { @Test(expected = HttpClientErrorException.class) public void saveCTLSchemaWithWrongVerionTest() throws Exception { this.loginKaaAdmin(); - CTLSchemaDto gamma = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_GAMMA), null, null); + CtlSchemaDto gamma = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_GAMMA), null, null); } /** @@ -73,7 +73,7 @@ public void saveCTLSchemaWithWrongVerionTest() throws Exception { @Test(expected = HttpClientErrorException.class) public void saveCTLSchemaWithAppTokenAndWrongVerionTest() throws Exception { this.loginKaaAdmin(); - CTLSchemaDto gamma = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_GAMMA), null, null); + CtlSchemaDto gamma = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_GAMMA), null, null); } /** @@ -108,7 +108,7 @@ public void executeRestCall() throws Exception { @Test public void deleteCTLSchemaByFqnAndVersionTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - final CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + final CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); this.checkNotFound(new TestRestCall() { @Override @@ -126,7 +126,7 @@ public void executeRestCall() throws Exception { @Test public void deleteCTLSchemaByAppTokenByFqnAndVersionTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - final CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + final CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); this.checkNotFound(new TestRestCall() { @Override @@ -143,7 +143,7 @@ public void executeRestCall() throws Exception { @Test public void deleteCTLSchemaWithDependents() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - final CTLSchemaDto dependency = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + final CtlSchemaDto dependency = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); Set dependencies = new HashSet<>(); dependencies.add(new FqnVersion(dependency.getMetaInfo().getFqn(), dependency.getVersion())); @@ -168,7 +168,7 @@ public void executeRestCall() throws Exception { @Test public void deleteCTLSchemaByAppTokenWithDependents() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - final CTLSchemaDto dependency = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), + final CtlSchemaDto dependency = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); Set dependencies = new HashSet<>(); @@ -194,7 +194,7 @@ public void executeRestCall() throws Exception { @Test public void deleteSystemCTLSchemaByFqnAndVersionTest() throws Exception { this.loginKaaAdmin(); - final CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); + final CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); this.loginTenantDeveloper(tenantDeveloperUser); this.checkForbidden(new TestRestCall() { @Override @@ -211,7 +211,7 @@ public void executeRestCall() throws Exception { @Test public void deleteSystemCTLSchemaByAppTokenByFqnAndVersionTest() throws Exception { this.loginKaaAdmin(); - final CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); + final CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); this.loginTenantDeveloper(tenantDeveloperUser); this.checkForbidden(new TestRestCall() { @Override @@ -227,8 +227,8 @@ public void executeRestCall() throws Exception { @Test public void getCTLSchemaByFqnAndVersionTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); - CTLSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken( + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken( saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); Assert.assertNotNull(loaded); Assert.assertEquals(saved, loaded); @@ -240,8 +240,8 @@ public void getCTLSchemaByFqnAndVersionTest() throws Exception { @Test public void getCTLSchemaWithAppTokenByFqnAndVersionTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); - CTLSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); Assert.assertNotNull(loaded); Assert.assertEquals(saved, loaded); @@ -254,9 +254,9 @@ public void getCTLSchemaWithAppTokenByFqnAndVersionTest() throws Exception { @Test public void getSystemCTLSchemaByFqnAndVersionTest() throws Exception { this.loginKaaAdmin(); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), null, null); + CtlSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), null, null); Assert.assertNotNull(loaded); Assert.assertEquals(saved, loaded); } @@ -268,9 +268,9 @@ public void getSystemCTLSchemaByFqnAndVersionTest() throws Exception { @Test public void getSystemCTLSchemaWithAppTokenByFqnAndVersionTest() throws Exception { this.loginKaaAdmin(); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), null, null); + CtlSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), null, null); Assert.assertNotNull(loaded); Assert.assertEquals(saved, loaded); } @@ -281,8 +281,8 @@ public void getSystemCTLSchemaWithAppTokenByFqnAndVersionTest() throws Exception @Test public void getCTLSchemaByIdTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); - CTLSchemaDto loaded = client.getCTLSchemaById(saved.getId()); + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto loaded = client.getCTLSchemaById(saved.getId()); Assert.assertNotNull(loaded); Assert.assertEquals(saved, loaded); } @@ -290,8 +290,8 @@ public void getCTLSchemaByIdTest() throws Exception { @Test public void getCTLFlatSchemaByIdTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); - CTLSchemaDto loaded = client.getCTLSchemaById(saved.getId()); + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto loaded = client.getCTLSchemaById(saved.getId()); String savedFlatSchema = ctlService.flatExportAsString(saved); String loadedFlatSchema = client.getFlatSchemaByCtlSchemaId(loaded.getId()); Assert.assertNotNull(loaded); @@ -306,7 +306,7 @@ public void downloadCtlSchemaTest() throws Exception { ApplicationDto application = createApplication(tenantAdminDto); this.loginTenantDeveloper(tenantDeveloperUser); String name = this.ctlRandomFieldType(); - CTLSchemaDto saved = this.createCTLSchema(name, CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application.getApplicationToken(), + CtlSchemaDto saved = this.createCTLSchema(name, CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application.getApplicationToken(), null, null); FileData fd = client.downloadCtlSchemaByAppToken(client.getCTLSchemaById(saved.getId()), CTLSchemaExportMethod.FLAT, application.getApplicationToken()); Assert.assertNotNull(fd); @@ -320,7 +320,7 @@ public void downloadCtlSchemaTest() throws Exception { @Test public void checkCTLFqnExistsTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); String fqn = saved.getMetaInfo().getFqn(); boolean result = client.checkFqnExistsWithAppToken(fqn, tenantDeveloperDto.getTenantId(), null); Assert.assertFalse(result); @@ -330,7 +330,7 @@ public void checkCTLFqnExistsTest() throws Exception { ApplicationDto application1 = createApplication(tenantAdminDto); ApplicationDto application2 = createApplication(tenantAdminDto); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto schema1 = this.createCTLSchema("TestAppFqn1", CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), + CtlSchemaDto schema1 = this.createCTLSchema("TestAppFqn1", CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application1.getApplicationToken(), null, null); this.createCTLSchema("TestAppFqn1", CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application2.getApplicationToken(), null, null); @@ -352,7 +352,7 @@ public void updateCTLSchemaScopeTest() throws Exception { ApplicationDto application = createApplication(tenantAdminDto); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application.getApplicationToken(), null, null); CTLSchemaMetaInfoDto metaInfo = saved.getMetaInfo(); CTLSchemaMetaInfoDto updatedMetaInfo = client.promoteScopeToTenant(metaInfo.getApplicationId(), metaInfo.getFqn()); @@ -368,7 +368,7 @@ public void updateCTLSchemaScopeTest() throws Exception { public void promoteScopeToTenantNotFoundTest() throws Exception { ApplicationDto application = createApplication(tenantAdminDto); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); final CTLSchemaMetaInfoDto metaInfo2 = saved.getMetaInfo(); Assert.assertNull(metaInfo2.getApplicationId()); @@ -388,7 +388,7 @@ public void promoteScopeToTenantForbiddenTest() throws Exception { ; this.loginTenantAdmin(tenantAdminUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); + CtlSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantAdminDto.getTenantId(), null, null, null); final CTLSchemaMetaInfoDto metaInfo3 = saved.getMetaInfo(); Assert.assertNull(metaInfo3.getApplicationId()); @@ -408,13 +408,13 @@ public void promoteScopeToTenantWithDependenciesInAppScopeTest() throws Exceptio ApplicationDto application = createApplication(tenantAdminDto); loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto dep = createCTLSchema(ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), + CtlSchemaDto dep = createCTLSchema(ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application.getApplicationToken(), null, null); String fqn = dep.getMetaInfo().getFqn(); int version = dep.getVersion(); Map fields = ImmutableMap.of("test", fqn); Set deps = ImmutableSet.of(new FqnVersion(fqn, version)); - CTLSchemaDto schema = createCTLSchema(ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), + CtlSchemaDto schema = createCTLSchema(ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application.getApplicationToken(), deps, fields); final CTLSchemaMetaInfoDto metaInfo = schema.getMetaInfo(); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileFilterIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileFilterIT.java index a7a7fcd219..af7d960a14 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileFilterIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileFilterIT.java @@ -25,7 +25,7 @@ import org.kaaproject.kaa.common.dto.ProfileFilterRecordDto; import org.kaaproject.kaa.common.dto.ProfileVersionPairDto; import org.kaaproject.kaa.common.dto.UpdateStatus; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import java.util.ArrayList; import java.util.Collections; @@ -142,7 +142,7 @@ public void testGetVacantSchemasByEndpointGroupId() throws Exception { EndpointGroupDto endpointGroup = createEndpointGroup(); - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); EndpointProfileSchemaDto profileSchema1 = createEndpointProfileSchema(endpointGroup.getApplicationId(), ctlSchema.getId()); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileSchemaIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileSchemaIT.java index 1b10251d25..e5d1515ccf 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileSchemaIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerProfileSchemaIT.java @@ -22,7 +22,7 @@ import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto; import org.kaaproject.kaa.common.dto.VersionDto; import org.kaaproject.kaa.common.dto.admin.SchemaVersions; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import java.util.ArrayList; import java.util.Collections; @@ -72,7 +72,7 @@ public void testGetProfileSchemasByApplicationToken() throws Exception { loginTenantDeveloper(tenantDeveloperDto.getUsername()); - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); List defaultProfileSchemas = client.getProfileSchemas(application.getApplicationToken()); profileSchemas.addAll(defaultProfileSchemas); @@ -112,7 +112,7 @@ public void testGetProfileSchemaVersionsByApplicationToken() throws Exception { List defaultProfileSchemas = client.getProfileSchemas(application.getApplicationToken()); profileSchemas.addAll(defaultProfileSchemas); - CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); + CtlSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); for (int i = 0; i < 10; i++) { EndpointProfileSchemaDto profileSchema = createEndpointProfileSchema(application.getId(), ctlSchema.getId()); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/DefaultAkkaServiceTest.java b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/DefaultAkkaServiceTest.java index 6a238f8fea..bdb78c8089 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/DefaultAkkaServiceTest.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/DefaultAkkaServiceTest.java @@ -44,7 +44,7 @@ import org.kaaproject.kaa.common.dto.credentials.CredentialsDto; import org.kaaproject.kaa.common.dto.credentials.CredentialsStatus; import org.kaaproject.kaa.common.dto.credentials.EndpointRegistrationDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.logs.LogSchemaDto; import org.kaaproject.kaa.common.dto.user.UserVerifierDto; import org.kaaproject.kaa.common.endpoint.gen.ConfigurationSyncRequest; @@ -1375,7 +1375,7 @@ public void testLogSyncRequest() throws Exception { profileSchemaDto.setId("1"); profileSchemaDto.setCtlSchemaId("22"); - CTLSchemaDto ctlSchema = new CTLSchemaDto(); + CtlSchemaDto ctlSchema = new CtlSchemaDto(); ctlSchema.setId("22"); when(cacheService.getProfileSchemaByAppAndVersion(new AppVersionKey(APP_TOKEN, 0))).thenReturn(profileSchemaDto); @@ -1386,7 +1386,7 @@ public void testLogSyncRequest() throws Exception { serverProfileSchemaDto.setId("1"); serverProfileSchemaDto.setCtlSchemaId("23"); - CTLSchemaDto serverCtlSchema = new CTLSchemaDto(); + CtlSchemaDto serverCtlSchema = new CtlSchemaDto(); serverCtlSchema.setId("23"); when(cacheService.getServerProfileSchemaByAppAndVersion(new AppVersionKey(APP_TOKEN, 0))).thenReturn(serverProfileSchemaDto); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessorTest.java b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessorTest.java index 6a4d90a02e..d1260aa5d8 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessorTest.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorMessageProcessorTest.java @@ -26,7 +26,7 @@ import org.kaaproject.kaa.common.dto.EndpointProfileDataDto; import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto; import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.logs.LogSchemaDto; import org.kaaproject.kaa.server.common.dao.ApplicationService; @@ -149,12 +149,12 @@ public void before() throws Exception { Mockito.when(cacheService.getServerProfileSchemaByAppAndVersion(key)).thenReturn(serverProfileSchema); // Endpoint profile CTL schema - CTLSchemaDto endpointProfileCTLSchema = new CTLSchemaDto(); + CtlSchemaDto endpointProfileCTLSchema = new CtlSchemaDto(); endpointProfileCTLSchema.setId(CLIENT_PROFILE_SCHEMA_CTL_SCHEMA_ID); Mockito.when(cacheService.getCtlSchemaById(CLIENT_PROFILE_SCHEMA_CTL_SCHEMA_ID)).thenReturn(endpointProfileCTLSchema); // Server profile CTL schema - CTLSchemaDto serverProfileCTLSchema = new CTLSchemaDto(); + CtlSchemaDto serverProfileCTLSchema = new CtlSchemaDto(); serverProfileCTLSchema.setId(SERVER_PROFILE_SCHEMA_CTL_SCHEMA_ID); Mockito.when(cacheService.getCtlSchemaById(SERVER_PROFILE_SCHEMA_CTL_SCHEMA_ID)).thenReturn(serverProfileCTLSchema); @@ -174,12 +174,12 @@ public void before() throws Exception { message = new LogEventPackMessage(REQUEST_ID, ActorRef.noSender(), pack); } - protected CTLSchemaDto generateCTLSchemaDto(String tenantId) { + protected CtlSchemaDto generateCTLSchemaDto(String tenantId) { return generateCTLSchemaDto(DEFAULT_FQN, tenantId, null, 100); } - protected CTLSchemaDto generateCTLSchemaDto(String fqn, String tenantId, String applicationId, int version) { - CTLSchemaDto ctlSchema = new CTLSchemaDto(); + protected CtlSchemaDto generateCTLSchemaDto(String fqn, String tenantId, String applicationId, int version) { + CtlSchemaDto ctlSchema = new CtlSchemaDto(); ctlSchema.setMetaInfo(new CTLSchemaMetaInfoDto(fqn, tenantId, applicationId)); ctlSchema.setVersion(version); String name = fqn.substring(fqn.lastIndexOf(".") + 1); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorTest.java b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorTest.java index b4a6dd82d6..5c37e68b8a 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorTest.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/akka/actors/core/ApplicationLogActorTest.java @@ -29,7 +29,7 @@ import org.kaaproject.kaa.common.dto.EndpointProfileDataDto; import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto; import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.logs.LogSchemaDto; import org.kaaproject.kaa.server.common.dao.ApplicationService; import org.kaaproject.kaa.server.common.dao.CTLService; @@ -120,10 +120,10 @@ public void before() throws Exception { when(cacheService.getServerProfileSchemaByAppAndVersion(new AppVersionKey(APP_TOKEN, SERVER_SCHEMA_VERSION))) .thenReturn(serverProfileSchemaDto); - CTLSchemaDto profileCtlSchemaDto = new CTLSchemaDto(); + CtlSchemaDto profileCtlSchemaDto = new CtlSchemaDto(); profileCtlSchemaDto.setId(CLIENT_PROFILE_CTL_SCHEMA_ID); - CTLSchemaDto serverProfileCtlSchemaDto = new CTLSchemaDto(); + CtlSchemaDto serverProfileCtlSchemaDto = new CtlSchemaDto(); serverProfileCtlSchemaDto.setId(SERVER_PROFILE_CTL_SCHEMA_ID); when(cacheService.getCtlSchemaById(CLIENT_PROFILE_CTL_SCHEMA_ID)).thenReturn(profileCtlSchemaDto); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/delta/DeltaServiceIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/delta/DeltaServiceIT.java index c773f1ce08..fb0840e890 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/delta/DeltaServiceIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/delta/DeltaServiceIT.java @@ -42,7 +42,7 @@ import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto; import org.kaaproject.kaa.common.dto.ProfileFilterDto; import org.kaaproject.kaa.common.dto.TenantDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.endpoint.gen.BasicEndpointProfile; import org.kaaproject.kaa.common.hash.EndpointObjectHash; @@ -155,26 +155,26 @@ public void beforeTest() throws IOException, DeltaCalculatorException, ControlSe EndpointGroupDto groupAll = endpointService.findEndpointGroupsByAppId(application.getId()).get(0); - CTLSchemaDto profileCtlSchema = new CTLSchemaDto(); + CtlSchemaDto profileCtlSchema = new CtlSchemaDto(); CTLSchemaMetaInfoDto metaInfo = new CTLSchemaMetaInfoDto(BasicEndpointProfile.SCHEMA$.getFullName(), application.getTenantId(), application.getId()); profileCtlSchema.setMetaInfo(metaInfo); profileCtlSchema.setBody(BasicEndpointProfile.SCHEMA$.toString()); profileCtlSchema.setVersion(1); - profileCtlSchema.setDependencySet(new HashSet()); + profileCtlSchema.setDependencySet(new HashSet()); profileCtlSchema = ctlService.saveCTLSchema(profileCtlSchema); Schema schema = new Schema.Parser().parse(dataSchema); - CTLSchemaDto confCtlSchema = new CTLSchemaDto(); + CtlSchemaDto confCtlSchema = new CtlSchemaDto(); CTLSchemaMetaInfoDto confMetaInfo = new CTLSchemaMetaInfoDto(schema.getFullName(), application.getTenantId(), application.getId()); confCtlSchema.setMetaInfo(confMetaInfo); confCtlSchema.setBody(schema.toString()); confCtlSchema.setVersion(CONF_SCHEMA_VERSION); - confCtlSchema.setDependencySet(new HashSet()); + confCtlSchema.setDependencySet(new HashSet()); confCtlSchema = ctlService.saveCTLSchema(confCtlSchema); EndpointProfileSchemaDto profileSchemaObj = new EndpointProfileSchemaDto(); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/event/ESTestCacheService.java b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/event/ESTestCacheService.java index 7cf01792f6..2bbf0fd4e3 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/event/ESTestCacheService.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/operations/service/event/ESTestCacheService.java @@ -27,7 +27,7 @@ import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto; import org.kaaproject.kaa.common.dto.TopicDto; import org.kaaproject.kaa.common.dto.admin.SdkProfileDto; -import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; +import org.kaaproject.kaa.common.dto.ctl.CtlSchemaDto; import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto; import org.kaaproject.kaa.common.hash.EndpointObjectHash; import org.kaaproject.kaa.server.common.core.configuration.BaseData; @@ -404,7 +404,7 @@ public List putApplicationEventFamilyMaps(List