Commit fdfd3d67 authored by Mayank Saggar [Microsoft]'s avatar Mayank Saggar [Microsoft]
Browse files

Reformated code in all the files affected in the MR, corrected the...

Reformated code in all the files affected in the MR, corrected the indentation, removed the methods not required and optimized the imports
parent 4fd8c094
Pipeline #17442 failed with stages
in 5 minutes and 26 seconds
......@@ -18,7 +18,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opengroup.osdu</groupId>
......@@ -27,146 +27,148 @@
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.opengroup.osdu.workflow</groupId>
<artifactId>workflow-test-azure</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<groupId>org.opengroup.osdu.workflow</groupId>
<artifactId>workflow-test-azure</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.main.basedir>${project.basedir}</project.main.basedir>
<jackson.version>2.10.1</jackson.version>
<test.data.file.name>testData.json</test.data.file.name>
<test.data.directory>${project.build.directory}</test.data.directory>
</properties>
<dependencies>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>workflow-test-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>workflow-test-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.main.basedir>${project.basedir}</project.main.basedir>
<jackson.version>2.10.1</jackson.version>
<test.data.file.name>testData.json</test.data.file.name>
<test.data.directory>${project.build.directory}</test.data.directory>
</properties>
<dependencies>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>workflow-test-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>workflow-test-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.1.10.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
<scope>test</scope>
</dependency>
<!-- Added dependency of core-lib-Azure to add Azure Service Principle class -->
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-azure</artifactId>
<version>0.0.28</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.50.Final</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-common</artifactId>
<version>0.3.5</version>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.1.10.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
<scope>test</scope>
</dependency>
<!-- Added dependency of core-lib-Azure to add Azure Service Principle class -->
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-azure</artifactId>
<version>0.0.28</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.50.Final</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-common</artifactId>
<version>0.3.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<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>
</arguments>
<classpathScope>test</classpathScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<argLine>-DTEST_DATA_DIRECTORY=${test.data.directory} -DTEST_DATA_FILE_NAME=${test.data.file.name}</argLine>
<includes>
<include>**/RunTests.java</include>
</includes>
<executable>java</executable>
<arguments>
<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>
</arguments>
<classpathScope>test</classpathScope>
</configuration>
</plugin>
</plugins>
</build>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<argLine>-DTEST_DATA_DIRECTORY=${test.data.directory}
-DTEST_DATA_FILE_NAME=${test.data.file.name}
</argLine>
<includes>
<include>**/RunTests.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.azure.workflow.utils;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
......@@ -21,12 +22,9 @@ import org.opengroup.osdu.workflow.util.PayloadBuilder;
import java.util.HashMap;
import java.util.Map;
import static org.opengroup.osdu.workflow.consts.TestConstants.*;
public class AzurePayLoadBuilder {
public static String buildInvalidWorkflowIdPayload(String workflowId){
public static String buildInvalidWorkflowIdPayload(String workflowId) {
Map<String, Object> payload = new HashMap<>();
payload.put("Workflow", workflowId);
......@@ -34,7 +32,7 @@ public class AzurePayLoadBuilder {
return new Gson().toJson(payload);
}
public static String buildStartWorkflow(Map<String, Object> context, String type){
public static String buildStartWorkflow(Map<String, Object> context, String type) {
Map<String, Object> payload = new HashMap<>();
payload.put("WorkflowType", type);
......@@ -44,130 +42,131 @@ public class AzurePayLoadBuilder {
return new Gson().toJson(payload);
}
public static String getValidWorkflowPayload(){
public static String getValidWorkflowPayload() {
return PayloadBuilder.buildStartWorkflow(buildContext(), TestConstants.WORKFLOW_TYPE_INGEST);
}
public static String getInValidWorkflowPayload(){
public static String getInValidWorkflowPayload() {
return AzurePayLoadBuilder.buildStartWorkflow(buildContext(), TestConstants.WORKFLOW_TYPE_INGEST);
}
public static Map<String, Object> buildContext() {
Map<String, Object> context = new HashMap<>();
Map<String, Object> conf = new HashMap<>();
conf.put("test","test") ;
context.put("conf", conf);
conf.put("test", "test");
context.put("conf", conf);
return context;
}
public static JsonObject getWellLogCtxObj()
{
JsonObject main= new JsonObject();
JsonObject item= new JsonObject();
item.addProperty("data-partition-id","opendes");
JsonObject legalTagitem= new JsonObject();
public static JsonObject getWellLogCtxObj() {
JsonObject main = new JsonObject();
JsonObject item = new JsonObject();
item.addProperty("data-partition-id", "opendes");
JsonObject legalTagitem = new JsonObject();
JsonArray legal = new JsonArray();
legal.add("opendes-dps-integration-test-valid2-legal-tag");
JsonArray otherRelevantDataCountries = new JsonArray();
otherRelevantDataCountries.add("US");
legalTagitem.add("legaltags",legal);
legalTagitem.add("otherRelevantDataCountries",otherRelevantDataCountries);
legalTagitem.addProperty("status","complaint");
legalTagitem.add("legaltags", legal);
legalTagitem.add("otherRelevantDataCountries", otherRelevantDataCountries);
legalTagitem.addProperty("status", "complaint");
//acl
JsonObject acl= new JsonObject();
JsonObject acl = new JsonObject();
JsonArray viewers = new JsonArray();
viewers.add("data.default.viewer@opendes.contoso.com");
JsonArray owners = new JsonArray();
owners.add("data.default.owner@opendes.contoso.com");
acl.add("viewers",viewers);
acl.add("owners",owners);
item.add("legal-tags",legalTagitem);
item.add("acl",acl);
JsonObject workproduct= new JsonObject();
workproduct.addProperty("ResourceTypeID","srn:type:work-product/WellLog:");
workproduct.addProperty("ResourceSecurityClassification","srn:reference-data/ResourceSecurityClassification:RESTRICTED:");
JsonObject groupTypeProperties= new JsonObject();
acl.add("viewers", viewers);
acl.add("owners", owners);
item.add("legal-tags", legalTagitem);
item.add("acl", acl);
JsonObject workproduct = new JsonObject();
workproduct.addProperty("ResourceTypeID", "srn:type:work-product/WellLog:");
workproduct.addProperty("ResourceSecurityClassification", "srn:reference-data/ResourceSecurityClassification:RESTRICTED:");
JsonObject groupTypeProperties = new JsonObject();
JsonArray Components = new JsonArray();
JsonArray Artefacts1 = new JsonArray();
JsonObject GroupTypeProperties = new JsonObject();
GroupTypeProperties.add("Components",Components);
GroupTypeProperties.add("Components", Components);
groupTypeProperties.add("GroupTypeProperties", GroupTypeProperties);
JsonObject data= new JsonObject();
JsonObject individualTypeProperties= new JsonObject();
individualTypeProperties.addProperty("Name","AKM-11 LOG");
individualTypeProperties.addProperty("Description","Well Log");
groupTypeProperties.add("IndividualTypeProperties",individualTypeProperties );
JsonObject extensionProperties= new JsonObject();
groupTypeProperties.add("ExtensionProperties",extensionProperties);
JsonObject data = new JsonObject();
JsonObject individualTypeProperties = new JsonObject();
individualTypeProperties.addProperty("Name", "AKM-11 LOG");
individualTypeProperties.addProperty("Description", "Well Log");
groupTypeProperties.add("IndividualTypeProperties", individualTypeProperties);
JsonObject extensionProperties = new JsonObject();
groupTypeProperties.add("ExtensionProperties", extensionProperties);
JsonArray componentsAssociativeIDs = new JsonArray();
componentsAssociativeIDs.add("wpc-1");
groupTypeProperties.add("ComponentsAssociativeIDs", componentsAssociativeIDs);
JsonArray workproductcomponents= new JsonArray();
JsonObject resourceTypeID= new JsonObject();
JsonArray workproductcomponents = new JsonArray();
JsonObject resourceTypeID = new JsonObject();
resourceTypeID.addProperty("ResourceTypeID", "srn:type:work-product-component/WellLog:");
resourceTypeID.addProperty("ResourceSecurityClassification", "srn:reference-data/ResourceSecurityClassification:RESTRICTED:");
workproductcomponents.add(resourceTypeID);
JsonObject dataa= new JsonObject();
JsonObject groupTypePropertiess= new JsonObject();
JsonObject dataa = new JsonObject();
JsonObject groupTypePropertiess = new JsonObject();
JsonArray files = new JsonArray();
JsonArray Artefacts = new JsonArray();
JsonObject GroupTypeProperties1 = new JsonObject();
GroupTypeProperties1.add("Files",files);
GroupTypeProperties1.add("Artefacts",Artefacts);
GroupTypeProperties1.add("Files", files);
GroupTypeProperties1.add("Artefacts", Artefacts);
groupTypePropertiess.add("GroupTypeProperties", GroupTypeProperties1);
JsonObject individualTypePropertie= new JsonObject();
individualTypePropertie.addProperty("Name","AKM-11 LOG");
individualTypePropertie.addProperty("Description","Well Log");
individualTypePropertie.addProperty("WellboreID","srn:master-data/Wellbore:1013:");
JsonObject individualTypePropertie = new JsonObject();
individualTypePropertie.addProperty("Name", "AKM-11 LOG");
individualTypePropertie.addProperty("Description", "Well Log");
individualTypePropertie.addProperty("WellboreID", "srn:master-data/Wellbore:1013:");
groupTypePropertiess.add("IndividualTypeProperties", individualTypePropertie);
JsonObject topMeasuredDepth= new JsonObject();
JsonObject topMeasuredDepth = new JsonObject();
topMeasuredDepth.addProperty("Depth", 2182.0004);
topMeasuredDepth.addProperty("UnitOfMeasure", "srn:reference-data/UnitOfMeasure:M:");
groupTypePropertiess.add("TopMeasuredDepth", topMeasuredDepth);
JsonObject bottomMeasuredDepth= new JsonObject();
bottomMeasuredDepth.addProperty("Depth", 2481.0);
JsonObject bottomMeasuredDepth = new JsonObject();
bottomMeasuredDepth.addProperty("Depth", 2481.0);
bottomMeasuredDepth.addProperty("UnitOfMeasure", "srn:reference-data/UnitOfMeasure:M:");
groupTypePropertiess.add("BottomMeasuredDepth", bottomMeasuredDepth);
JsonArray curves = new JsonArray();
JsonObject curvesObj= new JsonObject();
curvesObj.addProperty("Mnemonic","DEPT");
curvesObj.addProperty("TopDepth",2182.0);
curvesObj.addProperty("BaseDepth",2481.0);
curvesObj.addProperty("DepthUnit","srn:reference-data/UnitOfMeasure:M:");
curvesObj.addProperty("CurveUnit","srn:reference-data/UnitOfMeasure:M:");
JsonObject curvesObj2= new JsonObject();
curvesObj2.addProperty("Mnemonic","GR");
curvesObj2.addProperty("TopDepth",2182.0);
curvesObj2.addProperty("BaseDepth",2481.0);
curvesObj2.addProperty("DepthUnit","srn:reference-data/UnitOfMeasure:M:");
curvesObj2.addProperty("CurveUnit","srn:reference-data/UnitOfMeasure:GAPI:");
JsonObject curvesObj3= new JsonObject();
curvesObj3.addProperty("Mnemonic","DT");
curvesObj3.addProperty("TopDepth",2182.0);
curvesObj3.addProperty("BaseDepth",2481.0);
curvesObj3.addProperty("DepthUnit","srn:reference-data/UnitOfMeasure:M:");
curvesObj3.addProperty("CurveUnit","srn:reference-data/UnitOfMeasure:US/F:");
JsonObject curvesObj4= new JsonObject();
curvesObj4.addProperty("Mnemonic","RHOB");
curvesObj4.addProperty("TopDepth",2182.0);
curvesObj4.addProperty("BaseDepth",2481.0);
curvesObj4.addProperty("DepthUnit","srn:reference-data/UnitOfMeasure:M:");
curvesObj4.addProperty("CurveUnit","srn:reference-data/UnitOfMeasure:G/C3:");
JsonObject curvesObj5= new JsonObject();
curvesObj5.addProperty("Mnemonic","DRHO");
curvesObj5.addProperty("TopDepth",2182.0);
curvesObj5.addProperty("BaseDepth",2481.0);
curvesObj5.addProperty("DepthUnit","srn:reference-data/UnitOfMeasure:M:");
curvesObj5.addProperty("CurveUnit","srn:reference-data/UnitOfMeasure:G/C3:");
JsonObject curvesObj6= new JsonObject();
curvesObj6.addProperty("Mnemonic","NPHI");
curvesObj6.addProperty("TopDepth",2182.0);
curvesObj6.addProperty("BaseDepth",2481.0);
curvesObj6.addProperty("DepthUnit","srn:reference-data/UnitOfMeasure:M:");
curvesObj6.addProperty("CurveUnit","srn:reference-data/UnitOfMeasure:V/V:");
JsonObject curvesObj = new JsonObject();
curvesObj.addProperty("Mnemonic", "DEPT");
curvesObj.addProperty("TopDepth", 2182.0);
curvesObj.addProperty("BaseDepth", 2481.0);
curvesObj.addProperty("DepthUnit", "srn:reference-data/UnitOfMeasure:M:");
curvesObj.addProperty("CurveUnit", "srn:reference-data/UnitOfMeasure:M:");
JsonObject curvesObj2 = new JsonObject();
curvesObj2.addProperty("Mnemonic", "GR");
curvesObj2.addProperty("TopDepth", 2182.0);
curvesObj2.addProperty("BaseDepth", 2481.0);
curvesObj2.addProperty("DepthUnit", "srn:reference-data/UnitOfMeasure:M:");
curvesObj2.addProperty("CurveUnit", "srn:reference-data/UnitOfMeasure:GAPI:");
JsonObject curvesObj3 = new JsonObject();
curvesObj3.addProperty("Mnemonic", "DT");
curvesObj3.addProperty("TopDepth", 2182.0);
curvesObj3.addProperty("BaseDepth", 2481.0);
curvesObj3.addProperty("DepthUnit", "srn:reference-data/UnitOfMeasure:M:");
curvesObj3.addProperty("CurveUnit", "srn:reference-data/UnitOfMeasure:US/F:");
JsonObject curvesObj4 = new JsonObject();
curvesObj4.addProperty("Mnemonic", "RHOB");
curvesObj4.addProperty("TopDepth", 2182.0);
curvesObj4.addProperty("BaseDepth", 2481.0);
curvesObj4.addProperty("DepthUnit", "srn:reference-data/UnitOfMeasure:M:");
curvesObj4.addProperty("CurveUnit", "srn:reference-data/UnitOfMeasure:G/C3:");
JsonObject curvesObj5 = new JsonObject();
curvesObj5.addProperty("Mnemonic", "DRHO");
curvesObj5.addProperty("TopDepth", 2182.0);
curvesObj5.addProperty("BaseDepth", 2481.0);
curvesObj5.addProperty("DepthUnit", "srn:reference-data/UnitOfMeasure:M:");
curvesObj5.addProperty("CurveUnit", "srn:reference-data/UnitOfMeasure:G/C3:");
JsonObject curvesObj6 = new JsonObject();
curvesObj6.addProperty("Mnemonic", "NPHI");
curvesObj6.addProperty("TopDepth", 2182.0);
curvesObj6.addProperty("BaseDepth", 2481.0);
curvesObj6.addProperty("DepthUnit", "srn:reference-data/UnitOfMeasure:M:");
curvesObj6.addProperty("CurveUnit", "srn:reference-data/UnitOfMeasure:V/V:");
curves.add(curvesObj);
curves.add(curvesObj2);
curves.add(curvesObj3);
......@@ -175,33 +174,33 @@ public class AzurePayLoadBuilder {
curves.add(curvesObj5);
curves.add(curvesObj6);
groupTypePropertiess.add("Curves", curves);
JsonObject emptyObj= new JsonObject();
groupTypePropertiess.add("ExtensionProperties",emptyObj);
JsonObject emptyObj = new JsonObject();
groupTypePropertiess.add("ExtensionProperties", emptyObj);
resourceTypeID.addProperty("AssociativeID", "wpc-1");
JsonArray fileAssociativeIDs = new JsonArray();
fileAssociativeIDs.add("f-1");
groupTypePropertiess.add("FileAssociativeIDs", fileAssociativeIDs);
JsonArray filesData= new JsonArray();
JsonArray filesData = new JsonArray();
JsonObject resourceType= new JsonObject();
JsonObject resourceType = new JsonObject();
resourceType.addProperty("ResourceTypeID", "srn:type:file/las2:");
resourceType.addProperty("ResourceSecurityClassification", "srn:reference-data/ResourceSecurityClassification:RESTRICTED:");
resourceType.addProperty("AssociativeID", "f-1");
JsonObject gTypeProperties= new JsonObject();
JsonObject gTypeProperties = new JsonObject();
gTypeProperties.addProperty("FileSource", "");
gTypeProperties.addProperty("PreLoadFilePath", "https://azglobalosdulake.blob.core.windows.net/data/well-logs/1013_akm11_1978_comp.las");
JsonObject DData= new JsonObject();
JsonObject Grp= new JsonObject();
JsonObject DData = new JsonObject();
JsonObject Grp = new JsonObject();
Grp.add("GroupTypeProperties", gTypeProperties);
Grp.add("IndividualTypeProperties",emptyObj);
Grp.add("ExtensionProperties",emptyObj);