From b80bcb81356fc9953e85196d8cbf6ada2ebbc143 Mon Sep 17 00:00:00 2001 From: wasala Date: Mon, 26 Mar 2018 15:48:46 +0200 Subject: Divide into module dependecy Add dependency build of dmaapClients and aaiClients. This modules are mandatory to prh application. Issue-ID: DCAEGEN2-407 Change-Id: I2150a15d76e81dd01503f44339ddb3c50f5b0348 Signed-off-by: wasala --- .gitignore | 12 +- pom.xml | 292 ++++++++++++++++++--- prh-aai-client/pom.xml | 14 + .../config/AAIDmaapProducerConfiguration.java | 41 +++ .../src/main/java/services/config/Config.java | 29 ++ .../src/main/java/services/config/DmaapConfig.java | 34 +++ prh-app-server/pom.xml | 56 ++++ .../org/onap/dcaegen2/services/prh/MainApp.java | 40 +++ .../prh/exceptions/AAINotFoundException.java | 30 +++ .../services/prh/tasks/DmaapConsumerTask.java | 46 ++++ .../dcaegen2/services/prh/tasks/DmaapTask.java | 31 +++ .../dcaegen2/services/prh/tasks/ScheduledTask.java | 62 +++++ prh-app-server/src/main/resources/application.yaml | 2 + .../dcaegen2/services/prh/ServerPrhAppTest.java | 31 +++ prh-app-server/src/test/resources/logback-test.xml | 33 +++ prh-dmaap-client/pom.xml | 14 + .../org/onap/dcaegen2/services/config/Config.java | 29 ++ .../onap/dcaegen2/services/config/DmaapConfig.java | 34 +++ .../config/DmaapConsumerConfiguration.java | 37 +++ .../config/DmaapProducerConfiguration.java | 29 ++ .../org/onap/dcaegen2/services/prh/MainApp.java | 41 --- .../config/dmaap/DmaapConsumerConfiguration.java | 39 --- .../event/executor/mutual/config/AAIConfig.java | 28 -- .../prh/event/executor/mutual/config/Config.java | 30 --- .../event/executor/mutual/config/DmaapConfig.java | 35 --- .../config/aai/AAIDmaapProducerConfiguration.java | 43 --- .../config/dmaap/DmaapProducerConfiguration.java | 33 --- .../prh/exceptions/AAINotFoundException.java | 31 --- .../services/prh/tasks/DmaapConsumerTask.java | 47 ---- .../dcaegen2/services/prh/tasks/DmaapTask.java | 32 --- .../dcaegen2/services/prh/tasks/ScheduledTask.java | 63 ----- src/main/resources/application.yaml | 7 - .../dcaegen2/services/prh/ServerPrhAppTest.java | 31 --- 33 files changed, 853 insertions(+), 503 deletions(-) create mode 100644 prh-aai-client/pom.xml create mode 100644 prh-aai-client/src/main/java/services/config/AAIDmaapProducerConfiguration.java create mode 100644 prh-aai-client/src/main/java/services/config/Config.java create mode 100644 prh-aai-client/src/main/java/services/config/DmaapConfig.java create mode 100644 prh-app-server/pom.xml create mode 100644 prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java create mode 100644 prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java create mode 100644 prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java create mode 100644 prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java create mode 100644 prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java create mode 100644 prh-app-server/src/main/resources/application.yaml create mode 100644 prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java create mode 100644 prh-app-server/src/test/resources/logback-test.xml create mode 100644 prh-dmaap-client/pom.xml create mode 100644 prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/Config.java create mode 100644 prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConfig.java create mode 100644 prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConsumerConfiguration.java create mode 100644 prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapProducerConfiguration.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/MainApp.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/event/executor/consumer/config/dmaap/DmaapConsumerConfiguration.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/AAIConfig.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/Config.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/DmaapConfig.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/aai/AAIDmaapProducerConfiguration.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/dmaap/DmaapProducerConfiguration.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java delete mode 100644 src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java delete mode 100644 src/main/resources/application.yaml delete mode 100644 src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java diff --git a/.gitignore b/.gitignore index f56704bd..691c9f04 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,15 @@ +# Compiled class file *.class # Mobile Tools for Java (J2ME) .mtj.tmp/ +# Log file +*.log + +# BlueJ files +*.ctxt + # Package Files # *.jar *.war @@ -15,4 +22,7 @@ hs_err_pid* .idea *.iml -target \ No newline at end of file +target + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* \ No newline at end of file diff --git a/pom.xml b/pom.xml index 089a1a0a..3b17ffa0 100644 --- a/pom.xml +++ b/pom.xml @@ -13,8 +13,20 @@ 1.0.0-SNAPSHOT pnf-registration-handler pnf-registration-handler + pom + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + UTF-8 + UTF-8 + 8 3.7.0 @@ -33,6 +45,7 @@ content/sites/site/org/onap/dcaegen2/services/prh/${project.artifactId}/${project.version} + @@ -46,27 +59,24 @@ http://maven.restlet.com + external-repository https://oss.sonatype.org/content/repositories + - - - org.springframework.boot - spring-boot-starter-web - - org.springframework.boot - spring-boot-starter-webflux + org.immutables + value + 2.5.6 - - org.immutables - value - 2.5.6 - + + + + org.junit.jupiter @@ -100,9 +110,21 @@ test + + + + + org.apache.maven.wagon + wagon-webdav-jackrabbit + 3.0.0 + + + + + org.apache.maven.plugins maven-compiler-plugin @@ -114,34 +136,83 @@ true - + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + true + + + + attach-sources + verify + + jar-no-fork + + + + + + org.apache.maven.plugins - maven-shade-plugin - 3.1.0 + maven-javadoc-plugin + 3.0.0 + + + true + false + false + + aggregate + site + + aggregate + + + + attach-javadoc + + jar + + + + + + + + org.apache.felix + maven-bundle-plugin + 3.5.0 + true + + + *;inline=false;scope=compile + true + lib + + + + + Bundling PRH Jar package - shade + bundle - - - - - org.onap.dcaegen2.services.prh.ServerPrhApp - - - + + org.apache.maven.plugins - maven-site-plugin - 3.6 + maven-antrun-plugin + 1.8 @@ -149,6 +220,35 @@ org.apache.maven.plugins maven-surefire-plugin 2.19.1 + + false + -Xmx2048m -Djava.awt.headless=true -XX:+UseConcMarkSweepGC + -XX:OnOutOfMemoryError="kill -9 %p" -XX:+HeapDumpOnOutOfMemoryError + + ${surefire.redirectTestOutputToFile} + + methods + 8 + 8 + true + xml + false + + ${project.build.directory} + + ${basedir}/src/test/resources/logback-test.xml + + ${project.build.directory} + + + **/*Test.java + + + **/*IT.java + + + ${surefireArgLine} + org.junit.platform @@ -157,6 +257,77 @@ + + + + org.codehaus.mojo + findbugs-maven-plugin + ${findbugs.plugin.version} + + Max + Low + true + + true + ${project.basedir}/findbugs-exclude.xml + ${project.reporting.outputDirectory}/findbugs + ${project.reporting.outputDirectory}/findbugs + + + + + analyze-compile + compile + + check + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + + true + + + ${project.version} + + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.6 + + + + org.apache.maven.plugins + maven-jxr-plugin + 2.5 + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + false + false + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.21.0 + @@ -164,14 +335,58 @@ org.apache.maven.plugins maven-compiler-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + - org.springframework.boot - spring-boot-maven-plugin + org.apache.maven.plugins + maven-surefire-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + org.apache.maven.plugins + maven-source-plugin + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + + + + org.apache.maven.plugins + maven-site-plugin + + + + org.apache.maven.plugins + maven-jxr-plugin + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + + org.apache.maven.plugins + maven-surefire-report-plugin + + org.apache.maven.plugins maven-javadoc-plugin @@ -191,17 +406,10 @@ - - - - - org.springframework.boot - spring-boot-dependencies - 2.0.0.RELEASE - pom - import - - - + + prh-app-server + prh-aai-client + prh-dmaap-client + diff --git a/prh-aai-client/pom.xml b/prh-aai-client/pom.xml new file mode 100644 index 00000000..5ac67ce8 --- /dev/null +++ b/prh-aai-client/pom.xml @@ -0,0 +1,14 @@ + + + + + prh + org.onap.dcaegen2.services + 1.0.0-SNAPSHOT + + 4.0.0 + + prh-aai-client + \ No newline at end of file diff --git a/prh-aai-client/src/main/java/services/config/AAIDmaapProducerConfiguration.java b/prh-aai-client/src/main/java/services/config/AAIDmaapProducerConfiguration.java new file mode 100644 index 00000000..396a78be --- /dev/null +++ b/prh-aai-client/src/main/java/services/config/AAIDmaapProducerConfiguration.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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 services.config; + +import java.net.URL; +import org.immutables.value.Value; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +@Value.Immutable(prehash = true) +@Value.Style(stagedBuilder = true) +public abstract class AAIDmaapProducerConfiguration extends DmaapConfig { + + private static final long serialVersionUID = 1L; + + private String aaiHost; + private Integer aaiHostPortNumber; + private String aaiProtocol; + private String aaiUserName; + private String aaiUserPassword; + private URL aaiProxyURL; + private boolean aaiIgnoreSSLCertificateErrors; +} diff --git a/prh-aai-client/src/main/java/services/config/Config.java b/prh-aai-client/src/main/java/services/config/Config.java new file mode 100644 index 00000000..a2a012c5 --- /dev/null +++ b/prh-aai-client/src/main/java/services/config/Config.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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 services.config; + +import java.io.Serializable; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +interface Config extends Serializable { + +} diff --git a/prh-aai-client/src/main/java/services/config/DmaapConfig.java b/prh-aai-client/src/main/java/services/config/DmaapConfig.java new file mode 100644 index 00000000..0ddaea28 --- /dev/null +++ b/prh-aai-client/src/main/java/services/config/DmaapConfig.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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 services.config; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +public abstract class DmaapConfig implements Config { + + private String dmmaphostName; + private Integer dmmapportNumber; + private String dmmaptopicName; + private String dmmapprotocol; + private String dmmapuserName; + private String dmmapuserPassword; + private String dmmapcontentType; +} diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml new file mode 100644 index 00000000..513b5118 --- /dev/null +++ b/prh-app-server/pom.xml @@ -0,0 +1,56 @@ + + + + prh + org.onap.dcaegen2.services + 1.0.0-SNAPSHOT + + 4.0.0 + + prh-app-server + jar + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-webflux + + + org.junit.platform + junit-platform-commons + RELEASE + + + + + + + + org.springframework.boot + spring-boot-dependencies + 2.0.0.RELEASE + pom + import + + + + \ No newline at end of file diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java new file mode 100644 index 00000000..ebdf1bb4 --- /dev/null +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +@SpringBootApplication +@Configuration +@ComponentScan +@EnableScheduling +public class MainApp { + + public static void main(String[] args) { + SpringApplication.run(MainApp.class, args); + } +} diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java new file mode 100644 index 00000000..22dd24bd --- /dev/null +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.exceptions; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +public class AAINotFoundException extends Exception { + + public AAINotFoundException(String message) { + super(message); + } +} diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java new file mode 100644 index 00000000..0d7ec225 --- /dev/null +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.tasks; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +@Component +public class DmaapConsumerTask implements DmaapTask { + + private static final Logger logger = LoggerFactory.getLogger(DmaapConsumerTask.class); + private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + + @Override + public void execute() { + logger.info("Start task DmaapConsumerTask::execute() :: Execution Time - {}", dateTimeFormatter.format( + LocalDateTime.now())); + //TODO: ADD implementation for executing request to consume topic from dmaap + + logger.info("End task DmaapConsumerTask::execute() :: Execution Time - {}", + dateTimeFormatter.format(LocalDateTime.now())); + } +} \ No newline at end of file diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java new file mode 100644 index 00000000..f5f8c284 --- /dev/null +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.tasks; + +import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +public interface DmaapTask { + + void execute() throws AAINotFoundException; + +} diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java new file mode 100644 index 00000000..006d44ea --- /dev/null +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.tasks; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +@Component +public class ScheduledTask { + + private static final int FIXED_DELAY = 1000; + private static final Logger logger = LoggerFactory.getLogger(ScheduledTask.class); + private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + + private final DmaapTask dmaapConsumerTask; + + @Autowired + public ScheduledTask(DmaapConsumerTask dmaapConsumerTask) { + this.dmaapConsumerTask = dmaapConsumerTask; + } + + + @Scheduled(fixedDelay = FIXED_DELAY) + public void scheduledTaskAskingDMaaPOfConsumeEvent() { + logger.info("Task scheduledTaskAskingDMaaPOfConsumeEvent() :: Execution Time - {}", dateTimeFormatter.format( + LocalDateTime.now())); + try { + dmaapConsumerTask.execute(); + } catch (AAINotFoundException e) { + logger.warn("Task scheduledTaskAskingDMaaPOfConsumeEvent()::AAINotFoundException :: Execution Time - {}:{}", + dateTimeFormatter.format( + LocalDateTime.now()), e.getMessage()); + } + } + +} diff --git a/prh-app-server/src/main/resources/application.yaml b/prh-app-server/src/main/resources/application.yaml new file mode 100644 index 00000000..4d372c26 --- /dev/null +++ b/prh-app-server/src/main/resources/application.yaml @@ -0,0 +1,2 @@ +server: + port: 8100 \ No newline at end of file diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java new file mode 100644 index 00000000..4373a50d --- /dev/null +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh; + +import org.junit.jupiter.api.Test; + +class MainAppTest { + + @Test + void justAnExample() { + System.out.println("This test method should be run"); + } +} \ No newline at end of file diff --git a/prh-app-server/src/test/resources/logback-test.xml b/prh-app-server/src/test/resources/logback-test.xml new file mode 100644 index 00000000..0a53315a --- /dev/null +++ b/prh-app-server/src/test/resources/logback-test.xml @@ -0,0 +1,33 @@ + + + + + + + + %d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n + + + + + + + + + diff --git a/prh-dmaap-client/pom.xml b/prh-dmaap-client/pom.xml new file mode 100644 index 00000000..68170645 --- /dev/null +++ b/prh-dmaap-client/pom.xml @@ -0,0 +1,14 @@ + + + + prh + org.onap.dcaegen2.services + 1.0.0-SNAPSHOT + + 4.0.0 + + prh-dmaap-client + + \ No newline at end of file diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/Config.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/Config.java new file mode 100644 index 00000000..422f3daf --- /dev/null +++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/Config.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.config; + +import java.io.Serializable; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +interface Config extends Serializable { + +} diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConfig.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConfig.java new file mode 100644 index 00000000..3b485cdb --- /dev/null +++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConfig.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.config; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +public abstract class DmaapConfig implements Config { + + private String dmmaphostName; + private Integer dmmapportNumber; + private String dmmaptopicName; + private String dmmapprotocol; + private String dmmapuserName; + private String dmmapuserPassword; + private String dmmapcontentType; +} diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConsumerConfiguration.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConsumerConfiguration.java new file mode 100644 index 00000000..d36104bd --- /dev/null +++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapConsumerConfiguration.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.config; + +import org.immutables.value.Value; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +@Value.Immutable(prehash = true) +@Value.Style(stagedBuilder = true) +public abstract class DmaapConsumerConfiguration extends DmaapConfig { + + private static final long serialVersionUID = 1L; + + private String consumerId; + private String consumerGroup; + private Integer timeoutMS; + private Integer messageLimit; +} \ No newline at end of file diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapProducerConfiguration.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapProducerConfiguration.java new file mode 100644 index 00000000..f5749a3f --- /dev/null +++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/config/DmaapProducerConfiguration.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.config; + +/** + * @author Przemysław Wąsala on 3/23/18 + */ +public class DmaapProducerConfiguration extends DmaapConfig { + + private static final long serialVersionUID = 1L; + +} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java b/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java deleted file mode 100644 index ca7cc362..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.EnableScheduling; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -@SpringBootApplication -@Configuration -@ComponentScan -@EnableScheduling -public class MainApp { - - public static void main(String[] args) { - SpringApplication.run(MainApp.class, args); - } -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/consumer/config/dmaap/DmaapConsumerConfiguration.java b/src/main/java/org/onap/dcaegen2/services/prh/event/executor/consumer/config/dmaap/DmaapConsumerConfiguration.java deleted file mode 100644 index 3ea3d213..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/consumer/config/dmaap/DmaapConsumerConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.event.executor.consumer.config.dmaap; - -import org.immutables.value.Value; -import org.onap.dcaegen2.services.prh.event.executor.mutual.config.DmaapConfig; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -@Value.Immutable(prehash = true) -@Value.Style(stagedBuilder = true) -public abstract class DmaapConsumerConfiguration extends DmaapConfig { - - private static final long serialVersionUID = 1L; - - private String consumerId; - private String consumerGroup; - private Integer timeoutMS; - private Integer messageLimit; -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/AAIConfig.java b/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/AAIConfig.java deleted file mode 100644 index 58858b5c..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/AAIConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.event.executor.mutual.config; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -public abstract class AAIConfig implements Config { - -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/Config.java b/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/Config.java deleted file mode 100644 index d0784457..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/Config.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.event.executor.mutual.config; - -import java.io.Serializable; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -interface Config extends Serializable { - -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/DmaapConfig.java b/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/DmaapConfig.java deleted file mode 100644 index 0a2ee9d1..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/mutual/config/DmaapConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.event.executor.mutual.config; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -public abstract class DmaapConfig implements Config { - - private String dmmaphostName; - private Integer dmmapportNumber; - private String dmmaptopicName; - private String dmmapprotocol; - private String dmmapuserName; - private String dmmapuserPassword; - private String dmmapcontentType; -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/aai/AAIDmaapProducerConfiguration.java b/src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/aai/AAIDmaapProducerConfiguration.java deleted file mode 100644 index 214ffa94..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/aai/AAIDmaapProducerConfiguration.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.event.executor.publisher.config.aai; - -import java.net.URL; -import org.immutables.value.Value; -import org.onap.dcaegen2.services.prh.event.executor.mutual.config.DmaapConfig; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -@Value.Immutable(prehash = true) -@Value.Style(stagedBuilder = true) -public abstract class AAIDmaapProducerConfiguration extends DmaapConfig { - - private static final long serialVersionUID = 1L; - - private String aaiHost; - private Integer aaiHostPortNumber; - private String aaiProtocol; - private String aaiUserName; - private String aaiUserPassword; - private URL aaiProxyURL; - private boolean aaiIgnoreSSLCertificateErrors; -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/dmaap/DmaapProducerConfiguration.java b/src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/dmaap/DmaapProducerConfiguration.java deleted file mode 100644 index 494fad4c..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/event/executor/publisher/config/dmaap/DmaapProducerConfiguration.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.event.executor.publisher.config.dmaap; - -import org.onap.dcaegen2.services.prh.event.executor.mutual.config.DmaapConfig; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ - -public class DmaapProducerConfiguration extends DmaapConfig { - - private static final long serialVersionUID = 1L; - -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java b/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java deleted file mode 100644 index 61b0c69b..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.exceptions; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -public class AAINotFoundException extends Exception { - - public AAINotFoundException(String message) { - super(message); - } -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java b/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java deleted file mode 100644 index 5902587b..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.tasks; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -@Component -public class DmaapConsumerTask implements DmaapTask { - - private static final Logger logger = LoggerFactory.getLogger(DmaapConsumerTask.class); - private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); - - @Override - public void execute() { - logger.info("Start task DmaapConsumerTask::execute() :: Execution Time - {}", dateTimeFormatter.format( - LocalDateTime.now())); - //TODO: ADD implementation for executing request to consume topic from dmaap - - logger.info("End task DmaapConsumerTask::execute() :: Execution Time - {}", - dateTimeFormatter.format(LocalDateTime.now())); - } -} \ No newline at end of file diff --git a/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java b/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java deleted file mode 100644 index bb3fdc6d..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapTask.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.tasks; - -import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -public interface DmaapTask { - - void execute() throws AAINotFoundException; - -} diff --git a/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java b/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java deleted file mode 100644 index c06eceb0..00000000 --- a/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh.tasks; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * @author Przemysław Wąsala on 3/23/18 - * @project pnf-registration-handler - */ -@Component -public class ScheduledTask { - - private static final int FIXED_DELAY = 1000; - private static final Logger logger = LoggerFactory.getLogger(ScheduledTask.class); - private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); - - private final DmaapTask dmaapConsumerTask; - - @Autowired - public ScheduledTask(DmaapConsumerTask dmaapConsumerTask) { - this.dmaapConsumerTask = dmaapConsumerTask; - } - - - @Scheduled(fixedDelay = FIXED_DELAY) - public void scheduledTaskAskingDMaaPOfConsumeEvent() { - logger.info("Task scheduledTaskAskingDMaaPOfConsumeEvent() :: Execution Time - {}", dateTimeFormatter.format( - LocalDateTime.now())); - try { - dmaapConsumerTask.execute(); - } catch (AAINotFoundException e) { - logger.warn("Task scheduledTaskAskingDMaaPOfConsumeEvent()::AAINotFoundException :: Execution Time - {}:{}", - dateTimeFormatter.format( - LocalDateTime.now()), e.getMessage()); - } - } - -} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml deleted file mode 100644 index ef147c10..00000000 --- a/src/main/resources/application.yaml +++ /dev/null @@ -1,7 +0,0 @@ -server: - port: 8080 -logging: - level: - .: error - org.springframework: ERROR - org.onap.dcaegen2.services.prg: ERROR \ No newline at end of file diff --git a/src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java b/src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java deleted file mode 100644 index 4373a50d..00000000 --- a/src/test/java/org/onap/dcaegen2/services/prh/ServerPrhAppTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. 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.dcaegen2.services.prh; - -import org.junit.jupiter.api.Test; - -class MainAppTest { - - @Test - void justAnExample() { - System.out.println("This test method should be run"); - } -} \ No newline at end of file -- cgit 1.2.3-korg