<openapi.generator.maven.plugin.version>7.12.0</openapi.generator.maven.plugin.version>
<sonar.version>4.0.0.4121</sonar.version>
<spring.boot.maven.plugin.version>3.5.6</spring.boot.maven.plugin.version>
- <spotbugs.maven.plugin.version>4.7.3.0</spotbugs.maven.plugin.version>
+ <spotbugs.maven.plugin.version>4.8.6.4</spotbugs.maven.plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<!-- Code Coverage Configuration -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
- <version>1.18.24</version>
+ <version>1.18.32</version>
</dependency>
<dependency>
<groupId>${cps.groupId}</groupId>
</snapshotRepository>
</distributionManagement>
-</project>
\ No newline at end of file
+</project>
private static final int QUERY_PARAM_NAME_INDEX = 0;
private static final EnumMap<OperationEnum, HttpMethod> operationToHttpMethodMap =
- new EnumMap<>(OperationEnum.class);
+ new EnumMap<>(OperationEnum.class);
static {
operationToHttpMethodMap.put(OperationEnum.READ, HttpMethod.GET);
private final SdncProperties sdncProperties;
private final SdncRestconfClient sdncRestconfClient;
- private final String topologyUrlData;
- private final String topologyUrlOperational;
private final Configuration jsonPathConfiguration = Configuration.builder()
.mappingProvider(new JacksonMappingProvider())
.build();
/**
- * Constructor for {@code SdncOperations}. This method also manipulates url properties.
+ * Constructor for {@code SdncOperations}.
*
* @param sdncProperties {@code SdncProperties}
* @param sdncRestconfClient {@code SdncRestconfClient}
public SdncOperations(final SdncProperties sdncProperties, final SdncRestconfClient sdncRestconfClient) {
this.sdncProperties = sdncProperties;
this.sdncRestconfClient = sdncRestconfClient;
- topologyUrlOperational = getTopologyUrlOperational();
- topologyUrlData = getTopologyUrlData();
}
/**
- * This method fetches list of modules usind sdnc client.
+ * This method fetches list of modules using sdnc client.
*
* @param nodeId node id for node
* @return a collection of module schemas
}
private String prepareGetOperationSchemaUrl(final String nodeId) {
- return UriComponentsBuilder.fromUriString(topologyUrlOperational)
+ return UriComponentsBuilder.fromUriString(getTopologyUrl(TOPOLOGY_URL_TEMPLATE_OPERATIONAL))
.pathSegment("node={nodeId}")
.pathSegment("yang-ext:mount")
.path(GET_SCHEMA_SOURCES_URL)
}
private String addQuery(final String url, final MultiValueMap<String, String> queryMap) {
-
- return UriComponentsBuilder
- .fromUriString(url)
- .queryParams(queryMap)
- .buildAndExpand().toUriString();
+ return UriComponentsBuilder.fromUriString(url).queryParams(queryMap).buildAndExpand().toUriString();
}
private String addTopologyDataUrlwithNode(final String nodeId) {
- return UriComponentsBuilder
- .fromUriString(topologyUrlData)
- .pathSegment("node={nodeId}")
- .pathSegment("yang-ext:mount")
- .buildAndExpand(nodeId).toUriString();
+ return UriComponentsBuilder.fromUriString(getTopologyUrl(TOPOLOGY_URL_TEMPLATE_DATA))
+ .pathSegment("node={nodeId}")
+ .pathSegment("yang-ext:mount")
+ .buildAndExpand(nodeId).toUriString();
}
private List<ModuleSchema> convertToModuleSchemas(final String modulesListAsJson) {
try {
return JsonPath.using(jsonPathConfiguration).parse(modulesListAsJson).read(
- PATH_TO_MODULE_SCHEMAS, new TypeRef<>() {
- });
+ PATH_TO_MODULE_SCHEMAS, new TypeRef<>() {});
} catch (final JsonPathException jsonPathException) {
throw new SdncException("SDNC Response processing failed",
"SDNC response is not in the expected format.", jsonPathException);
}
}
- private String getTopologyUrlData() {
- return UriComponentsBuilder.fromUriString(TOPOLOGY_URL_TEMPLATE_DATA)
- .path("topology={topologyId}")
- .buildAndExpand(this.sdncProperties.getTopologyId()).toUriString();
- }
-
- private String getTopologyUrlOperational() {
- return UriComponentsBuilder.fromUriString(
- TOPOLOGY_URL_TEMPLATE_OPERATIONAL)
- .path("topology={topologyId}")
- .buildAndExpand(this.sdncProperties.getTopologyId()).toUriString();
+ private String getTopologyUrl(final String uriTemplate) {
+ return UriComponentsBuilder.fromUriString(uriTemplate)
+ .path("topology={topologyId}")
+ .buildAndExpand(sdncProperties.getTopologyId()).toUriString();
}
private Map<String, String> extractQueryParams(final String optionsParamInQuery,