Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Search
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Search
Commits
51e5c59d
Commit
51e5c59d
authored
2 years ago
by
Zhibin Mai
Browse files
Options
Downloads
Patches
Plain Diff
Clean unit tests
parent
ca06254a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!423
Use alias to shorten the index names in multi-kind searchMulti kind alias
Pipeline
#162491
failed
2 years ago
Stage: review
Stage: build
Stage: containerize
Stage: scan
Stage: deploy
Stage: integration
Changes
1
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
search-core/src/test/java/org/opengroup/osdu/search/util/CrossTenantUtilsTest.java
+9
-25
9 additions, 25 deletions
.../org/opengroup/osdu/search/util/CrossTenantUtilsTest.java
with
9 additions
and
25 deletions
search-core/src/test/java/org/opengroup/osdu/search/util/CrossTenantUtilsTest.java
+
9
−
25
View file @
51e5c59d
...
...
@@ -65,12 +65,7 @@ public class CrossTenantUtilsTest {
kind
.
add
(
"slb:wks:log:1.0.5"
);
String
indices
=
"opendes-welldb-wellbore2-1.0.0,opendes-osdudemo-wellbore-1.0.0,opendes-wks-polylineSet-1.0.0,slb-wks-log-1.0.5,-.*"
;
when
(
queryRequest
.
getKind
()).
thenReturn
(
kind
);
when
(
this
.
elasticIndexNameResolver
.
getIndexNameFromKind
(
anyString
())).
thenAnswer
(
invocation
->
{
String
kd
=
invocation
.
getArgument
(
0
);
kd
=
kd
.
replace
(
":"
,
"-"
);
return
kd
;
});
mock_getIndexNameFromKind
();
assertEquals
(
indices
,
this
.
sut
.
getIndexName
(
queryRequest
));
}
...
...
@@ -79,12 +74,7 @@ public class CrossTenantUtilsTest {
String
kind
=
"opendes:welldb:wellbore2:1.0.0,opendes:osdudemo:wellbore:1.0.0,opendes:wks:polylineSet:1.0.0,slb:wks:log:1.0.5"
;
String
indices
=
"opendes-welldb-wellbore2-1.0.0,opendes-osdudemo-wellbore-1.0.0,opendes-wks-polylineSet-1.0.0,slb-wks-log-1.0.5,-.*"
;
when
(
queryRequest
.
getKind
()).
thenReturn
(
kind
);
when
(
this
.
elasticIndexNameResolver
.
getIndexNameFromKind
(
anyString
())).
thenAnswer
(
invocation
->
{
String
kd
=
invocation
.
getArgument
(
0
);
kd
=
kd
.
replace
(
":"
,
"-"
);
return
kd
;
});
mock_getIndexNameFromKind
();
assertEquals
(
indices
,
this
.
sut
.
getIndexName
(
queryRequest
));
}
...
...
@@ -92,12 +82,7 @@ public class CrossTenantUtilsTest {
public
void
should_returnMultiIndicesAsIs_when_total_length_is_not_longer_than_max_length
()
{
List
<
String
>
kinds
=
getKindsNotLongerThan
(
MAX_INDEX_NAME_LENGTH
);
when
(
queryRequest
.
getKind
()).
thenReturn
(
kinds
);
when
(
this
.
elasticIndexNameResolver
.
getIndexNameFromKind
(
anyString
())).
thenAnswer
(
invocation
->
{
String
kd
=
invocation
.
getArgument
(
0
);
kd
=
kd
.
replace
(
":"
,
"-"
);
return
kd
;
});
mock_getIndexNameFromKind
();
assertEquals
(
getIndexName
(
kinds
),
this
.
sut
.
getIndexName
(
queryRequest
));
}
...
...
@@ -110,12 +95,7 @@ public class CrossTenantUtilsTest {
when
(
indexAliasService
.
getIndicesAliases
(
any
())).
thenReturn
(
kindAliasMap
);
when
(
queryRequest
.
getKind
()).
thenReturn
(
kinds
);
when
(
this
.
elasticIndexNameResolver
.
getIndexNameFromKind
(
anyString
())).
thenAnswer
(
invocation
->
{
String
kd
=
invocation
.
getArgument
(
0
);
kd
=
kd
.
replace
(
":"
,
"-"
);
return
kd
;
});
mock_getIndexNameFromKind
();
assertEquals
(
getIndexName
(
kinds
.
size
(),
alias
),
this
.
sut
.
getIndexName
(
queryRequest
));
}
...
...
@@ -126,13 +106,17 @@ public class CrossTenantUtilsTest {
when
(
indexAliasService
.
getIndicesAliases
(
any
())).
thenReturn
(
kindAliasMap
);
when
(
queryRequest
.
getKind
()).
thenReturn
(
kinds
);
mock_getIndexNameFromKind
();
assertEquals
(
getIndexName
(
kinds
),
this
.
sut
.
getIndexName
(
queryRequest
));
}
private
void
mock_getIndexNameFromKind
()
{
when
(
this
.
elasticIndexNameResolver
.
getIndexNameFromKind
(
anyString
())).
thenAnswer
(
invocation
->
{
String
kd
=
invocation
.
getArgument
(
0
);
kd
=
kd
.
replace
(
":"
,
"-"
);
return
kd
;
});
assertEquals
(
getIndexName
(
kinds
),
this
.
sut
.
getIndexName
(
queryRequest
));
}
private
List
<
String
>
getKindsNotLongerThan
(
int
length
)
{
...
...
This diff is collapsed.
Click to expand it.
Zhibin Mai
@zmai
mentioned in commit
30eee870
·
2 years ago
mentioned in commit
30eee870
mentioned in commit 30eee8703fbade4231155330abc93e23808de0e5
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment