Commit 984a58d2 authored by Sheng Wang's avatar Sheng Wang
Browse files

cuse gitlab environment to do integration

parent ede0d76d
Pipeline #21587 failed with stages
in 2 minutes and 55 seconds
......@@ -26,20 +26,17 @@ import java.util.Map;
public abstract class ActivityPlanTest extends TestBase {
protected static final long NOW = System.currentTimeMillis();
protected static final long FIVE_SECOND_LATER = NOW + 5000L;
protected static final String LEGAL_TAG = "slb-osdu-dev-des-prod-testing-public-usa-dataset-x";//LegalTagUtils.createRandomName();
protected static final String ACL = "data.default.viewers@slb-osdu-dev-des-prod-testing.contoso.com";//AclUtils.getAcl();
protected static final String LEGAL_TAG = LegalTagUtils.createRandomName();
protected static final String KIND = TenantUtils.getTenantName() + ":test:endtoend:1.1." + NOW;
private static String WELL_TYPE = "Well";
protected static final String WELL_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", WELL_TYPE.toLowerCase());
protected static final String WELL_ID = "WELL-ID-01";
protected static final String WELL_ID = WELL_TYPE.toLowerCase() + "-" + NOW;
protected static long WELL_VERSION;
private static String PLAN_TYPE = "ActivityPlan";
protected static final String PLAN_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", PLAN_TYPE.toLowerCase());
protected static final String PLAN_ID = "PLAN-ID-01";
protected static final String PLAN_ID = PLAN_TYPE.toLowerCase() + "-" + NOW;
protected static long PLAN_VERSION;
protected static String token;
......@@ -52,20 +49,20 @@ public abstract class ActivityPlanTest extends TestBase {
String plan_schema = SchemaUtil.buildActivityPlan();
SchemaUtil.create(plan_schema, token);
//LegalTagUtils.create(LEGAL_TAG, token);
LegalTagUtils.create(LEGAL_TAG, token);
String well_body = EntityUtil.buildWell(WELL_ID, WELL_SCHEMA_ID, LEGAL_TAG, ACL);
String well_body = EntityUtil.buildWell(WELL_ID, WELL_SCHEMA_ID, LEGAL_TAG);
WELL_VERSION = EntityUtil.create(WELL_TYPE, WELL_ID, well_body, token);
Assert.assertTrue(WELL_VERSION > 0);
String wellid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", WELL_TYPE, WELL_ID, WELL_VERSION);
String plan_body = EntityUtil.buildActivityPlan(PLAN_ID, PLAN_SCHEMA_ID, LEGAL_TAG, ACL, wellid, "");
String plan_body = EntityUtil.buildActivityPlan(PLAN_ID, PLAN_SCHEMA_ID, LEGAL_TAG, wellid, "");
PLAN_VERSION = EntityUtil.create(PLAN_TYPE, PLAN_ID, plan_body, token);
Assert.assertTrue(PLAN_VERSION > 0);
}
public static void classTearDown(String token) throws Exception {
//LegalTagUtils.delete(LEGAL_TAG, token);
LegalTagUtils.delete(LEGAL_TAG, token);
EntityUtil.purgeEntity(WELL_TYPE, WELL_ID, token);
EntityUtil.purgeEntity(PLAN_TYPE, PLAN_ID, token);
......
......@@ -26,20 +26,17 @@ import java.util.Map;
public abstract class BHARunTest extends TestBase {
protected static final long NOW = System.currentTimeMillis();
protected static final long FIVE_SECOND_LATER = NOW + 5000L;
protected static final String LEGAL_TAG = "slb-osdu-dev-des-prod-testing-public-usa-dataset-x";//LegalTagUtils.createRandomName();
protected static final String ACL = "data.default.viewers@slb-osdu-dev-des-prod-testing.contoso.com";//AclUtils.getAcl();
protected static final String LEGAL_TAG = LegalTagUtils.createRandomName();
protected static final String KIND = TenantUtils.getTenantName() + ":test:endtoend:1.1." + NOW;
private static String BHARUN_TYPE = "BHARun";
protected static final String BHARUN_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", BHARUN_TYPE.toLowerCase());
protected static final String BHARUN_ID = "WELLBORE-ID-01";
protected static final String BHARUN_ID = BHARUN_TYPE.toLowerCase() + "-" + NOW;
protected static long BHARUN_VERSION;
private static String SECTION_TYPE = "Section";
protected static final String SECTION_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", SECTION_TYPE.toLowerCase());
protected static final String SECTION_ID = "SECTION-ID-01";
protected static final String SECTION_ID = SECTION_TYPE.toLowerCase() + "-" + NOW;
protected static long SECTION_VERSION;
protected static String token;
......@@ -53,21 +50,21 @@ public abstract class BHARunTest extends TestBase {
String section_schema = SchemaUtil.buildSection();
SchemaUtil.create(section_schema, token);
//LegalTagUtils.create(LEGAL_TAG, token);
LegalTagUtils.create(LEGAL_TAG, token);
String bharun_body = EntityUtil.buildBHARun(BHARUN_ID,BHARUN_SCHEMA_ID, LEGAL_TAG, ACL);
String bharun_body = EntityUtil.buildBHARun(BHARUN_ID,BHARUN_SCHEMA_ID, LEGAL_TAG);
BHARUN_VERSION = EntityUtil.create(BHARUN_TYPE, BHARUN_ID, bharun_body, token);
Assert.assertTrue(BHARUN_VERSION > 0);
String bharunid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", BHARUN_TYPE, BHARUN_ID, BHARUN_VERSION);
String section_body = EntityUtil.buildSection(SECTION_ID, SECTION_SCHEMA_ID, LEGAL_TAG, ACL, new String[]{bharunid});
String section_body = EntityUtil.buildSection(SECTION_ID, SECTION_SCHEMA_ID, LEGAL_TAG, new String[]{bharunid});
SECTION_VERSION = EntityUtil.create(SECTION_TYPE, SECTION_ID, section_body, token);
Assert.assertTrue(SECTION_VERSION > 0);
}
public static void classTearDown(String token) throws Exception {
//LegalTagUtils.delete(LEGAL_TAG, token);
LegalTagUtils.delete(LEGAL_TAG, token);
EntityUtil.purgeEntity(BHARUN_TYPE, BHARUN_ID, token);
EntityUtil.purgeEntity(SECTION_TYPE, SECTION_ID, token);
......
......@@ -26,30 +26,27 @@ import java.util.Map;
public abstract class DrillingProgramTest extends TestBase {
protected static final long NOW = System.currentTimeMillis();
protected static final long FIVE_SECOND_LATER = NOW + 5000L;
protected static final String LEGAL_TAG = "slb-osdu-dev-des-prod-testing-public-usa-dataset-x";//LegalTagUtils.createRandomName();
protected static final String ACL = "data.default.viewers@slb-osdu-dev-des-prod-testing.contoso.com";//AclUtils.getAcl();
protected static final String LEGAL_TAG = LegalTagUtils.createRandomName();
protected static final String KIND = TenantUtils.getTenantName() + ":test:endtoend:1.1." + NOW;
private static String WELL_TYPE = "Well";
protected static final String WELL_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", WELL_TYPE.toLowerCase());
protected static final String WELL_ID = "WELL-ID-01";
protected static final String WELL_ID = WELL_TYPE.toLowerCase() + "-" + NOW;
protected static long WELL_VERSION;
private static String WELLBORE_TYPE = "Wellbore";
protected static final String WELLBORE_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", WELLBORE_TYPE.toLowerCase());
protected static final String WELLBORE_ID = "WELLBORE-ID-01";
protected static final String WELLBORE_ID = WELLBORE_TYPE.toLowerCase() + "-" + NOW;
protected static long WELLBORE_VERSION;
private static String PLAN_TYPE = "ActivityPlan";
protected static final String PLAN_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", PLAN_TYPE.toLowerCase());
protected static final String PLAN_ID = "PLAN-ID-01";
protected static final String PLAN_ID = PLAN_TYPE.toLowerCase() + "-" + NOW;
protected static long PLAN_VERSION;
private static String DP_TYPE = "DrillingProgram";
protected static final String DP_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", DP_TYPE.toLowerCase());
protected static final String DP_ID = "DP-ID-01";
protected static final String DP_ID = DP_TYPE.toLowerCase() + "-" + NOW;
protected static long DP_VERSION;
protected static String token;
......@@ -67,30 +64,30 @@ public abstract class DrillingProgramTest extends TestBase {
String dp_schema = SchemaUtil.buildDrillingProgram();
SchemaUtil.create(dp_schema, token);
//LegalTagUtils.create(LEGAL_TAG, token);
LegalTagUtils.create(LEGAL_TAG, token);
String well_body = EntityUtil.buildWell(WELL_ID, WELL_SCHEMA_ID, LEGAL_TAG, ACL);
String well_body = EntityUtil.buildWell(WELL_ID, WELL_SCHEMA_ID, LEGAL_TAG);
WELL_VERSION = EntityUtil.create(WELL_TYPE, WELL_ID, well_body, token);
Assert.assertTrue(WELL_VERSION > 0);
String wellid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", WELL_TYPE, WELL_ID, WELL_VERSION);
String wellbore_body = EntityUtil.buildWellbore(WELLBORE_ID, WELLBORE_SCHEMA_ID, LEGAL_TAG, ACL, wellid,"", new String[]{});
String wellbore_body = EntityUtil.buildWellbore(WELLBORE_ID, WELLBORE_SCHEMA_ID, LEGAL_TAG, wellid,"", new String[]{});
WELLBORE_VERSION = EntityUtil.create(WELLBORE_TYPE, WELLBORE_ID, wellbore_body, token);
Assert.assertTrue(WELLBORE_VERSION > 0);
String wellboreid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", WELLBORE_TYPE, WELLBORE_ID, WELLBORE_VERSION);
String plan_body = EntityUtil.buildActivityPlan(PLAN_ID, PLAN_SCHEMA_ID, LEGAL_TAG, ACL, wellid, wellboreid);
String plan_body = EntityUtil.buildActivityPlan(PLAN_ID, PLAN_SCHEMA_ID, LEGAL_TAG, wellid, wellboreid);
PLAN_VERSION = EntityUtil.create(PLAN_TYPE, PLAN_ID, plan_body, token);
Assert.assertTrue(PLAN_VERSION > 0);
String planid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", PLAN_TYPE, PLAN_ID, PLAN_VERSION);
String dp_body = EntityUtil.buildDrillingProgram(DP_ID, DP_SCHEMA_ID, LEGAL_TAG, ACL, wellid, wellboreid, planid);
String dp_body = EntityUtil.buildDrillingProgram(DP_ID, DP_SCHEMA_ID, LEGAL_TAG, wellid, wellboreid, planid);
DP_VERSION = EntityUtil.create(DP_TYPE, DP_ID, dp_body, token);
Assert.assertTrue(DP_VERSION > 0);
}
public static void classTearDown(String token) throws Exception {
//LegalTagUtils.delete(LEGAL_TAG, token);
LegalTagUtils.delete(LEGAL_TAG, token);
EntityUtil.purgeEntity(WELL_TYPE, WELL_ID, token);
EntityUtil.purgeEntity(WELLBORE_TYPE, WELLBORE_ID, token);
......
......@@ -28,35 +28,32 @@ import java.util.Map;
public abstract class QueryTest extends TestBase {
protected static final long NOW = System.currentTimeMillis();
protected static final long FIVE_SECOND_LATER = NOW + 5000L;
protected static final String LEGAL_TAG = "slb-osdu-dev-des-prod-testing-public-usa-dataset-x";//LegalTagUtils.createRandomName();
protected static final String ACL = "data.default.viewers@slb-osdu-dev-des-prod-testing.contoso.com";//AclUtils.getAcl();
protected static final String LEGAL_TAG = LegalTagUtils.createRandomName();
protected static final String KIND = TenantUtils.getTenantName() + ":test:endtoend:1.1." + NOW;
private static String WELL_TYPE = "Well";
protected static final String WELL_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", WELL_TYPE.toLowerCase());
protected static final String WELL_ID = "WELL-ID-01";
protected static final String WELL_ID = WELL_TYPE.toLowerCase() + "-" + NOW;
protected static long WELL_VERSION;
private static String BHARUN_TYPE = "BHARun";
protected static final String BHARUN_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", BHARUN_TYPE.toLowerCase());
protected static final String BHARUN_ID = "WELLBORE-ID-01";
protected static final String BHARUN_ID = BHARUN_TYPE.toLowerCase() + "-" + NOW;
protected static long BHARUN_VERSION;
private static String SECTION_TYPE = "Section";
protected static final String SECTION_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", SECTION_TYPE.toLowerCase());
protected static final String SECTION_ID = "SECTION-ID-01";
protected static final String SECTION_ID = SECTION_TYPE.toLowerCase() + "-" + NOW;
protected static long SECTION_VERSION;
private static String TRAJECTORY_TYPE = "WellboreTrajectory";
protected static final String TRAJECTORY_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", TRAJECTORY_TYPE.toLowerCase());
protected static final String TRAJECTORY_ID = "TRAJ-ID-01";
protected static final String TRAJECTORY_ID = TRAJECTORY_TYPE.toLowerCase() + "-" + NOW;
protected static long TRAJECTORY_VERSION;
private static String WELLBORE_TYPE = "Wellbore";
protected static final String WELLBORE_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", WELLBORE_TYPE.toLowerCase());
protected static final String WELLBORE_ID = "WELLBORE-ID-01";
protected static final String WELLBORE_ID = WELLBORE_TYPE.toLowerCase() + "-" + NOW;
protected static long WELLBORE_VERSION;
protected static String token;
......@@ -75,36 +72,36 @@ public abstract class QueryTest extends TestBase {
String wellbore_schema = SchemaUtil.buildWellbore();
SchemaUtil.create(wellbore_schema, token);
//LegalTagUtils.create(LEGAL_TAG, token);
LegalTagUtils.create(LEGAL_TAG, token);
String well_body = EntityUtil.buildWell(WELL_ID, WELL_SCHEMA_ID, LEGAL_TAG, ACL);
String well_body = EntityUtil.buildWell(WELL_ID, WELL_SCHEMA_ID, LEGAL_TAG);
WELL_VERSION = EntityUtil.create(WELL_TYPE, WELL_ID, well_body, token);
Assert.assertTrue(WELL_VERSION > 0);
String wellid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", WELL_TYPE, WELL_ID, WELL_VERSION);
String bharun_body = EntityUtil.buildBHARun(BHARUN_ID,BHARUN_SCHEMA_ID, LEGAL_TAG, ACL);
String bharun_body = EntityUtil.buildBHARun(BHARUN_ID,BHARUN_SCHEMA_ID, LEGAL_TAG);
BHARUN_VERSION = EntityUtil.create(BHARUN_TYPE, BHARUN_ID, bharun_body, token);
Assert.assertTrue(BHARUN_VERSION > 0);
String bharunid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", BHARUN_TYPE, BHARUN_ID, BHARUN_VERSION);
String section_body = EntityUtil.buildSection(SECTION_ID, SECTION_SCHEMA_ID, LEGAL_TAG, ACL, new String[]{bharunid});
String section_body = EntityUtil.buildSection(SECTION_ID, SECTION_SCHEMA_ID, LEGAL_TAG, new String[]{bharunid});
SECTION_VERSION = EntityUtil.create(SECTION_TYPE, SECTION_ID, section_body, token);
Assert.assertTrue(SECTION_VERSION > 0);
String sectionid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", SECTION_TYPE, SECTION_ID, SECTION_VERSION);
String trajectory_body = EntityUtil.buildWellboreTrajectory(TRAJECTORY_ID, TRAJECTORY_SCHEMA_ID, LEGAL_TAG, ACL);
String trajectory_body = EntityUtil.buildWellboreTrajectory(TRAJECTORY_ID, TRAJECTORY_SCHEMA_ID, LEGAL_TAG);
TRAJECTORY_VERSION = EntityUtil.create(TRAJECTORY_TYPE, TRAJECTORY_ID, trajectory_body, token);
Assert.assertTrue(TRAJECTORY_VERSION > 0);
String trajectoryid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", TRAJECTORY_TYPE, TRAJECTORY_ID, TRAJECTORY_VERSION);
String wellbore_body = EntityUtil.buildWellbore(WELLBORE_ID, WELLBORE_SCHEMA_ID, LEGAL_TAG, ACL, wellid, trajectoryid, new String[]{sectionid});
String wellbore_body = EntityUtil.buildWellbore(WELLBORE_ID, WELLBORE_SCHEMA_ID, LEGAL_TAG, wellid, trajectoryid, new String[]{sectionid});
WELLBORE_VERSION = EntityUtil.create(WELLBORE_TYPE, WELLBORE_ID, wellbore_body, token);
Assert.assertTrue(WELLBORE_VERSION > 0);
}
public static void classTearDown(String token) throws Exception {
//LegalTagUtils.delete(LEGAL_TAG, token);
LegalTagUtils.delete(LEGAL_TAG, token);
EntityUtil.purgeEntity(WELL_TYPE, WELL_ID, token);
EntityUtil.purgeEntity(BHARUN_TYPE, BHARUN_ID, token);
......
......@@ -26,20 +26,17 @@ import java.util.Map;
public abstract class SectionTest extends TestBase {
protected static final long NOW = System.currentTimeMillis();
protected static final long FIVE_SECOND_LATER = NOW + 5000L;
protected static final String LEGAL_TAG = "slb-osdu-dev-des-prod-testing-public-usa-dataset-x";//LegalTagUtils.createRandomName();
protected static final String ACL = "data.default.viewers@slb-osdu-dev-des-prod-testing.contoso.com";//AclUtils.getAcl();
protected static final String LEGAL_TAG = LegalTagUtils.createRandomName();
protected static final String KIND = TenantUtils.getTenantName() + ":test:endtoend:1.1." + NOW;
private static String SECTION_TYPE = "Section";
protected static final String SECTION_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", SECTION_TYPE.toLowerCase());
protected static final String SECTION_ID = "SECTION-ID-01";
protected static final String SECTION_ID = SECTION_TYPE.toLowerCase() + "-" + NOW;
protected static long SECTION_VERSION;
private static String WELLBORE_TYPE = "Wellbore";
protected static final String WELLBORE_SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", WELLBORE_TYPE.toLowerCase());
protected static final String WELLBORE_ID = "WELLBORE-ID-01";
protected static final String WELLBORE_ID = WELLBORE_TYPE.toLowerCase() + "-" + NOW;
protected static long WELLBORE_VERSION;
protected static String token;
......@@ -53,21 +50,21 @@ public abstract class SectionTest extends TestBase {
String wellbore_schema = SchemaUtil.buildWellbore();
SchemaUtil.create(wellbore_schema, token);
//LegalTagUtils.create(LEGAL_TAG, token);
LegalTagUtils.create(LEGAL_TAG, token);
String section_body = EntityUtil.buildSection(SECTION_ID, SECTION_SCHEMA_ID, LEGAL_TAG, ACL, new String[]{});
String section_body = EntityUtil.buildSection(SECTION_ID, SECTION_SCHEMA_ID, LEGAL_TAG, new String[]{});
SECTION_VERSION = EntityUtil.create(SECTION_TYPE, SECTION_ID, section_body, token);
Assert.assertTrue(SECTION_VERSION > 0);
String sectionid = String.format("srn:<namespace>:work-product-component/%s:%s:%d", SECTION_TYPE, SECTION_ID, SECTION_VERSION);
String wellbore_body = EntityUtil.buildWellbore(WELLBORE_ID, WELLBORE_SCHEMA_ID, LEGAL_TAG, ACL, "", "", new String[]{sectionid});
String wellbore_body = EntityUtil.buildWellbore(WELLBORE_ID, WELLBORE_SCHEMA_ID, LEGAL_TAG, "", "", new String[]{sectionid});
WELLBORE_VERSION = EntityUtil.create(WELLBORE_TYPE, WELLBORE_ID, wellbore_body, token);
Assert.assertTrue(WELLBORE_VERSION > 0);
}
public static void classTearDown(String token) throws Exception {
//LegalTagUtils.delete(LEGAL_TAG, token);
LegalTagUtils.delete(LEGAL_TAG, token);
EntityUtil.purgeEntity(SECTION_TYPE, SECTION_ID, token);
EntityUtil.purgeEntity(WELLBORE_TYPE, WELLBORE_ID, token);
......
......@@ -20,36 +20,31 @@ import org.junit.Test;
public abstract class EntityTest extends TestBase{
protected static final long NOW = System.currentTimeMillis();
protected static final long FIVE_SECOND_LATER = NOW + 5000L;
protected static final String LEGAL_TAG = "slb-osdu-dev-des-prod-testing-public-usa-dataset-x";//LegalTagUtils.createRandomName();
protected static final String ACL = "data.default.viewers@slb-osdu-dev-des-prod-testing.contoso.com";//AclUtils.getAcl();
protected static final String LEGAL_TAG = LegalTagUtils.createRandomName();
protected static final String KIND = TenantUtils.getTenantName() + ":test:endtoend:1.1." + NOW;
private static String TYPE = "Well";
protected static final String SCHEMA_ID = String.format("slb:wd-schema:%s:3.0.0", TYPE.toLowerCase());
protected static final String ID = "9ced4cc5-02c8-5208-883d-520cbec39df7";
protected static final String ID = TYPE.toLowerCase() + "-" + NOW;;
protected static String token;
public static void classSetup(String theToken) throws Exception {
token = theToken;
TestUtils.disableSslVerification();
String schema = SchemaUtil.buildWell();
SchemaUtil.create(schema, token);
//LegalTagUtils.create(LEGAL_TAG, token);
LegalTagUtils.create(LEGAL_TAG, token);
}
public static void classTearDown(String token) throws Exception {
//LegalTagUtils.delete(LEGAL_TAG, token);
LegalTagUtils.delete(LEGAL_TAG, token);
}
@Test
public void should_returnEntity_create_whenValidEntity() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
//Create
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
......@@ -59,7 +54,7 @@ public abstract class EntityTest extends TestBase{
@Test
public void should_returnEntity_whenQueryVaildEntity() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
//Create
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
......@@ -71,7 +66,7 @@ public abstract class EntityTest extends TestBase{
@Test
public void should_returnVersionNumbers_whenQueryVersionNumbers() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
//Get
......@@ -82,7 +77,7 @@ public abstract class EntityTest extends TestBase{
@Test
public void should_returnSuccess_whenDeleteEntity() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
//Delete
......@@ -93,7 +88,7 @@ public abstract class EntityTest extends TestBase{
@Test
public void should_returnSuccess_whenPurgeEntity() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
//Purge
......@@ -102,7 +97,7 @@ public abstract class EntityTest extends TestBase{
@Test
public void should_returnEntity_whenQueryEntityVersion() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
//Get
......@@ -113,7 +108,7 @@ public abstract class EntityTest extends TestBase{
@Test
public void should_returnSuccess_whenDeleteEntityVersion() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
//Delete
......@@ -124,7 +119,7 @@ public abstract class EntityTest extends TestBase{
@Test
public void should_returnSuccess_whenPurgeEntityVersion() throws Exception {
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG, ACL);
String body = EntityUtil.buildWell(ID, SCHEMA_ID, LEGAL_TAG);
long version = EntityUtil.create(TYPE, ID, body, token);
Assert.assertTrue(version > 0);
//Purge
......
// Copyright 2020 Schlumberger
//
// 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.wd.test.core.util;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.sun.jersey.api.client.ClientResponse;
import org.apache.http.HttpStatus;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class AclUtils {
protected static final String domain = System.getProperty("DOMAIN", System.getenv("DOMAIN"));
public static final String getAclSuffix() {
String environment = getEnvironment();
//build.gradle currently throws exception if a variable is set to empty or not set at all
//workaround by setting it to an "empty" string to construct the url
if (environment.equalsIgnoreCase("empty")) environment = "";
if (!environment.isEmpty())
environment = "." + environment;
return String.format("%s%s.%s", TenantUtils.getTenantName(), environment, domain);
}
public static String getEnvironment() {
return System.getProperty("DEPLOY_ENV", System.getenv("DEPLOY_ENV"));
}
public static final String getAcl() {
return String.format("data.test1@%s", getAclSuffix());
}
public static final String getIntegrationTesterAcl() {
return String.format("data.integration.test@%s", getAclSuffix());
}
}
......@@ -104,64 +104,64 @@ public class EntityUtil {
return entityUrl;
}
public static String buildDrillingProgram(String id, String schemaID, String legalTag, String acl,
public static String buildDrillingProgram(String id, String schemaID, String legalTag,
String wellId, String wellboreId, String planId) {
JsonObject data = new JsonObject();
data.addProperty("WellID", wellId);
data.addProperty("WellboreID", wellboreId);
data.addProperty("ActivityPlanID", planId);
JsonObject body = buildBody("DrillingProgram", id, schemaID, legalTag, acl, data);
JsonObject body = buildBody("DrillingProgram", id, schemaID, legalTag, data);
return body.toString();
}
public static String buildActivityPlan(String id, String schemaID, String legalTag, String acl,
public static String buildActivityPlan(String id, String schemaID, String legalTag,
String wellId, String wellboreId) {
JsonObject data = new JsonObject();
data.addProperty("WellID", wellId);
data.addProperty("WellboreID", wellboreId);
JsonObject body = buildBody("ActivityPlan", id, schemaID, legalTag, acl, data);
JsonObject body = buildBody("ActivityPlan", id, schemaID, legalTag, data);
return body.toString();
}
public static String buildWell(String id, String schemaID, String legalTag, String acl) {
public static String buildWell(String id, String schemaID, String legalTag) {
JsonObject data = new JsonObject();
data.addProperty("Name", "demo well name");
JsonObject body = buildBody("Well", id, schemaID, legalTag, acl, data);
JsonObject body = buildBody("Well", id, schemaID, legalTag, data);
return body.toString();
}
public static String buildWellbore(String id, String schemaID, String legalTag, String acl,
public static String buildWellbore(String id, String schemaID, String legalTag,
String wellId, String trajectoryId, String[] sectionIds) {
JsonObject data = new JsonObject();
data.addProperty("WellID", wellId);
data.addProperty("TrajectoryID", trajectoryId);
data.add("SectionID", buildArray(sectionIds));
JsonObject body = buildBody("Wellbore", id, schemaID, legalTag, acl, data);
JsonObject body = buildBody("Wellbore", id, schemaID, legalTag, data);
return body.toString();
}
public static String buildWellboreTrajectory(String id, String schemaID, String legalTag, String acl) {
public static String buildWellboreTrajectory(String id, String schemaID, String legalTag) {
JsonObject data = new JsonObject();
JsonObject body = buildBody("WellboreTrajectory", id, schemaID, legalTag, acl, data);
JsonObject body = buildB