You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by of...@apache.org on 2020/01/09 17:18:27 UTC

[incubator-dlab] 02/03: [DLAB-1432](Part 2) Support a multiple cloud functionality

This is an automated email from the ASF dual-hosted git repository.

ofuks pushed a commit to branch multiple-cloud
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit d36cccacdfed788a814536e66215715d8a509ebc
Author: Oleh Fuks <ol...@gmail.com>
AuthorDate: Thu Jan 9 19:14:32 2020 +0200

    [DLAB-1432](Part 2) Support a multiple cloud functionality
---
 .../dlab/backendapi/SelfServiceApplication.java    |   2 -
 .../java/com/epam/dlab/backendapi/dao/KeyDAO.java  | 190 ----------
 .../epam/dlab/backendapi/dao/aws/AwsKeyDao.java    |  45 ---
 .../dlab/backendapi/dao/azure/AzureKeyDao.java     |  47 ---
 .../epam/dlab/backendapi/dao/gcp/GcpKeyDao.java    |  47 ---
 .../backendapi/modules/AwsSelfServiceModule.java   |   7 -
 .../backendapi/modules/AzureSelfServiceModule.java |   7 -
 .../backendapi/modules/CloudProviderModule.java    |   8 -
 .../epam/dlab/backendapi/modules/DevModule.java    |   2 -
 .../backendapi/modules/GcpSelfServiceModule.java   |   8 -
 .../dlab/backendapi/modules/ProductionModule.java  |   2 -
 .../dlab/backendapi/resources/EdgeResource.java    |  74 ----
 .../backendapi/resources/EnvironmentResource.java  |  21 --
 .../backendapi/resources/KeyUploaderResource.java  | 131 -------
 .../resources/callback/aws/EdgeCallbackAws.java    |  65 ----
 .../callback/aws/KeyUploaderCallbackAws.java       |  66 ----
 .../callback/azure/EdgeCallbackAzure.java          |  63 ----
 .../callback/azure/KeyUploaderCallbackAzure.java   |  70 ----
 .../resources/callback/base/EdgeCallback.java      |  78 ----
 .../callback/base/KeyUploaderCallback.java         |  58 ---
 .../resources/callback/gcp/EdgeCallbackGcp.java    |  63 ----
 .../callback/gcp/KeyUploaderCallbackGcp.java       |  68 ----
 .../dlab/backendapi/service/AccessKeyService.java  |   9 -
 .../epam/dlab/backendapi/service/EdgeService.java  |  35 --
 .../backendapi/service/EnvironmentService.java     |   4 -
 .../backendapi/service/ReuploadKeyService.java     |   2 -
 .../backendapi/service/UserResourceService.java    |  33 --
 .../service/impl/AccessKeyServiceImpl.java         | 119 ------
 .../backendapi/service/impl/EdgeServiceImpl.java   | 153 --------
 .../service/impl/EnvironmentServiceImpl.java       |  36 +-
 .../impl/InfrastructureTemplateServiceImpl.java    |  12 +-
 .../service/impl/ReuploadKeyServiceImpl.java       |  33 +-
 .../service/impl/UserResourceServiceImpl.java      |  95 -----
 .../backendapi/resources/EdgeResourceTest.java     | 164 ---------
 .../resources/EnvironmentResourceTest.java         |  98 -----
 .../resources/KeyUploaderResourceTest.java         | 405 ---------------------
 .../service/impl/AccessKeyServiceImplTest.java     | 311 ----------------
 .../service/impl/EdgeServiceImplTest.java          | 241 ------------
 .../service/impl/EnvironmentServiceImplTest.java   | 126 +------
 .../service/impl/ReuploadKeyServiceImplTest.java   | 142 +-------
 .../service/impl/UserResourceServiceImplTest.java  | 109 ------
 41 files changed, 25 insertions(+), 3224 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java
index da6a5c5..cffd327 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java
@@ -129,8 +129,6 @@ public class SelfServiceApplication extends Application<SelfServiceApplicationCo
 		jersey.register(new ValidationExceptionMapper());
 		jersey.register(new ResourceQuoteReachedExceptionMapper());
 		jersey.register(injector.getInstance(SecurityResource.class));
