From b92a40d42ebdd003e4a12b2d9b868e680007c9ad Mon Sep 17 00:00:00 2001 From: Oleksandr Didukh Date: Wed, 15 Jun 2016 14:47:09 +0300 Subject: [PATCH] KAA-977: Remove deprecated REST API call methods that are based on ApplicationId instead of Application Tokens (#752) KAA-977: Ignore applicationId field --- .../kaa/server/common/admin/AdminClient.java | 314 +----------- .../common/dto/EndpointProfileBodyDto.java | 3 + .../admin/controller/KaaAdminController.java | 485 +----------------- .../control/AbstractTestControlServer.java | 14 +- .../ControlServerApplicationEventMapIT.java | 84 +-- .../control/ControlServerApplicationIT.java | 17 +- .../control/ControlServerCTLSchemaIT.java | 102 +--- .../ControlServerConfigurationSchemaIT.java | 74 --- .../control/ControlServerEndpointGroupIT.java | 35 -- .../control/ControlServerLogAppenderIT.java | 13 - .../control/ControlServerLogSchemaIT.java | 27 - .../ControlServerNotificationSchemaIT.java | 49 -- .../control/ControlServerProfileSchemaIT.java | 47 +- .../server/control/ControlServerSdkIT.java | 8 +- .../server/control/ControlServerTopicIT.java | 15 - 15 files changed, 94 insertions(+), 1193 deletions(-) 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 737ed221f7..3586753f68 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 @@ -216,12 +216,8 @@ public List getApplications() throws Exception { return entity.getBody(); } - public ApplicationDto getApplication(String applicationId) throws Exception { - return restTemplate.getForObject(restTemplate.getUrl() + "application/" + applicationId, ApplicationDto.class); - } - public ApplicationDto getApplicationByApplicationToken(String token) throws Exception { - return restTemplate.getForObject(restTemplate.getUrl() + "application/token/" + token, ApplicationDto.class); + return restTemplate.getForObject(restTemplate.getUrl() + "application/" + token, ApplicationDto.class); } public void deleteApplication(String applicationId) throws Exception { @@ -294,21 +290,10 @@ public TopicDto getTopic(String topicId) throws Exception { return restTemplate.getForObject(restTemplate.getUrl() + "topic/" + topicId, TopicDto.class); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getTopicsByApplicationToken(String)} - */ - @Deprecated - public List getTopicsByApplicationId(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "topics/" + applicationId, HttpMethod.GET, null, typeRef); - return entity.getBody(); - } - public List getTopicsByApplicationToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "topicsByAppToken/" + applicationToken, HttpMethod.GET, null, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "topics/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -417,54 +402,22 @@ public LogSchemaDto getLogSchema(String logSchemaId) throws Exception { return restTemplate.getForObject(restTemplate.getUrl() + "logSchema/" + logSchemaId, LogSchemaDto.class); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getSchemaVersionsByApplicationToken(String)} - */ - @Deprecated - public SchemaVersions getSchemaVersionsByApplicationId(String applicationId) throws Exception { - return restTemplate.getForObject(restTemplate.getUrl() + "schemaVersions/" + applicationId, SchemaVersions.class); - } - public SchemaVersions getSchemaVersionsByApplicationToken(String applicationToken) throws Exception { - return restTemplate.getForObject(restTemplate.getUrl() + "schemaVersionsByAppToken/" + applicationToken, SchemaVersions.class); - } - - /** - * @deprecated As of release 0.9.0, replaced by {@link #getConfigurationSchemasByAppToken(String)} - */ - @Deprecated - public List getConfigurationSchemas(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "configurationSchemas/" + applicationId, - HttpMethod.GET, null, typeRef); - return entity.getBody(); + return restTemplate.getForObject(restTemplate.getUrl() + "schemaVersions/" + applicationToken, SchemaVersions.class); } public List getConfigurationSchemasByAppToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "configurationSchemasByAppToken/" + + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "configurationSchemas/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } - public List getProfileSchemas(String applicationId) throws Exception { + public List getProfileSchemas(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "profileSchemas/" + applicationId, - HttpMethod.GET, null, typeRef); - return entity.getBody(); - } - - /** - * @deprecated As of release 0.9.0, replaced by {@link #getServerProfileSchemasByAppToken(String)} - */ - @Deprecated - public List getServerProfileSchemas(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "serverProfileSchemas/" + applicationId, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "profileSchemas/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -472,67 +425,31 @@ public List getServerProfileSchemas(String applicationId public List getServerProfileSchemasByAppToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "serverProfileSchemasByAppToken/" + + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "serverProfileSchemas/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getNotificationSchemasByAppToken(String)} - */ - @Deprecated - public List getNotificationSchemas(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "notificationSchemas/" + applicationId, - HttpMethod.GET, null, typeRef); - return entity.getBody(); - } - public List getNotificationSchemasByAppToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "notificationSchemasByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "notificationSchemas/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getUserNotificationSchemasByAppToken(String)} - */ - @Deprecated - public List getUserNotificationSchemas(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "userNotificationSchemas/" + applicationId, HttpMethod.GET, - null, typeRef); - return entity.getBody(); - } - public List getUserNotificationSchemasByAppToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "userNotificationSchemasByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "userNotificationSchemas/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getLogSchemasByAppToken(String)} - */ - @Deprecated - public List getLogSchemas(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "logSchemas/" + applicationId, HttpMethod.GET, null, - typeRef); - return entity.getBody(); - } - public List getLogSchemasByAppToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "logSchemasByAppToken/" + applicationToken, HttpMethod.GET, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "logSchemas/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -571,22 +488,10 @@ public void deleteEndpointGroup(String endpointGroupId) throws Exception { restTemplate.postForLocation(restTemplate.getUrl() + "delEndpointGroup", params); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getEndpointGroupsByAppToken(String)} - */ - @Deprecated - public List getEndpointGroups(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "endpointGroups/" + applicationId, HttpMethod.GET, - null, typeRef); - return entity.getBody(); - } - public List getEndpointGroupsByAppToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "endpointGroupsByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "endpointGroups/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -778,62 +683,26 @@ public ApplicationEventFamilyMapDto getApplicationEventFamilyMap(String aefMapId return restTemplate.getForObject(restTemplate.getUrl() + "applicationEventMap/" + aefMapId, ApplicationEventFamilyMapDto.class); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getApplicationEventFamilyMapsByApplicationToken(String)} - */ - @Deprecated - public List getApplicationEventFamilyMapsByApplicationId(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "applicationEventMaps/" + applicationId, - HttpMethod.GET, null, typeRef); - return entity.getBody(); - } - public List getApplicationEventFamilyMapsByApplicationToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "applicationEventMapsByAppToken/" + + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "applicationEventMaps/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getVacantEventClassFamiliesByApplicationToken(String)} - */ - @Deprecated - public List getVacantEventClassFamiliesByApplicationId(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "vacantEventClassFamilies/" + applicationId, HttpMethod.GET, - null, typeRef); - return entity.getBody(); - } - public List getVacantEventClassFamiliesByApplicationToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "vacantEventClassFamiliesByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "vacantEventClassFamilies/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getEventClassFamiliesByApplicationToken(String)} - */ - @Deprecated - public List getEventClassFamiliesByApplicationId(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "eventClassFamilies/" + applicationId, HttpMethod.GET, - null, typeRef); - return entity.getBody(); - } - public List getEventClassFamiliesByApplicationToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "eventClassFamiliesByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "eventClassFamilies/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -846,22 +715,10 @@ public LogAppenderDto getLogAppender(String logAppenderId) throws Exception { return restTemplate.getForObject(restTemplate.getUrl() + "logAppender/" + logAppenderId, LogAppenderDto.class); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getLogAppendersByAppToken(String)} - */ - @Deprecated - public List getLogAppenders(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "logAppenders/" + applicationId, HttpMethod.GET, null, - typeRef); - return entity.getBody(); - } - public List getLogAppendersByAppToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "logAppendersByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "logAppenders/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -876,21 +733,10 @@ public UserVerifierDto getUserVerifier(String userVerifierId) throws Exception { return restTemplate.getForObject(restTemplate.getUrl() + "userVerifier/" + userVerifierId, UserVerifierDto.class); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getUserVerifiersByApplicationToken(String)} - */ - @Deprecated - public List getUserVerifiersByApplicationId(String applicationId) { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "userVerifiers/" + applicationId, HttpMethod.GET, null, typeRef); - return entity.getBody(); - } - public List getUserVerifiersByApplicationToken(String applicationToken) { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "userVerifiersByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "userVerifiers/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -922,22 +768,10 @@ public SdkProfileDto getSdkProfile(String sdkProfileId) throws Exception { return entity.getBody(); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getSdkProfilesByApplicationToken(String)} - */ - @Deprecated - public List getSdkProfiles(String applicationId) throws Exception { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "sdkProfiles/" + applicationId, HttpMethod.GET, null, - typeRef); - return entity.getBody(); - } - public List getSdkProfilesByApplicationToken(String applicationToken) throws Exception { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "sdkProfilesByAppToken/" + applicationToken, + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "sdkProfiles/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } @@ -988,23 +822,6 @@ public FileData downloadSdk(SdkProfileDto key) throws Exception { return data; } - /** - * @deprecated As of release 0.9.0, replaced by {@link #downloadCtlSchemaByAppToken(CTLSchemaDto, CTLSchemaExportMethod, String)} - */ - @Deprecated - public FileData downloadCtlSchema(CTLSchemaDto ctlSchemaDto, CTLSchemaExportMethod method) { - FileDataResponseExtractor extractor = new FileDataResponseExtractor(); - MultiValueMap parameters = new LinkedMultiValueMap<>(); - parameters.add("fqn", ctlSchemaDto.getMetaInfo().getFqn()); - parameters.add("version", Integer.toString(ctlSchemaDto.getVersion())); - if (ctlSchemaDto.getMetaInfo().getApplicationId() != null) { - parameters.add("applicationId", ctlSchemaDto.getMetaInfo().getApplicationId()); - } - parameters.add("method", method.name()); - RequestCallback request = new DataRequestCallback<>(parameters); - return restTemplate.execute(restTemplate.getUrl() + "CTL/exportSchema", HttpMethod.POST, request, extractor); - } - public FileData downloadCtlSchemaByAppToken(CTLSchemaDto ctlSchemaDto, CTLSchemaExportMethod method, String appToken) { FileDataResponseExtractor extractor = new FileDataResponseExtractor(); MultiValueMap parameters = new LinkedMultiValueMap<>(); @@ -1015,7 +832,7 @@ public FileData downloadCtlSchemaByAppToken(CTLSchemaDto ctlSchemaDto, CTLSchema } parameters.add("method", method.name()); RequestCallback request = new DataRequestCallback<>(parameters); - return restTemplate.execute(restTemplate.getUrl() + "CTL/appToken/exportSchema", HttpMethod.POST, request, extractor); + return restTemplate.execute(restTemplate.getUrl() + "CTL/exportSchema", HttpMethod.POST, request, extractor); } public void flushSdkCache() throws Exception { @@ -1155,22 +972,6 @@ public String getFilename() { return bar; } - /** - * @deprecated As of release 0.9.0, replaced by {@link #saveCTLSchemaWithAppToken(String, String, String)} - */ - @Deprecated - public CTLSchemaDto saveCTLSchema(String body, String tenantId, String applicationId) { - MultiValueMap params = new LinkedMultiValueMap<>(); - params.add("body", body); - if (tenantId != null) { - params.add("tenantId", tenantId); - } - if (applicationId != null) { - params.add("applicationId", applicationId); - } - return restTemplate.postForObject(restTemplate.getUrl() + "CTL/saveSchema", params, CTLSchemaDto.class); - } - public CTLSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId, String applicationToken) { MultiValueMap params = new LinkedMultiValueMap<>(); params.add("body", body); @@ -1180,27 +981,7 @@ public CTLSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId, Stri if (applicationToken != null) { params.add("applicationToken", applicationToken); } - return restTemplate.postForObject(restTemplate.getUrl() + "CTL/appToken/saveSchema", params, CTLSchemaDto.class); - } - - /** - * @deprecated As of release 0.9.0, replaced by {@link #deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String, Integer, String, String)} - */ - @Deprecated - public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationId(String fqn, - Integer version, - String tenantId, - String applicationId) { - MultiValueMap params = new LinkedMultiValueMap<>(); - params.add("fqn", fqn); - params.add("version", version); - if (tenantId != null) { - params.add("tenantId", tenantId); - } - if (applicationId != null) { - params.add("applicationId", applicationId); - } - restTemplate.postForLocation(restTemplate.getUrl() + "CTL/deleteSchema", params); + return restTemplate.postForObject(restTemplate.getUrl() + "CTL/saveSchema", params, CTLSchemaDto.class); } public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, @@ -1216,32 +997,18 @@ public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, if (applicationToken!= null) { params.add("applicationToken", applicationToken); } - restTemplate.postForLocation(restTemplate.getUrl() + "CTL/appToken/deleteSchema", params); - } - - /** - * @deprecated As of release 0.9.0, replaced by {@link #getCTLSchemaByFqnVersionTenantIdAndApplicationToken(String, Integer, String, String)} - */ - @Deprecated - public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationId(String fqn, Integer version, String tenantId, String applicationId) { - if (tenantId != null && applicationId != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}&applicationId={applicationId}", CTLSchemaDto.class, fqn, version, tenantId, applicationId); - }else if (tenantId != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}", CTLSchemaDto.class, fqn, version, tenantId); - } else { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}", CTLSchemaDto.class, fqn, version); - } + restTemplate.postForLocation(restTemplate.getUrl() + "CTL/deleteSchema", params); } public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, Integer version, String tenantId, String applicationToken) { if (tenantId != null && applicationToken != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/appToken/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}" + + return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}" + "&applicationToken={applicationToken}", CTLSchemaDto.class, fqn, version, tenantId, applicationToken); }else if (tenantId != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/appToken/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}", + return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}&tenantId={tenantId}", CTLSchemaDto.class, fqn, version, tenantId); } else { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/appToken/getSchema?fqn={fqn}&version={version}", CTLSchemaDto.class, fqn, version); + return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchema?fqn={fqn}&version={version}", CTLSchemaDto.class, fqn, version); } } @@ -1249,29 +1016,14 @@ public CTLSchemaDto getCTLSchemaById(String id) { return restTemplate.getForObject(restTemplate.getUrl() + "CTL/getSchemaById?id={id}", CTLSchemaDto.class, id); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #checkFqnExistsWithAppToken(String, String, String)} - */ - @Deprecated - public boolean checkFqnExists(String fqn, String tenantId, String applicationId) { - if (tenantId != null && applicationId != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/checkFqn?fqn={fqn}&tenantId={tenantId}&applicationId={applicationId}", - Boolean.class, fqn, tenantId, applicationId); - } else if (tenantId != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/checkFqn?fqn={fqn}&tenantId={tenantId}", Boolean.class, fqn, tenantId); - } else { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/checkFqn?fqn={fqn}", Boolean.class, fqn); - } - } - public boolean checkFqnExistsWithAppToken(String fqn, String tenantId, String applicationToken) { if (tenantId != null && applicationToken != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/appToken/checkFqn?fqn={fqn}&tenantId={tenantId}&applicationToken={applicationToken}", + return restTemplate.getForObject(restTemplate.getUrl() + "CTL/checkFqn?fqn={fqn}&tenantId={tenantId}&applicationToken={applicationToken}", Boolean.class, fqn, tenantId, applicationToken); } else if (tenantId != null) { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/appToken/checkFqn?fqn={fqn}&tenantId={tenantId}", Boolean.class, fqn, tenantId); + return restTemplate.getForObject(restTemplate.getUrl() + "CTL/checkFqn?fqn={fqn}&tenantId={tenantId}", Boolean.class, fqn, tenantId); } else { - return restTemplate.getForObject(restTemplate.getUrl() + "CTL/appToken/checkFqn?fqn={fqn}", Boolean.class, fqn); + return restTemplate.getForObject(restTemplate.getUrl() + "CTL/checkFqn?fqn={fqn}", Boolean.class, fqn); } } @@ -1296,22 +1048,10 @@ public List getTenantLevelCTLSchemas() { return entity.getBody(); } - /** - * @deprecated As of release 0.9.0, replaced by {@link #getApplicationLevelCTLSchemasByAppToken(String)} - */ - @Deprecated - public List getApplicationLevelCTLSchemas(String applicationId) { - ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { - }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "CTL/getApplicationSchemas/" + - applicationId, HttpMethod.GET, null, typeRef); - return entity.getBody(); - } - public List getApplicationLevelCTLSchemasByAppToken(String applicationToken) { ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { }; - ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "CTL/appToken/getApplicationSchemas/" + + ResponseEntity> entity = restTemplate.exchange(restTemplate.getUrl() + "CTL/getApplicationSchemas/" + applicationToken, HttpMethod.GET, null, typeRef); return entity.getBody(); } diff --git a/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/EndpointProfileBodyDto.java b/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/EndpointProfileBodyDto.java index c9e34ca8a1..ea64941ded 100644 --- a/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/EndpointProfileBodyDto.java +++ b/server/common/dto/src/main/java/org/kaaproject/kaa/common/dto/EndpointProfileBodyDto.java @@ -16,6 +16,8 @@ package org.kaaproject.kaa.common.dto; +import com.fasterxml.jackson.annotation.JsonIgnore; + import java.io.Serializable; import java.util.Arrays; @@ -28,6 +30,7 @@ public class EndpointProfileBodyDto implements Serializable { private String serverSideProfile; private int clientSideProfileVersion; private int serverSideProfileVersion; + @JsonIgnore private String appId; public EndpointProfileBodyDto() {} diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/KaaAdminController.java b/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/KaaAdminController.java index ca026bc178..c68bc8f419 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/KaaAdminController.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/KaaAdminController.java @@ -468,23 +468,6 @@ public List getApplications() throws KaaAdminServiceException { return kaaAdminService.getApplications(); } - /** - * Gets the application by its id. - * - * @param applicationId - * the application id - * @return the application dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getApplicationByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "application/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public ApplicationDto getApplication(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getApplication(applicationId); - } - /** * Gets the application by its application token. * @@ -494,7 +477,7 @@ public ApplicationDto getApplication(@PathVariable String applicationId) throws * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "application/token/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "application/{applicationToken}", method = RequestMethod.GET) @ResponseBody public ApplicationDto getApplicationByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getApplicationByApplicationToken(applicationToken); @@ -624,23 +607,6 @@ public void deleteUser(@RequestParam(value = "userId") String userId) throws Kaa kaaAdminService.deleteUser(userId); } - /** - * Gets the schema versions by application id. - * - * @param applicationId - * the application id - * @return the schema versions - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getSchemaVersionsByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "schemaVersions/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public SchemaVersions getSchemaVersionsByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getSchemaVersionsByApplicationId(applicationId); - } - /** * Gets the schema versions by application token. * @@ -650,7 +616,7 @@ public SchemaVersions getSchemaVersionsByApplicationId(@PathVariable String appl * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "schemaVersionsByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "schemaVersions/{applicationToken}", method = RequestMethod.GET) @ResponseBody public SchemaVersions getSchemaVersionsByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getSchemaVersionsByApplicationToken(applicationToken); @@ -733,23 +699,6 @@ public SdkProfileDto getSdkProfile(@PathVariable String sdkProfileId) throws Kaa return kaaAdminService.getSdkProfile(sdkProfileId); } - /** - * Returns a list of SDK profiles for the given application. - * - * @param applicationId - * the application id - * @return the list sdk profile dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getSdkProfilesByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "sdkProfiles/{applicationId}") - @ResponseBody - public List getSdkProfilesByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getSdkProfilesByApplicationId(applicationId); - } - /** * Returns a list of SDK profiles for the given application. * @@ -759,7 +708,7 @@ public List getSdkProfilesByApplicationId(@PathVariable String ap * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "sdkProfilesByAppToken/{applicationToken}") + @RequestMapping(value = "sdkProfiles/{applicationToken}") @ResponseBody public List getSdkProfilesByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getSdkProfilesByApplicationToken(applicationToken); @@ -781,30 +730,6 @@ public void flushSdkCache() throws KaaAdminServiceException { } } - /** - * Saves a CTL schema. - * - * @param body - * the ctl body - * @param applicationId - * id of the application - * @param tenantId - * id of the tenant - * - * @throws KaaAdminServiceException - * the kaa admin service exception - * - * @return CTL schema info - * @deprecated As of release 0.9.0, replaced by {@link #saveCTLSchemaWithAppToken(String, String, String)} - */ - @Deprecated - @RequestMapping(value = "CTL/saveSchema", params = { "body" }, method = RequestMethod.POST) - @ResponseBody - public CTLSchemaDto saveCTLSchema(@RequestParam String body, @RequestParam(required = false) String tenantId, - @RequestParam(required = false) String applicationId) throws KaaAdminServiceException { - return kaaAdminService.saveCTLSchema(body, tenantId, applicationId); - } - /** * Saves a CTL schema. * @@ -820,38 +745,13 @@ public CTLSchemaDto saveCTLSchema(@RequestParam String body, @RequestParam(requi * * @return CTL schema info */ - @RequestMapping(value = "CTL/appToken/saveSchema", params = { "body" }, method = RequestMethod.POST) + @RequestMapping(value = "CTL/saveSchema", params = { "body" }, method = RequestMethod.POST) @ResponseBody public CTLSchemaDto saveCTLSchemaWithAppToken(@RequestParam String body, @RequestParam(required = false) String tenantId, @RequestParam(required = false) String applicationToken) throws KaaAdminServiceException { return kaaAdminService.saveCTLSchemaWithAppToken(body, tenantId, applicationToken); } - /** - * Removes a CTL schema by its fully qualified name and version number. - * - * @param fqn - * the fqn - * @param version - * the version - * @param tenantId - * id of the tenant - * @param applicationId - * id of the application - * - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String, int, String, String)} - */ - @Deprecated - @RequestMapping(value = "CTL/deleteSchema", params = { "fqn", "version" }, method = RequestMethod.POST) - @ResponseStatus(value = HttpStatus.OK) - public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationId(@RequestParam String fqn, @RequestParam int version, - @RequestParam(required = false) String tenantId, - @RequestParam(required = false) String applicationId) throws KaaAdminServiceException { - kaaAdminService.deleteCTLSchemaByFqnVersionTenantIdAndApplicationId(fqn, version, tenantId, applicationId); - } - /** * Removes a CTL schema by its fully qualified name and version number. * @@ -867,7 +767,7 @@ public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationId(@RequestParam St * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "CTL/appToken/deleteSchema", params = { "fqn", "version" }, method = RequestMethod.POST) + @RequestMapping(value = "CTL/deleteSchema", params = { "fqn", "version" }, method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(@RequestParam String fqn, @RequestParam int version, @RequestParam(required = false) String tenantId, @@ -876,35 +776,6 @@ public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(@RequestParam kaaAdminService.deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(fqn, version, tenantId, applicationToken); } - /** - * Retrieves a CTL schema by its fully qualified name and version number. - * - * @param fqn - * the fqn - * @param version - * the version - * @param tenantId - * id of the tenant - * @param applicationId - * id of the application - * - * @throws KaaAdminServiceException - * the kaa admin service exception - * - * @return CTL schema info - * @deprecated As of release 0.9.0, replaced by {@link #getCTLSchemaByFqnVersionTenantIdAndApplicationToken(String, int, String, String)} - */ - @Deprecated - @RequestMapping(value = "CTL/getSchema", params = { "fqn", "version" }, method = RequestMethod.GET) - @ResponseBody - public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationId(@RequestParam String fqn, - @RequestParam int version, - @RequestParam(required = false) String tenantId, - @RequestParam(required = false) String applicationId) - throws KaaAdminServiceException { - return kaaAdminService.getCTLSchemaByFqnVersionTenantIdAndApplicationId(fqn, version, tenantId, applicationId); - } - /** * Retrieves a CTL schema by its fully qualified name and version number. * @@ -922,7 +793,7 @@ public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationId(@RequestPar * * @return CTL schema info */ - @RequestMapping(value = "CTL/appToken/getSchema", params = { "fqn", "version" }, method = RequestMethod.GET) + @RequestMapping(value = "CTL/getSchema", params = { "fqn", "version" }, method = RequestMethod.GET) @ResponseBody public CTLSchemaDto getCTLSchemaByFqnVersionTenantIdAndApplicationToken(@RequestParam String fqn, @RequestParam int version, @@ -949,32 +820,6 @@ public CTLSchemaDto getCTLSchemaById(@RequestParam String id) throws KaaAdminSer return kaaAdminService.getCTLSchemaById(id); } - /** - * Checks if CTL schema with same fqn is already exists in the sibling application. - * - * @param fqn - * the fqn - * @param tenantId - * id of the tenant - * @param applicationId - * id of the application - * - * @throws KaaAdminServiceException - * the kaa admin service exception - * - * @return true if CTL schema with same fqn is already exists in other scope - * @deprecated As of release 0.9.0, replaced by {@link #checkFqnExistsWithAppToken(String, String, String)} - */ - @Deprecated - @RequestMapping(value = "CTL/checkFqn", params = { "fqn" }, method = RequestMethod.GET) - @ResponseBody - public boolean checkFqnExists(@RequestParam String fqn, - @RequestParam(required = false) String tenantId, - @RequestParam(required = false) String applicationId) - throws KaaAdminServiceException { - return kaaAdminService.checkFqnExists(fqn, tenantId, applicationId); - } - /** * Checks if CTL schema with same fqn is already exists in the sibling application. * @@ -990,7 +835,7 @@ public boolean checkFqnExists(@RequestParam String fqn, * * @return true if CTL schema with same fqn is already exists in other scope */ - @RequestMapping(value = "CTL/appToken/checkFqn", params = { "fqn" }, method = RequestMethod.GET) + @RequestMapping(value = "CTL/checkFqn", params = { "fqn" }, method = RequestMethod.GET) @ResponseBody public boolean checkFqnExistsWithAppToken(@RequestParam String fqn, @RequestParam(required = false) String tenantId, @@ -1041,24 +886,6 @@ public List getTenantLevelCTLSchemas() throws KaaAdminServ return kaaAdminService.getTenantLevelCTLSchemas(); } - /** - * Retrieves a list of available CTL schemas for application. - * - * @param applicationId - * id of the application - * - * @throws KaaAdminServiceException - * the kaa admin service exception - * @return CTL schema metadata list - * @deprecated As of release 0.9.0, replaced by {@link #getApplicationLevelCTLSchemasByAppToken(String)} - */ - @Deprecated - @RequestMapping(value = "CTL/getApplicationSchemas/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getApplicationLevelCTLSchemas(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getApplicationLevelCTLSchemas(applicationId); - } - /** * Retrieves a list of available CTL schemas for application. * @@ -1069,54 +896,12 @@ public List getApplicationLevelCTLSchemas(@PathVariable St * the kaa admin service exception * @return CTL schema metadata list */ - @RequestMapping(value = "CTL/appToken/getApplicationSchemas/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "CTL/getApplicationSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getApplicationLevelCTLSchemasByAppToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getApplicationLevelCTLSchemasByAppToken(applicationToken); } - /** - * Exports a CTL schema and, depending on the export method specified, all - * of its dependencies. - * - * @param fqn - * - the schema fqn - * @param version - * - the schema version - * @param method - * - the schema export method - * @param applicationId - * id of the application - * @param request - * - the http request - * @param response - * - the http response - * - * @see CTLSchemaExportMethod - * - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #exportCTLSchemaByAppToken(String, int, String, String, HttpServletRequest, HttpServletResponse)} - */ - @Deprecated - @RequestMapping(value = "CTL/exportSchema", params = { "fqn", "version", "method" }, method = RequestMethod.POST) - @ResponseStatus(value = HttpStatus.OK) - public void exportCTLSchema(@RequestParam String fqn, @RequestParam int version, @RequestParam String method, - @RequestParam(required = false) String applicationId, - HttpServletRequest request, HttpServletResponse response) throws KaaAdminServiceException { - try { - FileData output = kaaAdminService.exportCTLSchema(fqn, version, applicationId, CTLSchemaExportMethod.valueOf(method.toUpperCase())); - ServletUtils.prepareDisposition(request, response, output.getFileName()); - response.setContentType(output.getContentType()); - response.setContentLength(output.getFileData().length); - response.setBufferSize(BUFFER); - response.getOutputStream().write(output.getFileData()); - response.flushBuffer(); - } catch (Exception cause) { - throw Utils.handleException(cause); - } - } - /** * Exports a CTL schema and, depending on the export method specified, all * of its dependencies. @@ -1139,7 +924,7 @@ public void exportCTLSchema(@RequestParam String fqn, @RequestParam int version, * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "CTL/appToken/exportSchema", params = { "fqn", "version", "method" }, method = RequestMethod.POST) + @RequestMapping(value = "CTL/exportSchema", params = { "fqn", "version", "method" }, method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void exportCTLSchemaByAppToken(@RequestParam String fqn, @RequestParam int version, @RequestParam String method, @RequestParam(required = false) String applicationToken, @@ -1157,24 +942,6 @@ public void exportCTLSchemaByAppToken(@RequestParam String fqn, @RequestParam in } } - /** - * Gets the server profile schemas by application id. - * - * @param applicationId - * the application id - * @return the list profile schema dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getServerProfileSchemasByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "serverProfileSchemas/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getServerProfileSchemasByApplicationId(@PathVariable String applicationId) - throws KaaAdminServiceException { - return kaaAdminService.getServerProfileSchemasByApplicationId(applicationId); - } - /** * Gets the server profile schemas by application token. * @@ -1184,7 +951,7 @@ public List getServerProfileSchemasByApplicationId(@Path * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "serverProfileSchemasByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "serverProfileSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getServerProfileSchemasByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { @@ -1222,24 +989,6 @@ public ServerProfileSchemaDto saveServerProfileSchema(@RequestBody ServerProfile return kaaAdminService.saveServerProfileSchema(serverProfileSchema); } - /** - * Gets the profile schemas by application id. - * - * @param applicationId - * the application id - * @return the list of endpoint profile schema dto objects - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getProfileSchemasByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "profileSchemas/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getProfileSchemasByApplicationId(@PathVariable String applicationId) - throws KaaAdminServiceException { - return kaaAdminService.getProfileSchemasByApplicationId(applicationId); - } - /** * Gets the profile schemas by application token. * @@ -1249,7 +998,7 @@ public List getProfileSchemasByApplicationId(@PathVari * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "profileSchemasByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "profileSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getProfileSchemasByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { @@ -1286,24 +1035,6 @@ public EndpointProfileSchemaDto saveProfileSchema(@RequestBody EndpointProfileSc return kaaAdminService.saveProfileSchema(profileSchema); } - /** - * Gets the configuration schemas by application id. - * - * @param applicationId - * the application id - * @return the сonfiguration schema dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getConfigurationSchemasByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "configurationSchemas/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getConfigurationSchemasByApplicationId(@PathVariable String applicationId) - throws KaaAdminServiceException { - return kaaAdminService.getConfigurationSchemasByApplicationId(applicationId); - } - /** * Gets the configuration schemas by application token. * @@ -1313,7 +1044,7 @@ public List getConfigurationSchemasByApplicationId(@Path * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "configurationSchemasByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "configurationSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getConfigurationSchemasByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { @@ -1370,24 +1101,6 @@ public ConfigurationSchemaDto editConfigurationSchema(@RequestBody Configuration return kaaAdminService.editConfigurationSchema(configurationSchema, null); } - /** - * Gets the notification schemas by application id. - * - * @param applicationId - * the application id - * @return the list notification schema dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getNotificationSchemasByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "notificationSchemas/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getNotificationSchemasByApplicationId(@PathVariable String applicationId) - throws KaaAdminServiceException { - return kaaAdminService.getNotificationSchemasByApplicationId(applicationId); - } - /** * Gets the notification schemas by application token. * @@ -1397,30 +1110,13 @@ public List getNotificationSchemasByApplicationId(@PathVa * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "notificationSchemasByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "notificationSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getNotificationSchemasByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getNotificationSchemasByApplicationToken(applicationToken); } - /** - * Gets the user notification schemas by application id. - * - * @param applicationId - * the application id - * @return the list schema dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getUserNotificationSchemasByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "userNotificationSchemas/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getUserNotificationSchemasByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getUserNotificationSchemasByApplicationId(applicationId); - } - /** * Gets the user notification schemas by application token. * @@ -1430,7 +1126,7 @@ public List getUserNotificationSchemasByApplicationId(@PathVariable * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "userNotificationSchemasByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "userNotificationSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getUserNotificationSchemasByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getUserNotificationSchemasByApplicationToken(applicationToken); @@ -1486,23 +1182,6 @@ public NotificationSchemaDto editNotificationSchema(@RequestBody NotificationSch return kaaAdminService.editNotificationSchema(notificationSchema, null); } - /** - * Gets all log schemas by application id. - * - * @param applicationId - * the application id - * @return the list log schema dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getLogSchemasByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "logSchemas/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getLogSchemasByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getLogSchemasByApplicationId(applicationId); - } - /** * Gets all log schemas by application token. * @@ -1512,7 +1191,7 @@ public List getLogSchemasByApplicationId(@PathVariable String appl * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "logSchemasByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "logSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getLogSchemasByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getLogSchemasByApplicationToken(applicationToken); @@ -1585,23 +1264,6 @@ public LogSchemaDto editLogSchema(@RequestBody LogSchemaDto logSchema) throws Ka return kaaAdminService.editLogSchema(logSchema, null); } - /** - * Gets all log appenders by application id. - * - * @param applicationId - * the application id - * @return the list log appender dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getLogAppendersByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "logAppenders/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getLogAppendersByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getRestLogAppendersByApplicationId(applicationId); - } - /** * Gets all log appenders by application token. * @@ -1611,7 +1273,7 @@ public List getLogAppendersByApplicationId(@PathVariable String * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "logAppendersByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "logAppenders/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getLogAppendersByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getRestLogAppendersByApplicationToken(applicationToken); @@ -1661,23 +1323,6 @@ public void deleteLogAppender(@RequestParam(value = "logAppenderId") String logA kaaAdminService.deleteLogAppender(logAppenderId); } - /** - * Gets all user verifiers by application id. - * - * @param applicationId - * the application id - * @return the list user verifier dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getUserVerifiersByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "userVerifiers/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getUserVerifiersByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getRestUserVerifiersByApplicationId(applicationId); - } - /** * Gets all user verifiers by application token. * @@ -1687,7 +1332,7 @@ public List getUserVerifiersByApplicationId(@PathVariable Strin * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "userVerifiersByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "userVerifiers/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getUserVerifiersByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getRestUserVerifiersByApplicationToken(applicationToken); @@ -1795,23 +1440,6 @@ public void getRecordSchema(@RequestBody RecordKey key, HttpServletRequest reque } } - /** - * Gets all endpoint groups by application id. - * - * @param applicationId - * the application id - * @return the list endpoint group dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getEndpointGroupsByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "endpointGroups/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getEndpointGroupsByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getEndpointGroupsByApplicationId(applicationId); - } - /** * Gets all endpoint groups by application token. * @@ -1821,7 +1449,7 @@ public List getEndpointGroupsByApplicationId(@PathVariable Str * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "endpointGroupsByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "endpointGroups/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getEndpointGroupsByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getEndpointGroupsByApplicationToken(applicationToken); @@ -2109,23 +1737,6 @@ public void deleteConfigurationRecord(@RequestParam(value = "schemaId") String s kaaAdminService.deleteConfigurationRecord(schemaId, endpointGroupId); } - /** - * Gets all topics by application id. - * - * @param applicationId - * the application id - * @return the topic dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getTopicsByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "topics/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getTopicsByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getTopicsByApplicationId(applicationId); - } - /** * Gets all topics by application token. * @@ -2135,7 +1746,7 @@ public List getTopicsByApplicationId(@PathVariable String applicationI * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "topicsByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "topics/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getTopicsByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getTopicsByApplicationToken(applicationToken); @@ -2374,24 +1985,6 @@ public List getEventClassesByFamilyIdVersionAndType( return kaaAdminService.getEventClassesByFamilyIdVersionAndType(eventClassFamilyId, version, type); } - /** - * Gets all application event family maps by application id. - * - * @param applicationId - * the application id - * @return list the application event family map dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getApplicationEventFamilyMapsByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "applicationEventMaps/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getApplicationEventFamilyMapsByApplicationId(@PathVariable String applicationId) - throws KaaAdminServiceException { - return kaaAdminService.getApplicationEventFamilyMapsByApplicationId(applicationId); - } - /** * Gets all application event family maps by application token. * @@ -2401,7 +1994,7 @@ public List getApplicationEventFamilyMapsByApplica * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "applicationEventMapsByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "applicationEventMaps/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getApplicationEventFamilyMapsByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { @@ -2440,23 +2033,6 @@ public ApplicationEventFamilyMapDto editApplicationEventFamilyMap(@RequestBody A return kaaAdminService.editApplicationEventFamilyMap(applicationEventFamilyMap); } - /** - * Gets all vacant event class families by application id. - * - * @param applicationId - * the application id - * @return the list ecf info dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getVacantEventClassFamiliesByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "vacantEventClassFamilies/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getVacantEventClassFamiliesByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getVacantEventClassFamiliesByApplicationId(applicationId); - } - /** * Gets all vacant event class families by application token. * @@ -2466,29 +2042,12 @@ public List getVacantEventClassFamiliesByApplicationId(@PathVariable * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "vacantEventClassFamiliesByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "vacantEventClassFamilies/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getVacantEventClassFamiliesByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getVacantEventClassFamiliesByApplicationToken(applicationToken); } - /** - * Gets all event class families by application id. - * - * @param applicationId - * the application id - * @return the list aef map info dto - * @throws KaaAdminServiceException - * the kaa admin service exception - * @deprecated As of release 0.9.0, replaced by {@link #getEventClassFamiliesByApplicationToken(String)} - */ - @Deprecated - @RequestMapping(value = "eventClassFamilies/{applicationId}", method = RequestMethod.GET) - @ResponseBody - public List getEventClassFamiliesByApplicationId(@PathVariable String applicationId) throws KaaAdminServiceException { - return kaaAdminService.getEventClassFamiliesByApplicationId(applicationId); - } - /** * Gets all event class families by application token. * @@ -2498,7 +2057,7 @@ public List getEventClassFamiliesByApplicationId(@PathVariable St * @throws KaaAdminServiceException * the kaa admin service exception */ - @RequestMapping(value = "eventClassFamiliesByAppToken/{applicationToken}", method = RequestMethod.GET) + @RequestMapping(value = "eventClassFamilies/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List getEventClassFamiliesByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException { return kaaAdminService.getEventClassFamiliesByApplicationToken(applicationToken); 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 b303644ab1..3c3fb7e184 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 @@ -1185,23 +1185,23 @@ protected ApplicationEventFamilyMapDto createApplicationEventFamilyMap() throws /** * Creates the application event family map. * - * @param applicationId the application id + * @param applicationToken the application token * @param ecfId the ecf id * @param version the version * @return the application event family map dto * @throws Exception the exception */ - protected ApplicationEventFamilyMapDto createApplicationEventFamilyMap(String applicationId, String ecfId, int version) throws Exception { + protected ApplicationEventFamilyMapDto createApplicationEventFamilyMap(String applicationToken, String ecfId, int version) throws Exception { ApplicationEventFamilyMapDto applicationEventFamilyMap = new ApplicationEventFamilyMapDto(); String tenantId = null; - if (strIsEmpty(applicationId)) { + if (strIsEmpty(applicationToken)) { ApplicationDto application = createApplication(tenantAdminDto); tenantId = application.getTenantId(); applicationEventFamilyMap.setApplicationId(application.getId()); } else { - applicationEventFamilyMap.setApplicationId(applicationId); - ApplicationDto application = client.getApplication(applicationId); + ApplicationDto application = client.getApplicationByApplicationToken(applicationToken); + applicationEventFamilyMap.setApplicationId(application.getId()); tenantId = application.getTenantId(); } EventClassFamilyDto eventClassFamily = null; @@ -1252,7 +1252,7 @@ protected String ctlRandomFieldType() { } protected CTLSchemaDto createCTLSchema(String name, String namespace, int version, - String tenantId, String applicationId, Set dependencies, + String tenantId, String applicationToken, Set dependencies, Map fields) throws Exception { LOG.debug("Generating CTL schema..."); @@ -1289,7 +1289,7 @@ protected CTLSchemaDto createCTLSchema(String name, String namespace, int versio LOG.debug("CTL schema generated: " + body); - return client.saveCTLSchema(body.toString(), tenantId, applicationId); + return client.saveCTLSchemaWithAppToken(body.toString(), tenantId, applicationToken); } /** diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationEventMapIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationEventMapIT.java index a7667e62cb..5027ca6e56 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationEventMapIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationEventMapIT.java @@ -60,32 +60,6 @@ public void testGetApplicationEventFamilyMap() throws Exception { Assert.assertEquals(applicationEventFamilyMap, storedApplicationEventFamilyMap); } - /** - * Test get application event family maps by application id. - * - * @throws Exception the exception - */ - @Test - public void testGetApplicationEventFamilyMapsByApplicationId() throws Exception { - List applicationEventFamilyMaps = new ArrayList(10); - ApplicationDto application = createApplication(tenantAdminDto); - EventClassFamilyDto eventClassFamily = createEventClassFamily(application.getTenantId()); - for (int i=0;i<10;i++) { - ApplicationEventFamilyMapDto applicationEventFamilyMap = createApplicationEventFamilyMap(application.getId(), eventClassFamily.getId(), (i+1)); - applicationEventFamilyMaps.add(applicationEventFamilyMap); - } - - Collections.sort(applicationEventFamilyMaps, new IdComparator()); - - loginTenantDeveloper(tenantDeveloperUser); - - List storedApplicationEventFamilyMaps = client.getApplicationEventFamilyMapsByApplicationId(application.getId()); - - Collections.sort(storedApplicationEventFamilyMaps, new IdComparator()); - - Assert.assertEquals(applicationEventFamilyMaps, storedApplicationEventFamilyMaps); - } - /** * Test get application event family maps by application token. * @@ -97,7 +71,8 @@ public void testGetApplicationEventFamilyMapsByApplicationToken() throws Excepti ApplicationDto application = createApplication(tenantAdminDto); EventClassFamilyDto eventClassFamily = createEventClassFamily(application.getTenantId()); for (int i=0;i<10;i++) { - ApplicationEventFamilyMapDto applicationEventFamilyMap = createApplicationEventFamilyMap(application.getId(), eventClassFamily.getId(), (i+1)); + ApplicationEventFamilyMapDto applicationEventFamilyMap = createApplicationEventFamilyMap( + application.getApplicationToken(), eventClassFamily.getId(), (i+1)); applicationEventFamilyMaps.add(applicationEventFamilyMap); } @@ -129,35 +104,6 @@ public void executeRestCall() throws Exception { }); } - /** - * Test get vacant event class families by application id. - * - * @throws Exception the exception - */ - @Test - public void testGetVacantEventClassFamiliesByApplicationId() throws Exception { - ApplicationDto application = createApplication(tenantAdminDto); - EventClassFamilyDto eventClassFamily = createEventClassFamily(application.getTenantId()); - createApplicationEventFamilyMap(application.getId(), eventClassFamily.getId(), 1); - - loginTenantDeveloper(tenantDeveloperUser); - List vacantEcfs = client.getVacantEventClassFamiliesByApplicationId(application.getId()); - Assert.assertNotNull(vacantEcfs); - Assert.assertEquals(0, vacantEcfs.size()); - - loginTenantAdmin(tenantAdminUser); - client.addEventClassFamilySchema(eventClassFamily.getId(), TEST_EVENT_CLASS_FAMILY_SCHEMA); - - loginTenantDeveloper(tenantDeveloperUser); - vacantEcfs = client.getVacantEventClassFamiliesByApplicationId(application.getId()); - Assert.assertNotNull(vacantEcfs); - Assert.assertEquals(1, vacantEcfs.size()); - Assert.assertNotNull(vacantEcfs.get(0)); - Assert.assertEquals(eventClassFamily.getId(), vacantEcfs.get(0).getEcfId()); - Assert.assertEquals(eventClassFamily.getName(), vacantEcfs.get(0).getEcfName()); - Assert.assertEquals(2, vacantEcfs.get(0).getVersion()); - } - /** * Test get vacant event class families by application token. * @@ -167,7 +113,7 @@ public void testGetVacantEventClassFamiliesByApplicationId() throws Exception { public void testGetVacantEventClassFamiliesByApplicationToken() throws Exception { ApplicationDto application = createApplication(tenantAdminDto); EventClassFamilyDto eventClassFamily = createEventClassFamily(application.getTenantId()); - createApplicationEventFamilyMap(application.getId(), eventClassFamily.getId(), 1); + createApplicationEventFamilyMap(application.getApplicationToken(), eventClassFamily.getId(), 1); loginTenantDeveloper(tenantDeveloperUser); List vacantEcfs = client.getVacantEventClassFamiliesByApplicationToken(application.getApplicationToken()); @@ -187,28 +133,6 @@ public void testGetVacantEventClassFamiliesByApplicationToken() throws Exception Assert.assertEquals(2, vacantEcfs.get(0).getVersion()); } - /** - * Test get event class families by application id. - * - * @throws Exception the exception - */ - @Test - public void testGetEventClassFamiliesByApplicationId() throws Exception { - ApplicationDto application = createApplication(tenantAdminDto); - EventClassFamilyDto eventClassFamily = createEventClassFamily(application.getTenantId()); - createApplicationEventFamilyMap(application.getId(), eventClassFamily.getId(), 1); - - loginTenantDeveloper(tenantDeveloperUser); - - List applicationEcfs = client.getEventClassFamiliesByApplicationId(application.getId()); - Assert.assertNotNull(applicationEcfs); - Assert.assertEquals(1, applicationEcfs.size()); - Assert.assertNotNull(applicationEcfs.get(0)); - Assert.assertEquals(eventClassFamily.getId(), applicationEcfs.get(0).getEcfId()); - Assert.assertEquals(eventClassFamily.getName(), applicationEcfs.get(0).getEcfName()); - Assert.assertEquals(1, applicationEcfs.get(0).getVersion()); - } - /** * Test get event class families by application token. * @@ -218,7 +142,7 @@ public void testGetEventClassFamiliesByApplicationId() throws Exception { public void testGetEventClassFamiliesByApplicationToken() throws Exception { ApplicationDto application = createApplication(tenantAdminDto); EventClassFamilyDto eventClassFamily = createEventClassFamily(application.getTenantId()); - createApplicationEventFamilyMap(application.getId(), eventClassFamily.getId(), 1); + createApplicationEventFamilyMap(application.getApplicationToken(), eventClassFamily.getId(), 1); loginTenantDeveloper(tenantDeveloperUser); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationIT.java index c495db4b35..30097d50da 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerApplicationIT.java @@ -58,21 +58,6 @@ public void testCreateApplication() throws Exception { public void testGetApplication() throws Exception { ApplicationDto application = createApplication(); - ApplicationDto storedApplication = client.getApplication(application.getId()); - - Assert.assertNotNull(storedApplication); - assertApplicationsEquals(application, storedApplication); - } - - /** - * Test get application by app token. - * - * @throws Exception the exception - */ - @Test - public void testGetApplicationByAppToken() throws Exception { - ApplicationDto application = createApplication(); - ApplicationDto storedApplication = client.getApplicationByApplicationToken(application.getApplicationToken()); Assert.assertNotNull(storedApplication); @@ -136,7 +121,7 @@ public void testDeleteApplication() throws Exception { checkNotFound(new TestRestCall() { @Override public void executeRestCall() throws Exception { - client.getApplication(application.getId()); + client.getApplicationByApplicationToken(application.getApplicationToken()); } }); } 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 0537316df9..bc596e6c15 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 @@ -50,22 +50,6 @@ public class ControlServerCTLSchemaIT extends AbstractTestControlServer { */ @Test public void saveCTLSchemaTest() throws Exception { - this.loginKaaAdmin(); - CTLSchemaDto beta = client.saveCTLSchema(getResourceAsString(TEST_CTL_SCHEMA_BETA), null, null); - Assert.assertNotNull(beta.getId()); - - this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto alpha = client.saveCTLSchema(getResourceAsString(TEST_CTL_SCHEMA_ALPHA), tenantDeveloperDto.getTenantId(), null); - Assert.assertNotNull(alpha.getId()); - } - - /** - * Saves a CTL schema to the database. - * - * @throws Exception - */ - @Test - public void saveCTLSchemaWithAppTokenTest() throws Exception { this.loginKaaAdmin(); CTLSchemaDto beta = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_BETA), null, null); Assert.assertNotNull(beta.getId()); @@ -83,7 +67,7 @@ public void saveCTLSchemaWithAppTokenTest() throws Exception { @Test(expected = HttpClientErrorException.class) public void saveCTLSchemaWithWrongVerionTest() throws Exception { this.loginKaaAdmin(); - CTLSchemaDto gamma = client.saveCTLSchema(getResourceAsString(TEST_CTL_SCHEMA_GAMMA), null, null); + CTLSchemaDto gamma = client.saveCTLSchemaWithAppToken(getResourceAsString(TEST_CTL_SCHEMA_GAMMA), null, null); } /** @@ -134,11 +118,12 @@ public void executeRestCall() throws Exception { public void deleteCTLSchemaByFqnAndVersionTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); final CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); - client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationId(saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); + client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); this.checkNotFound(new TestRestCall() { @Override public void executeRestCall() throws Exception { - client.getCTLSchemaByFqnVersionTenantIdAndApplicationId(saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); + client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken( + saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); } }); } @@ -181,7 +166,8 @@ public void deleteCTLSchemaWithDependents() throws Exception { this.checkBadRequest(new TestRestCall() { @Override public void executeRestCall() throws Exception { - client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationId(dependency.getMetaInfo().getFqn(), dependency.getVersion(), tenantDeveloperDto.getTenantId(), null); + client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken( + dependency.getMetaInfo().getFqn(), dependency.getVersion(), tenantDeveloperDto.getTenantId(), null); } }); } @@ -224,7 +210,7 @@ public void deleteSystemCTLSchemaByFqnAndVersionTest() throws Exception { this.checkForbidden(new TestRestCall() { @Override public void executeRestCall() throws Exception { - client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationId(saved.getMetaInfo().getFqn(), saved.getVersion(), null, null); + client.deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(saved.getMetaInfo().getFqn(), saved.getVersion(), null, null); } }); } @@ -255,7 +241,8 @@ public void executeRestCall() throws Exception { 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.getCTLSchemaByFqnVersionTenantIdAndApplicationId(saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); + CTLSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationToken( + saved.getMetaInfo().getFqn(), saved.getVersion(), tenantDeveloperDto.getTenantId(), null); Assert.assertNotNull(loaded); Assert.assertEquals(saved, loaded); } @@ -286,7 +273,7 @@ public void getSystemCTLSchemaByFqnAndVersionTest() throws Exception { this.loginKaaAdmin(); CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, null, null, null, null); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto loaded = client.getCTLSchemaByFqnVersionTenantIdAndApplicationId(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); } @@ -328,26 +315,11 @@ public void getCTLSchemaByIdTest() throws Exception { */ @Test public void downloadCtlSchemaTest() throws Exception { - this.loginTenantDeveloper(tenantDeveloperUser); - String name = this.ctlRandomFieldType(); - CTLSchemaDto saved = this.createCTLSchema(name, CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); - FileData fd = client.downloadCtlSchema(client.getCTLSchemaById(saved.getId()), CTLSchemaExportMethod.FLAT); - Assert.assertNotNull(fd); - Schema loaded = new Parser().parse(new String(fd.getFileData())); - Assert.assertEquals(name, loaded.getName()); - } - - /** - * Retrieves a CTL schema by its id. - * - * @throws Exception - */ - @Test - public void downloadCtlSchemaByAppTokenTest() 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.getId(), null, null); + 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); Schema loaded = new Parser().parse(new String(fd.getFileData())); @@ -361,41 +333,6 @@ public void downloadCtlSchemaByAppTokenTest() 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); - String fqn = saved.getMetaInfo().getFqn(); - boolean result = client.checkFqnExists(fqn, tenantDeveloperDto.getTenantId(), null); - Assert.assertFalse(result); - result = client.checkFqnExists(fqn, tenantDeveloperDto.getTenantId(), "123"); - Assert.assertFalse(result); - result = client.checkFqnExists(fqn, null, null); - Assert.assertFalse(result); - - ApplicationDto application1 = createApplication(tenantAdminDto); - ApplicationDto application2 = createApplication(tenantAdminDto); - this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto schema1 = this.createCTLSchema("TestAppFqn1", CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application1.getId(), null, null); - this.createCTLSchema("TestAppFqn1", CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application2.getId(), null, null); - - fqn = schema1.getMetaInfo().getFqn(); - - result = client.checkFqnExists(fqn, tenantDeveloperDto.getTenantId(), application1.getId()); - Assert.assertTrue(result); - - result = client.checkFqnExists(fqn, tenantDeveloperDto.getTenantId(), application2.getId()); - Assert.assertTrue(result); - - result = client.checkFqnExists(fqn, tenantDeveloperDto.getTenantId(), null); - Assert.assertFalse(result); - } - - /** - * Check existence of CTL schema with same fqn and another scope - * - * @throws Exception - */ - @Test - public void checkCTLFqnExistsWithAppTokenTest() throws Exception { this.loginTenantDeveloper(tenantDeveloperUser); CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); String fqn = saved.getMetaInfo().getFqn(); @@ -407,8 +344,10 @@ public void checkCTLFqnExistsWithAppTokenTest() throws Exception { ApplicationDto application1 = createApplication(tenantAdminDto); ApplicationDto application2 = createApplication(tenantAdminDto); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto schema1 = this.createCTLSchema("TestAppFqn1", CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application1.getId(), null, null); - this.createCTLSchema("TestAppFqn1", CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application2.getId(), null, null); + 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); + fqn = schema1.getMetaInfo().getFqn(); @@ -427,7 +366,8 @@ public void updateCTLSchemaScopeTest() throws Exception { ApplicationDto application = createApplication(tenantAdminDto); this.loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto saved = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application.getId(), null, null); + 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()); @@ -481,12 +421,14 @@ public void promoteScopeToTenantWithDependenciesInAppScopeTest() throws Exceptio ApplicationDto application = createApplication(tenantAdminDto); loginTenantDeveloper(tenantDeveloperUser); - CTLSchemaDto dep = createCTLSchema(ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), application.getId(), null, null); + 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(), application.getId(), deps, fields); + 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/ControlServerConfigurationSchemaIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerConfigurationSchemaIT.java index 24bfaa0a8c..5f58bdc915 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerConfigurationSchemaIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerConfigurationSchemaIT.java @@ -81,43 +81,6 @@ public void testGetConfigurationSchema() throws Exception { assertConfigurationSchemasEquals(configurationSchema, storedConfigurationSchema); } - /** - * Test get configuration schemas by application id. - * - * @throws Exception the exception - */ - @Test - public void testGetConfigurationSchemasByApplicationId() throws Exception { - - List configurationSchemas = new ArrayList(11); - ApplicationDto application = createApplication(tenantAdminDto); - - loginTenantDeveloper(tenantDeveloperDto.getUsername()); - - List defaultConfigurationSchemas = client.getConfigurationSchemas(application.getId()); - configurationSchemas.addAll(defaultConfigurationSchemas); - - for (int i=0;i<10;i++) { - ConfigurationSchemaDto configurationSchema = createConfigurationSchema(application.getId()); - configurationSchemas.add(configurationSchema); - } - - Collections.sort(configurationSchemas, new IdComparator()); - - List storedConfigurationSchemas = client.getConfigurationSchemas(application.getId()); - - Collections.sort(storedConfigurationSchemas, new IdComparator()); - - Assert.assertEquals(configurationSchemas.size(), storedConfigurationSchemas.size()); - for (int i=0;i configurationSchemas = new ArrayList(11); - ApplicationDto application = createApplication(tenantAdminDto); - - loginTenantDeveloper(tenantDeveloperDto.getUsername()); - - List defaultConfigurationSchemas = client.getConfigurationSchemas(application.getId()); - configurationSchemas.addAll(defaultConfigurationSchemas); - - for (int i=0;i<10;i++) { - ConfigurationSchemaDto configurationSchema = createConfigurationSchema(application.getId()); - configurationSchemas.add(configurationSchema); - } - - Collections.sort(configurationSchemas, new IdComparator()); - - SchemaVersions schemaVersions = client.getSchemaVersionsByApplicationId(application.getId()); - - List storedConfigurationSchemas = schemaVersions.getConfigurationSchemaVersions(); - - Collections.sort(storedConfigurationSchemas, new IdComparator()); - - Assert.assertEquals(configurationSchemas.size(), storedConfigurationSchemas.size()); - for (int i=0;i endpointGroups = new ArrayList<>(11); - - ApplicationDto application = createApplication(tenantAdminDto); - loginTenantDeveloper(tenantDeveloperDto.getUsername()); - - List defaultEndpointGroups = client.getEndpointGroups(application.getId()); - endpointGroups.addAll(defaultEndpointGroups); - - for (int i = 0; i < 10; i++) { - EndpointGroupDto endpointGroup = createEndpointGroup(application.getId()); - endpointGroups.add(endpointGroup); - } - - Collections.sort(endpointGroups, new IdComparator()); - - List storedEndpointGroups = client.getEndpointGroups(application.getId()); - - Collections.sort(storedEndpointGroups, new IdComparator()); - - Assert.assertEquals(endpointGroups.size(), storedEndpointGroups.size()); - for (int i=0;i found = client.getLogAppenders(appenderDto.getApplicationId()); - Assert.assertEquals(1, found.size()); - } - /** * Gets the log appenders by application token test. * diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerLogSchemaIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerLogSchemaIT.java index 17e7e70df3..f38c0d6280 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerLogSchemaIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerLogSchemaIT.java @@ -30,19 +30,6 @@ */ public class ControlServerLogSchemaIT extends AbstractTestControlServer { - /** - * Gets the log schemas by application id test. - * - * @return the log schemas by application id test - * @throws Exception the exception - */ - @Test - public void getLogSchemasByApplicationIdTest() throws Exception { - LogSchemaDto logSchemaDto = createLogSchema(); - List found = client.getLogSchemas(logSchemaDto.getApplicationId()); - Assert.assertEquals(2, found.size()); - } - /** * Gets the log schemas by application token test. * @@ -84,20 +71,6 @@ public void getLogSchemaByApplicationTokenAndVersionTest() throws Exception { Assert.assertEquals(logSchemaDto, found); } - /** - * Gets the log schema versions by application id test. - * - * @return the log schema versions by application id test - * @throws Exception the exception - */ - @Test - public void getLogSchemaVersionsByApplicationIdTest() throws Exception { - LogSchemaDto logSchemaDto = createLogSchema(); - SchemaVersions schemaVersions = client.getSchemaVersionsByApplicationId(logSchemaDto.getApplicationId()); - List found = schemaVersions.getLogSchemaVersions(); - Assert.assertEquals(2, found.size()); - } - /** * Gets the log schema versions by application token test. * diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerNotificationSchemaIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerNotificationSchemaIT.java index fc4c79974c..163f3106f4 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerNotificationSchemaIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerNotificationSchemaIT.java @@ -65,22 +65,6 @@ public void testGetNotificationSchema() throws Exception { } - /** - * Test get notification schemas by app id. - * - * @throws Exception the exception - */ - @Test - public void testGetNotificationSchemasByAppId() throws Exception { - NotificationSchemaDto schemaDto = createNotificationSchema(null, NotificationTypeDto.SYSTEM); - Assert.assertNotNull(schemaDto.getId()); - LOG.debug("Create notification schema with id {}", schemaDto.getId()); - List foundSchema = client.getNotificationSchemas(schemaDto.getApplicationId()); - Assert.assertFalse(foundSchema.isEmpty()); - Assert.assertEquals(2, foundSchema.size()); - Assert.assertEquals(schemaDto, foundSchema.get(1)); - } - /** * Test get notification schemas by app token. * @@ -98,22 +82,6 @@ public void testGetNotificationSchemasByAppToken() throws Exception { Assert.assertEquals(schemaDto, foundSchema.get(1)); } - /** - * Test get user notification schemas by app id. - * - * @throws Exception the exception - */ - @Test - public void testGetUserNotificationSchemasByAppId() throws Exception { - NotificationSchemaDto schemaDto = createNotificationSchema(null, NotificationTypeDto.USER); - Assert.assertNotNull(schemaDto.getId()); - LOG.debug("Create notification schema with id {}", schemaDto.getId()); - List foundSchema = client.getUserNotificationSchemas(schemaDto.getApplicationId()); - Assert.assertFalse(foundSchema.isEmpty()); - Assert.assertEquals(2, foundSchema.size()); - assertSchemasEquals(schemaDto, foundSchema.get(1)); - } - /** * Test get user notification schemas by app id. * @@ -131,23 +99,6 @@ public void testGetUserNotificationSchemasByAppToken() throws Exception { assertSchemasEquals(schemaDto, foundSchema.get(1)); } - /** - * Test get notification schema versions by app id. - * - * @throws Exception the exception - */ - @Test - public void testGetNotificationSchemaVersionsByAppId() throws Exception { - NotificationSchemaDto schemaDto = createNotificationSchema(null, NotificationTypeDto.USER); - Assert.assertNotNull(schemaDto.getId()); - LOG.debug("Create notification schema with id {}", schemaDto.getId()); - SchemaVersions schemaVersions = client.getSchemaVersionsByApplicationId(schemaDto.getApplicationId()); - List foundSchema = schemaVersions.getNotificationSchemaVersions(); - Assert.assertFalse(foundSchema.isEmpty()); - Assert.assertEquals(2, foundSchema.size()); - assertSchemasEquals(schemaDto, foundSchema.get(1)); - } - /** * Test get notification schema versions by app token. * 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 a99c4a9402..84e43ede38 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 @@ -65,7 +65,7 @@ public void testGetProfileSchema() throws Exception { * @throws Exception the exception */ @Test - public void testGetProfileSchemasByApplicationId() throws Exception { + public void testGetProfileSchemasByApplicationToken() throws Exception { List profileSchemas = new ArrayList<>(11); ApplicationDto application = createApplication(tenantAdminDto); @@ -74,7 +74,7 @@ public void testGetProfileSchemasByApplicationId() throws Exception { CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); - List defaultProfileSchemas = client.getProfileSchemas(application.getId()); + List defaultProfileSchemas = client.getProfileSchemas(application.getApplicationToken()); profileSchemas.addAll(defaultProfileSchemas); for (int i=0;i<10;i++) { @@ -84,7 +84,7 @@ public void testGetProfileSchemasByApplicationId() throws Exception { Collections.sort(profileSchemas, new IdComparator()); - List storedProfileSchemas = client.getProfileSchemas(application.getId()); + List storedProfileSchemas = client.getProfileSchemas(application.getApplicationToken()); Collections.sort(storedProfileSchemas, new IdComparator()); @@ -95,45 +95,6 @@ public void testGetProfileSchemasByApplicationId() throws Exception { assertProfileSchemasEquals(profileSchema, storedProfileSchema); } } - - /** - * Test get profile schema versions by application id. - * - * @throws Exception the exception - */ - @Test - public void testGetProfileSchemaVersionsByApplicationId() throws Exception { - - List profileSchemas = new ArrayList<>(11); - ApplicationDto application = createApplication(tenantAdminDto); - - loginTenantDeveloper(tenantDeveloperDto.getUsername()); - - List defaultProfileSchemas = client.getProfileSchemas(application.getId()); - profileSchemas.addAll(defaultProfileSchemas); - - 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()); - profileSchemas.add(profileSchema); - } - - Collections.sort(profileSchemas, new IdComparator()); - - SchemaVersions schemaVersions = client.getSchemaVersionsByApplicationId(application.getId()); - - List storedProfileSchemas = schemaVersions.getProfileSchemaVersions(); - - Collections.sort(storedProfileSchemas, new IdComparator()); - - Assert.assertEquals(profileSchemas.size(), storedProfileSchemas.size()); - for (int i=0;i defaultProfileSchemas = client.getProfileSchemas(application.getId()); + List defaultProfileSchemas = client.getProfileSchemas(application.getApplicationToken()); profileSchemas.addAll(defaultProfileSchemas); CTLSchemaDto ctlSchema = this.createCTLSchema(this.ctlRandomFieldType(), CTL_DEFAULT_NAMESPACE, 1, tenantDeveloperDto.getTenantId(), null, null, null); diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerSdkIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerSdkIT.java index 41f6943906..3584441b73 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerSdkIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerSdkIT.java @@ -71,7 +71,7 @@ public void testGenerateJavaSdkWithEventSupport() throws Exception { NotificationSchemaDto notificationSchema = createUserNotificationSchema(application.getId()); LogSchemaDto logSchema = createLogSchema(application.getId()); - ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getId(), null, 1); + ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getApplicationToken(), null, 1); List aefMapIds = Collections.singletonList(aefMap.getId()); FileData sdk = client.downloadSdk(getSdkProfile(application.getId(), profileSchema.getVersion(), @@ -97,7 +97,7 @@ public void testGenerateAndroidSdkWithEventSupport() throws Exception { NotificationSchemaDto notificationSchema = createUserNotificationSchema(application.getId()); LogSchemaDto logSchema = createLogSchema(application.getId()); - ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getId(), null, 1); + ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getApplicationToken(), null, 1); List aefMapIds = Collections.singletonList(aefMap.getId()); FileData sdk = client.downloadSdk(getSdkProfile(application.getId(), profileSchema.getVersion(), @@ -145,7 +145,7 @@ public void testGenerateCppSdkWithEventSupport() throws Exception { NotificationSchemaDto notificationSchema = createUserNotificationSchema(application.getId()); LogSchemaDto logSchema = createLogSchema(application.getId()); - ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getId(), null, 1); + ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getApplicationToken(), null, 1); List aefMapIds = Collections.singletonList(aefMap.getId()); FileData sdk = client.downloadSdk(getSdkProfile(application.getId(), profileSchema.getVersion(), @@ -196,7 +196,7 @@ public void testGenerateCSdkWithEventSupport() throws Exception { NotificationSchemaDto notificationSchema = createUserNotificationSchema(application.getId()); LogSchemaDto logSchema = createLogSchema(application.getId()); - ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getId(), null, 1); + ApplicationEventFamilyMapDto aefMap = createApplicationEventFamilyMap(application.getApplicationToken(), null, 1); List aefMapIds = Collections.singletonList(aefMap.getId()); FileData sdk = client.downloadSdk(getSdkProfile(application.getId(), profileSchema.getVersion(), diff --git a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerTopicIT.java b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerTopicIT.java index 3c2bb2ed5e..6ee8bd4f71 100644 --- a/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerTopicIT.java +++ b/server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerTopicIT.java @@ -62,21 +62,6 @@ public void testGetTopic() throws Exception { Assert.assertEquals(topic, storedTopic); } - /** - * Test get topic by app id. - * - * @throws Exception the exception - */ - @Test - public void testGetTopicByAppId() throws Exception { - TopicDto topic = createTopic(null, TopicTypeDto.MANDATORY); - LOG.debug("Created topic with id {}", topic.getId()); - List storedTopic = client.getTopicsByApplicationId(topic.getApplicationId()); - Assert.assertNotNull(storedTopic); - Assert.assertFalse(storedTopic.isEmpty()); - Assert.assertEquals(topic, storedTopic.get(0)); - } - /** * Test get topic by app token. *