</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-test</artifactId>
+ <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.vaadin.external.google</groupId>
+ <artifactId>android-json</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
- <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
- <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.aai.config.IntrospectionConfig;
import org.onap.aai.config.RestBeanConfig;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.setup.SchemaVersions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaLocationsBean.class, SchemaVersions.class, AAIConfigTranslator.class,
EdgeIngestor.class, EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
IntrospectionConfig.class, RestBeanConfig.class, GremlinServerSingleton.class})
-@ExtendWith(SpringExtension.class)
@TestPropertySource(
properties = {"schema.uri.base.path = /aai",
"schema.ingest.file = src/test/resources/application-test.properties"})
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.onap.aai.config.IntrospectionConfig;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaLocationsBean.class, SchemaConfigVersions.class, AAIConfigTranslator.class,
EdgeIngestor.class, EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
- GremlinServerSingleton.class, IntrospectionConfig.class})
-@ExtendWith(SpringExtension.class)
+ GremlinServerSingleton.class, IntrospectionConfig.class, LoaderFactory.class})
@TestPropertySource(
properties = {"schema.uri.base.path = /aai", "schema.source.name = onap",
"schema.ingest.file = src/test/resources/application-test.properties"})
</profiles>
<dependencies>
<dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <scope>compile</scope>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
</dependency>
<dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.3.0</version>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
- <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
- <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.7</version>
+ <!-- <version>3.7</version> -->
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1</version>
</dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-core</artifactId>
- </dependency>
<dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
- <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
- <version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-schema-ingest</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.onap.aai.aai-common</groupId>
- <artifactId>aai-aaf-auth</artifactId>
- </exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.34</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ </dependency>
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-els-onap-logging</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-junit</artifactId>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
+import org.springframework.core.env.Profiles;
@SpringBootApplication
// Component Scan provides a way to look for spring beans
// This is only needed for tomcat keeping this as temporary
System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
- if (env.acceptsProfiles(Profiles.TWO_WAY_SSL)
- && env.acceptsProfiles(Profiles.ONE_WAY_SSL)) {
+ if (env.acceptsProfiles(Profiles.of(org.onap.aai.schemaservice.Profiles.TWO_WAY_SSL))
+ && env.acceptsProfiles(Profiles.of(org.onap.aai.schemaservice.Profiles.ONE_WAY_SSL))) {
logger.warn("You have seriously misconfigured your application");
}
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
-import org.springframework.beans.factory.annotation.Autowired;
/**
* Converts the contents of the schema config file
protected SchemaLocationsBean bean;
protected SchemaVersions schemaVersions;
- @Autowired
public ConfigTranslator(SchemaLocationsBean schemaLocationbean, SchemaVersions schemaVersions) {
this.bean = schemaLocationbean;
this.schemaVersions = schemaVersions;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.ErrorObject;
-import org.onap.aai.logging.ErrorObjectNotFoundException;
import org.onap.aai.logging.LogFormatTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
AAIException aaiException = (AAIException) e;
String message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, aaiException,
templateVars);
- ErrorObject object = null;
- try {
- object = ErrorLogHelper.getErrorObject(aaiException.getCode());
- httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
- } catch (ErrorObjectNotFoundException e1) {
- LOGGER.error("getErrorObject exception {}", LogFormatTools.getStackTop(e1));
- }
+ ErrorObject object = ErrorLogHelper.getErrorObject(aaiException.getCode());
+ httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
httpServletResponse.setContentType(mediaTypeList.get(0).toString());
httpServletResponse.getWriter().write(message);
httpServletResponse.getWriter().close();
LOGGER.error("Encountered an internal exception {}", LogFormatTools.getStackTop(e));
String message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, aaiException,
templateVars);
- ErrorObject object = null;
- try {
- object = ErrorLogHelper.getErrorObject(aaiException.getCode());
- httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
- } catch (ErrorObjectNotFoundException e1) {
- LOGGER.error("getErrorObject exception {}", LogFormatTools.getStackTop(e1));
- }
+ ErrorObject object = ErrorLogHelper.getErrorObject(aaiException.getCode());
+ httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
httpServletResponse.setContentType(mediaTypeList.get(0).toString());
httpServletResponse.getWriter().write(message);
httpServletResponse.getWriter().close();
--- /dev/null
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2024 Deutsche Telekom. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.aai.schemaservice.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+@Configuration
+public class MappingConfig {
+
+ @Bean
+ public Gson gson() {
+ return new GsonBuilder().create();
+ }
+}
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import lombok.RequiredArgsConstructor;
+
import java.util.Optional;
import javax.ws.rs.GET;
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
import org.onap.aai.schemaservice.nodeschema.validation.AAISchemaValidationException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.RestController;
@Path("/v1")
+@RestController
+@RequiredArgsConstructor
public class EdgeResource extends RESTAPI {
private final EdgeService edgeService;
private final SchemaVersions schemaVersions;
private final Gson gson;
- @Autowired
- public EdgeResource(EdgeService edgeService, SchemaVersions schemaVersions) {
- this.edgeService = edgeService;
- this.schemaVersions = schemaVersions;
- gson = new GsonBuilder().create();
- }
-
@GET
@Path("/edgerules")
@Produces({"application/json"})
try {
- if (StringUtils.isEmpty(version)) {
+ if (ObjectUtils.isEmpty(version)) {
throw new AAIException("AAI_3050");
}
import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
public class EdgeService {
private static final Logger LOGGER = LoggerFactory.getLogger(EdgeService.class);
-
private static final String FILESEP = System.getProperty("file.separator");
- private SchemaVersions schemaVersions;
- private String edgesLocation;
-
- private Map<String, EdgeRules> rulesMap;
+ private final SchemaVersions schemaVersions;
+ private final String edgesLocation;
+ private final Map<String, EdgeRules> rulesMap;
+ private final Gson gson;
- @Autowired
public EdgeService(SchemaVersions schemaVersions,
@Value("${schema.edges.location}") String edgesLocation) {
this.schemaVersions = schemaVersions;
this.edgesLocation = edgesLocation;
this.rulesMap = new HashMap<>();
+ this.gson = new GsonBuilder()
+ .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
+ .create();
}
@PostConstruct
public void initialize() throws IOException {
- Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
- .create();
-
for (SchemaVersion schemaVersion : schemaVersions.getVersions()) {
String edgeRuleVersionPath = edgesLocation + FILESEP + schemaVersion.toString();
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.restcore.RESTAPI;
+import org.springframework.web.bind.annotation.RestController;
/**
* The Class EchoResponse.
*/
@Path("/util")
+@RestController
public class EchoResource extends RESTAPI {
/**
response = Response
.status(Status.OK).entity(ErrorLogHelper
- .getRESTAPIInfoResponse(headers.getAcceptableMediaTypes(), exceptionList))
+ .getRESTAPIInfoResponse(new ArrayList<>(headers.getAcceptableMediaTypes()), exceptionList))
.build();
} catch (Exception e) {
import org.glassfish.jersey.server.ContainerException;
import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
import org.onap.aai.schemaservice.interceptors.AAIHeaderProperties;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
requestContext.getHeaders().putSingle(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
}
- if (StringUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) {
+ if (ObjectUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) {
requestContext.getHeaders().putSingle(ACCEPT, DEFAULT_RESPONSE_TYPE);
}
}
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
-import jakarta.xml.bind.JAXBException;
-
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.regex.Pattern;
import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.onap.aai.schemaservice.config.ConfigTranslator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
private Map<SchemaVersion, Document> schemaPerVersion = new TreeMap<>();
private ConfigTranslator translator;
- @Autowired
/**
* Instantiates the NodeIngestor bean.
*
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.restcore.RESTAPI;
import org.onap.aai.schemaservice.nodeschema.validation.AAISchemaValidationException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.RestController;
@Path("/v1")
+@RestController
public class NodeSchemaResource extends RESTAPI {
private final NodeSchemaService nodeSchemaService;
private final SchemaVersions schemaVersions;
- @Autowired
public NodeSchemaResource(NodeSchemaService nodeSchemaService, SchemaVersions schemaVersions) {
this.nodeSchemaService = nodeSchemaService;
this.schemaVersions = schemaVersions;
Optional<String> optionalSchema = nodeSchemaService.fetch(version);
try {
- if (StringUtils.isEmpty(version)) {
+ if (ObjectUtils.isEmpty(version)) {
throw new AAIException("AAI_3050");
}
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+
@Service
+@RequiredArgsConstructor
public class NodeSchemaService {
private static final Logger LOGGER = LoggerFactory.getLogger(NodeSchemaResource.class);
- private SchemaVersions schemaVersions;
-
- private NodeIngestor nodeIngestor;
-
- private Map<String, String> versionMap = new HashMap<>();
-
- public NodeSchemaService(NodeIngestor nodeIngestor, SchemaVersions schemaVersions) {
- this.nodeIngestor = nodeIngestor;
- this.schemaVersions = schemaVersions;
- }
+ private final SchemaVersions schemaVersions;
+ private final NodeIngestor nodeIngestor;
+ private final Map<String, String> versionMap = new HashMap<>();
@PostConstruct
public void initialize() {
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* When an error is found, mark that it is NOT ok to
import org.onap.aai.schemaservice.config.ConfigTranslator;
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
public class DefaultVersionValidationModule implements VersionValidationModule {
private ConfigTranslator config;
- @Autowired
public DefaultVersionValidationModule(ConfigTranslator config) {
this.config = config;
}
import org.onap.aai.schemaservice.config.ConfigTranslator;
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
private SchemaErrorStrategy strat;
private DuplicateNodeDefinitionValidationModule dupChecker;
- @Autowired
public NodeValidator(ConfigTranslator translator, SchemaErrorStrategy strategy,
DuplicateNodeDefinitionValidationModule dupChecker) {
this.translator = translator;
package org.onap.aai.schemaservice.nodeschema.validation;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
private SchemaErrorStrategy strat;
private VersionValidationModule verMod;
- @Autowired
public VersionValidator(SchemaErrorStrategy strategy, VersionValidationModule verMod) {
this.strat = strategy;
this.verMod = verMod;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+import lombok.RequiredArgsConstructor;
@Path("/v1")
+@RestController
+@RequiredArgsConstructor
public class QueryResource {
- private QueryService queryService;
-
- @Autowired
- public QueryResource(QueryService queryService) {
- this.queryService = queryService;
- }
+ private final QueryService queryService;
@GET
@Path("/stored-queries")
import com.google.gson.Gson;
+import lombok.RequiredArgsConstructor;
+
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
@Path("/v1")
+@RestController
+@RequiredArgsConstructor
public class VersionResource {
- private VersionService versionService;
-
- @Autowired
- public VersionResource(VersionService versionService) {
- this.versionService = versionService;
- }
+ private final VersionService versionService;
+ private final Gson gson;
@GET
@Path("/versions")
@Produces({MediaType.APPLICATION_JSON})
public Response getVersions() {
- Gson gson = new Gson();
return Response.ok(gson.toJson(versionService.getVersionInfo())).build();
}
}
import org.onap.aai.schemaservice.versions.VersionResource;
import org.onap.logging.filter.base.AuditLogContainerFilter;
import org.reflections.Reflections;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
+import org.springframework.core.env.Profiles;
import org.springframework.stereotype.Component;
@Component
private Environment env;
- @Autowired
public JerseyConfiguration(Environment env) {
this.env = env;
// Turn the set back into a list
List<Class<? extends T>> filtersList = filters.stream().filter(f -> {
if (f.isAnnotationPresent(Profile.class)
- && !env.acceptsProfiles(f.getAnnotation(Profile.class).value())) {
+ && !env.acceptsProfiles(Profiles.of(f.getAnnotation(Profile.class).value()))) {
return false;
}
return true;
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.9.4</version>
+ <version>1.15.2</version>
</parent>
<groupId>org.onap.aai.schema-service</groupId>
<artifactId>schema-service</artifactId>
Nexus Proxy Properties and Snapshot Locations
Ideally this can be overwritten at runtime per internal environment specific values at runtime
-->
- <aai.common.version>1.9.4</aai.common.version>
+ <aai.common.version>1.15.2</aai.common.version>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<site.path>/content/sites/site/org/onap/aai/resources/${project.artifactId}/${project.version}</site.path>
<release.path>/content/repositories/releases/</release.path>
<aai.project.version>${project.version}</aai.project.version>
<checkstyle.skip>false</checkstyle.skip>
</properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>eclipselink</artifactId>
+ <version>2.7.15</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>org.eclipse.persistence.moxy</artifactId>
+ <version>2.7.15</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<build>
<pluginManagement>
<plugins>