Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Indexer
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
Indexer
Commits
b64d23da
Commit
b64d23da
authored
3 years ago
by
Neelesh Thakur
Browse files
Options
Downloads
Patches
Plain Diff
add tests
parent
fe2258a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!183
Locking down maven central
,
!167
add schema parse error in record trace field
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/IndexerSchemaServiceTest.java
+28
-0
28 additions, 0 deletions
.../osdu/indexer/azure/service/IndexerSchemaServiceTest.java
with
28 additions
and
0 deletions
provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/IndexerSchemaServiceTest.java
+
28
−
0
View file @
b64d23da
...
...
@@ -31,6 +31,7 @@ import org.opengroup.osdu.core.common.model.indexer.OperationType;
import
org.opengroup.osdu.core.common.search.ElasticIndexNameResolver
;
import
org.opengroup.osdu.core.common.search.IndicesService
;
import
org.opengroup.osdu.indexer.provider.interfaces.ISchemaCache
;
import
org.opengroup.osdu.indexer.schema.converter.exeption.SchemaProcessingException
;
import
org.opengroup.osdu.indexer.service.IndexSchemaServiceImpl
;
import
org.opengroup.osdu.indexer.service.IndexerMappingService
;
import
org.opengroup.osdu.indexer.service.SchemaService
;
...
...
@@ -39,9 +40,12 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
ArgumentMatchers
.*;
...
...
@@ -404,4 +408,28 @@ public class IndexerSchemaServiceTest {
assertFalse
(
this
.
sut
.
isStorageSchemaSyncRequired
(
kind
,
false
));
}
@Test
public
void
should_returnErrors_givenSchemaProcessingException_getIndexerInputSchemaSchemaTest
()
throws
UnsupportedEncodingException
,
URISyntaxException
{
SchemaProcessingException
processingException
=
new
SchemaProcessingException
(
"error processing schema"
);
when
(
schemaService
.
getSchema
(
any
())).
thenThrow
(
processingException
);
List
<
String
>
errors
=
new
ArrayList
<>();
IndexSchema
indexSchema
=
this
.
sut
.
getIndexerInputSchema
(
kind
,
errors
);
assertNotNull
(
indexSchema
);
assertTrue
(
errors
.
contains
(
"error processing schema"
));
}
@Test
public
void
should_returnErrors_givenRuntimeException_getIndexerInputSchemaSchemaTest
()
throws
UnsupportedEncodingException
,
URISyntaxException
{
RuntimeException
exception
=
new
RuntimeException
(
"error processing schema, RuntimeException exception thrown"
);
when
(
schemaService
.
getSchema
(
any
())).
thenThrow
(
exception
);
List
<
String
>
errors
=
new
ArrayList
<>();
IndexSchema
indexSchema
=
this
.
sut
.
getIndexerInputSchema
(
kind
,
errors
);
assertNotNull
(
indexSchema
);
assertTrue
(
errors
.
contains
(
"error processing schema, RuntimeException exception thrown"
));
}
}
This diff is collapsed.
Click to expand it.
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