-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Need to select the serialization method for JobParameters for the com…
…mandline User needs ability to set the default serialization technique for SCDF when restarting a job User needs ability to select a serialization technique for a specific job restart When user restarts a job repository from the list that is derived from thinjobexecutions it should use default technique Add restful documentation. Add support to allow user to set useJsonJobParameters for job relaunch via the shell. Note: there are not tests for the shell update in this commit. This is because the current set of tests rely on @EnableDataflowServer which does not work. But before we fix @EnableDataflowServer we need to make sure we want to carry it forward per Issue #1040 Polish PR before push to repo JobCommand should ignore identifyingParameters when deserializing JobParameters This is a generated list and and will cause deserialization to fail if not skipped SCDF needs to support any type of class for JobParameters However, if the class is not a base java type or one provided by dataflow the user has to build dataflow with their class included. Add tests for JobParameterJacksonDeserializer Remove Disabled annotation from JobExecutionController tests that are no longer needed Update per code review request. Added test for JobParamterMixin via the JobTemplateTests Removed the duration parameter from getDurationBasedEstimate method Rebased Reset the duration calculation from nanos back to millis. Optimized restartExecutionArgs routine that removes duplicates. This was per a comment in code review Remove unnecessary exclusions from AbstractShellIntegrationTest The changes are code review requests. Add warn log message when job restart id is invalid. * Initialize ObjectMapper with the tools provided by DataFlowTemplate when testing * These changes were identified during code review
- Loading branch information
Showing
25 changed files
with
395 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...ngframework/cloud/dataflow/rest/support/jackson/JobParameterJacksonDeserializerTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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 org.springframework.cloud.dataflow.rest.support.jackson; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
|
||
import com.fasterxml.jackson.core.JsonFactory; | ||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.core.json.UTF8StreamJsonParser; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.batch.core.JobParameter; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType; | ||
|
||
public class JobParameterJacksonDeserializerTests { | ||
|
||
@Test | ||
public void validJobParameter() throws IOException { | ||
JobParameterJacksonDeserializer jobParameterJacksonDeserializer = new JobParameterJacksonDeserializer(); | ||
String json = "{\"value\":\"BAR\",\"type\":\"java.lang.String\",\"identifying\":true}"; | ||
JobParameter jobParameter = jobParameterJacksonDeserializer.deserialize(getJsonParser(json), null); | ||
assertThat(jobParameter.getType()).isEqualTo(String.class); | ||
assertThat(jobParameter.getValue()).isEqualTo("BAR"); | ||
assertThat(jobParameter.isIdentifying()).isTrue(); | ||
} | ||
|
||
@Test | ||
public void inValidJobParameter() throws IOException { | ||
JobParameterJacksonDeserializer jobParameterJacksonDeserializer = new JobParameterJacksonDeserializer(); | ||
String json = "{\"value\":\"BAR\",\"type\":\"java.lang.FOO\",\"identifying\":true}"; | ||
assertThatExceptionOfType(IllegalArgumentException.class) | ||
.isThrownBy(() -> { | ||
jobParameterJacksonDeserializer.deserialize(getJsonParser(json), null); | ||
}) | ||
.withMessage("JobParameter type java.lang.FOO is not supported by DataFlow"); | ||
} | ||
|
||
private JsonParser getJsonParser(String json) throws IOException { | ||
JsonFactory factory = new JsonFactory(); | ||
byte[] jsonData = json.getBytes(); | ||
ByteArrayInputStream inputStream = new ByteArrayInputStream(jsonData); | ||
UTF8StreamJsonParser jsonParser = (UTF8StreamJsonParser) factory.createParser(inputStream); | ||
jsonParser.setCodec(new ObjectMapper()); | ||
return jsonParser; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.