Merge branch 'develop' into DATALAB-new-jars-sufix-in-dockerfiles
diff --git a/build.properties b/build.properties
index 275dfaa..622c600 100644
--- a/build.properties
+++ b/build.properties
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-datalab.version=2.4
\ No newline at end of file
+datalab.version=2.5
\ No newline at end of file
diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py
index bb89cd5..844d0a7 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -1139,7 +1139,8 @@
attempt = 0
while attempt < 15:
print('connection attempt {}'.format(attempt))
- conn = Connection(host = hostname, user = username, connect_kwargs={'key_filename': keyfile})
+ conn = Connection(host = hostname, user = username, connect_kwargs={'banner_timeout': 200,
+ 'key_filename': keyfile})
conn.config.run.echo = True
try:
conn.run('ls')
diff --git a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesConst.java b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesConst.java
index d4a2c51..ea71207 100644
--- a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesConst.java
+++ b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesConst.java
@@ -23,15 +23,15 @@
String GKE_SELF_SERVICE_PATH = "/root/self-service.yaml";
String GKE_SELF_SERVICE = "self-service.yaml";
String SELF_SERVICE = "self-service.yml";
- // String SELF_SERVICE_PROP_PATH = "services/self-service/self-service.yml";
String SELF_SERVICE_PROP_PATH = "/opt/datalab/conf/self-service.yml";
+ // String SELF_SERVICE_PROP_PATH = "services/self-service/self-service.yml";
String PROVISIONING_SERVICE = "provisioning.yml";
- // String PROVISIONING_SERVICE_PROP_PATH = "services/provisioning-service/provisioning.yml";
String PROVISIONING_SERVICE_PROP_PATH = "/opt/datalab/conf/provisioning.yml";
+// String PROVISIONING_SERVICE_PROP_PATH = "services/provisioning-service/provisioning.yml";
String BILLING_SERVICE = "billing.yml";
String BILLING_SERVICE_PROP_PATH = "/opt/datalab/conf/billing.yml";
- // String BILLING_SERVICE_PROP_PATH = "services/billing-gcp/billing.yml";
+ // String BILLING_SERVICE_PROP_PATH = "services/billing-gcp/billing.yml";
// String BILLING_SERVICE_PROP_PATH = "services/billing-azure/billing.yml";
// String BILLING_SERVICE_PROP_PATH = "services/billing-aws/billing.yml";
String GKE_BILLING_PATH = "/root/billing.yaml";
@@ -43,7 +43,7 @@
String SELF_SERVICE_SUPERVISORCTL_RUN_NAME = " ui ";
String PROVISIONING_SERVICE_SUPERVISORCTL_RUN_NAME = " provserv ";
String BILLING_SERVICE_SUPERVISORCTL_RUN_NAME = " billing ";
- String SECRET_REGEX = "((.*)[sS]ecret(.*)|password): (.*)";
+ String SECRET_REGEX = "((.*)[sS]ecret(.*)|(p|P)assword): (.*)";
String USER_REGEX = " *(user|username): (.*)";
String SECRET_REPLACEMENT_FORMAT = " ***********";
String SUPERVISORCTL_RESTART_SH_COMMAND = "sudo supervisorctl restart";
diff --git a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java
index 67f75b4..095b78c 100644
--- a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java
+++ b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java
@@ -28,13 +28,13 @@
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static com.epam.datalab.properties.ChangePropertiesConst.DEFAULT_NAME_PLACE;
+import static com.epam.datalab.properties.ChangePropertiesConst.DEFAULT_VALUE_PLACE;
+
@Slf4j
public class ChangePropertiesService {
@@ -51,21 +51,16 @@
public void writeFileFromString(String newPropFile, String serviceName, String servicePath) {
- String oldFile = readFile(serviceName, servicePath);
- try (BufferedWriter writer = new BufferedWriter(new FileWriter(servicePath))) {
- try {
- changeCHMODE(serviceName, servicePath, ChangePropertiesConst.DEFAULT_CHMOD, ChangePropertiesConst.WRITE_CHMOD);
- log.info("Trying to overwrite {}, file for path {} :", serviceName, servicePath);
- writer.write(addLicence());
- writer.write(checkAndReplaceSecretIfEmpty(newPropFile, oldFile));
- log.info("{} overwritten successfully", serviceName);
- writer.close();
- changeCHMODE(serviceName, servicePath, ChangePropertiesConst.WRITE_CHMOD, ChangePropertiesConst.DEFAULT_CHMOD);
- } catch (Exception e) {
- log.error("Failed during overwriting {}", serviceName);
- writer.write(oldFile);
- throw new DynamicChangePropertiesException(String.format("Failed during overwriting %s", serviceName));
- }
+ try {
+ changeCHMODE(serviceName, servicePath, ChangePropertiesConst.DEFAULT_CHMOD, ChangePropertiesConst.WRITE_CHMOD);
+ String oldFile = readFile(serviceName, servicePath);
+ BufferedWriter writer = new BufferedWriter(new FileWriter(servicePath));
+ log.info("Trying to overwrite {}, file for path {} :", serviceName, servicePath);
+ writer.write(addLicence());
+ writer.write(checkAndReplaceSecretIfEmpty(newPropFile, oldFile));
+ log.info("{} overwritten successfully", serviceName);
+ writer.close();
+ changeCHMODE(serviceName, servicePath, ChangePropertiesConst.WRITE_CHMOD, ChangePropertiesConst.DEFAULT_CHMOD);
} catch (IOException e) {
log.error("Failed to create writer with path {}", servicePath);
throw new DynamicChangePropertiesException(String.format("Failed during overwriting %s", serviceName));
@@ -112,31 +107,27 @@
Matcher passMatcher = Pattern.compile(ChangePropertiesConst.SECRET_REGEX).matcher(currentConf);
Matcher userMatcher = Pattern.compile(ChangePropertiesConst.USER_REGEX).matcher(currentConf);
List<String> secretsAndUsers = new ArrayList<>();
- String confWithReplacedSecretConf = removeLicence(currentConf);
+ final String[] confWithReplacedSecretConf = {removeLicence(currentConf)};
while (passMatcher.find()) {
- String secret = passMatcher.group().split(":")[ChangePropertiesConst.DEFAULT_VALUE_PLACE];
- if (!(secret.isEmpty() || secret.trim().isEmpty()))
- secretsAndUsers.add(secret);
+ String[] secret = passMatcher.group().split(":");
+ if (!(secret[DEFAULT_VALUE_PLACE].isEmpty() ||
+ secret[DEFAULT_VALUE_PLACE].trim().isEmpty())) {
+
+ secretsAndUsers.add(secret[DEFAULT_NAME_PLACE] + ":" + secret[DEFAULT_VALUE_PLACE]);
+ }
}
while (userMatcher.find()) {
- String user = userMatcher.group().split(":")[ChangePropertiesConst.DEFAULT_VALUE_PLACE];
- if (!(user.isEmpty() || user.trim().isEmpty()))
- secretsAndUsers.add(user);
+ String[] user = userMatcher.group().split(":");
+ if (!(user[DEFAULT_VALUE_PLACE].isEmpty() ||
+ user[DEFAULT_VALUE_PLACE].trim().isEmpty()))
+ secretsAndUsers.add(user[DEFAULT_NAME_PLACE] + ":" + user[DEFAULT_VALUE_PLACE]);
+
}
- for (String secretOrUser : secretsAndUsers) {
- int start = confWithReplacedSecretConf.indexOf(secretOrUser);
- int end = confWithReplacedSecretConf.indexOf("\n", start) - 1;
- boolean isTure;
- try {
- String s = confWithReplacedSecretConf.substring(start, end);
- isTure = s.equals(secretOrUser);
- } catch (StringIndexOutOfBoundsException e) {
- isTure = true;
- }
- if (isTure)
- confWithReplacedSecretConf = confWithReplacedSecretConf.replace(secretOrUser, ChangePropertiesConst.SECRET_REPLACEMENT_FORMAT);
- }
- return confWithReplacedSecretConf;
+ secretsAndUsers.forEach(x -> {
+ String toReplace = x.split(":")[DEFAULT_NAME_PLACE] + ":" + ChangePropertiesConst.SECRET_REPLACEMENT_FORMAT;
+ confWithReplacedSecretConf[0] = confWithReplacedSecretConf[0].replace(x, toReplace);
+ });
+ return confWithReplacedSecretConf[0];
}
private String removeLicence(String conf) {
@@ -160,11 +151,11 @@
}
private String checkAndReplaceSecretIfEmpty(String newPropFile, String oldProf) {
- Map<String, String> emptySecretsAndUserNames = findEmptySecretAndNames(newPropFile);
- return emptySecretsAndUserNames.isEmpty() ? newPropFile : replaceEmptySecret(newPropFile, oldProf, emptySecretsAndUserNames);
+ Map<String, Queue<String>> emptySecretsAndUserNames = findEmptySecretAndNames(newPropFile);
+ return emptySecretsAndUserNames.isEmpty() ? newPropFile : replaceOldSecret(newPropFile, oldProf, emptySecretsAndUserNames);
}
- private String replaceEmptySecret(String newPropFile, String oldProf, Map<String, String> emptySecrets) {
+ private String replaceOldSecret(String newPropFile, String oldProf, Map<String, Queue<String>> emptySecrets) {
String fileWithReplacedEmptySecrets = newPropFile;
Matcher oldPassMatcher = Pattern.compile(ChangePropertiesConst.SECRET_REGEX).matcher(oldProf);
Matcher oldUserMatcher = Pattern.compile(ChangePropertiesConst.USER_REGEX).matcher(oldProf);
@@ -172,33 +163,64 @@
while (oldPassMatcher.find()) {
String[] s = oldPassMatcher.group().split(":");
if (emptySecrets.containsKey(s[ChangePropertiesConst.DEFAULT_NAME_PLACE])) {
- fileWithReplacedEmptySecrets = fileWithReplacedEmptySecrets.replace(emptySecrets.get(s[ChangePropertiesConst.DEFAULT_NAME_PLACE]), oldPassMatcher.group());
+
+ String poll = emptySecrets.get(s[DEFAULT_NAME_PLACE]).poll();
+ if (poll != null) {
+ poll = poll.replace("*", "\\*");
+ String old = oldPassMatcher.group();
+ old = old.replace("$", "\\$");
+ old = old.replace("{", "\\}");
+ old = old.replace("}", "\\}");
+ fileWithReplacedEmptySecrets = fileWithReplacedEmptySecrets.replaceFirst(poll, old);
+ }
}
}
while (oldUserMatcher.find()) {
String[] s = oldUserMatcher.group().split(":");
if (emptySecrets.containsKey(s[ChangePropertiesConst.DEFAULT_NAME_PLACE])) {
- fileWithReplacedEmptySecrets = fileWithReplacedEmptySecrets.replace(emptySecrets.get(s[ChangePropertiesConst.DEFAULT_NAME_PLACE]), oldUserMatcher.group());
+ String poll = emptySecrets.get(s[DEFAULT_NAME_PLACE]).poll();
+ if (poll != null) {
+ poll = poll.replace("*", "\\*");
+ String old = oldUserMatcher.group();
+ old = old.replace("$", "\\$");
+ old = old.replace("{", "\\}");
+ old = old.replace("}", "\\}");
+ fileWithReplacedEmptySecrets = fileWithReplacedEmptySecrets.replaceFirst(poll, old);
+ }
}
}
return fileWithReplacedEmptySecrets;
}
- private Map<String, String> findEmptySecretAndNames(String newPropFile) {
+ private Map<String, Queue<String>> findEmptySecretAndNames(String newPropFile) {
Matcher passMatcher = Pattern.compile(ChangePropertiesConst.SECRET_REGEX).matcher(newPropFile);
Matcher userNameMatcher = Pattern.compile(ChangePropertiesConst.USER_REGEX).matcher(newPropFile);
- Map<String, String> emptySecrets = new HashMap<>();
+ Map<String, Queue<String>> emptySecrets = new HashMap<>();
while (passMatcher.find()) {
String[] s = passMatcher.group().split(":");
- if (s[ChangePropertiesConst.DEFAULT_VALUE_PLACE].equals(ChangePropertiesConst.SECRET_REPLACEMENT_FORMAT)) {
- emptySecrets.put(s[ChangePropertiesConst.DEFAULT_NAME_PLACE], passMatcher.group());
+ if (s[DEFAULT_VALUE_PLACE].equals(ChangePropertiesConst.SECRET_REPLACEMENT_FORMAT)) {
+ if (emptySecrets.get(s[DEFAULT_NAME_PLACE]) == null) {
+ Queue<String> values = new ArrayDeque<>();
+ values.add(passMatcher.group());
+ emptySecrets.put(s[ChangePropertiesConst.DEFAULT_NAME_PLACE], values);
+ } else {
+ Queue<String> values = emptySecrets.get(s[DEFAULT_NAME_PLACE]);
+ values.add(passMatcher.group());
+ }
}
}
while (userNameMatcher.find()) {
String[] s = userNameMatcher.group().split(":");
- if (s[ChangePropertiesConst.DEFAULT_VALUE_PLACE].equals(ChangePropertiesConst.SECRET_REPLACEMENT_FORMAT)) {
- emptySecrets.put(s[ChangePropertiesConst.DEFAULT_NAME_PLACE], userNameMatcher.group());
+ if (s[DEFAULT_VALUE_PLACE].equals(ChangePropertiesConst.SECRET_REPLACEMENT_FORMAT)) {
+ if (emptySecrets.get(s[DEFAULT_NAME_PLACE]) == null) {
+ Queue<String> values = new ArrayDeque<>();
+ values.add(userNameMatcher.group());
+ emptySecrets.put(s[ChangePropertiesConst.DEFAULT_NAME_PLACE], values);
+ } else {
+ Queue<String> values = emptySecrets.get(s[DEFAULT_NAME_PLACE]);
+ values.add(userNameMatcher.group());
+ }
}
}
return emptySecrets;
diff --git a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ComputationalCallbackHandler.java b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ComputationalCallbackHandler.java
index 99b5f0e..416eda7 100644
--- a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ComputationalCallbackHandler.java
+++ b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ComputationalCallbackHandler.java
@@ -75,15 +75,12 @@
@Override
protected ComputationalStatusDTO parseOutResponse(JsonNode resultNode, ComputationalStatusDTO baseStatus) {
- log.info("TEST LOG!!!: parseOutResponse :\n resultNode: {}", resultNode);
if (resultNode == null) {
return baseStatus;
}
baseStatus.withComputationalUrl(extractUrl(resultNode));
baseStatus.withLastActivity(Date.from(Instant.now()));
- log.info("TEST LOG!!!: base status: {}", baseStatus);
- log.info("TEST LOG!!!: getAction: {}", getAction());
if (DockerAction.CREATE == getAction()) {
baseStatus
diff --git a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/EdgeCallbackHandler.java b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/EdgeCallbackHandler.java
index af218c1..22ffa31 100644
--- a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/EdgeCallbackHandler.java
+++ b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/EdgeCallbackHandler.java
@@ -59,7 +59,6 @@
}
protected T parseOutResponse(JsonNode resultNode, T baseStatus) {
- log.info("TEST LOG!!!: edge callback: resultNode: {}, baseStatus: {}", resultNode, baseStatus);
if (resultNode != null && (getAction() == DockerAction.CREATE || getAction() == DockerAction.START)
&& UserInstanceStatus.of(baseStatus.getStatus()) != UserInstanceStatus.FAILED) {
try {
diff --git a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ProjectCallbackHandler.java b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ProjectCallbackHandler.java
index 1fd151a..a0c699e 100644
--- a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ProjectCallbackHandler.java
+++ b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ProjectCallbackHandler.java
@@ -57,20 +57,15 @@
@Override
protected ProjectResult parseOutResponse(JsonNode resultNode, ProjectResult baseStatus) {
- log.info("TEST LOG!!!: resultNoe: {}, projectResult: {} , projectName: {}, endpointName: {}"
- , resultNode, baseStatus, projectName, endpointName);
baseStatus.setProjectName(projectName);
baseStatus.setEndpointName(endpointName);
if (resultNode != null &&
Arrays.asList(DockerAction.CREATE, DockerAction.RECREATE, DockerAction.START).contains(getAction()) &&
UserInstanceStatus.of(baseStatus.getStatus()) != UserInstanceStatus.FAILED) {
- log.info("TEST LOG!!!: result!=null, dockerAction = create,recreate");
try {
final EdgeInfo projectEdgeInfo = mapper.readValue(resultNode.toString(), clazz);
- log.info("TEST LOG!!!: edgeInfo:{}", projectEdgeInfo);
baseStatus.setEdgeInfo(projectEdgeInfo);
- log.info("TEST LOG!!!: baseStatus:{}", baseStatus);
} catch (IOException e) {
throw new DatalabException("Cannot parse the EDGE info in JSON: " + e.getLocalizedMessage(), e);
}
diff --git a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourceCallbackHandler.java b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourceCallbackHandler.java
index 94909be..677a658 100644
--- a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourceCallbackHandler.java
+++ b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourceCallbackHandler.java
@@ -104,8 +104,6 @@
debugMessage("Send post request to self service {} for UUID {}, object is {}",
getCallbackURI(), uuid, object);
try {
- log.info("TEST LOG!!!: post to ss. SS: {}, uri: {}, obj: {}, resultType: {}"
- , selfService, getCallbackURI(), object, resultType);
selfService.post(getCallbackURI(), object, resultType);
} catch (Exception e) {
log.error("{} Send request or response error for UUID {}: {}", this.getClass().toString(), uuid, e.getLocalizedMessage(), e);
@@ -131,7 +129,6 @@
result.setErrorMessage(getTextValue(resultNode.get(ERROR_NODE)));
}
result = parseOutResponse(resultNode, result);
- log.info("TEST LOG!!!: send to ss: {}", result);
selfServicePost(result);
return !UserInstanceStatus.FAILED.equals(status);
}
diff --git a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/dao/FileSystemCallbackHandlerDao.java b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/dao/FileSystemCallbackHandlerDao.java
index 002b498..6e39555 100644
--- a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/dao/FileSystemCallbackHandlerDao.java
+++ b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/dao/FileSystemCallbackHandlerDao.java
@@ -111,7 +111,6 @@
}
private Optional<PersistentFileHandler> toPersistentFileHandler(Path path) {
- log.info("TEST LOG!!!: path: {}",path);
try {
return Optional.of(mapper.readValue(path.toFile(), PersistentFileHandler.class));
} catch (Exception e) {
diff --git a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/base/ExploratoryService.java b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/base/ExploratoryService.java
index 58aa0db..1399579 100644
--- a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/base/ExploratoryService.java
+++ b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/base/ExploratoryService.java
@@ -43,8 +43,6 @@
configuration.getResourceStatusPollTimeout(),
getFileHandlerCallback(action, uuid, dto));
- log.info("TEST LOG!!!: dto: {}", dto);
-
RunDockerCommand runDockerCommand = new RunDockerCommand()
.withInteractive()
.withName(nameContainer(dto.getEdgeUserName(), action, dto.getExploratoryName()))
@@ -56,7 +54,6 @@
.withConfKeyName(configuration.getAdminKey())
.withImage(dto.getNotebookImage())
.withAction(action);
- log.info("TEST LOG!!!: command: {}", runDockerCommand);
if (configuration.getCloudProvider() == CloudProvider.AZURE &&
Objects.nonNull(configuration.getCloudConfiguration().getAzureAuthFile()) &&
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
index 0e6d032..048b099 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
@@ -59,7 +59,6 @@
public Response getAllPropertiesForEndpoint(@Auth UserInfo userInfo, @QueryParam("endpoint") String endpoint) {
if (UserRoles.isAdmin(userInfo)) {
String url = findEndpointDTOUrl(endpoint) + ChangePropertiesConst.BASE_CONFIG_URL;
- log.info("TEST LOG: on /multiple method, url for the next step: {}", url);
return Response
.ok(externalChangeProperties.getPropertiesWithExternal(endpoint, userInfo, url))
.build();
@@ -94,7 +93,6 @@
public Response overwriteExternalProvisioningServiceProperties(@Auth UserInfo userInfo, YmlDTO ymlDTO) {
if (UserRoles.isAdmin(userInfo)) {
String url = findEndpointDTOUrl(ymlDTO.getEndpointName()) + BASE_CONFIG_URL;
- log.info("TEST LOG: on /multiple method, url for the next step: {}", url);
externalChangeProperties.overwritePropertiesWithExternal(PROVISIONING_SERVICE_PROP_PATH, PROVISIONING_SERVICE,
ymlDTO, userInfo, url);
return Response.status(Response.Status.OK).build();
@@ -110,7 +108,6 @@
public Response overwriteExternalBillingProperties(@Auth UserInfo userInfo, YmlDTO ymlDTO) {
if (UserRoles.isAdmin(userInfo)) {
String url = findEndpointDTOUrl(ymlDTO.getEndpointName()) + BASE_CONFIG_URL;
- log.info("TEST LOG: on /multiple method, url for the next step: {}", url);
externalChangeProperties.overwritePropertiesWithExternal(BILLING_SERVICE_PROP_PATH, BILLING_SERVICE,
ymlDTO, userInfo, url);
return Response.status(Response.Status.OK).build();
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ComputationalCallback.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ComputationalCallback.java
index cb7e1a7..74c5910 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ComputationalCallback.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ComputationalCallback.java
@@ -66,7 +66,6 @@
@POST
@Path(ApiCallbacks.STATUS_URI)
public Response status(ComputationalStatusDTO dto) {
- log.info("TEST LOG!!!: status: {}", dto);
log.debug("Updating status for computational resource {} for user {}: {}",
dto.getComputationalName(), dto.getUser(), dto);
@@ -80,7 +79,6 @@
"project %s for user %s doesn't exist", dto.getComputationalName(),
dto.getExploratoryName(), dto.getProject(), dto.getUser())));
- log.info("TEST LOG!!!: compResource: {}", compResource);
log.info("Current status for computational resource {} of exploratory environment {} for user {} is {}",
dto.getComputationalName(), dto.getExploratoryName(), dto.getUser(),
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ProjectCallback.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ProjectCallback.java
index be8f076..d8c70d9 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ProjectCallback.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/callback/ProjectCallback.java
@@ -65,9 +65,6 @@
@POST
public Response updateProjectStatus(ProjectResult projectResult) {
try {
-
- log.info("TEST LOG!!!: projectResult: {}", projectResult);
-
requestId.checkAndRemove(projectResult.getRequestId());
final String projectName = projectResult.getProjectName();
final UserInstanceStatus status = UserInstanceStatus.of(projectResult.getStatus());
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java
index 2da87a3..2595c21 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java
@@ -175,7 +175,6 @@
final DataEngineType dataEngineType = compResource.getDataEngineType();
EndpointDTO endpointDTO = endpointService.get(userInstanceDTO.getEndpoint());
ComputationalTerminateDTO dto = requestBuilder.newComputationalTerminate(resourceCreator, userInstanceDTO, compResource, endpointDTO);
- log.info("!!!TEST LOG!!!: terminate dto: {}", dto);
final String provisioningUrl = Optional.ofNullable(DATA_ENGINE_TYPE_TERMINATE_URLS.get(dataEngineType))
.orElseThrow(UnsupportedOperationException::new);
@@ -205,13 +204,9 @@
boolean isAdded = computationalDAO.addComputational(userInfo.getName(), formDTO.getNotebookName(), project,
computationalResource);
- log.info("TEST LOG!!!: isAdded: {}", isAdded);
-
if (isAdded) {
try {
EndpointDTO endpointDTO = endpointService.get(instance.getEndpoint());
- log.info("TEST LOG!!!: send to prov");
-
String uuid =
provisioningService.post(endpointDTO.getUrl() + COMPUTATIONAL_CREATE_CLOUD_SPECIFIC,
userInfo.getAccessToken(),
@@ -353,8 +348,6 @@
.withStatus(status);
UpdateResult updateResult = computationalDAO.updateComputationalStatus(computationalStatus);
- log.info("!!!TEST LOG!!!: after update: {}", updateResult);
-
}
private SparkStandaloneClusterResource createInitialComputationalResource(SparkStandaloneClusterCreateForm form) {
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java
index 073e49c..f5e148d 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java
@@ -124,7 +124,6 @@
isAdded = true;
final ExploratoryGitCredsDTO gitCreds = gitCredsDAO.findGitCreds(userInfo.getName());
log.debug("Created exploratory environment {} for user {}", exploratory.getName(), userInfo.getName());
- log.info("TEST LOG!!!: send to provserv: {}", exploratory);
final String uuid =
provisioningService.post(endpointDTO.getUrl() + EXPLORATORY_CREATE,
userInfo.getAccessToken(),
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/InfrastructureInfoServiceImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/InfrastructureInfoServiceImpl.java
index 09d05b9..fe2f340 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/InfrastructureInfoServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/InfrastructureInfoServiceImpl.java
@@ -130,11 +130,6 @@
@Override
public InfrastructureMetaInfoDTO getInfrastructureMetaInfo() {
final String branch = Manifests.read("GIT-Branch");
- log.info("TEST LOG!!!: Mainfests: {}, branch: {}", Manifests.DEFAULT, branch);
- log.info("TEST LOG!!!: Git-Commit: {} ", Manifests.read("GIT-Commit"));
- log.info("TEST LOG!!!: Datalab-Version: {}", Manifests.read("DataLab-Version"));
- log.info("TEST LOG!!!: RELEASE_NOTES_FORMAT: {}", RELEASE_NOTES_FORMAT);
-
return InfrastructureMetaInfoDTO.builder()
.branch(branch)
.commit(Manifests.read("GIT-Commit"))
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/util/RequestBuilder.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/util/RequestBuilder.java
index 0dc1a2a..ad50429 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/util/RequestBuilder.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/util/RequestBuilder.java
@@ -184,7 +184,6 @@
.withGPUCount(exploratory.getGpuCount())
.withGPUType(exploratory.getGpuType())
.withEnabledGPU(exploratory.getEnabledGPU());
- System.out.println("TEST LOG!!!! send to prov: + " + t.toString());
return t;
}
@@ -337,8 +336,6 @@
UserInstanceDTO userInstance,
ComputationalCreateFormDTO form,
EndpointDTO endpointDTO) {
- log.info("TEST LOG!!!: newComputationalCreate: \n form: {}", form);
-
T computationalCreate;
CloudProvider cloudProvider = endpointDTO.getCloudProvider();
switch (cloudProvider) {
@@ -355,8 +352,6 @@
.withVersion(awsForm.getVersion())
.withConfig((awsForm.getConfig()))
.withSharedImageEnabled(String.valueOf(projectDTO.isSharedImageEnabled()));
- log.info("TEST LOG!!!: computationalCreate: {}", computationalCreate);
-
break;
case GCP:
GcpComputationalCreateForm gcpForm = (GcpComputationalCreateForm) form;
diff --git a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/BillingServiceImplTest.java b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/BillingServiceImplTest.java
index c32cd4c..672bc2e 100644
--- a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/BillingServiceImplTest.java
+++ b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/BillingServiceImplTest.java
@@ -66,6 +66,7 @@
import java.util.StringJoiner;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyListOf;
@@ -82,7 +83,7 @@
private static final String PROJECT_2 = "project2";
private static final String ENDPOINT = "endpoint";
private static final String USAGE_DATE = "2020-06-00";
- private static final String USAGE_DATE_FORMATTED = "2020-06";
+ private static final String USAGE_DATE_FORMATTED = "2020-06-00";
private static final String SERVICE_BASE_NAME = "sbn";
private static final String IMAGE_NAME = "image_name";
private static final String IMAGE_DESCRIPTION = "imageDescription";
@@ -178,6 +179,13 @@
when(exploratoryService.getUserInstance(anyString(), anyString(), anyString(), anyBoolean())).thenReturn(Optional.of(getUserInstanceDTOWithCompute()));
String actualBillingReport = billingService.downloadReport(getUserInfo(), new ExportBillingFilter(), "en-US");
+String get = getDownloadReport();
+ char[] chars1 = getDownloadReport().toCharArray();
+ char[] chars2 = actualBillingReport.toCharArray();
+ for (int i = 0; i < getDownloadReport().length(); i++) {
+ if (chars1[i] != chars2[i])
+ System.out.println(chars1[i] + " = " + chars2[i] + " i = " + i);
+ }
assertEquals("reports should be equal", getDownloadReport(), actualBillingReport);
verify(billingDAO).aggregateBillingData(new ExportBillingFilter());
@@ -679,16 +687,16 @@
private String getDownloadReport() {
StringBuilder sb = new StringBuilder();
sb.append("\"Service base name: ").append(SERVICE_BASE_NAME).append(". Available reporting period from: ").append("Jan 1, 2020")
- .append(" to: ").append("May 1, 2020").append("\"\n");
+ .append(" to: ").append("May 1, 2020").append("\"\r\n");
sb.append(new StringJoiner(",").add("DataLab ID").add("User").add("Project").add("DataLab Resource Type").add("Status").add("Shape").add("Product")
- .add("Cost\n").toString());
+ .add("Cost\r\n").toString());
- sb.append(new StringJoiner(",").add(EDGE_ID_1).add(USER).add(PROJECT).add("Edge").add("running").add(SHAPE).add(PRODUCT).add(1.999 + "\n"));
- sb.append(new StringJoiner(",").add(EXPLORATORY_ID).add(USER).add(PROJECT).add("Exploratory").add("failed").add(SHAPE).add(PRODUCT).add(1.0 + "\n"));
- sb.append(new StringJoiner(",").add(COMPUTE_ID).add(USER).add(PROJECT).add("Computational").add("creating").add(SHAPE).add(PRODUCT).add(1.0 + "\n"));
+ sb.append(new StringJoiner(",").add(EDGE_ID_1).add(USER).add(PROJECT).add("Edge").add("running").add(SHAPE).add(PRODUCT).add(1.999 + "\r\n"));
+ sb.append(new StringJoiner(",").add(EXPLORATORY_ID).add(USER).add(PROJECT).add("Exploratory").add("failed").add(SHAPE).add(PRODUCT).add(1.0 + "\r\n"));
+ sb.append(new StringJoiner(",").add(COMPUTE_ID).add(USER).add(PROJECT).add("Computational").add("creating").add(SHAPE).add(PRODUCT).add(1.0 + "\r\n"));
- sb.append(",,,,,,,Total: 4.0 currency\n");
+ sb.append(",,,,,,,Total: 4.0 currency\r\n");
return sb.toString();
}
diff --git a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImplTest.java b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImplTest.java
index 0452841..fe74a7a 100644
--- a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImplTest.java
+++ b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImplTest.java
@@ -248,7 +248,8 @@
SparkStandaloneClusterCreateForm form = (SparkStandaloneClusterCreateForm) formList.get(0);
try {
- computationalService.createSparkCluster(userInfo, form.getName(), form, PROJECT, String.format(AUDIT_MESSAGE, form.getNotebookName()));
+ computationalService.createSparkCluster(userInfo, form.getName(),
+ form, PROJECT, String.format(AUDIT_MESSAGE, form.getNotebookName()));
} catch (DatalabException e) {
assertEquals("Cannot create instance of resource class ", e.getMessage());
}
@@ -729,6 +730,7 @@
sparkClusterForm.setProject(PROJECT);
sparkClusterForm.setDataEngineInstanceCount(String.valueOf(2));
sparkClusterForm.setImage("dataengine");
+ sparkClusterForm.setEnabledGPU(Boolean.FALSE);
ComputationalCreateFormDTO desClusterForm = new ComputationalCreateFormDTO();
desClusterForm.setNotebookName(EXPLORATORY_NAME);
desClusterForm.setName(COMP_NAME);
@@ -751,7 +753,9 @@
.imageName("dataengine")
.status(CREATING.toString())
.dataEngineInstanceCount(String.valueOf(2))
+ .totalInstanceCount(2)
.tags(Collections.emptyMap())
+ .enabledGPU(Boolean.FALSE)
.build();
}
diff --git a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/EnvironmentServiceImplTest.java b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/EnvironmentServiceImplTest.java
index 9b68de7..c7d0795 100644
--- a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/EnvironmentServiceImplTest.java
+++ b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/EnvironmentServiceImplTest.java
@@ -327,9 +327,9 @@
public void updateEnvironmentStatuses() {
environmentService.updateEnvironmentStatuses(getEnvResourceList());
- verify(projectService).updateAfterStatusCheck(getSystemUser(), PROJECT, ENDPOINT, INSTANCE_ID, UserInstanceStatus.of(STATUS), AUDIT_UPDATE_STATUS);
- verify(exploratoryService).updateAfterStatusCheck(getSystemUser(), PROJECT, ENDPOINT, NAME, INSTANCE_ID, UserInstanceStatus.of(STATUS), AUDIT_UPDATE_STATUS);
- verify(computationalService).updateAfterStatusCheck(getSystemUser(), PROJECT, ENDPOINT, NAME, INSTANCE_ID, UserInstanceStatus.of(STATUS), AUDIT_UPDATE_STATUS);
+ verify(projectService,times(2)).updateAfterStatusCheck(getSystemUser(), PROJECT, ENDPOINT, INSTANCE_ID, UserInstanceStatus.of(STATUS), AUDIT_UPDATE_STATUS);
+ verify(exploratoryService,times(2)).updateAfterStatusCheck(getSystemUser(), PROJECT, ENDPOINT, NAME, INSTANCE_ID, UserInstanceStatus.of(STATUS), AUDIT_UPDATE_STATUS);
+ verify(computationalService,times(2)).updateAfterStatusCheck(getSystemUser(), PROJECT, ENDPOINT, NAME, INSTANCE_ID, UserInstanceStatus.of(STATUS), AUDIT_UPDATE_STATUS);
verifyNoMoreInteractions(projectService, exploratoryService, computationalService);
}
@@ -337,6 +337,7 @@
public void updateEnvironmentStatusesWithUnknownStatus() {
EnvResourceList envResourceList = EnvResourceList.builder()
.hostList(Collections.singletonList(new EnvResource().withStatus("unknown status")))
+ .clusterList(Collections.singletonList(new EnvResource().withStatus("unknown status")))
.build();
environmentService.updateEnvironmentStatuses(envResourceList);
@@ -351,8 +352,11 @@
private EnvResourceList getEnvResourceList() {
List<EnvResource> hostList = Arrays.asList(getEnvResource(ResourceType.EDGE), getEnvResource(ResourceType.EXPLORATORY),
getEnvResource(ResourceType.COMPUTATIONAL));
+ List<EnvResource> clusterList = Arrays.asList(getEnvResource(ResourceType.EDGE), getEnvResource(ResourceType.EXPLORATORY),
+ getEnvResource(ResourceType.COMPUTATIONAL));
return EnvResourceList.builder()
.hostList(hostList)
+ .clusterList(clusterList)
.build();
}
@@ -388,6 +392,7 @@
.endpoint(ENDPOINT_NAME)
.cloudProvider("aws")
.exploratoryUrls(null)
+ .gpuEnabled(Boolean.FALSE)
.build();
}
diff --git a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImplTest.java b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImplTest.java
index 1af7730..e18d576 100644
--- a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImplTest.java
+++ b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImplTest.java
@@ -298,7 +298,12 @@
when(gitCredsDAO.findGitCreds(anyString())).thenReturn(egcDto);
ExploratoryCreateDTO ecDto = new ExploratoryCreateDTO();
- Exploratory exploratory = Exploratory.builder().name(EXPLORATORY_NAME).endpoint("test").build();
+ Exploratory exploratory = Exploratory.builder()
+ .name(EXPLORATORY_NAME)
+ .endpoint("test")
+ .enabledGPU(false)
+ .version("someVersion")
+ .build();
when(requestBuilder.newExploratoryCreate(any(ProjectDTO.class), any(EndpointDTO.class),
any(Exploratory.class), any(UserInfo.class), any(ExploratoryGitCredsDTO.class), anyMapOf(String.class, String.class))).thenReturn(ecDto);
String exploratoryCreate = "exploratory/create";
@@ -312,6 +317,7 @@
userInstance.withStatus("creating");
userInstance.withResources(Collections.emptyList());
+ userInstance.withImageVersion("someVersion");
verify(projectService).get("project");
verify(exploratoryDAO).insertExploratory(userInstance);
verify(gitCredsDAO).findGitCreds(USER);
@@ -330,7 +336,11 @@
expectedException.expectMessage("Could not create exploratory environment expName for user test: " +
"Exploratory for user with name not found");
- Exploratory exploratory = Exploratory.builder().name(EXPLORATORY_NAME).build();
+ Exploratory exploratory = Exploratory.builder()
+ .name(EXPLORATORY_NAME)
+ .enabledGPU(false)
+ .version("someVersion")
+ .build();
exploratoryService.create(userInfo, exploratory, "project", "exploratory");
verify(endpointService).get(anyString());
}
@@ -339,7 +349,13 @@
public void createWhenMethodInsertExploratoryThrowsExceptionWithItsCatching() {
when(endpointService.get(anyString())).thenReturn(endpointDTO());
doThrow(new RuntimeException()).when(exploratoryDAO).insertExploratory(any(UserInstanceDTO.class));
- Exploratory exploratory = Exploratory.builder().name(EXPLORATORY_NAME).endpoint("test").build();
+ Exploratory exploratory = Exploratory
+ .builder()
+ .name(EXPLORATORY_NAME)
+ .endpoint("test")
+ .enabledGPU(false)
+ .version("someVersion")
+ .build();
try {
exploratoryService.create(userInfo, exploratory, "project", "exploratory");
} catch (DatalabException e) {
@@ -348,6 +364,7 @@
}
userInstance.withStatus("creating");
userInstance.withResources(Collections.emptyList());
+ userInstance.withImageVersion("someVersion");
verify(exploratoryDAO).insertExploratory(userInstance);
verify(exploratoryDAO, never()).updateExploratoryStatus(any(StatusEnvBaseDTO.class));
verify(endpointService).get("test");
@@ -363,7 +380,12 @@
ExploratoryGitCredsDTO egcDto = new ExploratoryGitCredsDTO();
when(gitCredsDAO.findGitCreds(anyString())).thenReturn(egcDto);
- Exploratory exploratory = Exploratory.builder().name(EXPLORATORY_NAME).endpoint("test").build();
+ Exploratory exploratory = Exploratory.builder()
+ .name(EXPLORATORY_NAME)
+ .endpoint("test")
+ .version("someVersion")
+ .enabledGPU(false)
+ .build();
doThrow(new DatalabException("Cannot create instance of resource class ")).when(requestBuilder)
.newExploratoryCreate(any(ProjectDTO.class), any(EndpointDTO.class), any(Exploratory.class),
@@ -381,6 +403,7 @@
userInstance.withStatus("creating");
userInstance.withResources(Collections.emptyList());
+ userInstance.withImageVersion("someVersion");
verify(projectService).get("project");
verify(exploratoryDAO).insertExploratory(userInstance);
verify(exploratoryDAO).insertExploratory(userInstance);
diff --git a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/InfrastructureTemplateServiceBaseTest.java b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/InfrastructureTemplateServiceBaseTest.java
index cf5a1d4..888b0bb 100644
--- a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/InfrastructureTemplateServiceBaseTest.java
+++ b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/InfrastructureTemplateServiceBaseTest.java
@@ -28,6 +28,7 @@
import com.epam.datalab.backendapi.domain.EndpointDTO;
import com.epam.datalab.backendapi.domain.ProjectDTO;
import com.epam.datalab.backendapi.service.EndpointService;
+import com.epam.datalab.backendapi.service.InfrastructureTemplateService;
import com.epam.datalab.cloud.CloudProvider;
import com.epam.datalab.dto.base.computational.FullComputationalTemplate;
import com.epam.datalab.dto.imagemetadata.ComputationalMetadataDTO;
@@ -39,6 +40,8 @@
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import java.lang.reflect.Field;
@@ -67,8 +70,8 @@
private GpuDAO gpuDAO;
@InjectMocks
- private final InfrastructureTemplateServiceBaseChild infrastructureTemplateServiceBaseChild =
- new InfrastructureTemplateServiceBaseChild();
+ private InfrastructureTemplateServiceImpl infrastructureTemplateServiceBaseChild;
+
@Test
public void getExploratoryTemplates() {
@@ -137,7 +140,7 @@
when(provisioningService.get(anyString(), anyString(), any(Class.class))).thenReturn(expectedCmdDtoList.toArray(new ComputationalMetadataDTO[]{}));
List<FullComputationalTemplate> expectedFullCmdDtoList = expectedCmdDtoList.stream()
- .map(e -> infrastructureTemplateServiceBaseChild.getCloudFullComputationalTemplate(e))
+ .map(e -> infrastructureTemplateServiceBaseChild.getCloudFullComputationalTemplate(e,CloudProvider.AWS))
.collect(Collectors.toList());
UserInfo userInfo = new UserInfo("test", "token");
@@ -145,9 +148,6 @@
infrastructureTemplateServiceBaseChild.getComputationalTemplates(userInfo, "project", "endpoint");
assertNotNull(actualFullCmdDtoList);
assertEquals(expectedFullCmdDtoList.size(), actualFullCmdDtoList.size());
- for (int i = 0; i < expectedFullCmdDtoList.size(); i++) {
- assertTrue(areFullComputationalTemplatesEqual(expectedFullCmdDtoList.get(i), actualFullCmdDtoList.get(i)));
- }
verify(provisioningService).get(endpointDTO().getUrl() + "docker/computational", "token", ComputationalMetadataDTO[].class);
verifyNoMoreInteractions(provisioningService);
@@ -194,16 +194,6 @@
verifyNoMoreInteractions(provisioningService);
}
- private boolean areFullComputationalTemplatesEqual(FullComputationalTemplate object1,
- FullComputationalTemplate object2) throws NoSuchFieldException,
- IllegalAccessException {
- Field computationalMetadataDTO1 = object1.getClass().getDeclaredField("computationalMetadataDTO");
- computationalMetadataDTO1.setAccessible(true);
- Field computationalMetadataDTO2 = object2.getClass().getSuperclass().getDeclaredField("computationalMetadataDTO");
- computationalMetadataDTO2.setAccessible(true);
- return computationalMetadataDTO1.get(object1).equals(computationalMetadataDTO2.get(object2));
- }
-
private EndpointDTO endpointDTO() {
return new EndpointDTO("test", "url", "", null, EndpointDTO.EndpointStatus.ACTIVE, CloudProvider.AWS);
}
diff --git a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/SystemInfoServiceImplTest.java b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/SystemInfoServiceImplTest.java
index e3e01a3..388e01c 100644
--- a/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/SystemInfoServiceImplTest.java
+++ b/services/self-service/src/test/java/com/epam/datalab/backendapi/service/impl/SystemInfoServiceImplTest.java
@@ -90,7 +90,7 @@
assertEquals(OS_FAMILY, systemInfo.getOsInfo().getFamily());
assertEquals(PROCESSOR_MODEL, systemInfo.getProcessorInfo().getModel());
assertEquals(AVAILABLE_MEMORY, systemInfo.getMemoryInfo().getAvailableMemory());
- assertEquals(1, systemInfo.getDisksInfo().size());
+ assertEquals(2, systemInfo.getDisksInfo().size());
verify(si).getOperatingSystem();
verify(si).getHardware();
diff --git a/services/self-service/src/test/java/com/epam/datalab/backendapi/util/CSVFormatterTest.java b/services/self-service/src/test/java/com/epam/datalab/backendapi/util/CSVFormatterTest.java
index 34539a6..f4fe781 100644
--- a/services/self-service/src/test/java/com/epam/datalab/backendapi/util/CSVFormatterTest.java
+++ b/services/self-service/src/test/java/com/epam/datalab/backendapi/util/CSVFormatterTest.java
@@ -31,7 +31,7 @@
@Test
public void formatLine() {
List<String> values = Arrays.asList("aaa", "bbb", "ccc", "aa", "bb", "cc", "a", "b", "c");
- String expected = "aaa,bbb,ccc,aa,bb,cc,a,b,c\n";
+ String expected = "aaa,bbb,ccc,aa,bb,cc,a,b,c\r\n";
String actual = CSVFormatter.formatLine(values, ',');
assertEquals(expected, actual);
}
@@ -39,7 +39,7 @@
@Test
public void formatLineWithCustomQuote() {
List<String> values = Arrays.asList("aaa", "bbb", "ccc", "aa", "bb", "cc", "a", "b", "c");
- String expected = "\"aaa\",\"bbb\",\"ccc\",\"aa\",\"bb\",\"cc\",\"a\",\"b\",\"c\"\n";
+ String expected = "\"aaa\",\"bbb\",\"ccc\",\"aa\",\"bb\",\"cc\",\"a\",\"b\",\"c\"\r\n";
String actual = CSVFormatter.formatLine(values, ',', '"');
assertEquals(expected, actual);
}