Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Data Flow
Data Enrichment
wks
Commits
20a5204f
Commit
20a5204f
authored
Apr 27, 2021
by
devesh bajpai
Browse files
Merge branch 'get-wks-kind-from-mapping' into 'master'
Get wks kind from mapping See merge request
!48
parents
92d2cffe
4614426a
Pipeline
#37298
passed with stages
in 15 minutes and 1 second
Changes
9
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
testing/wks-test-core/src/test/java/org/opengroup/osdu/wks/model/AutomationConstants.java
View file @
20a5204f
...
...
@@ -25,7 +25,7 @@ public class AutomationConstants {
public
static
final
String
COLON_SEPARATOR
=
":"
;
public
static
final
String
DASH
=
"-"
;
public
static
final
String
POINT
=
"."
;
public
static
final
String
OS_TARGET_SCHEMA_KIND_TENANT
=
getEnvironmentVariableOrDefaultValue
(
"OS_TARGET_SCHEMA_KIND_TENANT"
,
"
opendes
:wks:wellbore:1.
3.1
"
);
public
static
final
String
OS_TARGET_SCHEMA_KIND_TENANT
=
getEnvironmentVariableOrDefaultValue
(
"OS_TARGET_SCHEMA_KIND_TENANT"
,
"
slb
:wks:wellbore:1.
4.0
"
);
public
static
final
String
OS_TARGET_SCHEMA_KIND
=
getEnvironmentVariableOrDefaultValue
(
"OS_TARGET_SCHEMA_KIND"
,
"slb:wks:wellbore:1.3.1"
);
public
static
final
List
<
String
>
OS_TARGET_SCHEMA_KIND_IHS
=
Arrays
.
asList
(
"slb:wks:log:2.3.1"
,
"abc:wks:log:3.2.1"
);
public
static
final
List
<
String
>
OS_TARGET_SCHEMA_KIND_OGA
=
Arrays
.
asList
(
"slb:wks:well:4.3.1"
,
"slb:wks:well:5.1.0"
,
"abc:wks:well:1.5.1"
);
...
...
testing/wks-test-core/src/test/java/org/opengroup/osdu/wks/stepdefs/IntegrationTestStepDefs.java
View file @
20a5204f
...
...
@@ -226,7 +226,6 @@ public class IntegrationTestStepDefs implements En {
List
<
HttpResponse
>
httpResponseList
=
this
.
context
.
getResponseList
();
for
(
int
i
=
0
;
i
<
httpResponseList
.
size
();
i
++)
{
String
expectedKind
=
AutomationConstants
.
OS_TARGET_SCHEMA_KIND_IHS
.
get
(
i
);
expectedKind
=
AutomationConstants
.
TENANT_NAME_PLACEHOLDER_VALUE
+
expectedKind
.
substring
(
expectedKind
.
indexOf
(
AutomationConstants
.
COLON_SEPARATOR
));
String
actualKind
=
new
JsonPath
(
httpResponseList
.
get
(
i
).
getBody
()).
get
(
"kind"
).
toString
();
assertEquals
(
expectedKind
,
actualKind
);
}
...
...
wks-core/src/main/java/org/opengroup/osdu/wks/service/transformer/WksTransformer.java
View file @
20a5204f
...
...
@@ -97,7 +97,7 @@ public class WksTransformer {
Tree
transformedTree
=
copyTagsAttribute
(
rawRecordTree
,
transformedTreeFromPreviousStage
);
transformedTree
.
putObject
(
ID
,
createRecordId
(
rawRecordTree
,
targetSchemaKind
));
transformedTree
.
putObject
(
ANCESTRY
+
Constants
.
POINT
+
PARENTS
,
fetchParent
(
rawRecordTree
));
transformedTree
.
putObject
(
KIND
,
createWksKind
(
targetSchemaKind
,
rawRecordTree
.
get
(
ID
).
asString
())
);
transformedTree
.
putObject
(
KIND
,
targetSchemaKind
);
transformedTree
.
putObject
(
ACL
,
rawRecordTree
.
get
(
ACL
));
transformedTree
.
putObject
(
LEGAL
,
rawRecordTree
.
get
(
LEGAL
));
...
...
@@ -193,11 +193,6 @@ public class WksTransformer {
return
WksIdGenerator
.
createRecordId
(
rawRecordTree
.
get
(
ID
).
asString
(),
wksSchemaKind
);
}
private
String
createWksKind
(
String
wksSchemaKind
,
String
rawRecordId
)
{
String
[]
idStrArr
=
rawRecordId
.
split
(
Constants
.
COLON_SEPARATOR
);
return
idStrArr
[
0
]
+
wksSchemaKind
.
substring
(
wksSchemaKind
.
indexOf
(
Constants
.
COLON_SEPARATOR
));
}
private
String
[]
fetchParent
(
Tree
rawRecordTree
)
{
String
parent
=
rawRecordTree
.
get
(
ID
).
asString
()
+
Constants
.
COLON_SEPARATOR
+
Long
.
valueOf
(
rawRecordTree
.
get
(
VERSION
)
...
...
wks-core/src/test/java/org/opengroup/osdu/wks/util/WksTransformerTest.java
View file @
20a5204f
...
...
@@ -56,7 +56,7 @@ public class WksTransformerTest {
private
static
final
String
UNIT_TEST_RESOURCES_FOLDER_PATH
=
"/unit_test_resources/"
;
private
static
final
String
MAPPING_FILE_NAME
=
"mapping.json"
;
private
static
final
String
RAW_RECORD_FILE_NAME
=
"raw_record.json"
;
private
static
final
String
TARGET_SCHEMA_KIND
=
"part
1
:wks:entity:1.0.0"
;
private
static
final
String
TARGET_SCHEMA_KIND
=
"part
2
:wks:entity:1.0.0"
;
private
static
final
String
RAW_RECORD_WITHOUT_META_FILE_NAME
=
"raw_record_without_meta.json"
;
private
static
final
String
RAW_RECORD_WITH_EMPTY_META_FILE_NAME
=
"raw_record_with_empty_meta.json"
;
private
static
final
String
RAW_RECORD_WITH_NO_ANCESTRY_FILE_NAME
=
"raw_record_with_no_ancestry.json"
;
...
...
wks-core/src/test/resources/unit_test_resources/mapping.json
View file @
20a5204f
...
...
@@ -8,7 +8,7 @@
"schemaVersionMajor"
:
1
},
"targetSchema"
:
{
"authority"
:
"part
1
"
,
"authority"
:
"part
2
"
,
"source"
:
"wks"
,
"entityType"
:
"entity"
,
"schemaVersionMajor"
:
1
...
...
wks-core/src/test/resources/unit_test_resources/transformed_record.json
View file @
20a5204f
...
...
@@ -51,11 +51,11 @@
"persistableReference"
:
"{
\"
lateBoundCRS
\"
:{
\"
wkt
\"
:
\"
GEOGCS[
\\\"
GCS_European_1950
\\\"
,DATUM[
\\\"
D_European_1950
\\\"
,SPHEROID[
\\\"
International_1924
\\\"
,6378388.0,297.0]],PRIMEM[
\\\"
Greenwich
\\\"
,0.0],UNIT[
\\\"
Degree
\\\"
,0.0174532925199433],AUTHORITY[
\\\"
EPSG
\\\"
,4230]]
\"
,
\"
ver
\"
:
\"
PE_10_3_1
\"
,
\"
name
\"
:
\"
GCS_European_1950
\"
,
\"
authCode
\"
:{
\"
auth
\"
:
\"
EPSG
\"
,
\"
code
\"
:
\"
4230
\"
},
\"
type
\"
:
\"
LBC
\"
},
\"
singleCT
\"
:{
\"
wkt
\"
:
\"
GEOGTRAN[
\\\"
ED_1950_To_WGS_1984_23
\\\"
,GEOGCS[
\\\"
GCS_European_1950
\\\"
,DATUM[
\\\"
D_European_1950
\\\"
,SPHEROID[
\\\"
International_1924
\\\"
,6378388.0,297.0]],PRIMEM[
\\\"
Greenwich
\\\"
,0.0],UNIT[
\\\"
Degree
\\\"
,0.0174532925199433]],GEOGCS[
\\\"
GCS_WGS_1984
\\\"
,DATUM[
\\\"
D_WGS_1984
\\\"
,SPHEROID[
\\\"
WGS_1984
\\\"
,6378137.0,298.257223563]],PRIMEM[
\\\"
Greenwich
\\\"
,0.0],UNIT[
\\\"
Degree
\\\"
,0.0174532925199433]],METHOD[
\\\"
Position_Vector
\\\"
],PARAMETER[
\\\"
X_Axis_Translation
\\\"
,-116.641],PARAMETER[
\\\"
Y_Axis_Translation
\\\"
,-56.931],PARAMETER[
\\\"
Z_Axis_Translation
\\\"
,-110.559],PARAMETER[
\\\"
X_Axis_Rotation
\\\"
,0.893],PARAMETER[
\\\"
Y_Axis_Rotation
\\\"
,0.921],PARAMETER[
\\\"
Z_Axis_Rotation
\\\"
,-0.917],PARAMETER[
\\\"
Scale_Difference
\\\"
,-3.52],AUTHORITY[
\\\"
EPSG
\\\"
,1612]]
\"
,
\"
ver
\"
:
\"
PE_10_3_1
\"
,
\"
name
\"
:
\"
ED_1950_To_WGS_1984_23
\"
,
\"
authCode
\"
:{
\"
auth
\"
:
\"
EPSG
\"
,
\"
code
\"
:
\"
1612
\"
},
\"
type
\"
:
\"
ST
\"
},
\"
ver
\"
:
\"
PE_10_3_1
\"
,
\"
name
\"
:
\"
ED50 * EPSG-Nor N62 2001 [4230,1612]
\"
,
\"
authCode
\"
:{
\"
auth
\"
:
\"\"
,
\"
code
\"
:
\"
4230023
\"
},
\"
type
\"
:
\"
EBC
\"
}"
,
"propertyNames"
:
[
"wksAttribute2.y"
]
}
],
"id"
:
"part1:entity:wks-3b9edab584ccc863c1dec7f1f5cf89c70d312020.part
1
.wks.entity.1"
,
"id"
:
"part1:entity:wks-3b9edab584ccc863c1dec7f1f5cf89c70d312020.part
2
.wks.entity.1"
,
"ancestry"
:
{
"parents"
:
[
"part1:source:entity-uniqueId:39429347234"
]
},
"kind"
:
"part
1
:wks:entity:1.0.0"
,
"kind"
:
"part
2
:wks:entity:1.0.0"
,
"acl"
:
{
"viewers"
:
[
"data.default.viewers@part1.dev.com"
],
"owners"
:
[
"data.default.owners@part1.dev.com"
]
...
...
wks-core/src/test/resources/unit_test_resources/transformed_record_with_tags.json
View file @
20a5204f
...
...
@@ -51,11 +51,11 @@
"persistableReference"
:
"{
\"
lateBoundCRS
\"
:{
\"
wkt
\"
:
\"
GEOGCS[
\\\"
GCS_European_1950
\\\"
,DATUM[
\\\"
D_European_1950
\\\"
,SPHEROID[
\\\"
International_1924
\\\"
,6378388.0,297.0]],PRIMEM[
\\\"
Greenwich
\\\"
,0.0],UNIT[
\\\"
Degree
\\\"
,0.0174532925199433],AUTHORITY[
\\\"
EPSG
\\\"
,4230]]
\"
,
\"
ver
\"
:
\"
PE_10_3_1
\"
,
\"
name
\"
:
\"
GCS_European_1950
\"
,
\"
authCode
\"
:{
\"
auth
\"
:
\"
EPSG
\"
,
\"
code
\"
:
\"
4230
\"
},
\"
type
\"
:
\"
LBC
\"
},
\"
singleCT
\"
:{
\"
wkt
\"
:
\"
GEOGTRAN[
\\\"
ED_1950_To_WGS_1984_23
\\\"
,GEOGCS[
\\\"
GCS_European_1950
\\\"
,DATUM[
\\\"
D_European_1950
\\\"
,SPHEROID[
\\\"
International_1924
\\\"
,6378388.0,297.0]],PRIMEM[
\\\"
Greenwich
\\\"
,0.0],UNIT[
\\\"
Degree
\\\"
,0.0174532925199433]],GEOGCS[
\\\"
GCS_WGS_1984
\\\"
,DATUM[
\\\"
D_WGS_1984
\\\"
,SPHEROID[
\\\"
WGS_1984
\\\"
,6378137.0,298.257223563]],PRIMEM[
\\\"
Greenwich
\\\"
,0.0],UNIT[
\\\"
Degree
\\\"
,0.0174532925199433]],METHOD[
\\\"
Position_Vector
\\\"
],PARAMETER[
\\\"
X_Axis_Translation
\\\"
,-116.641],PARAMETER[
\\\"
Y_Axis_Translation
\\\"
,-56.931],PARAMETER[
\\\"
Z_Axis_Translation
\\\"
,-110.559],PARAMETER[
\\\"
X_Axis_Rotation
\\\"
,0.893],PARAMETER[
\\\"
Y_Axis_Rotation
\\\"
,0.921],PARAMETER[
\\\"
Z_Axis_Rotation
\\\"
,-0.917],PARAMETER[
\\\"
Scale_Difference
\\\"
,-3.52],AUTHORITY[
\\\"
EPSG
\\\"
,1612]]
\"
,
\"
ver
\"
:
\"
PE_10_3_1
\"
,
\"
name
\"
:
\"
ED_1950_To_WGS_1984_23
\"
,
\"
authCode
\"
:{
\"
auth
\"
:
\"
EPSG
\"
,
\"
code
\"
:
\"
1612
\"
},
\"
type
\"
:
\"
ST
\"
},
\"
ver
\"
:
\"
PE_10_3_1
\"
,
\"
name
\"
:
\"
ED50 * EPSG-Nor N62 2001 [4230,1612]
\"
,
\"
authCode
\"
:{
\"
auth
\"
:
\"\"
,
\"
code
\"
:
\"
4230023
\"
},
\"
type
\"
:
\"
EBC
\"
}"
,
"propertyNames"
:
[
"wksAttribute2.y"
]
}
],
"id"
:
"part1:entity:wks-3b9edab584ccc863c1dec7f1f5cf89c70d312020.part
1
.wks.entity.1"
,
"id"
:
"part1:entity:wks-3b9edab584ccc863c1dec7f1f5cf89c70d312020.part
2
.wks.entity.1"
,
"ancestry"
:
{
"parents"
:
[
"part1:source:entity-uniqueId:39429347234"
]
},
"kind"
:
"part
1
:wks:entity:1.0.0"
,
"kind"
:
"part
2
:wks:entity:1.0.0"
,
"acl"
:
{
"viewers"
:
[
"data.default.viewers@part1.dev.com"
],
"owners"
:
[
"data.default.owners@part1.dev.com"
]
...
...
wks-core/src/test/resources/unit_test_resources/transformed_record_without_meta.json
View file @
20a5204f
...
...
@@ -35,11 +35,11 @@
},
"Wks Attribute 18 (CDE)"
:
2246.5
},
"id"
:
"part1:entity:wks-3b9edab584ccc863c1dec7f1f5cf89c70d312020.part
1
.wks.entity.1"
,
"id"
:
"part1:entity:wks-3b9edab584ccc863c1dec7f1f5cf89c70d312020.part
2
.wks.entity.1"
,
"ancestry"
:
{
"parents"
:
[
"part1:source:entity-uniqueId:39429347234"
]
},
"kind"
:
"part
1
:wks:entity:1.0.0"
,
"kind"
:
"part
2
:wks:entity:1.0.0"
,
"acl"
:
{
"viewers"
:
[
"data.default.viewers@part1.dev.com"
],
"owners"
:
[
"data.default.owners@part1.dev.com"
]
...
...
wks-core/src/test/resources/unit_test_resources/transformed_tree_with_relationship.json
View file @
20a5204f
{
"id"
:
"part1:entity:wks-066f2079ed2f81f02a550b91140d4d7d68b1adf0.part
1
.wks.entity.1"
,
"id"
:
"part1:entity:wks-066f2079ed2f81f02a550b91140d4d7d68b1adf0.part
2
.wks.entity.1"
,
"ancestry"
:
{
"parents"
:
[
"part1:source:wellbore-dGVzdFdlbGxfYXV0b19hdHRlbXB0Ng:1568075751408965"
]
},
"kind"
:
"part
1
:wks:entity:1.0.0"
,
"kind"
:
"part
2
:wks:entity:1.0.0"
,
"acl"
:
{
"viewers"
:
[
"data.default.viewers@part1.dev.com"
],
"owners"
:
[
"data.default.owners@part1.dev.com"
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment