Commit 29b8205d authored by Vineeth Guna [Microsoft]'s avatar Vineeth Guna [Microsoft]
Browse files

Changed -D params keys and migrated fetching of values for pre integration to DefaultVariable class

parent 035ce345
Pipeline #17332 failed with stages
in 6 minutes and 13 seconds
......@@ -137,8 +137,8 @@
<configuration>
<executable>java</executable>
<arguments>
<argument>-Dtest.data.directory=${test.data.directory}</argument>
<argument>-Dtest.data.file.name=${test.data.file.name}</argument>
<argument>-DTEST_DATA_DIRECTORY=${test.data.directory}</argument>
<argument>-DTEST_DATA_FILE_NAME=${test.data.file.name}</argument>
<argument>-classpath</argument>
<classpath />
<argument>org.opengroup.osdu.azure.workflow.RunPreIntegrationSetup</argument>
......@@ -161,7 +161,7 @@
</execution>
</executions>
<configuration>
<argLine>-Dtest.data.directory=${test.data.directory} -Dtest.data.file.name=${test.data.file.name}</argLine>
<argLine>-DTEST_DATA_DIRECTORY=${test.data.directory} -DTEST_DATA_FILE_NAME=${test.data.file.name}</argLine>
<includes>
<include>**/RunTests.java</include>
</includes>
......
......@@ -14,7 +14,9 @@ public enum DefaultVariable {
GOOGLE_AUDIENCE(""),
FINISHED_WORKFLOW_ID(""),
DAG_ACTIVATION_TIME("60");
DAG_ACTIVATION_TIME("60"),
TEST_DATA_DIRECTORY(""),
TEST_DATA_FILE_NAME("testData.json");
public static String getEnvironmentVariableOrDefaultKey(DefaultVariable key){
......
......@@ -5,6 +5,7 @@ import com.google.gson.GsonBuilder;
import com.sun.jersey.api.client.ClientResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.workflow.consts.DefaultVariable;
import org.opengroup.osdu.workflow.setup.manifest.DAGManifest;
import org.opengroup.osdu.workflow.setup.manifest.Manifest;
import org.opengroup.osdu.workflow.setup.manifest.ManifestProvider;
......@@ -25,9 +26,6 @@ import static org.opengroup.osdu.workflow.consts.TestConstants.CREATE_WORKFLOW_U
@Slf4j
public class PreIntegrationSetup {
private static final String TEST_DATA_DIRECTORY_PROPERTY = "test.data.directory";
private static final String TEST_DATA_FILE_NAME_PROPERTY = "test.data.file.name";
private final HTTPClient client;
private final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
......@@ -36,7 +34,6 @@ public class PreIntegrationSetup {
}
public void run() {
validateInputs();
try {
Map<String, Object> testData = new HashMap<>();
Manifest manifest = ManifestProvider.getManifest();
......@@ -47,15 +44,6 @@ public class PreIntegrationSetup {
}
}
private void validateInputs() {
if(!System.getProperties().containsKey(TEST_DATA_DIRECTORY_PROPERTY) ||
!System.getProperties().containsKey(TEST_DATA_FILE_NAME_PROPERTY)) {
throw new RuntimeException(String.format("Missing JVM arguments. " +
"Please make sure %s and %s are passed as JVM arguments", TEST_DATA_DIRECTORY_PROPERTY,
TEST_DATA_FILE_NAME_PROPERTY));
}
}
private Map<String, Object> createWorkflows(Manifest manifest) throws Exception {
Map<String, Object> dagData = new HashMap<>();
List<String> toBeCreatedDagNames = manifest.getAllDAGNames();
......@@ -94,8 +82,10 @@ public class PreIntegrationSetup {
}
private void saveTestData(Map<String, Object> testData) throws Exception {
String directoryToSave = System.getProperty(TEST_DATA_DIRECTORY_PROPERTY);
String fileName = System.getProperty(TEST_DATA_FILE_NAME_PROPERTY);
String directoryToSave = DefaultVariable
.getEnvironmentVariableOrDefaultKey(DefaultVariable.TEST_DATA_DIRECTORY);
String fileName = DefaultVariable
.getEnvironmentVariableOrDefaultKey(DefaultVariable.TEST_DATA_FILE_NAME);
String contentToSave = gson.toJson(testData);
Path testDataPath = Paths.get(directoryToSave, fileName);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment