diff options
Diffstat (limited to 'src/main/java/org/onap')
7 files changed, 26 insertions, 31 deletions
diff --git a/src/main/java/org/onap/aai/cacher/Application.java b/src/main/java/org/onap/aai/cacher/Application.java index 6d40b68..e2dbca9 100644 --- a/src/main/java/org/onap/aai/cacher/Application.java +++ b/src/main/java/org/onap/aai/cacher/Application.java @@ -28,9 +28,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; @@ -39,7 +40,7 @@ import java.util.UUID; @SpringBootApplication @EnableScheduling -@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class }) +@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class}) @ComponentScan(basePackages = { "org.onap.aai.cacher", "com" }) public class Application extends SpringBootServletInitializer { @@ -65,7 +66,7 @@ public class Application extends SpringBootServletInitializer { LoggingContext.statusCode(StatusCode.COMPLETE); SpringApplication app = new SpringApplication(Application.class); - app.setLogStartupInfo(false); + app.setLogStartupInfo(true); app.setRegisterShutdownHook(true); app.addInitializers(new PropertyPasswordConfiguration()); app.run(args); diff --git a/src/main/java/org/onap/aai/cacher/common/MongoConfig.java b/src/main/java/org/onap/aai/cacher/common/MongoConfig.java index ca063a7..854437d 100644 --- a/src/main/java/org/onap/aai/cacher/common/MongoConfig.java +++ b/src/main/java/org/onap/aai/cacher/common/MongoConfig.java @@ -28,7 +28,10 @@ import de.flapdoodle.embed.mongo.Command; import de.flapdoodle.embed.mongo.MongodExecutable; import de.flapdoodle.embed.mongo.MongodProcess; import de.flapdoodle.embed.mongo.MongodStarter; -import de.flapdoodle.embed.mongo.config.*; +import de.flapdoodle.embed.mongo.config.Defaults; +import de.flapdoodle.embed.mongo.config.MongoCmdOptions; +import de.flapdoodle.embed.mongo.config.MongodConfig; +import de.flapdoodle.embed.mongo.config.Net; import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.process.config.io.ProcessOutput; import de.flapdoodle.embed.process.io.Processors; @@ -50,11 +53,11 @@ public class MongoConfig { private static final EELFLogger EELF_LOGGER = EELFManager.getInstance().getLogger(MongoConfig.class); - @Value("${mongodb.host}") + @Value("${spring.data.mongodb.host}") private String MONGO_DB_HOST; - @Value("${mongodb.dbName}") + @Value("${spring.data.mongodb.database}") private String MONGO_DB_NAME; - @Value("${mongodb.port}") + @Value("${spring.data.mongodb.port}") private int MONGO_DB_PORT; private MongodProcess mongod; @@ -93,19 +96,18 @@ public class MongoConfig { Logger logger = LoggerFactory.getLogger("mongo"); int port = MONGO_DB_PORT; - IMongodConfig mongoConfigConfig = new MongodConfigBuilder() + MongodConfig mongoConfigConfig = MongodConfig.builder() .version(Version.Main.PRODUCTION) .net(new Net(port, Network.localhostIsIPv6())) - .cmdOptions(new MongoCmdOptionsBuilder().enableTextSearch(true).useNoPrealloc(false).build()) - .configServer(false) + .cmdOptions(MongoCmdOptions.builder().enableTextSearch(true).useNoPrealloc(false).build()) + .isConfigServer(false) .build(); ProcessOutput processOutput = new ProcessOutput(Processors.logTo(logger, Slf4jLevel.WARN), Processors.logTo(logger, Slf4jLevel.WARN), Processors.logTo(logger, Slf4jLevel.WARN)); MongodExecutable mongodExecutable = MongodStarter - .getInstance((new RuntimeConfigBuilder()) - .defaults(Command.MongoD) + .getInstance(Defaults.runtimeConfigFor(Command.MongoD) .processOutput(processOutput) .build()) .prepare(mongoConfigConfig); diff --git a/src/main/java/org/onap/aai/cacher/injestion/parser/strategy/aai/AAIResourcesUriTemplates.java b/src/main/java/org/onap/aai/cacher/injestion/parser/strategy/aai/AAIResourcesUriTemplates.java index 819a7a6..0a4c931 100644 --- a/src/main/java/org/onap/aai/cacher/injestion/parser/strategy/aai/AAIResourcesUriTemplates.java +++ b/src/main/java/org/onap/aai/cacher/injestion/parser/strategy/aai/AAIResourcesUriTemplates.java @@ -227,11 +227,7 @@ public class AAIResourcesUriTemplates { * @return */ public String encodeProp(String string) { - try { - return UriUtils.encode(string, "UTF-8"); - } catch (UnsupportedEncodingException e) { - return ""; - } + return UriUtils.encode(string, "UTF-8"); } /** @@ -241,11 +237,7 @@ public class AAIResourcesUriTemplates { * @return */ public String decodeProp(String string) { - try { - return UriUtils.decode(string, "UTF-8"); - } catch (UnsupportedEncodingException e) { - return ""; - } + return UriUtils.decode(string, "UTF-8"); } public String getAAIUriFromEntityUri(String fullUri) { diff --git a/src/main/java/org/onap/aai/cacher/service/tasks/ScheduledTaskConfig.java b/src/main/java/org/onap/aai/cacher/service/tasks/ScheduledTaskConfig.java index cdd9a2c..3f09124 100644 --- a/src/main/java/org/onap/aai/cacher/service/tasks/ScheduledTaskConfig.java +++ b/src/main/java/org/onap/aai/cacher/service/tasks/ScheduledTaskConfig.java @@ -42,7 +42,7 @@ public class ScheduledTaskConfig { private static final int TASK_INTERVAL_TIME = 30000; private static final int TASK_DELAY_TIME = 0; - private ScheduledTaskConfig(){} + //private ScheduledTaskConfig(){} @Configuration static class RegisterTaskSchedulerViaSchedulingConfigurer implements SchedulingConfigurer { diff --git a/src/main/java/org/onap/aai/cacher/util/RestClient.java b/src/main/java/org/onap/aai/cacher/util/RestClient.java index 9613d81..f836287 100644 --- a/src/main/java/org/onap/aai/cacher/util/RestClient.java +++ b/src/main/java/org/onap/aai/cacher/util/RestClient.java @@ -125,7 +125,7 @@ public class RestClient { @Bean RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception { - RestTemplate restTemplate = builder.requestFactory(new HttpComponentsClientHttpRequestFactory(restClient)) + RestTemplate restTemplate = builder.requestFactory(() -> new HttpComponentsClientHttpRequestFactory(restClient)) .build(); restTemplate.setErrorHandler(new ResponseErrorHandler() { diff --git a/src/main/java/org/onap/aai/cacher/web/JerseyConfiguration.java b/src/main/java/org/onap/aai/cacher/web/JerseyConfiguration.java index b18e840..d0a15cd 100644 --- a/src/main/java/org/onap/aai/cacher/web/JerseyConfiguration.java +++ b/src/main/java/org/onap/aai/cacher/web/JerseyConfiguration.java @@ -19,7 +19,7 @@ */ package org.onap.aai.cacher.web; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.onap.aai.cacher.service.rest.CacheInteractionService; import org.onap.aai.cacher.service.rest.CacheKeyService; @@ -60,7 +60,7 @@ public class JerseyConfiguration extends ResourceConfig { // If the LoggingFilter second argument is set to true, it will print response // value as well if ("true".equalsIgnoreCase(env.getProperty("aai.request.logging.enabled"))) { - register(new LoggingFilter(log, false)); + register(new LoggingFeature(log, 0)); } } diff --git a/src/main/java/org/onap/aai/cacher/web/LocalHostAccessLog.java b/src/main/java/org/onap/aai/cacher/web/LocalHostAccessLog.java index 81addb5..ff7d79f 100644 --- a/src/main/java/org/onap/aai/cacher/web/LocalHostAccessLog.java +++ b/src/main/java/org/onap/aai/cacher/web/LocalHostAccessLog.java @@ -22,9 +22,9 @@ package org.onap.aai.cacher.web; import ch.qos.logback.access.jetty.RequestLogImpl; import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.RequestLogHandler; -import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; -import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer; +import org.springframework.boot.web.embedded.jetty.JettyServerCustomizer; +import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; +import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -34,8 +34,8 @@ import java.util.Arrays; public class LocalHostAccessLog { @Bean - public EmbeddedServletContainerFactory jettyConfigBean() { - JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory(); + public AbstractServletWebServerFactory jettyConfigBean() { + JettyServletWebServerFactory jef = new JettyServletWebServerFactory(); jef.addServerCustomizers((JettyServerCustomizer) server -> { HandlerCollection handlers = new HandlerCollection(); |