Commit d7ee6f8d authored by Anuj Gupta's avatar Anuj Gupta Committed by Alan Braz
Browse files

Revert "IBm Impl , Int test and synched gcp role code chnages"

This reverts commit dc5ab17a.
parent 3ee35240
......@@ -10,6 +10,10 @@ variables:
OSDU_GCP_ENV_VARS: SPRING_CLOUD_GCP_DATASTORE_NAMESPACE=$OSDU_GCP_NAMESPACE,GCP_AIRFLOW_URL=$OSDU_GCP_AIRFLOW_URL,OSDU_ENTITLEMENTS_URL=$OSDU_GCP_ENTITLEMENTS_URL --vpc-connector=$OSDU_GCP_VPC_CONNECTOR
OSDU_GCP_ENVIRONMENT: dev
OSDU_GCP_PORT: 8080
IBM_BUILD_SUBDIR: provider/workflow-ibm
IBM_INT_TEST_SUBDIR: testing/workflow-test-ibm
# integration tests variables
WORKFLOW_HOST: https://os-workflow-attcrcktoa-uc.a.run.app
FINISHED_WORKFLOW_ID: fad778da-fbc4-4261-8b3e-deb48be44969
......@@ -39,3 +43,9 @@ include:
- project: "osdu/platform/ci-cd-pipelines"
ref: 'master'
file: 'cloud-providers/osdu-gcp-cloudrun.yml'
- project: "osdu/platform/ci-cd-pipelines"
ref: 'master'
file: 'cloud-providers/ibm.yml'
This diff is collapsed.
......@@ -39,7 +39,7 @@
<module>workflow-core</module>
<module>provider/workflow-azure</module>
<module>provider/workflow-gcp</module>
<!-- <module>provider/workflow-ibm</module> Fix: Missing classes-->
<module>provider/workflow-ibm</module>
<module>provider/workflow-gcp-datastore</module>
</modules>
......@@ -51,7 +51,7 @@
<javax.inject.version>1</javax.inject.version>
<org.mapstruct.version>1.3.1.Final</org.mapstruct.version>
<maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
<os-core-common.version>0.3.5</os-core-common.version>
<os-core-common.version>0.3.6</os-core-common.version>
<springfox.version>2.9.2</springfox.version>
</properties>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Copyright 2020 Google LLC
~
~ 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
~
~ http://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.
-->
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-workflow</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>workflow-ibm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>workflow-ibm</name>
<description>IBM Cloud implementation of Workflow service APIs</description>
<properties>
<!-- <spring-boot.repackage.skip>true</spring-boot.repackage.skip> -->
<osdu.ibmcore.version>0.3.6-SNAPSHOT</osdu.ibmcore.version>
<start-class>org.opengroup.osdu.workflow.provider.ibm.WorkflowIBMApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>workflow-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-lib-ibm</artifactId>
<version>${osdu.ibmcore.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.10</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>2.13.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.4</version>
</dependency>
</dependencies>
<!--
<repositories>
<repository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/projects/146/packages/maven</url>
</repository>
<snapshotRepository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/projects/146/packages/maven</url>
</snapshotRepository>
</distributionManagement>
-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>spring-boot</classifier>
<mainClass>${start-class}</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = "org.opengroup.osdu.workflow")
public class WorkflowIBMApplication {
public static void main(String[] args) {
SpringApplication.run(WorkflowIBMApplication.class, args);
}
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.exception;
import org.opengroup.osdu.core.common.exception.CoreException;
public class IngestionStrategyQueryException extends CoreException {
public IngestionStrategyQueryException(String message) {
super(message);
}
public IngestionStrategyQueryException(String message, Throwable cause) {
super(message, cause);
}
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.exception;
import org.opengroup.osdu.core.common.exception.BadRequestException;
public class WorkflowStatusNotFoundException extends BadRequestException {
public WorkflowStatusNotFoundException(String message) {
super(message);
}
public WorkflowStatusNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.exception;
import org.opengroup.osdu.core.common.exception.BadRequestException;
public class WorkflowStatusNotSavedException extends BadRequestException{
public WorkflowStatusNotSavedException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public WorkflowStatusNotSavedException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.exception;
import org.opengroup.osdu.core.common.exception.BadRequestException;
public class WorkflowStatusNotUpdatedException extends BadRequestException {
public WorkflowStatusNotUpdatedException(String message) {
super(message);
}
public WorkflowStatusNotUpdatedException(String message, Throwable cause) {
super(message, cause);
}
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.exception;
import org.opengroup.osdu.core.common.exception.CoreException;
import org.opengroup.osdu.workflow.exception.WorkflowNotFoundException;
public class WorkflowStatusQueryException extends WorkflowNotFoundException {
public WorkflowStatusQueryException(String message) {
super(message);
}
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.model;
import org.opengroup.osdu.workflow.model.WorkflowStatus;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WorkflowStatusDoc extends WorkflowStatus {
private String _id;
private String _rev;
public WorkflowStatusDoc(WorkflowStatus workflowStatus) {
this._id = workflowStatus.getWorkflowId();
this.setAirflowRunId(workflowStatus.getAirflowRunId());
this.setSubmittedAt(workflowStatus.getSubmittedAt());
this.setSubmittedBy(workflowStatus.getSubmittedBy());
this.setWorkflowStatusType(workflowStatus.getWorkflowStatusType());
}
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.property;
import javax.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ConfigurationProperties(prefix = "ibm.airflow")
@Validated
@Component
public class AirflowProperties {
@NotBlank
String url;
}
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* 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
*
* http://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.opengroup.osdu.workflow.provider.ibm.repository;
import static java.lang.String.format;
import static org.opengroup.osdu.workflow.model.IngestionStrategy.Fields.DAG_NAME;
import static org.opengroup.osdu.workflow.model.IngestionStrategy.Fields.DATA_TYPE;
import static org.opengroup.osdu.workflow.model.IngestionStrategy.Fields.USER_ID;
import static org.opengroup.osdu.workflow.model.IngestionStrategy.Fields.WORKFLOW_TYPE;
import java.net.MalformedURLException;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.opengroup.osdu.core.common.model.WorkflowType;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.workflow.model.IngestionStrategy;
import org.opengroup.osdu.workflow.provider.ibm.exception.IngestionStrategyQueryException;
import org.opengroup.osdu.workflow.provider.interfaces.IIngestionStrategyRepository;
import org.springframework.stereotype.Repository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.opengroup.osdu.core.ibm.cloudant.IBMCloudantClientFactory;
import com.cloudant.client.api.Database;
import javax.annotation.PostConstruct;
import org.opengroup.osdu.core.ibm.auth.ServiceCredentials;
import com.cloudant.client.api.query.QueryBuilder;
import com.cloudant.client.api.query.QueryResult;
import static com.cloudant.client.api.query.Expression.eq;
import static com.cloudant.client.api.query.Operation.and;
@Repository
@Slf4j
@RequiredArgsConstructor
public class IngestionStrategyRepository implements IIngestionStrategyRepository {
@Value("${ibm.db.url}")
private String dbUrl;
@Value("${ibm.db.apikey:#{null}}")
private String apiKey;
@Value("${ibm.db.user:#{null}}")
private String dbUser;
@Value("${ibm.db.password:#{null}}")
private String dbPassword;
@Value("${ibm.env.prefix:local-dev}")
private String dbNamePrefix;
private IBMCloudantClientFactory cloudantFactory;
@Autowired
private TenantInfo tenant;
private Database db;
private static final String COLLECTION_NAME = "ingestion-strategy";
@PostConstruct
public void init() throws MalformedURLException {
cloudantFactory = new IBMCloudantClientFactory(new ServiceCredentials(dbUrl,dbUser,dbPassword));
db = cloudantFactory.getDatabase(dbNamePrefix, COLLECTION_NAME);
// TODO-- need to chk if indexing needs to be done here.
// db.createIndex(JsonIndex.builder().name("kind-json-index").asc("kind").definition());
// db.createIndex(JsonIndex.builder().name("legalTagsNames-json-index").asc("legalTagsNames").definition());