-		jersey.register(injector.getInstance(KeyUploaderResource.class));
-		jersey.register(injector.getInstance(EdgeResource.class));
 
 		jersey.register(injector.getInstance(InfrastructureTemplateResource.class));
 		jersey.register(injector.getInstance(InfrastructureInfoResource.class));
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/KeyDAO.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/KeyDAO.java
deleted file mode 100644
index 8bce841..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/KeyDAO.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.dao;
-
-
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.base.edge.EdgeInfo;
-import com.epam.dlab.dto.keyload.KeyLoadStatus;
-import com.epam.dlab.dto.keyload.UserKeyDTO;
-import com.epam.dlab.exceptions.DlabException;
-import com.mongodb.client.model.Updates;
-import org.bson.Document;
-
-import java.util.Date;
-import java.util.Optional;
-
-import static com.epam.dlab.backendapi.dao.MongoCollections.USER_EDGE;
-import static com.epam.dlab.backendapi.dao.MongoCollections.USER_KEYS;
-import static com.mongodb.client.model.Filters.*;
-import static com.mongodb.client.model.Projections.*;
-import static com.mongodb.client.model.Updates.set;
-
-/**
- * DAO for manage the user key.
- */
-public abstract class KeyDAO extends BaseDAO {
-	private static final String EDGE_STATUS = "edge_status";
-	private static final String KEY_CONTENT = "content";
-
-	/**
-	 * Write the status of user key to Mongo database.
-	 *
-	 * @param user   user name
-	 * @param status the status of user key.
-	 */
-	public void updateKey(String user, String status) {
-		updateOne(USER_KEYS, eq(ID, user), set(STATUS, status));
-	}
-
-	/**
-	 * Delete the user key from Mongo database.
-	 *
-	 * @param user user name
-	 */
-	public void deleteKey(String user) {
-		mongoService.getCollection(USER_KEYS).deleteOne(eq(ID, user));
-	}
-
-	/**
-	 * Inserts ('insertRequired' equals 'true') or updates ('insertRequired' equals 'false') the user key to/in Mongo
-	 * database.
-	 *
-	 * @param user           user name
-	 * @param content        key content
-	 * @param insertRequired true/false
-	 */
-	public void upsertKey(final String user, String content, boolean insertRequired) {
-		Document doc = new Document(SET,
-				new Document()
-						.append(ID, user)
-						.append(KEY_CONTENT, content)
-						.append(STATUS, insertRequired ? KeyLoadStatus.NEW.getStatus() :
-								KeyLoadStatus.SUCCESS.getStatus())
-						.append(TIMESTAMP, new Date()));
-		updateOne(USER_KEYS, eq(ID, user), doc, insertRequired);
-	}
-
-	/**
-	 * Finds and returns the user key with the specified status
-	 *
-	 * @param user   user name.
-	 * @param status key status
-	 */
-	public UserKeyDTO fetchKey(String user, KeyLoadStatus status) {
-		return findOne(USER_KEYS,
-				and(eq(ID, user), eq(STATUS, status.getStatus())),
-				UserKeyDTO.class)
-				.orElseThrow(() -> new DlabException(String.format("Key of user %s with status %s not found", user,
-						status.getStatus())));
-	}
-
-	/**
-	 * Store the EDGE of user to Mongo database.
-	 *
-	 * @param user     user name
-	 * @param edgeInfo the EDGE of user
-	 */
-	public void updateEdgeInfo(String user, EdgeInfo edgeInfo) {
-		Document d = new Document(SET,
-				convertToBson(edgeInfo)
-						.append(ID, user));
-		updateOne(USER_EDGE,
-				eq(ID, user),
-				d,
-				true);
-	}
-
-	public abstract EdgeInfo getEdgeInfo(String user);
-
-	public <T extends EdgeInfo> T getEdgeInfo(String user, Class<T> target, T defaultValue) {
-		return findOne(USER_EDGE,
-				eq(ID, user), target)
-				.orElse(defaultValue);
-	}
-
-	public abstract Optional<? extends EdgeInfo> getEdgeInfoWhereStatusIn(String user, UserInstanceStatus... statuses);
-
-	protected <T extends EdgeInfo> Optional<T> getEdgeInfoWhereStatusIn(String user, Class<T> target,
-																		UserInstanceStatus... statuses) {
-		return findOne(USER_EDGE,
-				and(eq(ID, user), in(EDGE_STATUS, statusList(statuses))),
-				target);
-	}
-
-	/**
-	 * Finds and returns the status of user key.
-	 *
-	 * @param user user name
-	 */
-	public KeyLoadStatus findKeyStatus(String user) {
-		return findOne(USER_KEYS, eq(ID, user), UserKeyDTO.class)
-				.map(UserKeyDTO::getStatus)
-				.map(KeyLoadStatus::findByStatus)
-				.orElse(KeyLoadStatus.NONE);
-	}
-
-	/**
-	 * Updates the status of EDGE node.
-	 *
-	 * @param user   user name
-	 * @param status status of EDGE node
-	 */
-	public void updateEdgeStatus(String user, String status) {
-		updateOne(USER_EDGE,
-				eq(ID, user),
-				Updates.set(EDGE_STATUS, status));
-	}
-
-	/**
-	 * Return the status of EDGE node.
-	 *
-	 * @param user user name
-	 */
-	public String getEdgeStatus(String user) {
-		Document d = findOne(USER_EDGE,
-				eq(ID, user),
-				fields(include(EDGE_STATUS), excludeId())).orElse(null);
-		return (d == null ? "" : d.getString(EDGE_STATUS));
-	}
-
-	public void removeEdge(String user) {
-		deleteOne(USER_EDGE, eq(ID, user));
-	}
-
-	public boolean edgeNodeExist(String user) {
-		return findOne(USER_EDGE, and(eq(ID, user), not(in(EDGE_STATUS, UserInstanceStatus.TERMINATING.toString(),
-				UserInstanceStatus.TERMINATED.toString()))))
-				.isPresent();
-	}
-
-	/**
-	 * Updates the field 'reupload_key_required' of EDGE node.
-	 *
-	 * @param user                user name
-	 * @param reuploadKeyRequired true/false
-	 * @param edgeStatuses        allowable edge statuses
-	 */
-	public void updateEdgeReuploadKey(String user, boolean reuploadKeyRequired, UserInstanceStatus... edgeStatuses) {
-		updateOne(USER_EDGE,
-				and(eq(ID, user), in(EDGE_STATUS, statusList(edgeStatuses))),
-				Updates.set(REUPLOAD_KEY_REQUIRED, reuploadKeyRequired));
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/aws/AwsKeyDao.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/aws/AwsKeyDao.java
deleted file mode 100644
index 745a2cd..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/aws/AwsKeyDao.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.dao.aws;
-
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.aws.edge.EdgeInfoAws;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.Optional;
-
-@Slf4j
-public class AwsKeyDao extends KeyDAO {
-
-	public AwsKeyDao() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	@Override
-	public EdgeInfoAws getEdgeInfo(String user) {
-		return super.getEdgeInfo(user, EdgeInfoAws.class, new EdgeInfoAws());
-	}
-
-	@Override
-	public Optional<EdgeInfoAws> getEdgeInfoWhereStatusIn(String user, UserInstanceStatus... statuses) {
-		return super.getEdgeInfoWhereStatusIn(user, EdgeInfoAws.class, statuses);
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/azure/AzureKeyDao.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/azure/AzureKeyDao.java
deleted file mode 100644
index 4a7ec1b..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/azure/AzureKeyDao.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.dao.azure;
-
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.azure.edge.EdgeInfoAzure;
-import com.google.inject.Singleton;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.Optional;
-
-@Slf4j
-@Singleton
-public class AzureKeyDao extends KeyDAO {
-
-	public AzureKeyDao() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	@Override
-	public EdgeInfoAzure getEdgeInfo(String user) {
-		return super.getEdgeInfo(user, EdgeInfoAzure.class, new EdgeInfoAzure());
-	}
-
-	@Override
-	public Optional<EdgeInfoAzure> getEdgeInfoWhereStatusIn(String user, UserInstanceStatus... statuses) {
-		return super.getEdgeInfoWhereStatusIn(user, EdgeInfoAzure.class, statuses);
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/gcp/GcpKeyDao.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/gcp/GcpKeyDao.java
deleted file mode 100644
index 7057f8d..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/gcp/GcpKeyDao.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.dao.gcp;
-
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.gcp.edge.EdgeInfoGcp;
-import com.google.inject.Singleton;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.Optional;
-
-
-@Slf4j
-@Singleton
-public class GcpKeyDao extends KeyDAO {
-	public GcpKeyDao() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	@Override
-	public EdgeInfoGcp getEdgeInfo(String user) {
-		return super.getEdgeInfo(user, EdgeInfoGcp.class, new EdgeInfoGcp());
-	}
-
-	@Override
-	public Optional<EdgeInfoGcp> getEdgeInfoWhereStatusIn(String user, UserInstanceStatus... statuses) {
-		return super.getEdgeInfoWhereStatusIn(user, EdgeInfoGcp.class, statuses);
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AwsSelfServiceModule.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AwsSelfServiceModule.java
index a2f9217..f0b6077 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AwsSelfServiceModule.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AwsSelfServiceModule.java
@@ -23,14 +23,10 @@ import com.epam.dlab.backendapi.SelfServiceApplication;
 import com.epam.dlab.backendapi.annotation.BudgetLimited;
 import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
 import com.epam.dlab.backendapi.dao.BillingDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.dao.aws.AwsBillingDAO;
-import com.epam.dlab.backendapi.dao.aws.AwsKeyDao;
 import com.epam.dlab.backendapi.interceptor.BudgetLimitInterceptor;
 import com.epam.dlab.backendapi.resources.aws.BillingResourceAws;
 import com.epam.dlab.backendapi.resources.aws.ComputationalResourceAws;
-import com.epam.dlab.backendapi.resources.callback.aws.EdgeCallbackAws;
-import com.epam.dlab.backendapi.resources.callback.aws.KeyUploaderCallbackAws;
 import com.epam.dlab.backendapi.service.BillingService;
 import com.epam.dlab.backendapi.service.aws.AwsBillingService;
 import com.epam.dlab.cloud.CloudModule;
@@ -56,7 +52,6 @@ public class AwsSelfServiceModule extends CloudModule {
 	@Override
 	protected void configure() {
 		bind(BillingService.class).to(AwsBillingService.class);
-		bind((KeyDAO.class)).to(AwsKeyDao.class);
 		bind(SchedulerConfiguration.class).toInstance(
 				new SchedulerConfiguration(SelfServiceApplication.class.getPackage().getName()));
 		bind(BillingDAO.class).to(AwsBillingDAO.class);
@@ -67,8 +62,6 @@ public class AwsSelfServiceModule extends CloudModule {
 
 	@Override
 	public void init(Environment environment, Injector injector) {
-		environment.jersey().register(injector.getInstance(EdgeCallbackAws.class));
-		environment.jersey().register(injector.getInstance(KeyUploaderCallbackAws.class));
 		environment.jersey().register(injector.getInstance(ComputationalResourceAws.class));
 		environment.jersey().register(injector.getInstance(BillingResourceAws.class));
 
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AzureSelfServiceModule.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AzureSelfServiceModule.java
index b35cdfc..4ebe246 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AzureSelfServiceModule.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/AzureSelfServiceModule.java
@@ -23,14 +23,10 @@ import com.epam.dlab.backendapi.SelfServiceApplication;
 import com.epam.dlab.backendapi.annotation.BudgetLimited;
 import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
 import com.epam.dlab.backendapi.dao.BillingDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.dao.azure.AzureBillingDAO;
-import com.epam.dlab.backendapi.dao.azure.AzureKeyDao;
 import com.epam.dlab.backendapi.interceptor.BudgetLimitInterceptor;
 import com.epam.dlab.backendapi.resources.azure.BillingResourceAzure;
 import com.epam.dlab.backendapi.resources.azure.ComputationalResourceAzure;
-import com.epam.dlab.backendapi.resources.callback.azure.EdgeCallbackAzure;
-import com.epam.dlab.backendapi.resources.callback.azure.KeyUploaderCallbackAzure;
 import com.epam.dlab.backendapi.service.BillingService;
 import com.epam.dlab.backendapi.service.azure.AzureBillingService;
 import com.epam.dlab.cloud.CloudModule;
@@ -58,7 +54,6 @@ public class AzureSelfServiceModule extends CloudModule {
 	@Override
 	protected void configure() {
 		bind(BillingService.class).to(AzureBillingService.class);
-		bind((KeyDAO.class)).to(AzureKeyDao.class);
 		bind(SchedulerConfiguration.class).toInstance(
 				new SchedulerConfiguration(SelfServiceApplication.class.getPackage().getName()));
 		bind(BillingDAO.class).to(AzureBillingDAO.class);
@@ -69,8 +64,6 @@ public class AzureSelfServiceModule extends CloudModule {
 
 	@Override
 	public void init(Environment environment, Injector injector) {
-		environment.jersey().register(injector.getInstance(EdgeCallbackAzure.class));
-		environment.jersey().register(injector.getInstance(KeyUploaderCallbackAzure.class));
 		environment.jersey().register(injector.getInstance(ComputationalResourceAzure.class));
 		environment.jersey().register(injector.getInstance(BillingResourceAzure.class));
 
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/CloudProviderModule.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/CloudProviderModule.java
index c41a67d..94e190d 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/CloudProviderModule.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/CloudProviderModule.java
@@ -23,14 +23,10 @@ import com.epam.dlab.backendapi.SelfServiceApplication;
 import com.epam.dlab.backendapi.annotation.BudgetLimited;
 import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
 import com.epam.dlab.backendapi.dao.BillingDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.dao.aws.AwsBillingDAO;
-import com.epam.dlab.backendapi.dao.aws.AwsKeyDao;
 import com.epam.dlab.backendapi.interceptor.BudgetLimitInterceptor;
 import com.epam.dlab.backendapi.resources.aws.BillingResourceAws;
 import com.epam.dlab.backendapi.resources.aws.ComputationalResourceAws;
-import com.epam.dlab.backendapi.resources.callback.aws.EdgeCallbackAws;
-import com.epam.dlab.backendapi.resources.callback.aws.KeyUploaderCallbackAws;
 import com.epam.dlab.backendapi.service.BillingService;
 import com.epam.dlab.backendapi.service.InfrastructureInfoService;
 import com.epam.dlab.backendapi.service.InfrastructureTemplateService;
@@ -67,8 +63,6 @@ public class CloudProviderModule extends CloudModule {
                 new SchedulerConfiguration(SelfServiceApplication.class.getPackage().getName()));
 
 
-        bind((KeyDAO.class)).to(AwsKeyDao.class);
-
         final BudgetLimitInterceptor budgetLimitInterceptor = new BudgetLimitInterceptor();
         requestInjection(budgetLimitInterceptor);
         bindInterceptor(any(), annotatedWith(BudgetLimited.class), budgetLimitInterceptor);
@@ -76,8 +70,6 @@ public class CloudProviderModule extends CloudModule {
 
     @Override
     public void init(Environment environment, Injector injector) {
-        environment.jersey().register(injector.getInstance(EdgeCallbackAws.class));
-        environment.jersey().register(injector.getInstance(KeyUploaderCallbackAws.class));
         environment.jersey().register(injector.getInstance(ComputationalResourceAws.class));
         environment.jersey().register(injector.getInstance(BillingResourceAws.class));
     }
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/DevModule.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/DevModule.java
index 3594826..cf08d12 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/DevModule.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/DevModule.java
@@ -89,9 +89,7 @@ public class DevModule extends ModuleBase<SelfServiceApplicationConfiguration> i
 		bind(LibraryService.class).to(LibraryServiceImpl.class);
 		bind(SchedulerJobService.class).to(SchedulerJobServiceImpl.class);
 		bind(EnvironmentService.class).to(EnvironmentServiceImpl.class);
-		bind(EdgeService.class).to(EdgeServiceImpl.class);
 		bind(ReuploadKeyService.class).to(ReuploadKeyServiceImpl.class);
-		bind(UserResourceService.class).to(UserResourceServiceImpl.class);
 		bind(RESTService.class).annotatedWith(Names.named(ServiceConsts.MAVEN_SEARCH_API))
 				.toInstance(configuration.getMavenApiFactory().build(environment, ServiceConsts.MAVEN_SEARCH_API));
 
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java
index 8c9ff00..d19e3b8 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java
@@ -23,12 +23,8 @@ import com.epam.dlab.backendapi.SelfServiceApplication;
 import com.epam.dlab.backendapi.annotation.BudgetLimited;
 import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
 import com.epam.dlab.backendapi.dao.BillingDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.dao.gcp.GcpBillingDao;
-import com.epam.dlab.backendapi.dao.gcp.GcpKeyDao;
 import com.epam.dlab.backendapi.interceptor.BudgetLimitInterceptor;
-import com.epam.dlab.backendapi.resources.callback.gcp.EdgeCallbackGcp;
-import com.epam.dlab.backendapi.resources.callback.gcp.KeyUploaderCallbackGcp;
 import com.epam.dlab.backendapi.resources.gcp.BillingResourceGcp;
 import com.epam.dlab.backendapi.resources.gcp.ComputationalResourceGcp;
 import com.epam.dlab.backendapi.resources.gcp.GcpOauthResource;
@@ -57,9 +53,6 @@ public class GcpSelfServiceModule extends CloudModule {
     @Override
     @SuppressWarnings("unchecked")
     public void init(Environment environment, Injector injector) {
-
-		environment.jersey().register(injector.getInstance(EdgeCallbackGcp.class));
-		environment.jersey().register(injector.getInstance(KeyUploaderCallbackGcp.class));
 		environment.jersey().register(injector.getInstance(ComputationalResourceGcp.class));
 		environment.jersey().register(injector.getInstance(BillingResourceGcp.class));
 		if (injector.getInstance(SelfServiceApplicationConfiguration.class).isGcpOuauth2AuthenticationEnabled()) {
@@ -71,7 +64,6 @@ public class GcpSelfServiceModule extends CloudModule {
     @Override
     protected void configure() {
         bind(BillingService.class).to(GcpBillingService.class);
-        bind((KeyDAO.class)).to(GcpKeyDao.class);
         bind(BillingDAO.class).to(GcpBillingDao.class);
         bind(SchedulerConfiguration.class).toInstance(
                 new SchedulerConfiguration(SelfServiceApplication.class.getPackage().getName()));
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/ProductionModule.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/ProductionModule.java
index f66487a..0d0ae1d 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/ProductionModule.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/ProductionModule.java
@@ -78,9 +78,7 @@ public class ProductionModule extends ModuleBase<SelfServiceApplicationConfigura
 		bind(LibraryService.class).to(LibraryServiceImpl.class);
 		bind(SchedulerJobService.class).to(SchedulerJobServiceImpl.class);
 		bind(EnvironmentService.class).to(EnvironmentServiceImpl.class);
-		bind(EdgeService.class).to(EdgeServiceImpl.class);
 		bind(ReuploadKeyService.class).to(ReuploadKeyServiceImpl.class);
-		bind(UserResourceService.class).to(UserResourceServiceImpl.class);
 		bind(RESTService.class).annotatedWith(Names.named(ServiceConsts.MAVEN_SEARCH_API))
 				.toInstance(configuration.getMavenApiFactory().build(environment, ServiceConsts.MAVEN_SEARCH_API));
 		bind(ExternalLibraryService.class).to(MavenCentralLibraryService.class);
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EdgeResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EdgeResource.java
deleted file mode 100644
index 3ae31b3..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EdgeResource.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.service.EdgeService;
-import com.epam.dlab.rest.contracts.EdgeAPI;
-import com.google.inject.Inject;
-import io.dropwizard.auth.Auth;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-/**
- * Provides the REST API to manage(start/stop) edge node
- */
-@Path("/infrastructure/edge")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class EdgeResource implements EdgeAPI {
-
-	private final EdgeService edgeService;
-
-	@Inject
-	public EdgeResource(EdgeService edgeService) {
-		this.edgeService = edgeService;
-	}
-
-	/**
-	 * Starts EDGE node for user.
-	 *
-	 * @param userInfo user info.
-	 * @return Request Id.
-	 */
-	@POST
-	@Path("/start")
-	public String start(@Auth UserInfo userInfo) {
-		return edgeService.start(userInfo);
-	}
-
-	/**
-	 * Stop EDGE node for user.
-	 *
-	 * @param userInfo user info.
-	 * @return Request Id.
-	 */
-	@POST
-	@Path("/stop")
-	public String stop(@Auth UserInfo userInfo) {
-		return edgeService.stop(userInfo);
-	}
-}
\ No newline at end of file
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java
index 1bd6826..f227f3f 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java
@@ -62,17 +62,6 @@ public class EnvironmentResource {
 	@POST
 	@Consumes(MediaType.TEXT_PLAIN)
 	@Produces(MediaType.APPLICATION_JSON)
-	@Path("terminate")
-	public Response terminateEnv(@Auth UserInfo userInfo,
-								 @NotEmpty String user) {
-		log.info("User {} is terminating {} environment", userInfo.getName(), user);
-		environmentService.terminateEnvironment(userInfo, user);
-		return Response.ok().build();
-	}
-
-	@POST
-	@Consumes(MediaType.TEXT_PLAIN)
-	@Produces(MediaType.APPLICATION_JSON)
 	@Path("stop")
 	public Response stopEnv(@Auth UserInfo userInfo,
 							@NotEmpty String user) {
@@ -84,16 +73,6 @@ public class EnvironmentResource {
 	@POST
 	@Consumes(MediaType.TEXT_PLAIN)
 	@Produces(MediaType.APPLICATION_JSON)
-	@Path("stop/edge")
-	public Response stopEdge(@Auth UserInfo userInfo, @NotEmpty String user) {
-		log.info("Admin {} is stopping edge of user {}", userInfo.getName(), user);
-		environmentService.stopEdge(user);
-		return Response.ok().build();
-	}
-
-	@POST
-	@Consumes(MediaType.TEXT_PLAIN)
-	@Produces(MediaType.APPLICATION_JSON)
 	@Path("stop/{exploratoryName}")
 	public Response stopNotebook(@Auth UserInfo userInfo, @NotEmpty String user,
 								 @PathParam("exploratoryName") String exploratoryName) {
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeyUploaderResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeyUploaderResource.java
deleted file mode 100644
index a58f8dc..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeyUploaderResource.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.service.AccessKeyService;
-import com.epam.dlab.dto.keyload.KeyLoadStatus;
-import com.epam.dlab.exceptions.DlabException;
-import com.epam.dlab.exceptions.DlabValidationException;
-import com.epam.dlab.exceptions.ResourceNotFoundException;
-import com.epam.dlab.rest.contracts.EdgeAPI;
-import com.google.inject.Inject;
-import io.dropwizard.auth.Auth;
-import lombok.extern.slf4j.Slf4j;
-import org.glassfish.jersey.media.multipart.FormDataParam;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
-/**
- * Provides the REST API for upload the user key.
- */
-@Path("/user/access_key")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class KeyUploaderResource implements EdgeAPI {
-
-	private static final String FILE_ATTACHMENT_FORMAT = "attachment; filename=\"%s.pem\"";
-	private AccessKeyService keyService;
-
-	@Inject
-	public KeyUploaderResource(AccessKeyService keyService) {
-		this.keyService = keyService;
-	}
-
-	/**
-	 * Finds and returns the status of the user key.
-	 *
-	 * @param userInfo user info.
-	 * @return <pre>
-	 * {@link Status#NOT_FOUND} the user key has been not found.
-	 * {@link Status#ACCEPTED} the user key is uploading now.
-	 * {@link Status#OK} the user key is valid.
-	 * {@link Status#INTERNAL_SERVER_ERROR} the check of the status is failed.
-	 * </pre>
-	 */
-	@GET
-	public Response checkKey(@Auth UserInfo userInfo) {
-		final KeyLoadStatus status = keyService.getUserKeyStatus(userInfo.getName());
-		if (KeyLoadStatus.NONE == status) {
-			throw new ResourceNotFoundException("Key for user " + userInfo.getName() + " not found");
-		} else if (KeyLoadStatus.ERROR == status) {
-			throw new DlabException("Key for user " + userInfo.getName() + " is in error state");
-		}
-		return Response.status(status.getHttpStatus()).build();
-	}
-
-	/**
-	 * Uploads/reuploads the user key to server. If param 'isPrimaryUploading' equals 'true', then it stores
-	 * the user key to the database and calls the post method of the provisioning service for the key uploading
-	 * and edge creating for user. Else if this param equals 'false', then only replacing keys in the database
-	 * will be performed (user's key will be reuploaded).
-	 *
-	 * @param userInfo           user info.
-	 * @param fileContent        content of the user key.
-	 * @param isPrimaryUploading true if key is being primarily uploaded, false - in case of reuploading
-	 * @return 200 Ok
-	 */
-	@POST
-	@Consumes(MediaType.MULTIPART_FORM_DATA)
-	public Response loadKey( @Auth UserInfo userInfo,
-							@FormDataParam("file") String fileContent,
-							@QueryParam("is_primary_uploading") @DefaultValue("true") boolean isPrimaryUploading) {
-
-		validate(fileContent);
-		keyService.uploadKey(userInfo, fileContent, isPrimaryUploading);
-		return Response.ok().build();
-	}
-
-	/**
-	 * Creates the EDGE node and upload the user key  for user.
-	 *
-	 * @param userInfo user info.
-	 * @return {@link Response.Status#OK} request for provisioning service has been accepted.<br>
-	 */
-	@POST
-	@Path("/recover")
-	public Response recover(@Auth UserInfo userInfo) {
-		return Response.ok(keyService.recoverEdge(userInfo)).build();
-	}
-
-
-	@POST
-	@Path("/generate")
-	@Produces(MediaType.APPLICATION_OCTET_STREAM)
-	public Response generate(@Auth UserInfo userInfo,
-							 @QueryParam("is_primary_uploading") @DefaultValue("true") boolean isPrimaryUploading) {
-		final Response.ResponseBuilder builder = Response.ok(keyService.generateKey(userInfo, isPrimaryUploading));
-		builder.header(HttpHeaders.CONTENT_DISPOSITION, String.format(FILE_ATTACHMENT_FORMAT, userInfo.getName()));
-		return builder.build();
-	}
-
-	private void validate(String publicKey) {
-		if (!publicKey.startsWith("ssh-")) {
-			log.error("Wrong key format. Key should be in openSSH format");
-			log.trace("Key content:\n{}", publicKey);
-			throw new DlabValidationException("Wrong key format. Key should be in openSSH format");
-		}
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/aws/EdgeCallbackAws.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/aws/EdgeCallbackAws.java
deleted file mode 100644
index 696e0ed..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/aws/EdgeCallbackAws.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.aws;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.resources.callback.base.EdgeCallback;
-import com.epam.dlab.dto.aws.edge.EdgeInfoAws;
-import com.epam.dlab.dto.base.keyload.UploadFileResult;
-import com.epam.dlab.rest.contracts.ApiCallbacks;
-import com.google.inject.Inject;
-import io.dropwizard.auth.Auth;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/infrastructure/edge")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class EdgeCallbackAws extends EdgeCallback {
-
-	@Inject
-	private RequestId requestId;
-
-    public EdgeCallbackAws() {
-        log.info("{} is initialized", getClass().getSimpleName());
-    }
-
-    /**
-     * Stores the result of the upload the user key.
-     *
-     * @param dto result of the upload the user key.
-     * @return 200 OK
-     */
-    @POST
-    @Path(ApiCallbacks.STATUS_URI)
-    public Response status(@Auth UserInfo ui, UploadFileResult<EdgeInfoAws> dto) {
-		requestId.checkAndRemove(dto.getRequestId());
-        handleEdgeCallback(dto.getUser(), dto.getStatus());
-        return Response.ok().build();
-    }
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/aws/KeyUploaderCallbackAws.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/aws/KeyUploaderCallbackAws.java
deleted file mode 100644
index b3561ed..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/aws/KeyUploaderCallbackAws.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.aws;
-
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.resources.callback.base.KeyUploaderCallback;
-import com.epam.dlab.dto.aws.edge.EdgeInfoAws;
-import com.epam.dlab.dto.base.keyload.UploadFileResult;
-import com.google.inject.Inject;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/user/access_key")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class KeyUploaderCallbackAws {
-	@Inject
-	private KeyUploaderCallback keyUploaderCallback;
-	@Inject
-	private RequestId requestId;
-
-	public KeyUploaderCallbackAws() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	/**
-	 * Stores the result of the upload the user key.
-	 *
-	 * @param dto result of the upload the user key.
-	 * @return 200 OK
-	 */
-	@POST
-	@Path("/callback")
-	public Response loadKeyResponse(UploadFileResult<EdgeInfoAws> dto) {
-		log.debug("Upload the key result and EDGE node info for user {}: {}", dto.getUser(), dto);
-		requestId.checkAndRemove(dto.getRequestId());
-		keyUploaderCallback.handleCallback(dto.getStatus(), dto.getUser(), dto.getEdgeInfo());
-
-		return Response.ok().build();
-
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/azure/EdgeCallbackAzure.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/azure/EdgeCallbackAzure.java
deleted file mode 100644
index 0fe97b3..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/azure/EdgeCallbackAzure.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.azure;
-
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.resources.callback.base.EdgeCallback;
-import com.epam.dlab.dto.azure.edge.EdgeInfoAzure;
-import com.epam.dlab.dto.base.keyload.UploadFileResult;
-import com.epam.dlab.rest.contracts.ApiCallbacks;
-import com.google.inject.Inject;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/infrastructure/edge")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class EdgeCallbackAzure extends EdgeCallback {
-
-	@Inject
-	private RequestId requestId;
-
-	public EdgeCallbackAzure() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	/**
-	 * Stores the result of the upload the user key.
-	 *
-	 * @param dto result of the upload the user key.
-	 * @return 200 OK
-	 */
-	@POST
-	@Path(ApiCallbacks.STATUS_URI)
-	public Response status(UploadFileResult<EdgeInfoAzure> dto) {
-		requestId.checkAndRemove(dto.getRequestId());
-		handleEdgeCallback(dto.getUser(), dto.getStatus());
-		return Response.ok().build();
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/azure/KeyUploaderCallbackAzure.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/azure/KeyUploaderCallbackAzure.java
deleted file mode 100644
index b383ce0..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/azure/KeyUploaderCallbackAzure.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.azure;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.resources.callback.base.KeyUploaderCallback;
-import com.epam.dlab.dto.azure.edge.EdgeInfoAzure;
-import com.epam.dlab.dto.base.keyload.UploadFileResult;
-import com.google.inject.Inject;
-import io.dropwizard.auth.Auth;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/user/access_key")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class KeyUploaderCallbackAzure {
-
-    @Inject
-    private KeyUploaderCallback keyUploaderCallback;
-
-	@Inject
-	private RequestId requestId;
-
-    public KeyUploaderCallbackAzure() {
-        log.info("{} is initialized", getClass().getSimpleName());
-    }
-
-    /**
-     * Stores the result of the upload the user key.
-     *
-     * @param dto result of the upload the user key.
-     * @return 200 OK
-     */
-    @POST
-    @Path("/callback")
-	public Response loadKeyResponse(UploadFileResult<EdgeInfoAzure> dto) {
-        log.debug("Upload the key result and EDGE node info for user {}: {}", dto.getUser(), dto);
-		requestId.checkAndRemove(dto.getRequestId());
-        keyUploaderCallback.handleCallback(dto.getStatus(), dto.getUser(), dto.getEdgeInfo());
-
-        return Response.ok().build();
-
-    }
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/base/EdgeCallback.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/base/EdgeCallback.java
deleted file mode 100644
index 48ca592..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/base/EdgeCallback.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.base;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.backendapi.service.ExploratoryService;
-import com.epam.dlab.backendapi.service.ReuploadKeyService;
-import com.epam.dlab.backendapi.service.SecurityService;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.base.edge.EdgeInfo;
-import com.epam.dlab.exceptions.DlabException;
-import com.epam.dlab.model.ResourceData;
-import com.google.inject.Inject;
-import lombok.extern.slf4j.Slf4j;
-
-import static com.epam.dlab.dto.UserInstanceStatus.RUNNING;
-
-@Slf4j
-public class EdgeCallback {
-	@Inject
-	private KeyDAO keyDAO;
-	@Inject
-	private ExploratoryService exploratoryService;
-	@Inject
-	private SecurityService securityService;
-	@Inject
-	private ReuploadKeyService reuploadKeyService;
-
-	protected EdgeCallback() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	protected void handleEdgeCallback(String user, String status) {
-		EdgeInfo edgeInfo = keyDAO.getEdgeInfo(user);
-		log.debug("Current status of edge node for user {} is {}", user,
-				UserInstanceStatus.of(edgeInfo.getEdgeStatus()));
-
-		try {
-			if (UserInstanceStatus.of(status) == UserInstanceStatus.TERMINATED) {
-				log.debug("Removing key for user {}", user);
-				keyDAO.deleteKey(user);
-				keyDAO.removeEdge(user);
-			}
-			log.debug("Updating the status of EDGE node for user {} to {}", user, status);
-			keyDAO.updateEdgeStatus(user, status);
-
-		} catch (DlabException e) {
-			log.error("Could not update status of EDGE node for user {} to {}", user, status, e);
-			throw new DlabException(String.format("Could not update status of EDGE node to %s: %s",
-					status, e.getLocalizedMessage()), e);
-		}
-		if (UserInstanceStatus.of(status) == RUNNING && edgeInfo.isReuploadKeyRequired()) {
-			ResourceData resourceData = ResourceData.edgeResource(edgeInfo.getInstanceId());
-			UserInfo userInfo = securityService.getUserInfoOffline(user);
-			reuploadKeyService.reuploadKeyAction(userInfo, resourceData);
-		}
-	}
-
-
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/base/KeyUploaderCallback.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/base/KeyUploaderCallback.java
deleted file mode 100644
index 5c6e81d..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/base/KeyUploaderCallback.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.base;
-
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.base.edge.EdgeInfo;
-import com.epam.dlab.dto.keyload.KeyLoadStatus;
-import com.epam.dlab.exceptions.DlabException;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import lombok.extern.slf4j.Slf4j;
-
-@Singleton
-@Slf4j
-public class KeyUploaderCallback {
-    @Inject
-    private KeyDAO keyDAO;
-
-    public void handleCallback(String status, String user, EdgeInfo edgeInfo) {
-
-        boolean isSuccess = UserInstanceStatus.of(status) == UserInstanceStatus.RUNNING;
-        try {
-            keyDAO.updateKey(user, KeyLoadStatus.getStatus(isSuccess));
-            if (isSuccess) {
-                keyDAO.updateEdgeInfo(user, edgeInfo);
-            } else {
-                UserInstanceStatus instanceStatus = UserInstanceStatus.of(keyDAO.getEdgeStatus(user));
-                if (instanceStatus == null) {
-                    log.debug("Updating the key status for user {} to error", user);
-                    keyDAO.updateKey(user, "error");
-                } else {
-                    keyDAO.updateEdgeStatus(user, status);
-                }
-            }
-        } catch (DlabException e) {
-            log.error("Could not upload the key result and create EDGE node for user {}", user, e);
-            throw new DlabException("Could not upload the key result and create EDGE node for user " + user + ": " + e.getLocalizedMessage(), e);
-        }
-    }
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/gcp/EdgeCallbackGcp.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/gcp/EdgeCallbackGcp.java
deleted file mode 100644
index 57c521f..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/gcp/EdgeCallbackGcp.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.gcp;
-
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.resources.callback.base.EdgeCallback;
-import com.epam.dlab.dto.base.keyload.UploadFileResult;
-import com.epam.dlab.dto.gcp.edge.EdgeInfoGcp;
-import com.epam.dlab.rest.contracts.ApiCallbacks;
-import com.google.inject.Inject;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/infrastructure/edge")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class EdgeCallbackGcp extends EdgeCallback {
-
-	@Inject
-	private RequestId requestId;
-
-	public EdgeCallbackGcp() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	/**
-	 * Stores the result of the upload the user key.
-	 *
-	 * @param dto result of the upload the user key.
-	 * @return 200 OK
-	 */
-	@POST
-	@Path(ApiCallbacks.STATUS_URI)
-	public Response status(UploadFileResult<EdgeInfoGcp> dto) {
-		requestId.checkAndRemove(dto.getRequestId());
-		handleEdgeCallback(dto.getUser(), dto.getStatus());
-		return Response.ok().build();
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/gcp/KeyUploaderCallbackGcp.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/gcp/KeyUploaderCallbackGcp.java
deleted file mode 100644
index 3a2ce34..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/callback/gcp/KeyUploaderCallbackGcp.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources.callback.gcp;
-
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.resources.callback.base.KeyUploaderCallback;
-import com.epam.dlab.dto.base.keyload.UploadFileResult;
-import com.epam.dlab.dto.gcp.edge.EdgeInfoGcp;
-import com.google.inject.Inject;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/user/access_key")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-@Slf4j
-public class KeyUploaderCallbackGcp {
-
-	@Inject
-	private KeyUploaderCallback keyUploaderCallback;
-
-	@Inject
-	private RequestId requestId;
-
-	public KeyUploaderCallbackGcp() {
-		log.info("{} is initialized", getClass().getSimpleName());
-	}
-
-	/**
-	 * Stores the result of the upload the user key.
-	 *
-	 * @param dto result of the upload the user key.
-	 * @return 200 OK
-	 */
-	@POST
-	@Path("/callback")
-	public Response loadKeyResponse(UploadFileResult<EdgeInfoGcp> dto) {
-		log.debug("Upload the key result and EDGE node info for user {}: {}", dto.getUser(), dto);
-		requestId.checkAndRemove(dto.getRequestId());
-		keyUploaderCallback.handleCallback(dto.getStatus(), dto.getUser(), dto.getEdgeInfo());
-
-		return Response.ok().build();
-
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/AccessKeyService.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/AccessKeyService.java
index 145079e..c037285 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/AccessKeyService.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/AccessKeyService.java
@@ -21,17 +21,8 @@ package com.epam.dlab.backendapi.service;
 
 import com.epam.dlab.auth.UserInfo;
 import com.epam.dlab.backendapi.resources.dto.KeysDTO;
-import com.epam.dlab.dto.keyload.KeyLoadStatus;
 
 public interface AccessKeyService {
 
-	KeyLoadStatus getUserKeyStatus(String user);
-
-	String uploadKey(UserInfo user, String keyContent, boolean isPrimaryUploading);
-
-	String recoverEdge(UserInfo userInfo);
-
-	String generateKey(UserInfo userInfo, boolean createEdge);
-
 	KeysDTO generateKeys(UserInfo userInfo);
 }
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EdgeService.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EdgeService.java
deleted file mode 100644
index 55661c7..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EdgeService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.service;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.dto.UserInstanceStatus;
-
-public interface EdgeService {
-	String start(UserInfo userInfo);
-
-	String stop(UserInfo userInfo);
-
-	String terminate(UserInfo userInfo);
-
-	void updateReuploadKeyFlag(String user, boolean reuploadKeyRequired, UserInstanceStatus... edgeStatuses);
-
-	String getEdgeInfo(UserInfo userInfo, String projectName);
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EnvironmentService.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EnvironmentService.java
index 91d0ed7..5ef7cae 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EnvironmentService.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EnvironmentService.java
@@ -42,14 +42,10 @@ public interface EnvironmentService {
 
 	void stopProjectEnvironment(String project);
 
-	void stopEdge(String user);
-
 	void stopExploratory(UserInfo userInfo, String user, String exploratoryName);
 
 	void stopComputational(UserInfo userInfo, String user, String exploratoryName, String computationalName);
 
-	void terminateEnvironment(UserInfo userInfo, String user);
-
 	void terminateExploratory(UserInfo userInfo, String user, String exploratoryName);
 
 	void terminateComputational(UserInfo userInfo, String user, String exploratoryName, String computationalName);
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/ReuploadKeyService.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/ReuploadKeyService.java
index 88f1e9e..45939a0 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/ReuploadKeyService.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/ReuploadKeyService.java
@@ -25,8 +25,6 @@ import com.epam.dlab.model.ResourceData;
 
 public interface ReuploadKeyService {
 
-	String reuploadKey(UserInfo user, String keyContent);
-
 	void reuploadKeyAction(UserInfo userInfo, ResourceData resourceData);
 
 	void updateResourceData(ReuploadKeyStatusDTO dto);
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/UserResourceService.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/UserResourceService.java
deleted file mode 100644
index 972e78f..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/UserResourceService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package com.epam.dlab.backendapi.service;
-
-import com.epam.dlab.dto.UserInstanceDTO;
-import com.epam.dlab.model.ResourceData;
-
-import java.util.List;
-
-public interface UserResourceService {
-
-	List<ResourceData> convertToResourceData(List<UserInstanceDTO> userInstances);
-
-	void updateReuploadKeyFlagForUserResources(String user, boolean reuploadKeyRequired);
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/AccessKeyServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/AccessKeyServiceImpl.java
index 193e28a..11c8ef4 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/AccessKeyServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/AccessKeyServiceImpl.java
@@ -21,23 +21,11 @@ package com.epam.dlab.backendapi.service.impl;
 
 import com.epam.dlab.auth.UserInfo;
 import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
-import com.epam.dlab.backendapi.annotation.BudgetLimited;
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.backendapi.domain.RequestId;
 import com.epam.dlab.backendapi.resources.dto.KeysDTO;
 import com.epam.dlab.backendapi.service.AccessKeyService;
-import com.epam.dlab.backendapi.service.ReuploadKeyService;
-import com.epam.dlab.backendapi.util.RequestBuilder;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.base.edge.EdgeInfo;
-import com.epam.dlab.dto.base.keyload.UploadFile;
-import com.epam.dlab.dto.keyload.KeyLoadStatus;
-import com.epam.dlab.dto.keyload.UserKeyDTO;
 import com.epam.dlab.exceptions.DlabException;
-import com.epam.dlab.rest.client.RESTService;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-import com.google.inject.name.Named;
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.KeyPair;
@@ -46,90 +34,12 @@ import lombok.extern.slf4j.Slf4j;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-import static com.epam.dlab.constants.ServiceConsts.PROVISIONING_SERVICE_NAME;
-import static com.epam.dlab.dto.UserInstanceStatus.FAILED;
-import static com.epam.dlab.dto.UserInstanceStatus.TERMINATED;
-import static com.epam.dlab.rest.contracts.EdgeAPI.EDGE_CREATE;
-
 @Singleton
 @Slf4j
 public class AccessKeyServiceImpl implements AccessKeyService {
-
-	@Inject
-	private KeyDAO keyDAO;
-	@Inject
-	@Named(PROVISIONING_SERVICE_NAME)
-	private RESTService provisioningService;
-	@Inject
-	private RequestBuilder requestBuilder;
-	@Inject
-	private RequestId requestId;
 	@Inject
 	private SelfServiceApplicationConfiguration configuration;
-	@Inject
-	private ReuploadKeyService reuploadKeyService;
-
-	@Override
-	public KeyLoadStatus getUserKeyStatus(String user) {
-		log.debug("Check the status of the user key for {}", user);
-		try {
-			return keyDAO.findKeyStatus(user);
-		} catch (DlabException e) {
-			log.error("Check the status of the user key for {} fails", user, e);
-			return KeyLoadStatus.ERROR;
-		}
-	}
-
-	@BudgetLimited
-	@Override
-	public String uploadKey(UserInfo user, String keyContent, boolean isPrimaryUploading) {
-		log.debug(isPrimaryUploading ? "The key uploading and EDGE node creating for user {} is starting..." :
-				"The key reuploading for user {} is starting...", user);
-		keyDAO.upsertKey(user.getName(), keyContent, isPrimaryUploading);
-		try {
-			return isPrimaryUploading ? createEdge(user, keyContent) : reuploadKeyService.reuploadKey(user,
-					keyContent);
-		} catch (Exception e) {
-			log.error(isPrimaryUploading ? "The key uploading and EDGE node creating for user {} fails" :
-					"The key reuploading for user {} fails", user.getName(), e);
-			keyDAO.deleteKey(user.getName());
-			throw new DlabException(isPrimaryUploading ? "Could not upload the key and create EDGE node: " :
-					"Could not reupload the key. Previous key has been deleted: " + e.getLocalizedMessage(), e);
-		}
-	}
 
-	@BudgetLimited
-	@Override
-	public String recoverEdge(UserInfo userInfo) {
-		log.debug("Recreating edge node for user {}", userInfo.getName());
-		try {
-			String userName = userInfo.getName();
-			EdgeInfo edgeInfo = getEdgeInfo(userName);
-			UserKeyDTO key = keyDAO.fetchKey(userName, KeyLoadStatus.SUCCESS);
-			updateEdgeStatusToCreating(userName, edgeInfo);
-			return createEdge(userInfo, key.getContent());
-		} catch (Exception e) {
-			log.error("Could not create the EDGE node for user {}", userInfo.getName(), e);
-			keyDAO.updateEdgeStatus(userInfo.getName(), FAILED.toString());
-			throw new DlabException("Could not upload the key and create EDGE node: " + e.getLocalizedMessage(), e);
-		}
-	}
-
-	@Override
-	public String generateKey(UserInfo userInfo, boolean createEdge) {
-		log.debug("Generating new key pair for user {}", userInfo.getName());
-		try (ByteArrayOutputStream publicKeyOut = new ByteArrayOutputStream();
-			 ByteArrayOutputStream privateKeyOut = new ByteArrayOutputStream()) {
-			KeyPair pair = KeyPair.genKeyPair(new JSch(), KeyPair.RSA, configuration.getPrivateKeySize());
-			pair.writePublicKey(publicKeyOut, userInfo.getName());
-			pair.writePrivateKey(privateKeyOut);
-			uploadKey(userInfo, new String(publicKeyOut.toByteArray()), createEdge);
-			return new String(privateKeyOut.toByteArray());
-		} catch (JSchException | IOException e) {
-			log.error("Can not generate private/public key pair due to: {}", e.getMessage());
-			throw new DlabException("Can not generate private/public key pair due to: " + e.getMessage(), e);
-		}
-	}
 
 	@Override
 	public KeysDTO generateKeys(UserInfo userInfo) {
@@ -146,33 +56,4 @@ public class AccessKeyServiceImpl implements AccessKeyService {
 			throw new DlabException("Can not generate private/public key pair due to: " + e.getMessage(), e);
 		}
 	}
-
-	private EdgeInfo getEdgeInfo(String userName) {
-		EdgeInfo edgeInfo = keyDAO.getEdgeInfo(userName);
-		UserInstanceStatus status = UserInstanceStatus.of(edgeInfo.getEdgeStatus());
-		if (status == null || !status.in(FAILED, TERMINATED)) {
-			log.error("Could not create EDGE node for user {} because the status of instance is {}", userName,
-					status);
-			throw new DlabException("Could not create EDGE node because the status of instance is " + status);
-		}
-		return edgeInfo;
-	}
-
-	private void updateEdgeStatusToCreating(String userName, EdgeInfo edgeInfo) {
-		edgeInfo.setInstanceId(null);
-		edgeInfo.setEdgeStatus(UserInstanceStatus.CREATING.toString());
-		try {
-			keyDAO.updateEdgeInfo(userName, edgeInfo);
-		} catch (DlabException e) {
-			log.error("Could not update the status of EDGE node for user {}", userName, e);
-			throw new DlabException("Could not create EDGE node: " + e.getLocalizedMessage(), e);
-		}
-	}
-
-	private String createEdge(UserInfo user, String keyContent) {
-		UploadFile uploadFile = requestBuilder.newEdgeKeyUpload(user, keyContent);
-		String uuid = provisioningService.post(EDGE_CREATE, user.getAccessToken(), uploadFile, String.class);
-		requestId.put(user.getName(), uuid);
-		return uuid;
-	}
 }
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EdgeServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EdgeServiceImpl.java
deleted file mode 100644
index e62b52f..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EdgeServiceImpl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.service.impl;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.annotation.BudgetLimited;
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.backendapi.dao.ProjectDAO;
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.service.EdgeService;
-import com.epam.dlab.backendapi.util.RequestBuilder;
-import com.epam.dlab.constants.ServiceConsts;
-import com.epam.dlab.dto.ResourceSysBaseDTO;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.exceptions.DlabException;
-import com.epam.dlab.rest.client.RESTService;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.name.Named;
-import lombok.extern.slf4j.Slf4j;
-
-import static com.epam.dlab.dto.UserInstanceStatus.*;
-import static com.epam.dlab.rest.contracts.EdgeAPI.*;
-
-@Singleton
-@Slf4j
-public class EdgeServiceImpl implements EdgeService {
-
-	@Inject
-	private KeyDAO keyDAO;
-	@Inject
-	private ProjectDAO projectDAO;
-
-	@Inject
-	@Named(ServiceConsts.PROVISIONING_SERVICE_NAME)
-	private RESTService provisioningService;
-
-	@Inject
-	private RequestBuilder requestBuilder;
-
-	@Inject
-	private RequestId requestId;
-
-
-	@BudgetLimited
-	@Override
-	public String start(UserInfo userInfo) {
-		log.debug("Starting EDGE node for user {}", userInfo.getName());
-		UserInstanceStatus status = UserInstanceStatus.of(keyDAO.getEdgeStatus(userInfo.getName()));
-		if (status == null || !status.in(STOPPED)) {
-			log.error("Could not start EDGE node for user {} because the status of instance is {}",
-					userInfo.getName(), status);
-			throw new DlabException("Could not start EDGE node because the status of instance is " + status);
-		}
-		try {
-			return action(userInfo, EDGE_START, STARTING);
-		} catch (DlabException e) {
-			log.error("Could not start EDGE node for user {}", userInfo.getName(), e);
-			throw new DlabException("Could not start EDGE node: " + e.getLocalizedMessage(), e);
-		}
-	}
-
-	@Override
-	public String stop(UserInfo userInfo) {
-		log.debug("Stopping EDGE node for user {}", userInfo.getName());
-		UserInstanceStatus status = UserInstanceStatus.of(keyDAO.getEdgeStatus(userInfo.getName()));
-		if (status == null || !status.in(RUNNING)) {
-			log.error("Could not stop EDGE node for user {} because the status of instance is {}",
-					userInfo.getName(), status);
-			throw new DlabException("Could not stop EDGE node because the status of instance is " + status);
-		}
-
-		try {
-			return action(userInfo, EDGE_STOP, STOPPING);
-		} catch (DlabException e) {
-			log.error("Could not stop EDGE node for user {}", userInfo.getName(), e);
-			throw new DlabException("Could not stop EDGE node: " + e.getLocalizedMessage(), e);
-		}
-	}
-
-	@Override
-	public String terminate(UserInfo userInfo) {
-		log.debug("Terminating EDGE node for user {}", userInfo.getName());
-		UserInstanceStatus status = UserInstanceStatus.of(keyDAO.getEdgeStatus(userInfo.getName()));
-		if (status == null) {
-			log.error("Could not terminate EDGE node for user {} because the status of instance is null",
-					userInfo.getName());
-			throw new DlabException("Could not terminate EDGE node because the status of instance is null");
-		}
-
-		try {
-			return action(userInfo, EDGE_TERMINATE, TERMINATING);
-		} catch (DlabException e) {
-			log.error("Could not terminate EDGE node for user {}", userInfo.getName(), e);
-			throw new DlabException("Could not terminate EDGE node: " + e.getLocalizedMessage(), e);
-		}
-	}
-
-	/**
-	 * Updates parameter 'reuploadKeyRequired' for user's edge node with allowable statuses.
-	 *
-	 * @param user                user.
-	 * @param reuploadKeyRequired true/false.
-	 * @param edgeStatuses        allowable statuses of edge node.
-	 */
-	@Override
-	public void updateReuploadKeyFlag(String user, boolean reuploadKeyRequired, UserInstanceStatus... edgeStatuses) {
-		keyDAO.updateEdgeReuploadKey(user, reuploadKeyRequired, edgeStatuses);
-	}
-
-	@Override
-	public String getEdgeInfo(UserInfo userInfo, String projectName) {
-		return null;
-	}
-
-	/**
-	 * Sends the post request to the provisioning service and update the status of EDGE node.
-	 *
-	 * @param userInfo user info.
-	 * @param action   action for EDGE node.
-	 * @param status   status of EDGE node.
-	 * @return Request Id.
-	 */
-	private String action(UserInfo userInfo, String action, UserInstanceStatus status) {
-		try {
-			keyDAO.updateEdgeStatus(userInfo.getName(), status.toString());
-			ResourceSysBaseDTO<?> dto = requestBuilder.newEdgeAction(userInfo);
-			String uuid = provisioningService.post(action, userInfo.getAccessToken(), dto, String.class);
-			requestId.put(userInfo.getName(), uuid);
-			return uuid;
-		} catch (Exception t) {
-			keyDAO.updateEdgeStatus(userInfo.getName(), FAILED.toString());
-			throw new DlabException("Could not " + action + " EDGE node " + ": " + t.getLocalizedMessage(), t);
-		}
-	}
-}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java
index 1d70935..349dfdb 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java
@@ -22,7 +22,6 @@ package com.epam.dlab.backendapi.service.impl;
 import com.epam.dlab.auth.UserInfo;
 import com.epam.dlab.backendapi.dao.EnvDAO;
 import com.epam.dlab.backendapi.dao.ExploratoryDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.dao.UserSettingsDAO;
 import com.epam.dlab.backendapi.domain.ProjectDTO;
 import com.epam.dlab.backendapi.resources.dto.UserDTO;
@@ -63,10 +62,6 @@ public class EnvironmentServiceImpl implements EnvironmentService {
 	@Inject
 	private SecurityService securityService;
 	@Inject
-	private KeyDAO keyDAO;
-	@Inject
-	private EdgeService edgeService;
-	@Inject
 	private ProjectService projectService;
 	@Inject
 	private UserSettingsDAO settingsDAO;
@@ -118,7 +113,6 @@ public class EnvironmentServiceImpl implements EnvironmentService {
 		checkState(user, "stop");
 		exploratoryDAO.fetchRunningExploratoryFields(user)
 				.forEach(e -> stopExploratory(userInfo, user, e.getExploratoryName()));
-		stopEdge(user);
 	}
 
 	@Override
@@ -127,7 +121,6 @@ public class EnvironmentServiceImpl implements EnvironmentService {
 		checkState(user, "stop");
 		exploratoryDAO.fetchRunningExploratoryFields(user)
 				.forEach(this::stopNotebookWithServiceAccount);
-		stopEdge(user);
 	}
 
 	@Override
@@ -144,13 +137,6 @@ public class EnvironmentServiceImpl implements EnvironmentService {
 	}
 
 	@Override
-	public void stopEdge(String user) {
-		if (UserInstanceStatus.RUNNING.toString().equals(keyDAO.getEdgeStatus(user))) {
-			edgeService.stop(securityService.getUserInfoOffline(user));
-		}
-	}
-
-	@Override
 	public void stopExploratory(UserInfo userInfo, String user, String exploratoryName) {
 		exploratoryService.stop(new UserInfo(user, userInfo.getAccessToken()), exploratoryName);
 	}
@@ -162,17 +148,6 @@ public class EnvironmentServiceImpl implements EnvironmentService {
 	}
 
 	@Override
-	public void terminateEnvironment(UserInfo userInfo, String user) {
-		log.debug("Terminating environment for user {}", user);
-		checkState(user, "terminate");
-		if (!terminateEdge(user)) {
-			exploratoryDAO.fetchUserExploratoriesWhereStatusNotIn(user, UserInstanceStatus.TERMINATED,
-					UserInstanceStatus.FAILED, UserInstanceStatus.TERMINATING)
-					.forEach(e -> terminateExploratory(userInfo, user, e.getExploratoryName()));
-		}
-	}
-
-	@Override
 	public void terminateExploratory(UserInfo userInfo, String user, String exploratoryName) {
 		exploratoryService.terminate(new UserInfo(user, userInfo.getAccessToken()), exploratoryName);
 	}
@@ -194,7 +169,7 @@ public class EnvironmentServiceImpl implements EnvironmentService {
 								UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE),
 						UserInstanceStatus.CREATING,
 						UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE);
-		if (UserInstanceStatus.STARTING.toString().equals(keyDAO.getEdgeStatus(user)) || !userInstances.isEmpty()) {
+		if (!userInstances.isEmpty()) {
 			log.error(String.format(ERROR_MSG_FORMAT, action));
 			throw new ResourceConflictException(String.format(ERROR_MSG_FORMAT, action));
 		}
@@ -205,15 +180,6 @@ public class EnvironmentServiceImpl implements EnvironmentService {
 		exploratoryService.stop(userInfo, instance.getExploratoryName());
 	}
 
-	private boolean terminateEdge(String user) {
-		final boolean nodeExists = keyDAO.edgeNodeExist(user);
-		if (nodeExists) {
-			edgeService.terminate(securityService.getUserInfoOffline(user));
-			exploratoryService.updateExploratoryStatuses(user, UserInstanceStatus.TERMINATING);
-		}
-		return nodeExists;
-	}
-
 	private List<UserResourceInfo> getProjectEnv(ProjectDTO projectDTO, List<UserInstanceDTO> allInstances) {
 		final Stream<UserResourceInfo> userResources = allInstances.stream()
 				.filter(instance -> instance.getProject().equals(projectDTO.getName())).map(this::toUserResourceInfo);
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/InfrastructureTemplateServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/InfrastructureTemplateServiceImpl.java
index b119f95..ca718d4 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/InfrastructureTemplateServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/InfrastructureTemplateServiceImpl.java
@@ -80,15 +80,16 @@ public class InfrastructureTemplateServiceImpl implements InfrastructureTemplate
 
 		log.debug("Loading list of exploratory templates for user {} for project {}", user.getName(), project);
 		try {
+			EndpointDTO endpointDTO = endpointService.get(endpoint);
 			ExploratoryMetadataDTO[] array =
-					provisioningService.get(endpointService.get(endpoint).getUrl() + DOCKER_EXPLORATORY,
+					provisioningService.get(endpointDTO.getUrl() + DOCKER_EXPLORATORY,
 							user.getAccessToken(),
 							ExploratoryMetadataDTO[].class);
 
 			final Set<String> roles = userGroupDao.getUserGroups(user.getName());
 			return Arrays.stream(array)
 					.peek(e -> e.setImage(getSimpleImageName(e.getImage())))
-					.filter(e -> exploratoryGpuIssuesAzureFilter(e) &&
+					.filter(e -> exploratoryGpuIssuesAzureFilter(e, endpointDTO.getCloudProvider()) &&
 							UserRoles.checkAccess(user, RoleType.EXPLORATORY, e.getImage(), roles))
 					.peek(e -> filterShapes(user, e.getExploratoryEnvironmentShapes(), RoleType.EXPLORATORY_SHAPES,
 							roles))
@@ -150,10 +151,9 @@ public class InfrastructureTemplateServiceImpl implements InfrastructureTemplate
 	/**
 	 * Temporary filter for creation of exploratory env due to Azure issues
 	 */
-	private boolean exploratoryGpuIssuesAzureFilter(ExploratoryMetadataDTO e) {
-		return (!"redhat".equals(settingsDAO.getConfOsFamily()) || configuration.getCloudProvider() != CloudProvider
-				.AZURE)
-				|| !(e.getImage().endsWith("deeplearning") || e.getImage().endsWith("tensor"));
+	private boolean exploratoryGpuIssuesAzureFilter(ExploratoryMetadataDTO e, CloudProvider cloudProvider) {
+		return (!"redhat".equals(settingsDAO.getConfOsFamily()) || cloudProvider != CloudProvider.AZURE) ||
+				!(e.getImage().endsWith("deeplearning") || e.getImage().endsWith("tensor"));
 	}
 
 	/**
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImpl.java
index e783d9c..893ddc7 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImpl.java
@@ -22,11 +22,9 @@ package com.epam.dlab.backendapi.service.impl;
 import com.epam.dlab.auth.UserInfo;
 import com.epam.dlab.backendapi.dao.ComputationalDAO;
 import com.epam.dlab.backendapi.dao.ExploratoryDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.domain.RequestId;
 import com.epam.dlab.backendapi.service.ExploratoryService;
 import com.epam.dlab.backendapi.service.ReuploadKeyService;
-import com.epam.dlab.backendapi.service.UserResourceService;
 import com.epam.dlab.backendapi.util.RequestBuilder;
 import com.epam.dlab.dto.UserInstanceStatus;
 import com.epam.dlab.dto.base.DataEngineType;
@@ -45,7 +43,6 @@ import org.apache.commons.lang3.StringUtils;
 
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.List;
 import java.util.UUID;
 
 import static com.epam.dlab.constants.ServiceConsts.PROVISIONING_SERVICE_NAME;
@@ -58,8 +55,6 @@ import static com.epam.dlab.rest.contracts.KeyAPI.REUPLOAD_KEY;
 public class ReuploadKeyServiceImpl implements ReuploadKeyService {
 
 	@Inject
-	private KeyDAO keyDAO;
-	@Inject
 	@Named(PROVISIONING_SERVICE_NAME)
 	private RESTService provisioningService;
 	@Inject
@@ -72,32 +67,12 @@ public class ReuploadKeyServiceImpl implements ReuploadKeyService {
 	private ComputationalDAO computationalDAO;
 	@Inject
 	private ExploratoryDAO exploratoryDAO;
-	@Inject
-	private UserResourceService userResourceService;
 
 	private static final String REUPLOAD_KEY_UPDATE_MSG = "Reuploading key process is successfully finished. " +
 			"Updating 'reupload_key_required' flag to 'false' for {}.";
 	private static final String REUPLOAD_KEY_ERROR_MSG = "Reuploading key process is failed for {}. The next attempt" +
 			"starts after resource restarting.";
 
-
-	@Override
-	public String reuploadKey(UserInfo user, String keyContent) {
-		userResourceService.updateReuploadKeyFlagForUserResources(user.getName(), true);
-		List<ResourceData> resourcesForKeyReuploading = userResourceService.convertToResourceData(
-				exploratoryService.getInstancesWithStatuses(user.getName(), RUNNING, RUNNING));
-		keyDAO.getEdgeInfoWhereStatusIn(user.getName(), RUNNING)
-				.ifPresent(edgeInfo -> {
-					resourcesForKeyReuploading.add(ResourceData.edgeResource(edgeInfo.getInstanceId()));
-					keyDAO.updateEdgeStatus(user.getName(), REUPLOADING_KEY.toString());
-				});
-		updateStatusForUserInstances(user.getName(), REUPLOADING_KEY);
-
-		ReuploadKeyDTO reuploadKeyDTO = requestBuilder.newKeyReupload(user, UUID.randomUUID().toString(), keyContent,
-				resourcesForKeyReuploading);
-		return provisioningService.post(REUPLOAD_KEY, user.getAccessToken(), reuploadKeyDTO, String.class);
-	}
-
 	@Override
 	public void updateResourceData(ReuploadKeyStatusDTO dto) {
 		String user = dto.getUser();
@@ -130,9 +105,7 @@ public class ReuploadKeyServiceImpl implements ReuploadKeyService {
 	}
 
 	private void updateResourceStatus(String user, ResourceData resourceData, UserInstanceStatus newStatus) {
-		if (resourceData.getResourceType() == ResourceType.EDGE) {
-			keyDAO.updateEdgeStatus(user, newStatus.toString());
-		} else if (resourceData.getResourceType() == ResourceType.EXPLORATORY) {
+		if (resourceData.getResourceType() == ResourceType.EXPLORATORY) {
 			exploratoryDAO.updateStatusForExploratory(user, resourceData.getExploratoryName(), newStatus);
 		} else if (resourceData.getResourceType() == ResourceType.COMPUTATIONAL) {
 			computationalDAO.updateStatusForComputationalResource(user, resourceData.getExploratoryName(),
@@ -141,9 +114,7 @@ public class ReuploadKeyServiceImpl implements ReuploadKeyService {
 	}
 
 	private void updateResourceReuploadKeyFlag(String user, ResourceData resourceData, boolean reuploadKeyRequired) {
-		if (resourceData.getResourceType() == ResourceType.EDGE) {
-			keyDAO.updateEdgeReuploadKey(user, reuploadKeyRequired, UserInstanceStatus.values());
-		} else if (resourceData.getResourceType() == ResourceType.EXPLORATORY) {
+		if (resourceData.getResourceType() == ResourceType.EXPLORATORY) {
 			exploratoryDAO.updateReuploadKeyForExploratory(user, resourceData.getExploratoryName(),
 					reuploadKeyRequired);
 		} else if (resourceData.getResourceType() == ResourceType.COMPUTATIONAL) {
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserResourceServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserResourceServiceImpl.java
deleted file mode 100644
index 7a1c27c..0000000
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserResourceServiceImpl.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package com.epam.dlab.backendapi.service.impl;
-
-import com.epam.dlab.backendapi.service.ComputationalService;
-import com.epam.dlab.backendapi.service.EdgeService;
-import com.epam.dlab.backendapi.service.ExploratoryService;
-import com.epam.dlab.backendapi.service.UserResourceService;
-import com.epam.dlab.dto.UserInstanceDTO;
-import com.epam.dlab.dto.base.DataEngineType;
-import com.epam.dlab.model.ResourceData;
-import com.google.inject.Inject;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static com.epam.dlab.dto.UserInstanceStatus.*;
-
-public class UserResourceServiceImpl implements UserResourceService {
-
-	@Inject
-	private ExploratoryService exploratoryService;
-	@Inject
-	private ComputationalService computationalService;
-	@Inject
-	private EdgeService edgeService;
-
-	/**
-	 * Converts user's instances to another data type.
-	 *
-	 * @param userInstances list of user instances.
-	 * @return converted list of resources' data.
-	 */
-	@Override
-	public List<ResourceData> convertToResourceData(List<UserInstanceDTO> userInstances) {
-		return userInstances
-				.stream()
-				.flatMap(this::resourceDataStream)
-				.collect(Collectors.toList());
-	}
-
-	/**
-	 * Updates flag 'reuploadKeyRequired' for user's resources with predefined statuses.
-	 *
-	 * @param user                user's name.
-	 * @param reuploadKeyRequired true/false.
-	 */
-	@Override
-	public void updateReuploadKeyFlagForUserResources(String user, boolean reuploadKeyRequired) {
-		exploratoryService.updateExploratoriesReuploadKeyFlag(user, reuploadKeyRequired,
-				CREATING, CONFIGURING, STARTING, RUNNING, STOPPING, STOPPED);
-		computationalService.updateComputationalsReuploadKeyFlag(user,
-				Arrays.asList(STARTING, RUNNING, STOPPING, STOPPED),
-				Collections.singletonList(DataEngineType.SPARK_STANDALONE),
-				reuploadKeyRequired,
-				CREATING, CONFIGURING, STARTING, RUNNING, STOPPING, STOPPED);
-		computationalService.updateComputationalsReuploadKeyFlag(user,
-				Collections.singletonList(RUNNING),
-				Collections.singletonList(DataEngineType.CLOUD_SERVICE),
-				reuploadKeyRequired,
-				CREATING, CONFIGURING, STARTING, RUNNING);
-		edgeService.updateReuploadKeyFlag(user, reuploadKeyRequired, STARTING, RUNNING, STOPPING, STOPPED);
-	}
-
-	private Stream<ResourceData> resourceDataStream(UserInstanceDTO ui) {
-		final Stream<ResourceData> exploratoryStream =
-				Stream.of(ResourceData.exploratoryResource(ui.getExploratoryId(), ui.getExploratoryName()));
-		final Stream<ResourceData> computationalStream = ui.getResources()
-				.stream()
-				.map(cr -> ResourceData.computationalResource(cr.getComputationalId(),
-						ui.getExploratoryName(), cr.getComputationalName()));
-		return Stream.concat(exploratoryStream, computationalStream);
-	}
-}
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/EdgeResourceTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/EdgeResourceTest.java
deleted file mode 100644
index 075502e..0000000
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/EdgeResourceTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.service.EdgeService;
-import com.epam.dlab.exceptions.DlabException;
-import io.dropwizard.auth.AuthenticationException;
-import io.dropwizard.testing.junit.ResourceTestRule;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
-
-public class EdgeResourceTest extends TestBase {
-
-	private EdgeService edgeService = mock(EdgeService.class);
-
-	@Rule
-	public final ResourceTestRule resources = getResourceTestRuleInstance(new EdgeResource(edgeService));
-
-	@Before
-	public void setup() throws AuthenticationException {
-		authSetup();
-	}
-
-	@Test
-	public void start() {
-		when(edgeService.start(any(UserInfo.class))).thenReturn("someUuid");
-		final Response response = resources.getJerseyTest()
-				.target("/infrastructure/edge/start")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(getUserInfo()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals("someUuid", response.readEntity(String.class));
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(edgeService).start(getUserInfo());
-		verifyNoMoreInteractions(edgeService);
-	}
-
-	@Test
-	public void startWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		when(edgeService.start(any(UserInfo.class))).thenReturn("someUuid");
-		final Response response = resources.getJerseyTest()
-				.target("/infrastructure/edge/start")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(getUserInfo()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals("someUuid", response.readEntity(String.class));
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(edgeService).start(getUserInfo());
-		verifyNoMoreInteractions(edgeService);
-	}
-
-	@Test
-	public void startWithException() {
-		when(edgeService.start(any(UserInfo.class))).thenThrow(new DlabException("Could not start edge node"));
-		final Response response = resources.getJerseyTest()
-				.target("/infrastructure/edge/start")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(getUserInfo()));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		String expectedJson = "\"code\":500,\"message\":\"There was an error processing your request. " +
-				"It has been logged";
-		String actualJson = response.readEntity(String.class);
-		assertTrue(actualJson.contains(expectedJson));
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(edgeService).start(getUserInfo());
-		verifyNoMoreInteractions(edgeService);
-	}
-
-	@Test
-	public void stop() {
-		when(edgeService.stop(any(UserInfo.class))).thenReturn("someUuid");
-		final Response response = resources.getJerseyTest()
-				.target("/infrastructure/edge/stop")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(getUserInfo()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals("someUuid", response.readEntity(String.class));
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(edgeService).stop(getUserInfo());
-		verifyNoMoreInteractions(edgeService);
-	}
-
-	@Test
-	public void stopWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		when(edgeService.stop(any(UserInfo.class))).thenReturn("someUuid");
-		final Response response = resources.getJerseyTest()
-				.target("/infrastructure/edge/stop")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(getUserInfo()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals("someUuid", response.readEntity(String.class));
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(edgeService).stop(getUserInfo());
-		verifyNoMoreInteractions(edgeService);
-	}
-
-	@Test
-	public void stopWithException() {
-		when(edgeService.stop(any(UserInfo.class))).thenThrow(new DlabException("Could not stop edge node"));
-		final Response response = resources.getJerseyTest()
-				.target("/infrastructure/edge/stop")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(getUserInfo()));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		String expectedJson = "\"code\":500,\"message\":\"There was an error processing your request. " +
-				"It has been logged";
-		String actualJson = response.readEntity(String.class);
-		assertTrue(actualJson.contains(expectedJson));
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(edgeService).stop(getUserInfo());
-		verifyNoMoreInteractions(edgeService);
-	}
-
-}
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/EnvironmentResourceTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/EnvironmentResourceTest.java
index 2cc49a2..a8b01fa 100644
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/EnvironmentResourceTest.java
+++ b/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/EnvironmentResourceTest.java
@@ -125,55 +125,6 @@ public class EnvironmentResourceTest extends TestBase {
 	}
 
 	@Test
-	public void terminateEnv() {
-		doNothing().when(environmentService).terminateEnvironment(any(UserInfo.class), anyString());
-		final Response response = resources.getJerseyTest()
-				.target("/environment/terminate")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.text(USER));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(environmentService).terminateEnvironment(new UserInfo(USER, TOKEN), USER);
-		verifyNoMoreInteractions(environmentService);
-	}
-
-	@Test
-	public void terminateEnvWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		doNothing().when(environmentService).terminateEnvironment(any(UserInfo.class), anyString());
-		final Response response = resources.getJerseyTest()
-				.target("/environment/terminate")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.text(USER));
-
-		assertEquals(HttpStatus.SC_FORBIDDEN, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verifyZeroInteractions(environmentService);
-	}
-
-	@Test
-	public void terminateEnvWithResourceConflictException() {
-		doThrow(new ResourceConflictException("Can not terminate environment because one of the user resources is in" +
-				"status CREATING or STARTING")).when(environmentService).terminateEnvironment(any(UserInfo.class), anyString());
-		final Response response = resources.getJerseyTest()
-				.target("/environment/terminate")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.text(USER));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(environmentService).terminateEnvironment(new UserInfo(USER, TOKEN), USER);
-		verifyNoMoreInteractions(environmentService);
-	}
-
-	@Test
 	public void stopEnv() {
 		doNothing().when(environmentService).stopEnvironment(any(UserInfo.class), anyString());
 		final Response response = resources.getJerseyTest()
@@ -223,55 +174,6 @@ public class EnvironmentResourceTest extends TestBase {
 	}
 
 	@Test
-	public void stopEdge() {
-		doNothing().when(environmentService).stopEdge(anyString());
-		final Response response = resources.getJerseyTest()
-				.target("/environment/stop/edge")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.text(USER));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(environmentService).stopEdge(USER);
-		verifyNoMoreInteractions(environmentService);
-	}
-
-	@Test
-	public void stopEdgeWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		doNothing().when(environmentService).stopEdge(anyString());
-		final Response response = resources.getJerseyTest()
-				.target("/environment/stop/edge")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.text(USER));
-
-		assertEquals(HttpStatus.SC_FORBIDDEN, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verifyZeroInteractions(environmentService);
-	}
-
-	@Test
-	public void stopEdgeWithResourceConflictException() {
-		doThrow(new ResourceConflictException("Can not stop edge because its status is CREATING or STARTING"))
-				.when(environmentService).stopEdge(anyString());
-		final Response response = resources.getJerseyTest()
-				.target("/environment/stop/edge")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.text(USER));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(environmentService).stopEdge(USER);
-		verifyNoMoreInteractions(environmentService);
-	}
-
-	@Test
 	public void stopNotebook() {
 		doNothing().when(environmentService).stopExploratory(any(UserInfo.class), anyString(), anyString());
 		final Response response = resources.getJerseyTest()
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/KeyUploaderResourceTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/KeyUploaderResourceTest.java
deleted file mode 100644
index 1628cba..0000000
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/resources/KeyUploaderResourceTest.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.resources;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.service.AccessKeyService;
-import com.epam.dlab.dto.keyload.KeyLoadStatus;
-import com.epam.dlab.exceptions.DlabException;
-import io.dropwizard.auth.AuthenticationException;
-import io.dropwizard.testing.junit.ResourceTestRule;
-import org.apache.http.HttpStatus;
-import org.glassfish.jersey.media.multipart.FormDataMultiPart;
-import org.glassfish.jersey.media.multipart.MultiPartFeature;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.*;
-
-public class KeyUploaderResourceTest extends TestBase {
-
-	private AccessKeyService keyService = mock(AccessKeyService.class);
-
-	@Rule
-	public final ResourceTestRule resources = getResourceTestRuleInstance(new KeyUploaderResource(keyService));
-
-	@Before
-	public void setup() throws AuthenticationException {
-		authSetup();
-	}
-
-	@Test
-	public void checkKey() {
-		when(keyService.getUserKeyStatus(anyString())).thenReturn(KeyLoadStatus.SUCCESS);
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.get();
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).getUserKeyStatus(USER.toLowerCase());
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void checkKeyWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		when(keyService.getUserKeyStatus(anyString())).thenReturn(KeyLoadStatus.SUCCESS);
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.get();
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).getUserKeyStatus(USER.toLowerCase());
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void checkKeyWithErrorStatus() {
-		when(keyService.getUserKeyStatus(anyString())).thenReturn(KeyLoadStatus.ERROR);
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.get();
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).getUserKeyStatus(USER.toLowerCase());
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void loadKey() {
-		when(keyService.uploadKey(any(UserInfo.class), anyString(), anyBoolean())).thenReturn("someUuid");
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "ssh-h;glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).uploadKey(getUserInfo(), "ssh-h;glfh;lgfmhgfmmgfkl", true);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void loadKeyWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		when(keyService.uploadKey(any(UserInfo.class), anyString(), anyBoolean())).thenReturn("someUuid");
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "ssh-h;glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).uploadKey(getUserInfo(), "ssh-h;glfh;lgfmhgfmmgfkl", true);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void loadKeyWithWrongKeyFormat() {
-		when(keyService.uploadKey(any(UserInfo.class), anyString(), anyBoolean())).thenReturn("someUuid");
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verifyZeroInteractions(keyService);
-	}
-
-	@Test
-	public void loadKeyWithException() {
-		doThrow(new DlabException("Could not upload the key and create EDGE node"))
-				.when(keyService).uploadKey(any(UserInfo.class), anyString(), anyBoolean());
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "ssh-h;glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).uploadKey(getUserInfo(), "ssh-h;glfh;lgfmhgfmmgfkl", true);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void reuploadKey() {
-		when(keyService.uploadKey(any(UserInfo.class), anyString(), anyBoolean())).thenReturn("someUuid");
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "ssh-h;glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.queryParam("is_primary_uploading", "false")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).uploadKey(getUserInfo(), "ssh-h;glfh;lgfmhgfmmgfkl", false);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void reuploadKeyWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		when(keyService.uploadKey(any(UserInfo.class), anyString(), anyBoolean())).thenReturn("someUuid");
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "ssh-h;glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.queryParam("is_primary_uploading", "false")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertNull(response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).uploadKey(getUserInfo(), "ssh-h;glfh;lgfmhgfmmgfkl", false);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void reuploadKeyWithWrongKeyFormat() {
-		when(keyService.uploadKey(any(UserInfo.class), anyString(), anyBoolean())).thenReturn("someUuid");
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.queryParam("is_primary_uploading", "false")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verifyZeroInteractions(keyService);
-	}
-
-	@Test
-	public void reuploadKeyWithException() {
-		doThrow(new DlabException("Could not reupload the key. Previous key has been deleted"))
-				.when(keyService).uploadKey(any(UserInfo.class), anyString(), anyBoolean());
-
-		FormDataMultiPart multiPart = new FormDataMultiPart()
-				.field("file", "ssh-h;glfh;lgfmhgfmmgfkl");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key")
-				.queryParam("is_primary_uploading", "false")
-				.register(MultiPartFeature.class)
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.entity(multiPart, multiPart.getMediaType()));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).uploadKey(getUserInfo(), "ssh-h;glfh;lgfmhgfmmgfkl", false);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void recoverEdge() {
-		when(keyService.recoverEdge(any(UserInfo.class))).thenReturn("someUuid");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key/recover")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(""));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).recoverEdge(getUserInfo());
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void recoverEdgeWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		when(keyService.recoverEdge(any(UserInfo.class))).thenReturn("someUuid");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key/recover")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(""));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).recoverEdge(getUserInfo());
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void recoverEdgeWithException() {
-		doThrow(new DlabException("Could not upload the key and create EDGE node"))
-				.when(keyService).recoverEdge(any(UserInfo.class));
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key/recover")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(""));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).recoverEdge(getUserInfo());
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void generateKey() {
-		when(keyService.generateKey(any(UserInfo.class), anyBoolean())).thenReturn("someUuid");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key/generate")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(""));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals(MediaType.APPLICATION_OCTET_STREAM, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).generateKey(getUserInfo(), true);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void generateKeyWithoutEdgeCreation() {
-		when(keyService.generateKey(any(UserInfo.class), anyBoolean())).thenReturn("someUuid");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key/generate")
-				.queryParam("is_primary_uploading", "false")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(""));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals(MediaType.APPLICATION_OCTET_STREAM, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).generateKey(getUserInfo(), false);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void generateKeyWithFailedAuth() throws AuthenticationException {
-		authFailSetup();
-		when(keyService.generateKey(any(UserInfo.class), anyBoolean())).thenReturn("someUuid");
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key/generate")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(""));
-
-		assertEquals(HttpStatus.SC_OK, response.getStatus());
-		assertEquals(MediaType.APPLICATION_OCTET_STREAM, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).generateKey(getUserInfo(), true);
-		verifyNoMoreInteractions(keyService);
-	}
-
-	@Test
-	public void generateKeyWithException() {
-		doThrow(new DlabException("Can not generate private/public key pair due to"))
-				.when(keyService).generateKey(any(UserInfo.class), anyBoolean());
-
-		final Response response = resources.getJerseyTest()
-				.target("/user/access_key/generate")
-				.request()
-				.header("Authorization", "Bearer " + TOKEN)
-				.post(Entity.json(""));
-
-		assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus());
-		assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
-
-		verify(keyService).generateKey(getUserInfo(), true);
-		verifyNoMoreInteractions(keyService);
-	}
-
-}
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/AccessKeyServiceImplTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/AccessKeyServiceImplTest.java
deleted file mode 100644
index c68a3d0..0000000
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/AccessKeyServiceImplTest.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.service.impl;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.service.ExploratoryService;
-import com.epam.dlab.backendapi.service.ReuploadKeyService;
-import com.epam.dlab.backendapi.util.RequestBuilder;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.base.edge.EdgeInfo;
-import com.epam.dlab.dto.base.keyload.UploadFile;
-import com.epam.dlab.dto.keyload.KeyLoadStatus;
-import com.epam.dlab.dto.keyload.UserKeyDTO;
-import com.epam.dlab.exceptions.DlabException;
-import com.epam.dlab.rest.client.RESTService;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AccessKeyServiceImplTest {
-
-	private final String USER = "test";
-	private final String TOKEN = "token";
-
-	private UserInfo userInfo;
-
-	@Mock
-	private KeyDAO keyDAO;
-	@Mock
-	private RESTService provisioningService;
-	@Mock
-	private RequestBuilder requestBuilder;
-	@Mock
-	private RequestId requestId;
-	@Mock
-	private ExploratoryService exploratoryService;
-	@Mock
-	private SelfServiceApplicationConfiguration configuration;
-	@Mock
-	private ReuploadKeyService reuploadKeyService;
-
-	@InjectMocks
-	private AccessKeyServiceImpl accessKeyService;
-
-	@Rule
-	public ExpectedException expectedException = ExpectedException.none();
-
-	@Before
-	public void setUp() {
-		userInfo = getUserInfo();
-	}
-
-	@Test
-	public void getUserKeyStatus() {
-		when(keyDAO.findKeyStatus(anyString())).thenReturn(KeyLoadStatus.SUCCESS);
-
-		KeyLoadStatus keyLoadStatus = accessKeyService.getUserKeyStatus(USER);
-		assertEquals(KeyLoadStatus.SUCCESS, keyLoadStatus);
-
-		verify(keyDAO).findKeyStatus(USER);
-		verifyNoMoreInteractions(keyDAO);
-	}
-
-	@Test
-	public void getUserKeyStatusWithException() {
-		doThrow(new DlabException("Some message")).when(keyDAO).findKeyStatus(anyString());
-
-		KeyLoadStatus keyLoadStatus = accessKeyService.getUserKeyStatus(USER);
-		assertEquals(KeyLoadStatus.ERROR, keyLoadStatus);
-
-		verify(keyDAO).findKeyStatus(USER);
-		verifyNoMoreInteractions(keyDAO);
-	}
-
-	@Test
-	public void uploadKey() {
-		doNothing().when(keyDAO).upsertKey(anyString(), anyString(), anyBoolean());
-		doNothing().when(exploratoryService).updateExploratoriesReuploadKeyFlag(anyString(), anyBoolean(),
-				anyVararg());
-
-		UploadFile uploadFile = mock(UploadFile.class);
-		when(requestBuilder.newEdgeKeyUpload(any(UserInfo.class), anyString())).thenReturn(uploadFile);
-
-		String expectedUuid = "someUuid";
-		when(provisioningService.post(anyString(), anyString(), any(UploadFile.class), any())).
-				thenReturn(expectedUuid);
-		when(requestId.put(anyString(), anyString())).thenReturn(expectedUuid);
-
-		String keyContent = "keyContent";
-		String actualUuid = accessKeyService.uploadKey(userInfo, keyContent, true);
-		assertNotNull(actualUuid);
-		assertEquals(expectedUuid, actualUuid);
-
-		verify(keyDAO).upsertKey(USER, keyContent, true);
-		verifyZeroInteractions(exploratoryService);
-		verify(requestBuilder).newEdgeKeyUpload(userInfo, keyContent);
-		verify(provisioningService).post("infrastructure/edge/create", TOKEN, uploadFile, String.class);
-		verify(requestId).put(USER, expectedUuid);
-		verifyNoMoreInteractions(keyDAO, requestBuilder, provisioningService, requestId);
-	}
-
-
-	@Test
-	public void uploadKeyWithException() {
-		doNothing().when(keyDAO).upsertKey(anyString(), anyString(), anyBoolean());
-		doNothing().when(exploratoryService).updateExploratoriesReuploadKeyFlag(anyString(), anyBoolean(), anyVararg());
-		doThrow(new RuntimeException()).when(requestBuilder).newEdgeKeyUpload(any(UserInfo.class), anyString());
-
-		expectedException.expect(RuntimeException.class);
-
-		doNothing().when(keyDAO).deleteKey(anyString());
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not upload the key and create EDGE node: ");
-
-		accessKeyService.uploadKey(userInfo, "someKeyContent", true);
-	}
-
-	@Test
-	public void reUploadKey() {
-		doNothing().when(keyDAO).upsertKey(anyString(), anyString(), anyBoolean());
-		when(reuploadKeyService.reuploadKey(any(UserInfo.class), anyString())).thenReturn("someString");
-
-		String expectedString = "someString";
-		String keyContent = "keyContent";
-		String actualString = accessKeyService.uploadKey(userInfo, keyContent, false);
-		assertNotNull(actualString);
-		assertEquals(expectedString, actualString);
-
-		verify(keyDAO).upsertKey(USER, keyContent, false);
-		verify(reuploadKeyService).reuploadKey(userInfo, keyContent);
-		verifyNoMoreInteractions(keyDAO, reuploadKeyService);
-	}
-
-	@Test
-	public void reUploadKeyWithException() {
-		doNothing().when(keyDAO).upsertKey(anyString(), anyString(), anyBoolean());
-		doThrow(new RuntimeException()).when(reuploadKeyService).reuploadKey(any(UserInfo.class), anyString());
-
-		expectedException.expect(RuntimeException.class);
-
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not reupload the key. Previous key has been deleted:");
-
-		accessKeyService.uploadKey(userInfo, "someKeyContent", false);
-	}
-
-	@Test
-	public void recoverEdge() {
-		EdgeInfo edgeInfo = new EdgeInfo();
-		edgeInfo.setId("someId");
-		edgeInfo.setEdgeStatus("failed");
-		when(keyDAO.getEdgeInfo(anyString())).thenReturn(edgeInfo);
-
-		UserKeyDTO userKeyDTO = new UserKeyDTO();
-		userKeyDTO.withStatus("someStatus");
-		userKeyDTO.withContent("someContent");
-		when(keyDAO.fetchKey(anyString(), any(KeyLoadStatus.class))).thenReturn(userKeyDTO);
-
-		edgeInfo.setEdgeStatus("terminated");
-		edgeInfo.setInstanceId(null);
-
-		doNothing().when(keyDAO).updateEdgeInfo(anyString(), any(EdgeInfo.class));
-
-		UploadFile uploadFile = mock(UploadFile.class);
-		when(requestBuilder.newEdgeKeyUpload(any(UserInfo.class), anyString())).thenReturn(uploadFile);
-
-		String expectedUuid = "someUuid";
-		when(provisioningService.post(anyString(), anyString(), any(UploadFile.class), any()))
-				.thenReturn(expectedUuid);
-		when(requestId.put(anyString(), anyString())).thenReturn(expectedUuid);
-
-		String actualUuid = accessKeyService.recoverEdge(userInfo);
-		assertNotNull(actualUuid);
-		assertEquals(expectedUuid, actualUuid);
-
-		verify(keyDAO).getEdgeInfo(USER);
-		verify(keyDAO).fetchKey(USER, KeyLoadStatus.SUCCESS);
-		verify(keyDAO).updateEdgeInfo(USER, edgeInfo);
-
-		verify(requestBuilder).newEdgeKeyUpload(userInfo, userKeyDTO.getContent());
-		verify(provisioningService).post("infrastructure/edge/create", TOKEN, uploadFile, String.class);
-		verify(requestId).put(USER, expectedUuid);
-		verifyNoMoreInteractions(keyDAO, requestBuilder, provisioningService, requestId);
-	}
-
-	@Test
-	public void recoverEdgeWithExceptionInGetEdgeInfoMethod() {
-		EdgeInfo edgeInfo = new EdgeInfo();
-		edgeInfo.setId("someId");
-		edgeInfo.setEdgeStatus("running");
-		when(keyDAO.getEdgeInfo(anyString())).thenReturn(edgeInfo);
-
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not create EDGE node because the status of instance is running");
-
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not upload the key and create EDGE node:");
-
-		accessKeyService.recoverEdge(userInfo);
-
-		verify(keyDAO).getEdgeInfo(USER);
-		verify(keyDAO).updateEdgeStatus(USER, UserInstanceStatus.FAILED.toString());
-		verifyNoMoreInteractions(keyDAO);
-		verifyZeroInteractions(requestBuilder, provisioningService, requestId);
-	}
-
-	@Test
-	public void recoverEdgeWithExceptionInFetchKeyMethod() {
-		EdgeInfo edgeInfo = new EdgeInfo();
-		edgeInfo.setId("someId");
-		edgeInfo.setEdgeStatus("failed");
-		when(keyDAO.getEdgeInfo(anyString())).thenReturn(edgeInfo);
-
-		UserKeyDTO userKeyDTO = new UserKeyDTO();
-		userKeyDTO.withStatus("someStatus");
-		userKeyDTO.withContent("someContent");
-		doThrow(new DlabException(String.format("Key of user %s with status %s not found", USER,
-				KeyLoadStatus.SUCCESS))).when(keyDAO).fetchKey(anyString(), eq(KeyLoadStatus.SUCCESS));
-
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not upload the key and create EDGE node: ");
-
-		accessKeyService.recoverEdge(userInfo);
-
-		verify(keyDAO).getEdgeInfo(USER);
-		verify(keyDAO).fetchKey(USER, KeyLoadStatus.SUCCESS);
-		verify(keyDAO).updateEdgeStatus(USER, UserInstanceStatus.FAILED.toString());
-		verifyNoMoreInteractions(keyDAO);
-		verifyZeroInteractions(requestBuilder, provisioningService, requestId);
-	}
-
-	@Test
-	public void generateKey() {
-		doNothing().when(keyDAO).upsertKey(anyString(), anyString(), anyBoolean());
-
-		UploadFile uploadFile = mock(UploadFile.class);
-		when(requestBuilder.newEdgeKeyUpload(any(UserInfo.class), anyString())).thenReturn(uploadFile);
-
-		String someUuid = "someUuid";
-		when(configuration.getPrivateKeySize()).thenReturn(2048);
-		when(provisioningService.post(anyString(), anyString(), any(UploadFile.class), any())).thenReturn(someUuid);
-		when(requestId.put(anyString(), anyString())).thenReturn(someUuid);
-
-		String actualPrivateKey = accessKeyService.generateKey(userInfo, true);
-		assertTrue(StringUtils.isNotEmpty(actualPrivateKey));
-
-		verify(keyDAO).upsertKey(eq(USER), anyString(), eq(true));
-		verify(requestBuilder).newEdgeKeyUpload(refEq(userInfo), anyString());
-		verify(provisioningService).post("infrastructure/edge/create", TOKEN, uploadFile, String.class);
-		verify(requestId).put(USER, someUuid);
-		verifyNoMoreInteractions(keyDAO, requestBuilder, provisioningService, requestId);
-	}
-
-	@Test
-	public void generateKeyWithException() {
-		doNothing().when(keyDAO).upsertKey(anyString(), anyString(), anyBoolean());
-		when(configuration.getPrivateKeySize()).thenReturn(2048);
-		doThrow(new RuntimeException()).when(requestBuilder).newEdgeKeyUpload(any(UserInfo.class), anyString());
-		doNothing().when(keyDAO).deleteKey(anyString());
-
-		try {
-			accessKeyService.generateKey(userInfo, true);
-		} catch (DlabException e) {
-			assertEquals("Could not upload the key and create EDGE node: ", e.getMessage());
-		}
-
-		verify(keyDAO).upsertKey(eq(USER), anyString(), eq(true));
-		verify(requestBuilder).newEdgeKeyUpload(refEq(userInfo), anyString());
-		verify(keyDAO).deleteKey(USER);
-		verifyNoMoreInteractions(keyDAO, requestBuilder);
-	}
-
-	private UserInfo getUserInfo() {
-		return new UserInfo(USER, TOKEN);
-	}
-
-}
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/EdgeServiceImplTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/EdgeServiceImplTest.java
deleted file mode 100644
index 09784eb..0000000
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/EdgeServiceImplTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.epam.dlab.backendapi.service.impl;
-
-import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.dao.KeyDAO;
-import com.epam.dlab.backendapi.domain.RequestId;
-import com.epam.dlab.backendapi.util.RequestBuilder;
-import com.epam.dlab.dto.ResourceSysBaseDTO;
-import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.exceptions.DlabException;
-import com.epam.dlab.rest.client.RESTService;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.*;
-
-@RunWith(MockitoJUnitRunner.class)
-public class EdgeServiceImplTest {
-
-	private final String USER = "test";
-	private final String TOKEN = "token";
-	private final String UUID = "1234-56789765-4321";
-	private final String STATUS_STOPPED = "stopped";
-	private final String STATUS_RUNNING = "running";
-	private UserInfo userInfo;
-
-	@Mock
-	private KeyDAO keyDAO;
-	@Mock
-	private RESTService provisioningService;
-	@Mock
-	private RequestBuilder requestBuilder;
-	@Mock
-	private RequestId requestId;
-
-	@InjectMocks
-	private EdgeServiceImpl edgeService;
-
-	@Rule
-	public ExpectedException expectedException = ExpectedException.none();
-
-	@Before
-	public void setUp() {
-		userInfo = getUserInfo();
-	}
-
-	@Test
-	public void start() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_STOPPED);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-		ResourceSysBaseDTO rsbDto = new ResourceSysBaseDTO();
-		when(requestBuilder.newEdgeAction(any(UserInfo.class))).thenReturn(rsbDto);
-		String edgeStart = "infrastructure/edge/start";
-		when(provisioningService.post(anyString(), anyString(), any(ResourceSysBaseDTO.class), any()))
-				.thenReturn(UUID);
-		when(requestId.put(anyString(), anyString())).thenReturn(UUID);
-
-		String uuid = edgeService.start(userInfo);
-		assertNotNull(uuid);
-		assertEquals(UUID, uuid);
-
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(keyDAO).updateEdgeStatus(USER, "starting");
-		verify(requestBuilder).newEdgeAction(userInfo);
-		verify(provisioningService).post(edgeStart, TOKEN, rsbDto, String.class);
-		verify(requestId).put(USER, UUID);
-		verifyNoMoreInteractions(keyDAO, requestBuilder, provisioningService, requestId);
-	}
-
-	@Test
-	public void startWithInappropriateEdgeStatus() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_RUNNING);
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not start EDGE node because the status of instance is running");
-
-		edgeService.start(userInfo);
-	}
-
-	@Test
-	public void startWhenMethodNewEdgeActionThrowsException() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_STOPPED);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-
-		doThrow(new DlabException("Cannot create instance of resource class "))
-				.when(requestBuilder).newEdgeAction(any(UserInfo.class));
-		try {
-			edgeService.start(userInfo);
-		} catch (DlabException e) {
-			assertEquals("Could not start EDGE node: Could not infrastructure/edge/start EDGE node : " +
-					"Cannot create instance of resource class ", e.getMessage());
-		}
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(keyDAO).updateEdgeStatus(USER, "starting");
-		verify(keyDAO).updateEdgeStatus(USER, "failed");
-		verify(requestBuilder).newEdgeAction(userInfo);
-		verifyNoMoreInteractions(keyDAO, requestBuilder);
-	}
-
-	@Test
-	public void stop() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_RUNNING);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-		ResourceSysBaseDTO rsbDto = new ResourceSysBaseDTO();
-		when(requestBuilder.newEdgeAction(any(UserInfo.class))).thenReturn(rsbDto);
-		String edgeStop = "infrastructure/edge/stop";
-		when(provisioningService.post(anyString(), anyString(), any(ResourceSysBaseDTO.class), any())).thenReturn
-				(UUID);
-		when(requestId.put(anyString(), anyString())).thenReturn(UUID);
-
-		String uuid = edgeService.stop(userInfo);
-		assertNotNull(uuid);
-		assertEquals(UUID, uuid);
-
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(keyDAO).updateEdgeStatus(USER, "stopping");
-		verify(requestBuilder).newEdgeAction(userInfo);
-		verify(provisioningService).post(edgeStop, TOKEN, rsbDto, String.class);
-		verify(requestId).put(USER, UUID);
-		verifyNoMoreInteractions(keyDAO, requestBuilder, provisioningService, requestId);
-	}
-
-	@Test
-	public void stopWithInappropriateEdgeStatus() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_STOPPED);
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not stop EDGE node because the status of instance is stopped");
-
-		edgeService.stop(userInfo);
-	}
-
-	@Test
-	public void stopWhenMethodNewEdgeActionThrowsException() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_RUNNING);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-
-		doThrow(new DlabException("Cannot create instance of resource class "))
-				.when(requestBuilder).newEdgeAction(any(UserInfo.class));
-		try {
-			edgeService.stop(userInfo);
-		} catch (DlabException e) {
-			assertEquals("Could not stop EDGE node: Could not infrastructure/edge/stop EDGE node : " +
-					"Cannot create instance of resource class ", e.getMessage());
-		}
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(keyDAO).updateEdgeStatus(USER, "stopping");
-		verify(keyDAO).updateEdgeStatus(USER, "failed");
-		verify(requestBuilder).newEdgeAction(userInfo);
-		verifyNoMoreInteractions(keyDAO, requestBuilder);
-	}
-
-	@Test
-	public void terminate() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_RUNNING);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-		ResourceSysBaseDTO rsbDto = new ResourceSysBaseDTO();
-		when(requestBuilder.newEdgeAction(any(UserInfo.class))).thenReturn(rsbDto);
-		String edgeTerminate = "infrastructure/edge/terminate";
-		when(provisioningService.post(anyString(), anyString(), any(ResourceSysBaseDTO.class), any()))
-				.thenReturn(UUID);
-		when(requestId.put(anyString(), anyString())).thenReturn(UUID);
-
-		String uuid = edgeService.terminate(userInfo);
-		assertNotNull(uuid);
-		assertEquals(UUID, uuid);
-
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(keyDAO).updateEdgeStatus(USER, "terminating");
-		verify(requestBuilder).newEdgeAction(userInfo);
-		verify(provisioningService).post(edgeTerminate, TOKEN, rsbDto, String.class);
-		verify(requestId).put(USER, UUID);
-		verifyNoMoreInteractions(keyDAO, requestBuilder, provisioningService, requestId);
-	}
-
-	@Test
-	public void terminateWithInappropriateEdgeStatus() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(anyString());
-		expectedException.expect(DlabException.class);
-		expectedException.expectMessage("Could not terminate EDGE node because the status of instance is null");
-
-		edgeService.terminate(userInfo);
-	}
-
-	@Test
-	public void terminateWhenMethodNewEdgeActionThrowsException() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STATUS_RUNNING);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-
-		doThrow(new DlabException("Cannot create instance of resource class "))
-				.when(requestBuilder).newEdgeAction(any(UserInfo.class));
-		try {
-			edgeService.terminate(userInfo);
-		} catch (DlabException e) {
-			assertEquals("Could not terminate EDGE node: Could not infrastructure/edge/terminate EDGE node : " +
-					"Cannot create instance of resource class ", e.getMessage());
-		}
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(keyDAO).updateEdgeStatus(USER, "terminating");
-		verify(keyDAO).updateEdgeStatus(USER, "failed");
-		verify(requestBuilder).newEdgeAction(userInfo);
-		verifyNoMoreInteractions(keyDAO, requestBuilder);
-	}
-
-	@Test
-	public void updateReuploadKeyFlag() {
-		doNothing().when(keyDAO).updateEdgeReuploadKey(anyString(), anyBoolean(), anyVararg());
-		edgeService.updateReuploadKeyFlag(USER, true, UserInstanceStatus.RUNNING);
-
-		verify(keyDAO).updateEdgeReuploadKey(USER, true, UserInstanceStatus.RUNNING);
-		verifyNoMoreInteractions(keyDAO);
-	}
-
-	private UserInfo getUserInfo() {
-		return new UserInfo(USER, TOKEN);
-	}
-}
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImplTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImplTest.java
index bc8db84..5396ca8 100644
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImplTest.java
+++ b/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImplTest.java
@@ -22,16 +22,14 @@ package com.epam.dlab.backendapi.service.impl;
 import com.epam.dlab.auth.UserInfo;
 import com.epam.dlab.backendapi.dao.EnvDAO;
 import com.epam.dlab.backendapi.dao.ExploratoryDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.dao.UserSettingsDAO;
 import com.epam.dlab.backendapi.domain.ProjectDTO;
 import com.epam.dlab.backendapi.domain.ProjectEndpointDTO;
 import com.epam.dlab.backendapi.resources.dto.UserDTO;
 import com.epam.dlab.backendapi.service.ComputationalService;
-import com.epam.dlab.backendapi.service.EdgeService;
 import com.epam.dlab.backendapi.service.ExploratoryService;
-import com.epam.dlab.backendapi.service.SecurityService;
 import com.epam.dlab.backendapi.service.ProjectService;
+import com.epam.dlab.backendapi.service.SecurityService;
 import com.epam.dlab.dto.UserInstanceDTO;
 import com.epam.dlab.dto.UserInstanceStatus;
 import com.epam.dlab.dto.base.edge.EdgeInfo;
@@ -76,10 +74,6 @@ public class EnvironmentServiceImplTest {
 	@Mock
 	private ComputationalService computationalService;
 	@Mock
-	private EdgeService edgeService;
-	@Mock
-	private KeyDAO keyDAO;
-	@Mock
 	private UserSettingsDAO userSettingsDAO;
 	@Mock
 	private ProjectService projectService;
@@ -145,24 +139,18 @@ public class EnvironmentServiceImplTest {
 	public void stopEnvironment() {
 		final UserInfo userInfo = getUserInfo();
 		when(exploratoryDAO.fetchRunningExploratoryFields(anyString())).thenReturn(getUserInstances());
-		when(securityService.getUserInfoOffline(anyString())).thenReturn(userInfo);
 		when(exploratoryService.stop(any(UserInfo.class), anyString())).thenReturn(UUID);
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(RUNNING_STATE);
-		when(edgeService.stop(any(UserInfo.class))).thenReturn(UUID);
 
 		environmentService.stopEnvironment(userInfo, USER);
 
 		verify(exploratoryDAO).fetchRunningExploratoryFields(USER);
-		verify(securityService).getUserInfoOffline(USER);
 		verify(exploratoryService).stop(refEq(userInfo), eq(EXPLORATORY_NAME_1));
 		verify(exploratoryService).stop(refEq(userInfo), eq(EXPLORATORY_NAME_2));
-		verify(keyDAO, times(2)).getEdgeStatus(USER);
-		verify(edgeService).stop(refEq(userInfo));
 		verify(exploratoryDAO).fetchUserExploratoriesWhereStatusIn(USER, Arrays.asList(UserInstanceStatus.CREATING,
 				UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE),
 				UserInstanceStatus.CREATING,
 				UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE);
-		verifyNoMoreInteractions(keyDAO, exploratoryDAO, edgeService, exploratoryService);
+		verifyNoMoreInteractions(exploratoryDAO, exploratoryService);
 	}
 
 	@Test
@@ -176,32 +164,20 @@ public class EnvironmentServiceImplTest {
 	}
 
 	@Test
-	public void stopEnvironmentWithEdgeStarting() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn("starting");
-		expectedException.expect(ResourceConflictException.class);
-
-		environmentService.stopEnvironment(getUserInfo(), USER);
-	}
-
-	@Test
 	public void stopEnvironmentWithoutEdge() {
 		final UserInfo userInfo = getUserInfo();
 		when(exploratoryDAO.fetchRunningExploratoryFields(anyString())).thenReturn(getUserInstances());
 		when(exploratoryService.stop(any(UserInfo.class), anyString())).thenReturn(UUID);
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(STOPPED_STATE);
-		when(edgeService.stop(any(UserInfo.class))).thenReturn(UUID);
 
 		environmentService.stopEnvironment(userInfo, USER);
 
 		verify(exploratoryDAO).fetchRunningExploratoryFields(USER);
 		verify(exploratoryService).stop(refEq(userInfo), eq(EXPLORATORY_NAME_1));
 		verify(exploratoryService).stop(refEq(userInfo), eq(EXPLORATORY_NAME_2));
-		verify(keyDAO, times(2)).getEdgeStatus(USER);
-		verify(edgeService, never()).stop(refEq(userInfo));
 		verify(exploratoryDAO).fetchUserExploratoriesWhereStatusIn(USER, Arrays.asList(UserInstanceStatus.CREATING,
 				UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE),
 				UserInstanceStatus.CREATING, UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE);
-		verifyNoMoreInteractions(keyDAO, envDAO, exploratoryDAO, edgeService, exploratoryService);
+		verifyNoMoreInteractions(envDAO, exploratoryDAO, exploratoryService);
 	}
 
 	@Test
@@ -230,32 +206,6 @@ public class EnvironmentServiceImplTest {
 	}
 
 	@Test
-	public void stopEdge() {
-		final UserInfo userInfo = getUserInfo();
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn(RUNNING_STATE);
-		when(securityService.getUserInfoOffline(anyString())).thenReturn(userInfo);
-		when(edgeService.stop(any(UserInfo.class))).thenReturn(UUID);
-
-		environmentService.stopEdge(USER);
-
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(securityService).getUserInfoOffline(USER);
-		verify(edgeService).stop(refEq(userInfo));
-		verifyNoMoreInteractions(keyDAO, securityService, edgeService);
-	}
-
-	@Test
-	public void stopEdgeWhenItIsNotRunning() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn("starting");
-
-		environmentService.stopEdge(USER);
-
-		verify(keyDAO).getEdgeStatus(USER);
-		verifyZeroInteractions(securityService, edgeService);
-		verifyNoMoreInteractions(keyDAO);
-	}
-
-	@Test
 	public void stopExploratory() {
 		final UserInfo userInfo = getUserInfo();
 		when(exploratoryService.stop(any(UserInfo.class), anyString())).thenReturn(UUID);
@@ -278,76 +228,6 @@ public class EnvironmentServiceImplTest {
 	}
 
 	@Test
-	@SuppressWarnings("unchecked")
-	public void terminateEnvironment() {
-		final UserInfo userInfo = getUserInfo();
-		when(exploratoryDAO.fetchUserExploratoriesWhereStatusIn(anyString(), any(List.class), anyVararg()))
-				.thenReturn(Collections.emptyList());
-		when(securityService.getUserInfoOffline(anyString())).thenReturn(userInfo);
-		when(exploratoryService.terminate(any(UserInfo.class), anyString())).thenReturn(UUID);
-		when(keyDAO.edgeNodeExist(anyString())).thenReturn(true);
-		when(edgeService.terminate(any(UserInfo.class))).thenReturn(UUID);
-
-		environmentService.terminateEnvironment(userInfo, USER);
-
-		verify(exploratoryDAO).fetchUserExploratoriesWhereStatusIn(anyString(), any(List.class), anyVararg());
-		verify(securityService).getUserInfoOffline(USER);
-		verify(keyDAO).edgeNodeExist(USER);
-		verify(edgeService).terminate(refEq(userInfo));
-		verify(exploratoryService).updateExploratoryStatuses(USER, UserInstanceStatus.TERMINATING);
-		verify(keyDAO).getEdgeStatus(userInfo.getName());
-		verify(exploratoryDAO).fetchUserExploratoriesWhereStatusIn(USER, Arrays.asList(UserInstanceStatus.CREATING,
-				UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE),
-				UserInstanceStatus.CREATING, UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE);
-		verifyNoMoreInteractions(keyDAO, envDAO, exploratoryDAO, edgeService, exploratoryService);
-	}
-
-	@Test
-	@SuppressWarnings("unchecked")
-	public void terminateEnvironmentWithoutEdge() {
-		final UserInfo userInfo = getUserInfo();
-		when(exploratoryDAO.fetchUserExploratoriesWhereStatusIn(anyString(), any(List.class),
-				eq(UserInstanceStatus.CREATING), eq(UserInstanceStatus.STARTING))).thenReturn(Collections.emptyList());
-		when(exploratoryDAO.fetchUserExploratoriesWhereStatusNotIn(anyString(), eq(UserInstanceStatus.TERMINATED),
-				eq(UserInstanceStatus.FAILED), eq(UserInstanceStatus.TERMINATING))).thenReturn(getUserInstances());
-		when(exploratoryService.terminate(any(UserInfo.class), anyString())).thenReturn(UUID);
-		when(keyDAO.edgeNodeExist(anyString())).thenReturn(false);
-		when(edgeService.terminate(any(UserInfo.class))).thenReturn(UUID);
-
-		environmentService.terminateEnvironment(userInfo, USER);
-
-		verify(exploratoryDAO).fetchUserExploratoriesWhereStatusNotIn(USER, UserInstanceStatus.TERMINATED,
-				UserInstanceStatus.FAILED, UserInstanceStatus.TERMINATING);
-		verify(exploratoryService).terminate(refEq(userInfo), eq(EXPLORATORY_NAME_1));
-		verify(exploratoryService).terminate(refEq(userInfo), eq(EXPLORATORY_NAME_2));
-		verify(keyDAO).edgeNodeExist(USER);
-		verify(edgeService, never()).terminate(refEq(userInfo));
-		verify(keyDAO).getEdgeStatus(USER);
-		verify(exploratoryDAO).fetchUserExploratoriesWhereStatusIn(USER, Arrays.asList(UserInstanceStatus.CREATING,
-				UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE),
-				UserInstanceStatus.CREATING, UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE);
-		verifyNoMoreInteractions(keyDAO, envDAO, exploratoryDAO, edgeService, exploratoryService);
-	}
-
-	@Test
-	@SuppressWarnings("unchecked")
-	public void terminateEnvironmentWithWrongResourceState() {
-		when(exploratoryDAO.fetchUserExploratoriesWhereStatusIn(anyString(), any(List.class), anyVararg()))
-				.thenReturn(getUserInstances());
-		expectedException.expect(ResourceConflictException.class);
-
-		environmentService.terminateEnvironment(getUserInfo(), USER);
-	}
-
-	@Test
-	public void terminateEnvironmentWithEdgeStarting() {
-		when(keyDAO.getEdgeStatus(anyString())).thenReturn("starting");
-		expectedException.expect(ResourceConflictException.class);
-
-		environmentService.terminateEnvironment(getUserInfo(), USER);
-	}
-
-	@Test
 	public void terminateExploratory() {
 		final UserInfo userInfo = getUserInfo();
 		when(exploratoryService.terminate(any(UserInfo.class), anyString())).thenReturn(UUID);
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImplTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImplTest.java
index 6e4bdc1..7c5d048 100644
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImplTest.java
+++ b/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/ReuploadKeyServiceImplTest.java
@@ -22,16 +22,11 @@ package com.epam.dlab.backendapi.service.impl;
 import com.epam.dlab.auth.UserInfo;
 import com.epam.dlab.backendapi.dao.ComputationalDAO;
 import com.epam.dlab.backendapi.dao.ExploratoryDAO;
-import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.domain.RequestId;
 import com.epam.dlab.backendapi.service.ExploratoryService;
-import com.epam.dlab.backendapi.service.UserResourceService;
 import com.epam.dlab.backendapi.util.RequestBuilder;
 import com.epam.dlab.dto.UserInstanceDTO;
 import com.epam.dlab.dto.UserInstanceStatus;
-import com.epam.dlab.dto.aws.edge.EdgeInfoAws;
-import com.epam.dlab.dto.base.DataEngineType;
-import com.epam.dlab.dto.base.edge.EdgeInfo;
 import com.epam.dlab.dto.reuploadkey.ReuploadKeyCallbackDTO;
 import com.epam.dlab.dto.reuploadkey.ReuploadKeyDTO;
 import com.epam.dlab.dto.reuploadkey.ReuploadKeyStatus;
@@ -48,15 +43,15 @@ import org.junit.rules.ExpectedException;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 
-import java.util.*;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 
 import static com.epam.dlab.dto.UserInstanceStatus.REUPLOADING_KEY;
 import static com.epam.dlab.dto.UserInstanceStatus.RUNNING;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.*;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -69,8 +64,6 @@ public class ReuploadKeyServiceImplTest {
 	private UserInfo userInfo;
 
 	@Mock
-	private KeyDAO keyDAO;
-	@Mock
 	private RESTService provisioningService;
 	@Mock
 	private RequestBuilder requestBuilder;
@@ -82,8 +75,6 @@ public class ReuploadKeyServiceImplTest {
 	private ComputationalDAO computationalDAO;
 	@Mock
 	private ExploratoryDAO exploratoryDAO;
-	@Mock
-	private UserResourceService userResourceService;
 
 	@InjectMocks
 	private ReuploadKeyServiceImpl reuploadKeyService;
@@ -97,124 +88,23 @@ public class ReuploadKeyServiceImplTest {
 		userInfo = getUserInfo();
 	}
 
-
-	@Test
-	@SuppressWarnings("unchecked")
-	public void reuploadKey() {
-		doNothing().when(userResourceService).updateReuploadKeyFlagForUserResources(anyString(), anyBoolean());
-		List<UserInstanceDTO> instances = Collections.singletonList(getUserInstance());
-		when(exploratoryService.getInstancesWithStatuses(anyString(), any(UserInstanceStatus.class),
-				any(UserInstanceStatus.class))).thenReturn(instances);
-		List<ResourceData> resourceList = new ArrayList<>();
-		resourceList.add(new ResourceData(ResourceType.EXPLORATORY, "someId", EXPLORATORY_NAME, null));
-		when(userResourceService.convertToResourceData(any(List.class))).thenReturn(resourceList);
-
-		Optional<EdgeInfoAws> edgeInfo = Optional.of(new EdgeInfoAws());
-		Mockito.<Optional<? extends EdgeInfo>>when(keyDAO.getEdgeInfoWhereStatusIn(anyString(), anyVararg()))
-				.thenReturn(edgeInfo);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-
-		doNothing().when(exploratoryDAO).updateStatusForExploratories(any(UserInstanceStatus.class), anyString(),
-				any(UserInstanceStatus.class));
-		doNothing().when(computationalDAO).updateStatusForComputationalResources(any(UserInstanceStatus.class),
-				anyString(), any(List.class), any(List.class), any(UserInstanceStatus.class));
-		ReuploadKeyDTO reuploadFile = mock(ReuploadKeyDTO.class);
-		when(requestBuilder.newKeyReupload(any(UserInfo.class), anyString(), anyString(), any(List.class)))
-				.thenReturn(reuploadFile);
-		String expectedUuid = "someUuid";
-		when(provisioningService.post(anyString(), anyString(), any(ReuploadKeyDTO.class), any()))
-				.thenReturn(expectedUuid);
-
-		String keyContent = "keyContent";
-		String actualUuid = reuploadKeyService.reuploadKey(userInfo, keyContent);
-		assertNotNull(actualUuid);
-		assertEquals(expectedUuid, actualUuid);
-		assertEquals(2, resourceList.size());
-
-		verify(userResourceService).updateReuploadKeyFlagForUserResources(USER, true);
-		verify(exploratoryService).getInstancesWithStatuses(USER, RUNNING, RUNNING);
-		verify(userResourceService).convertToResourceData(instances);
-		verify(keyDAO).getEdgeInfoWhereStatusIn(USER, RUNNING);
-		verify(keyDAO).updateEdgeStatus(USER, "reuploading key");
-		verify(exploratoryDAO).updateStatusForExploratories(REUPLOADING_KEY, USER, RUNNING);
-		verify(computationalDAO).updateStatusForComputationalResources(REUPLOADING_KEY, USER,
-				Arrays.asList(RUNNING, REUPLOADING_KEY), Arrays.asList(DataEngineType.SPARK_STANDALONE,
-						DataEngineType.CLOUD_SERVICE), RUNNING);
-		verify(requestBuilder).newKeyReupload(refEq(userInfo), anyString(), eq(keyContent), any(List.class));
-		verify(provisioningService).post("/key/reupload", TOKEN, reuploadFile, String.class);
-		verifyNoMoreInteractions(userResourceService, exploratoryService, keyDAO, exploratoryDAO, computationalDAO,
-				requestBuilder, provisioningService);
-		verifyZeroInteractions(requestId);
-	}
-
-	@Test
-	@SuppressWarnings("unchecked")
-	public void reuploadKeyWithoutEdge() {
-		doNothing().when(userResourceService).updateReuploadKeyFlagForUserResources(anyString(), anyBoolean());
-		List<UserInstanceDTO> instances = Collections.singletonList(getUserInstance());
-		when(exploratoryService.getInstancesWithStatuses(anyString(), any(UserInstanceStatus.class),
-				any(UserInstanceStatus.class))).thenReturn(instances);
-		List<ResourceData> resourceList = new ArrayList<>();
-		resourceList.add(new ResourceData(ResourceType.EXPLORATORY, "someId", EXPLORATORY_NAME, null));
-		when(userResourceService.convertToResourceData(any(List.class))).thenReturn(resourceList);
-		when(keyDAO.getEdgeInfoWhereStatusIn(anyString(), anyVararg())).thenReturn(Optional.empty());
-		doNothing().when(exploratoryDAO).updateStatusForExploratories(any(UserInstanceStatus.class), anyString(),
-				any(UserInstanceStatus.class));
-		doNothing().when(computationalDAO).updateStatusForComputationalResources(any(UserInstanceStatus.class),
-				anyString(), any(List.class), any(List.class), any(UserInstanceStatus.class));
-		ReuploadKeyDTO reuploadFile = mock(ReuploadKeyDTO.class);
-		when(requestBuilder.newKeyReupload(any(UserInfo.class), anyString(), anyString(), any(List.class)))
-				.thenReturn(reuploadFile);
-		String expectedUuid = "someUuid";
-		when(provisioningService.post(anyString(), anyString(), any(ReuploadKeyDTO.class), any()))
-				.thenReturn(expectedUuid);
-
-		String keyContent = "keyContent";
-		String actualUuid = reuploadKeyService.reuploadKey(userInfo, keyContent);
-		assertNotNull(actualUuid);
-		assertEquals(expectedUuid, actualUuid);
-		assertEquals(1, resourceList.size());
-
-		verify(userResourceService).updateReuploadKeyFlagForUserResources(USER, true);
-		verify(exploratoryService).getInstancesWithStatuses(USER, RUNNING, RUNNING);
-		verify(userResourceService).convertToResourceData(instances);
-		verify(keyDAO).getEdgeInfoWhereStatusIn(USER, RUNNING);
-		verify(exploratoryDAO).updateStatusForExploratories(REUPLOADING_KEY, USER, RUNNING);
-		verify(computationalDAO).updateStatusForComputationalResources(REUPLOADING_KEY, USER,
-				Arrays.asList(RUNNING, REUPLOADING_KEY), Arrays.asList(DataEngineType.SPARK_STANDALONE,
-						DataEngineType.CLOUD_SERVICE), RUNNING);
-		verify(requestBuilder).newKeyReupload(refEq(userInfo), anyString(), eq(keyContent), any(List.class));
-		verify(provisioningService).post("/key/reupload", TOKEN, reuploadFile, String.class);
-		verifyNoMoreInteractions(userResourceService, exploratoryService, keyDAO, exploratoryDAO, computationalDAO,
-				requestBuilder, provisioningService);
-		verifyZeroInteractions(requestId);
-	}
-
 	@Test
 	public void updateResourceDataForEdgeWhenStatusCompleted() {
 		ResourceData resource = new ResourceData(ResourceType.EDGE, "someId", null, null);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
-		doNothing().when(keyDAO).updateEdgeReuploadKey(anyString(), anyBoolean(), anyVararg());
 		ReuploadKeyStatusDTO dto = getReuploadKeyStatusDTO(resource, ReuploadKeyStatus.COMPLETED);
 
 		reuploadKeyService.updateResourceData(dto);
 
-		verify(keyDAO).updateEdgeStatus(USER, "running");
-		verify(keyDAO).updateEdgeReuploadKey(USER, false, UserInstanceStatus.values());
-		verifyNoMoreInteractions(keyDAO);
 		verifyZeroInteractions(exploratoryDAO, computationalDAO);
 	}
 
 	@Test
 	public void updateResourceDataForEdgeWhenStatusFailed() {
 		ResourceData resource = new ResourceData(ResourceType.EDGE, "someId", null, null);
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
 
 		ReuploadKeyStatusDTO dto = getReuploadKeyStatusDTO(resource, ReuploadKeyStatus.FAILED);
 		reuploadKeyService.updateResourceData(dto);
 
-		verify(keyDAO).updateEdgeStatus(USER, "running");
-		verifyNoMoreInteractions(keyDAO);
 		verifyZeroInteractions(exploratoryDAO, computationalDAO);
 	}
 
@@ -232,7 +122,7 @@ public class ReuploadKeyServiceImplTest {
 		verify(exploratoryDAO).updateStatusForExploratory(USER, EXPLORATORY_NAME, RUNNING);
 		verify(exploratoryDAO).updateReuploadKeyForExploratory(USER, EXPLORATORY_NAME, false);
 		verifyNoMoreInteractions(exploratoryDAO);
-		verifyZeroInteractions(keyDAO, computationalDAO);
+		verifyZeroInteractions(computationalDAO);
 	}
 
 	@Test
@@ -247,7 +137,7 @@ public class ReuploadKeyServiceImplTest {
 
 		verify(exploratoryDAO).updateStatusForExploratory(USER, EXPLORATORY_NAME, RUNNING);
 		verifyNoMoreInteractions(exploratoryDAO);
-		verifyZeroInteractions(keyDAO, computationalDAO);
+		verifyZeroInteractions(computationalDAO);
 	}
 
 	@Test
@@ -265,7 +155,7 @@ public class ReuploadKeyServiceImplTest {
 		verify(computationalDAO).updateReuploadKeyFlagForComputationalResource(USER, EXPLORATORY_NAME, "compName",
 				false);
 		verifyNoMoreInteractions(computationalDAO);
-		verifyZeroInteractions(exploratoryDAO, keyDAO);
+		verifyZeroInteractions(exploratoryDAO);
 	}
 
 	@Test
@@ -279,13 +169,12 @@ public class ReuploadKeyServiceImplTest {
 
 		verify(computationalDAO).updateStatusForComputationalResource(USER, EXPLORATORY_NAME, "compName", RUNNING);
 		verifyNoMoreInteractions(computationalDAO);
-		verifyZeroInteractions(exploratoryDAO, keyDAO);
+		verifyZeroInteractions(exploratoryDAO);
 	}
 
 	@Test
 	@SuppressWarnings("unchecked")
 	public void reuploadKeyActionForEdge() {
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), anyString());
 		ReuploadKeyDTO reuploadFile = mock(ReuploadKeyDTO.class);
 		when(requestBuilder.newKeyReupload(any(UserInfo.class), anyString(), anyString(), any(List.class)))
 				.thenReturn(reuploadFile);
@@ -297,22 +186,19 @@ public class ReuploadKeyServiceImplTest {
 		ResourceData resource = new ResourceData(ResourceType.EDGE, "someId", null, null);
 		reuploadKeyService.reuploadKeyAction(userInfo, resource);
 
-		verify(keyDAO).updateEdgeStatus(USER, "reuploading key");
 		verify(requestBuilder).newKeyReupload(refEq(userInfo), anyString(), eq(""), any(List.class));
 		verify(provisioningService).post("/key/reupload", TOKEN, reuploadFile, String.class,
 				Collections.singletonMap("is_primary_reuploading", false));
 		verify(requestId).put(USER, expectedUuid);
-		verifyNoMoreInteractions(keyDAO, requestBuilder, provisioningService, requestId);
+		verifyNoMoreInteractions(requestBuilder, provisioningService, requestId);
 		verifyZeroInteractions(exploratoryDAO, computationalDAO);
 	}
 
 	@Test
 	@SuppressWarnings("unchecked")
 	public void reuploadKeyActionForEdgeWithException() {
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), eq("reuploading key"));
 		doThrow(new DlabException("Couldn't reupload key to edge"))
 				.when(requestBuilder).newKeyReupload(any(UserInfo.class), anyString(), anyString(), any(List.class));
-		doNothing().when(keyDAO).updateEdgeStatus(anyString(), eq("running"));
 
 		ResourceData resource = new ResourceData(ResourceType.EDGE, "someId", null, null);
 		try {
@@ -322,10 +208,8 @@ public class ReuploadKeyServiceImplTest {
 					e.getMessage());
 		}
 
-		verify(keyDAO).updateEdgeStatus(USER, "reuploading key");
 		verify(requestBuilder).newKeyReupload(refEq(userInfo), anyString(), eq(""), any(List.class));
-		verify(keyDAO).updateEdgeStatus(USER, "running");
-		verifyNoMoreInteractions(keyDAO, requestBuilder);
+		verifyNoMoreInteractions(requestBuilder);
 		verifyZeroInteractions(exploratoryDAO, computationalDAO, provisioningService, requestId);
 	}
 
@@ -351,7 +235,7 @@ public class ReuploadKeyServiceImplTest {
 				Collections.singletonMap("is_primary_reuploading", false));
 		verify(requestId).put(USER, expectedUuid);
 		verifyNoMoreInteractions(exploratoryDAO, requestBuilder, provisioningService, requestId);
-		verifyZeroInteractions(keyDAO, computationalDAO);
+		verifyZeroInteractions(computationalDAO);
 	}
 
 	@Test
@@ -376,7 +260,7 @@ public class ReuploadKeyServiceImplTest {
 		verify(requestBuilder).newKeyReupload(refEq(userInfo), anyString(), eq(""), any(List.class));
 		verify(exploratoryDAO).updateStatusForExploratory(USER, EXPLORATORY_NAME, RUNNING);
 		verifyNoMoreInteractions(exploratoryDAO, requestBuilder);
-		verifyZeroInteractions(keyDAO, computationalDAO, provisioningService, requestId);
+		verifyZeroInteractions(computationalDAO, provisioningService, requestId);
 	}
 
 	@Test
@@ -403,7 +287,7 @@ public class ReuploadKeyServiceImplTest {
 				Collections.singletonMap("is_primary_reuploading", false));
 		verify(requestId).put(USER, expectedUuid);
 		verifyNoMoreInteractions(computationalDAO, requestBuilder, provisioningService, requestId);
-		verifyZeroInteractions(keyDAO, exploratoryDAO);
+		verifyZeroInteractions(exploratoryDAO);
 	}
 
 	@Test
@@ -431,7 +315,7 @@ public class ReuploadKeyServiceImplTest {
 		verify(computationalDAO).updateStatusForComputationalResource(USER, EXPLORATORY_NAME,
 				"compName", RUNNING);
 		verifyNoMoreInteractions(computationalDAO, requestBuilder);
-		verifyZeroInteractions(keyDAO, exploratoryDAO, provisioningService, requestId);
+		verifyZeroInteractions(exploratoryDAO, provisioningService, requestId);
 	}
 
 	private UserInfo getUserInfo() {
diff --git a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/UserResourceServiceImplTest.java b/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/UserResourceServiceImplTest.java
deleted file mode 100644
index 5343c2b..0000000
--- a/services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/UserResourceServiceImplTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.epam.dlab.backendapi.service.impl;
-
-
-import com.epam.dlab.backendapi.service.ComputationalService;
-import com.epam.dlab.backendapi.service.EdgeService;
-import com.epam.dlab.backendapi.service.ExploratoryService;
-import com.epam.dlab.dto.UserInstanceDTO;
-import com.epam.dlab.dto.base.DataEngineType;
-import com.epam.dlab.dto.computational.UserComputationalResource;
-import com.epam.dlab.model.ResourceData;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static com.epam.dlab.dto.UserInstanceStatus.*;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.*;
-
-@RunWith(MockitoJUnitRunner.class)
-public class UserResourceServiceImplTest {
-
-	private final String USER = "test";
-	private final String EXPLORATORY_NAME = "explName";
-
-	@Mock
-	private ExploratoryService exploratoryService;
-	@Mock
-	private ComputationalService computationalService;
-	@Mock
-	private EdgeService edgeService;
-
-	@InjectMocks
-	private UserResourceServiceImpl userResourceService;
-
-	@Test
-	public void convertToResourceData() {
-		List<UserInstanceDTO> userInstances = Collections.singletonList(getUserInstance());
-		List<ResourceData> expectedResourceList = Arrays.asList(
-				ResourceData.exploratoryResource("explId", EXPLORATORY_NAME),
-				ResourceData.computationalResource("compId", EXPLORATORY_NAME, "compName")
-		);
-		List<ResourceData> actualResourceList = userResourceService.convertToResourceData(userInstances);
-		assertEquals(2, actualResourceList.size());
-		assertEquals(expectedResourceList.get(0).toString(), actualResourceList.get(0).toString());
-		assertEquals(expectedResourceList.get(1).toString(), actualResourceList.get(1).toString());
-	}
-
-	@Test
-	@SuppressWarnings("unchecked")
-	public void updateReuploadKeyFlagForUserResources() {
-		doNothing().when(exploratoryService).updateExploratoriesReuploadKeyFlag(anyString(), anyBoolean(), anyVararg
-				());
-		doNothing().when(computationalService).updateComputationalsReuploadKeyFlag(anyString(), any(List.class),
-				any(List.class), anyBoolean(), anyVararg());
-		doNothing().when(edgeService).updateReuploadKeyFlag(anyString(), anyBoolean(), anyVararg());
-
-		userResourceService.updateReuploadKeyFlagForUserResources(USER, false);
-
-		verify(exploratoryService).updateExploratoriesReuploadKeyFlag(USER, false,
-				CREATING, CONFIGURING, STARTING, RUNNING, STOPPING, STOPPED);
-		verify(computationalService).updateComputationalsReuploadKeyFlag(USER,
-				Arrays.asList(STARTING, RUNNING, STOPPING, STOPPED),
-				Collections.singletonList(DataEngineType.SPARK_STANDALONE),
-				false,
-				CREATING, CONFIGURING, STARTING, RUNNING, STOPPING, STOPPED);
-		verify(computationalService).updateComputationalsReuploadKeyFlag(USER,
-				Collections.singletonList(RUNNING),
-				Collections.singletonList(DataEngineType.CLOUD_SERVICE),
-				false,
-				CREATING, CONFIGURING, STARTING, RUNNING);
-		verify(edgeService).updateReuploadKeyFlag(USER, false, STARTING, RUNNING, STOPPING, STOPPED);
-		verifyNoMoreInteractions(exploratoryService, computationalService, edgeService);
-	}
-
-	private UserInstanceDTO getUserInstance() {
-		UserComputationalResource computationalResource = new UserComputationalResource();
-		computationalResource.setComputationalId("compId");
-		computationalResource.setComputationalName("compName");
-		return new UserInstanceDTO()
-				.withUser(USER)
-				.withExploratoryId("explId")
-				.withExploratoryName(EXPLORATORY_NAME)
-				.withResources(Collections.singletonList(computationalResource));
-	}
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org