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 Ingestion
Ingestion Framework
Commits
096c6cb1
Commit
096c6cb1
authored
Feb 10, 2021
by
Igor Filippov (EPAM)
Browse files
refactoring ApiConfiguration
parent
0ef3cb16
Pipeline
#26225
failed with stages
in 23 minutes and 18 seconds
Changes
6
Pipelines
5
Hide whitespace changes
Inline
Side-by-side
ingest-core/src/main/java/org/opengroup/osdu/ingest/config/ApiConfiguration.java
View file @
096c6cb1
...
...
@@ -18,44 +18,34 @@
package
org.opengroup.osdu.ingest.config
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.opengroup.osdu.ingest.client.v3.WorkflowServiceClient
;
import
org.opengroup.osdu.ingest.model.property.DataTypeProperties
;
import
org.opengroup.osdu.ingest.model.property.WorkflowProperties
;
import
org.opengroup.osdu.ingest.provider.interfaces.IValidationService
;
import
org.opengroup.osdu.ingest.provider.interfaces.IWorkflowPayloadService
;
import
org.opengroup.osdu.ingest.provider.interfaces.v3.IWorkflowIntegrationService
;
import
org.opengroup.osdu.ingest.service.OsduSubmitServiceImpl
;
import
org.opengroup.osdu.ingest.service.SubmitServiceImpl
;
import
org.opengroup.osdu.ingest.service.WorkflowIntegrationServiceImpl
;
import
org.opengroup.osdu.ingest.service.WorkflowPayloadServiceImpl
;
import
org.opengroup.osdu.ingest.service.v3.OsduSubmitService
;
import
org.opengroup.osdu.ingest.service.v3.SubmitService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.opengroup.osdu.ingest.service.v3.WorkflowIntegrationService
;
import
org.opengroup.osdu.ingest.validation.ValidationServiceImpl
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
ApiConfiguration
{
@Autowired
public
ObjectMapper
objectMapper
;
@Autowired
public
DataTypeProperties
dataTypeProperties
;
@Autowired
public
WorkflowProperties
workflowProperties
;
@Autowired
public
IWorkflowIntegrationService
workflowIntegrationService
;
@Autowired
public
IWorkflowPayloadService
workflowPayloadService
;
@Autowired
public
IValidationService
validationService
;
@Autowired
public
WorkflowIntegrationServiceImpl
workflowIntegrationServiceImpl
;
@Bean
(
name
=
"submitService"
)
@ConditionalOnProperty
(
prefix
=
"project.service.api.v3"
,
name
=
"enable"
,
havingValue
=
"true"
)
public
SubmitService
submitService
()
{
public
SubmitService
submitService
(
WorkflowIntegrationService
workflowIntegrationService
,
WorkflowPayloadServiceImpl
workflowPayloadService
,
ValidationServiceImpl
validationService
)
{
return
new
SubmitService
(
workflowIntegrationService
,
workflowPayloadService
,
validationService
);
}
...
...
@@ -63,7 +53,10 @@ public class ApiConfiguration {
@ConditionalOnProperty
(
prefix
=
"project.service.api.v3"
,
name
=
"enable"
,
havingValue
=
"false"
)
public
SubmitServiceImpl
submitServiceImpl
()
{
public
SubmitServiceImpl
submitServiceImpl
(
WorkflowIntegrationServiceImpl
workflowIntegrationServiceImpl
,
ValidationServiceImpl
validationService
,
WorkflowPayloadServiceImpl
workflowPayloadService
)
{
return
new
SubmitServiceImpl
(
workflowIntegrationServiceImpl
,
validationService
,
workflowPayloadService
);
}
...
...
@@ -72,7 +65,10 @@ public class ApiConfiguration {
@ConditionalOnProperty
(
prefix
=
"project.service.api.v3"
,
name
=
"enable"
,
havingValue
=
"true"
)
public
OsduSubmitService
osduSubmitService
()
{
public
OsduSubmitService
osduSubmitService
(
WorkflowIntegrationService
workflowIntegrationService
,
ObjectMapper
objectMapper
,
WorkflowProperties
workflowProperties
)
{
return
new
OsduSubmitService
(
workflowIntegrationService
,
objectMapper
,
workflowProperties
);
}
...
...
@@ -80,9 +76,40 @@ public class ApiConfiguration {
@ConditionalOnProperty
(
prefix
=
"project.service.api.v3"
,
name
=
"enable"
,
havingValue
=
"false"
)
public
OsduSubmitServiceImpl
osduSubmitServiceImpl
()
{
public
OsduSubmitServiceImpl
osduSubmitServiceImpl
(
WorkflowIntegrationServiceImpl
workflowIntegrationServiceImpl
,
WorkflowPayloadServiceImpl
workflowPayloadService
,
ValidationServiceImpl
validationService
,
ObjectMapper
objectMapper
,
DataTypeProperties
dataTypeProperties
)
{
return
new
OsduSubmitServiceImpl
(
workflowIntegrationServiceImpl
,
workflowPayloadService
,
validationService
,
objectMapper
,
dataTypeProperties
);
}
@Bean
@ConfigurationProperties
(
prefix
=
"osdu.data-type"
)
public
DataTypeProperties
dataTypeProperties
()
{
return
new
DataTypeProperties
();
}
@Bean
@ConfigurationProperties
(
prefix
=
"osdu.workflow-service"
)
public
WorkflowProperties
workflowProperties
()
{
return
new
WorkflowProperties
();
}
@Bean
@ConfigurationProperties
(
prefix
=
"api.v2.submit.manifest"
)
public
WorkflowPropertiesConfiguration
workflowPropertiesConfiguration
()
{
return
new
WorkflowPropertiesConfiguration
();
}
@Bean
public
WorkflowIntegrationService
workflowIntegrationService
(
WorkflowServiceClient
clientV3
,
ObjectMapper
objectMapper
,
WorkflowPropertiesConfiguration
workflowPropertiesConfiguration
)
{
return
new
WorkflowIntegrationService
(
clientV3
,
objectMapper
,
workflowPropertiesConfiguration
);
}
}
ingest-core/src/main/java/org/opengroup/osdu/ingest/config/WorkflowPropertiesConfiguration.java
View file @
096c6cb1
...
...
@@ -20,13 +20,8 @@ package org.opengroup.osdu.ingest.config;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
@Getter
@Setter
@Configuration
@ConfigurationProperties
(
prefix
=
"api.v2.submit.manifest"
)
public
class
WorkflowPropertiesConfiguration
{
private
String
workflowName
;
}
ingest-core/src/main/java/org/opengroup/osdu/ingest/model/property/DataTypeProperties.java
View file @
096c6cb1
...
...
@@ -16,23 +16,11 @@
package
org.opengroup.osdu.ingest.model.property
;
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
;
import
lombok.Getter
;
import
lombok.Setter
;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ConfigurationProperties
(
prefix
=
"osdu.data-type"
)
@Validated
@Component
@Getter
@Setter
public
class
DataTypeProperties
{
String
loadManifestType
;
}
ingest-core/src/main/java/org/opengroup/osdu/ingest/model/property/WorkflowProperties.java
View file @
096c6cb1
...
...
@@ -17,27 +17,15 @@
package
org.opengroup.osdu.ingest.model.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
;
import
lombok.Getter
;
import
lombok.Setter
;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ConfigurationProperties
(
prefix
=
"osdu.workflow-service"
)
@Validated
@Component
@Getter
@Setter
public
class
WorkflowProperties
{
@NotBlank
String
url
;
@NotBlank
String
appKey
;
}
ingest-core/src/main/java/org/opengroup/osdu/ingest/service/v3/WorkflowIntegrationService.java
View file @
096c6cb1
...
...
@@ -41,7 +41,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
@Slf4j
@Service
@RequiredArgsConstructor
public
class
WorkflowIntegrationService
implements
IWorkflowIntegrationService
{
private
final
WorkflowServiceClient
clientV3
;
...
...
ingest-core/src/test/java/org/opengroup/osdu/ingest/service/WorkflowPayloadServiceTest.java
View file @
096c6cb1
...
...
@@ -43,14 +43,13 @@ class WorkflowPayloadServiceTest {
private
static
final
String
FILE_ID
=
"file-id"
;
private
WorkflowProperties
workflowProperties
=
WorkflowProperties
.
builder
()
.
appKey
(
"test-app-key"
)
.
build
();
private
WorkflowProperties
workflowProperties
=
new
WorkflowProperties
();
private
IWorkflowPayloadService
workflowPayloadService
;
@BeforeEach
void
setUp
()
{
workflowProperties
.
setAppKey
(
"test-app-key"
);
workflowPayloadService
=
new
WorkflowPayloadServiceImpl
(
workflowProperties
,
new
ObjectMapper
());
}
...
...
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