Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Mar 24, 2023
1 parent 232006e commit 74607e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ public class SupportedPythonVersions {
@Value("${datajobs.deployment.defaultPythonVersion}")
private String defaultPythonVersion;


private static final String VDK_IMAGE = "vdkImage";

private static final String BASE_IMAGE = "baseImage";


/**
* Check if the pythonVersion passed by the user is supported by the Control Service.
*
Expand Down Expand Up @@ -70,9 +68,9 @@ public List<String> getSupportedPythonVersions() {

/**
* Returns the name of the data job base image as stored in the docker registry. If
* supportedPythonVersions is set, and the pythonVersion passed by the user is supported
* according to the configuration, the base image corresponding to the pythonVersion is returned.
* Otherwise, the default base image is returned.
* supportedPythonVersions is set, and the pythonVersion passed by the user is supported according
* to the configuration, the base image corresponding to the pythonVersion is returned. Otherwise,
* the default base image is returned.
*
* @param pythonVersion a string indicating the python version passed by the user
* @return a string of the data job base image.
Expand All @@ -81,7 +79,9 @@ public String getJobBaseImage(String pythonVersion) {
if (!supportedPythonVersions.isEmpty() && isPythonVersionSupported(pythonVersion)) {
return supportedPythonVersions.get(pythonVersion).get(BASE_IMAGE);
} else {
log.warn("An issue with the passed pythonVersion or supportedPythonVersions configuration has occurred. Returning default job base image");
log.warn(
"An issue with the passed pythonVersion or supportedPythonVersions configuration has"
+ " occurred. Returning default job base image");
return getDefaultJobBaseImage();
}
}
Expand All @@ -92,9 +92,9 @@ public String getDefaultJobBaseImage() {

/**
* Returns the name of the vdk image as stored in the docker registry. If supportedPythonVersions
* is set, and the pythonVersion, passed by the user, is supported according to the
* configuration, the vdk image corresponding to the pythonVersion is returned. Otherwise, the
* default vdk image is returned.
* is set, and the pythonVersion, passed by the user, is supported according to the configuration,
* the vdk image corresponding to the pythonVersion is returned. Otherwise, the default vdk image
* is returned.
*
* @param pythonVersion a string indicating the python version passed by the user
* @return a string of the vdk image.
Expand All @@ -103,7 +103,9 @@ public String getVdkImage(String pythonVersion) {
if (!supportedPythonVersions.isEmpty() && isPythonVersionSupported(pythonVersion)) {
return supportedPythonVersions.get(pythonVersion).get(VDK_IMAGE);
} else {
log.warn("An issue with the passed pythonVersion or supportedPythonVersions configuration has occurred. Returning default vdk image");
log.warn(
"An issue with the passed pythonVersion or supportedPythonVersions configuration has"
+ " occurred. Returning default vdk image");
return getDefaultVdkImage();
}
}
Expand All @@ -113,8 +115,8 @@ public String getDefaultVdkImage() {
}

/**
* Returns the default python version supported by the Control Service. The version number is
* read from the datajobs.deployment.defaultPythonVersion application property.
* Returns the default python version supported by the Control Service. The version number is read
* from the datajobs.deployment.defaultPythonVersion application property.
*
* @return a string indicating the default python version supported by the Control Service.
* @throws InvalidParameterException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public void getSupportedPythonVersions_multipleSupportedVersions() {

@Test
public void getSupportedPythonVersions_getDefaultVersion() {
ReflectionTestUtils.setField(
supportedPythonVersions, "defaultPythonVersion", "3.7");
ReflectionTestUtils.setField(supportedPythonVersions, "defaultPythonVersion", "3.7");
var res = new ArrayList<String>();
res.add("3.7");

Expand All @@ -96,8 +95,7 @@ public void getJobBaseImage_defaultImage() {
var supportedVersions = generateSupportedPythonVersionsConf();
ReflectionTestUtils.setField(
supportedPythonVersions, "supportedPythonVersions", supportedVersions);
ReflectionTestUtils.setField(
supportedPythonVersions, "defaultPythonVersion", "3.7");
ReflectionTestUtils.setField(supportedPythonVersions, "defaultPythonVersion", "3.7");
final String defaultBaseImage = "python:3.7-slim";

Assertions.assertEquals(defaultBaseImage, supportedPythonVersions.getJobBaseImage("3.11"));
Expand All @@ -119,8 +117,7 @@ public void getVdkImage_defaultImage() {
var supportedVersions = generateSupportedPythonVersionsConf();
ReflectionTestUtils.setField(
supportedPythonVersions, "supportedPythonVersions", supportedVersions);
ReflectionTestUtils.setField(
supportedPythonVersions, "defaultPythonVersion", "3.7");
ReflectionTestUtils.setField(supportedPythonVersions, "defaultPythonVersion", "3.7");

final String defaultVdkImage = "test_vdk_image_3.7";

Expand Down

0 comments on commit 74607e0

Please sign in to comment.