Skip to content

Commit

Permalink
KAA-1423: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
agulenko committed Sep 28, 2016
1 parent 63d2235 commit fc715b4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
Expand Up @@ -84,6 +84,7 @@

<bean id="userConfigurationService" class="org.kaaproject.kaa.server.common.dao.service.UserConfigurationServiceImpl">
<property name="endpointUserConfigurationDao" ref="endpointUserConfigurationDao"/>
<property name="endpointUserDao" ref="endpointUserDao"/>
</bean>

<bean id="endpointSpecificConfigurationService"
Expand Down
Expand Up @@ -41,10 +41,10 @@ public class EndpointSpecificConfigurationServiceImplTest {
private static final byte[] DECODED_KEY = Base64Utils.decodeFromString(KEY);
private static final int CONF_VERSION = 7;
private static final EndpointSpecificConfigurationServiceImpl SERVICE = new EndpointSpecificConfigurationServiceImpl();
EndpointSpecificConfigurationDao daoMock = mock(EndpointSpecificConfigurationDao.class);
EndpointService endpointServiceMock = mock(EndpointService.class);
ConfigurationService configurationServiceMock = mock(ConfigurationService.class);
EndpointSpecificConfiguration configuration = mock(EndpointSpecificConfiguration.class);
private EndpointSpecificConfigurationDao daoMock = mock(EndpointSpecificConfigurationDao.class);
private EndpointService endpointServiceMock = mock(EndpointService.class);
private ConfigurationService configurationServiceMock = mock(ConfigurationService.class);
private EndpointSpecificConfiguration configuration = mock(EndpointSpecificConfiguration.class);

@Before
public void setUp() throws Exception {
Expand Down
Expand Up @@ -65,7 +65,6 @@ public MongoEndpointSpecificConfiguration(EndpointSpecificConfigurationDto dto)
generateId();
}


@Override
public EndpointSpecificConfigurationDto toDto() {
EndpointSpecificConfigurationDto dto = new EndpointSpecificConfigurationDto();
Expand Down
Expand Up @@ -103,7 +103,7 @@ protected EndpointRegistrationDto generateEndpointRegistration(String applicatio
* @param configurationVersion The endpoint configuration version
* @param configuration The configuration body
* @param version The endpoint specific configuration version
* @return Saved endpoint specific configuration
* @return saved endpoint specific configuration
*/
protected EndpointSpecificConfigurationDto generateEndpointSpecificConfigurationDto(String endpointKeyHash, Integer configurationVersion, String configuration, Long version) {
EndpointSpecificConfigurationDto dto = new EndpointSpecificConfigurationDto(endpointKeyHash, configurationVersion, configuration, version);
Expand Down
Expand Up @@ -290,7 +290,7 @@ public void editUserConfiguration(
*/
@ApiOperation(value = "Create or update endpoint specific configuration",
notes = "Creates or updates endpoint specific configuration. If a configuration for target endpoint does not " +
"exist, then it will be created. If a configuration for target endpoint, it is updated. Only users " +
"exist, then it will be created. If a configuration for target endpoint exists, then it is updated. Only users " +
"with the TENANT_DEVELOPER or TENANT_USER role are allowed to perform this operation.")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Endpoint specific configuration created"),
Expand Down Expand Up @@ -321,7 +321,7 @@ public EndpointSpecificConfigurationDto editEndpointSpecificConfiguration(
"exist, then request is rejected. Only users " +
"with the TENANT_DEVELOPER or TENANT_USER role are allowed to perform this operation.")
@ApiResponses(value = {
@ApiResponse(code = 401, message = "Endpoint specific configuration successfully retrieved"),
@ApiResponse(code = 200, message = "Endpoint specific configuration successfully retrieved"),
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
Expand Down
Expand Up @@ -583,7 +583,7 @@ List<ConfigurationRecordDto> getConfigurationRecordsByEndpointGroupId(String end
void editUserConfiguration(EndpointUserConfigurationDto configuration) throws ControlServiceException;

/**
* Creates endpoint specific configuration.
* Edits endpoint specific configuration.
*
* @param configuration endpoint specific configuration
* @return saved endpoint specific configuration
Expand Down
Expand Up @@ -913,14 +913,14 @@ private void sendEndpointConfigurationRefreshMessage(String endpointKeyHash) {
OperationsNodeInfo server = resolve(endpointKeyHash);

if (server != null) {
ThriftEndpointConfigurationRefreshMessage nf = new ThriftEndpointConfigurationRefreshMessage();
nf.setAddress(new ThriftEntityAddress(appDto.getTenantId(), appDto.getApplicationToken(), ThriftClusterEntityType.ENDPOINT,
ThriftEndpointConfigurationRefreshMessage msg = new ThriftEndpointConfigurationRefreshMessage();
msg.setAddress(new ThriftEntityAddress(appDto.getTenantId(), appDto.getApplicationToken(), ThriftClusterEntityType.ENDPOINT,
ByteBuffer.wrap(endpointKeyHashBytes)));
nf.setActorClassifier(ThriftActorClassifier.GLOBAL);
msg.setActorClassifier(ThriftActorClassifier.GLOBAL);
if (LOG.isTraceEnabled()) {
LOG.trace("Sending message {} to [{}]", nf, Neighbors.getServerID(server.getConnectionInfo()));
LOG.trace("Sending message {} to [{}]", msg, Neighbors.getServerID(server.getConnectionInfo()));
}
neighbors.sendMessage(server.getConnectionInfo(), OperationsServiceMsg.fromEndpointConfigurationRefresh(nf));
neighbors.sendMessage(server.getConnectionInfo(), OperationsServiceMsg.fromEndpointConfigurationRefresh(msg));
} else {
LOG.warn("Can't find server for endpoint [{}]", endpointKeyHash);
}
Expand Down
Expand Up @@ -195,26 +195,26 @@ public String getEntityNode(byte[] entityId) {
@Override
public String sendRouteMessage(EndpointRouteMessage msg) {
String serverId = getEntityNode(msg.getAddress().getEndpointKey());
sendServerProfileUpdateMessage(serverId, OperationsServiceMsg.fromRoute(toThriftMsg(msg)));
sendOperationsServiceMessage(serverId, OperationsServiceMsg.fromRoute(toThriftMsg(msg)));
return serverId;
}

@Override
public void sendUnicastNotificationMessage(String serverId, ThriftUnicastNotificationMessage msg) {
sendServerProfileUpdateMessage(serverId, OperationsServiceMsg.fromNotification(msg));
sendOperationsServiceMessage(serverId, OperationsServiceMsg.fromNotification(msg));
}

@Override
public void sendServerProfileUpdateMessage(String serverId, ThriftServerProfileUpdateMessage msg) {
sendServerProfileUpdateMessage(serverId, OperationsServiceMsg.fromServerProfileUpdateMessage(msg));
sendOperationsServiceMessage(serverId, OperationsServiceMsg.fromServerProfileUpdateMessage(msg));
}

@Override
public void sendEndpointConfigurationRefreshMessage(String serverId, ThriftEndpointConfigurationRefreshMessage msg) {
sendServerProfileUpdateMessage(serverId, OperationsServiceMsg.fromEndpointConfigurationRefresh(msg));
sendOperationsServiceMessage(serverId, OperationsServiceMsg.fromEndpointConfigurationRefresh(msg));
}

private void sendServerProfileUpdateMessage(String serverId, OperationsServiceMsg msg) {
private void sendOperationsServiceMessage(String serverId, OperationsServiceMsg msg) {
NeighborConnection<MessageTemplate, OperationsServiceMsg> server = neighbors.getNeghborConnection(serverId);
if (server == null) {
LOG.warn("Specified server {} not found in neighbors list", serverId);
Expand Down

0 comments on commit fc715b4

Please sign in to comment.