diff options
author | Vishal Varvate <VV00489503@TechMahindra.com> | 2018-03-20 15:35:48 +0530 |
---|---|---|
committer | vvarvate <vv00489503@techmahindra.com> | 2018-03-21 22:29:35 +0530 |
commit | 82c6fcb70ca17cdda9ddc546817f3450f5b101e4 (patch) | |
tree | 9862504eac97edf691c4063712d955f4e2870bb1 | |
parent | 7025b737e3a187326951d82fcf76e33274505e3b (diff) |
SDNC-253 Historical Report Module Updated.
sdnc_reports_api Provides GUI for viewing historical reports, .
Issue-ID: SDNC-253
Change-Id: I36c52a200a9ba32a8eeced7b194be8fff01f8d5f
Signed-off-by: vvarvate <vv00489503@techmahindra.com>
52 files changed, 3068 insertions, 1 deletions
diff --git a/.project b/.project new file mode 100644 index 0000000..9d8b615 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>sdnc-features</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/desktop.ini b/desktop.ini new file mode 100644 index 0000000..d957fd1 --- /dev/null +++ b/desktop.ini @@ -0,0 +1,4 @@ +[ViewState] +Mode= +Vid= +FolderType=Generic @@ -8,12 +8,30 @@ <version>1.0.1-SNAPSHOT</version> <relativePath /> </parent> - + <groupId>org.onap.sdnc.features</groupId> <artifactId>sdnc-features</artifactId> <version>1.3.1-SNAPSHOT</version> <packaging>pom</packaging> +<!-- <modules> + <module>sdnc_reports_dao</module> + <module>sdnc_reports_api</module> + </modules> + + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>1.3.5.RELEASE</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> +</dependencyManagement> --> + <name>sdnc-features</name> <description>The SDN-C features repository contains code for karaf features that are used by the SDN controller</description> <url>https://wiki.onap.org</url> diff --git a/sdnc_report_api_sdnc_253_story/.project b/sdnc_report_api_sdnc_253_story/.project new file mode 100644 index 0000000..03bfd1e --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>sdnc_reports</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.core.resources.prefs b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.m2e.core.prefs b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/sdnc_report_api_sdnc_253_story/README.md b/sdnc_report_api_sdnc_253_story/README.md new file mode 100644 index 0000000..c8b02ab --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/README.md @@ -0,0 +1 @@ +# SDNCReports
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/pom.xml b/sdnc_report_api_sdnc_253_story/pom.xml new file mode 100644 index 0000000..187589b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/pom.xml @@ -0,0 +1,19 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.sdnc.reports</groupId> + <artifactId>sdnc_reports</artifactId> + <version>0.0.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>1.5.4.RELEASE</version> + </parent> + + + <modules> + <module>sdnc_reports_dao</module> + <module>sdnc_reports_api</module> + </modules> +</project>
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.classpath b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.classpath new file mode 100644 index 0000000..7e4ca5c --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.classpath @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.project b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.project new file mode 100644 index 0000000..9073075 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.project @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>sdnc_reports_api</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.springframework.ide.eclipse.core.springbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.springframework.ide.eclipse.core.springnature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + </natures> +</projectDescription> diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.core.resources.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.jdt.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..13b3428 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.m2e.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.wst.common.project.facet.core.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..d858295 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="cloudfoundry.standalone.app" version="1.0"/> +</faceted-project> diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/logs/sdnc_report_api.log b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/logs/sdnc_report_api.log new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/logs/sdnc_report_api.log diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/pom.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/pom.xml new file mode 100644 index 0000000..06503ac --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/pom.xml @@ -0,0 +1,163 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <artifactId>sdnc_reports_api</artifactId> + <parent> + <groupId>com.sdnc.reports</groupId> + <artifactId>sdnc_reports</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <java.version>1.8</java.version> + </properties> + + <dependencies> + + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + <version>1.4.194</version> +</dependency> + + <dependency> + <groupId>com.sdnc.reports</groupId> + <artifactId>sdnc_reports_dao</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.mariadb.jdbc</groupId> + <artifactId>mariadb-java-client</artifactId> + <version>1.1.9</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <version>1.5.4.RELEASE</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + <version>1.5.3.RELEASE</version> + </dependency> + + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>4.3.9.RELEASE</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tomcat.embed</groupId> + <artifactId>tomcat-embed-jasper</artifactId> + <scope>provided</scope> + </dependency> + + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + + </dependency> + + <!-- Add Log4j2 Dependency --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-log4j2</artifactId> + </dependency> + + + </dependencies> + + <build> + + <plugins> + + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + + <!-- <configuration> + <mainClass>${start-class}</mainClass> + <layout>ZIP</layout> + </configuration> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> --> + </plugin> + + +<plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.5.201505241946</version> + <executions> + <!-- + Prepares the property pointing to the JaCoCo runtime agent which + is passed as VM argument when Maven the Surefire plugin is executed. + --> + <execution> + <id>pre-unit-test</id> + <goals> + <goal>prepare-agent</goal> + </goals> + <configuration> + <!-- Sets the path to the file which contains the execution data. --> + <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile> + <!-- + Sets the name of the property containing the settings + for JaCoCo runtime agent. + --> + <propertyName>surefireArgLine</propertyName> + </configuration> + </execution> + <!-- + Ensures that the code coverage report for unit tests is created after + unit tests have been run. + --> + <execution> + <id>post-unit-test</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + <configuration> + <!-- Sets the path to the file which contains the execution data. --> + <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile> + <!-- Sets the output directory for the code coverage report. --> + <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory> + </configuration> + </execution> + </executions> +</plugin> + + + </plugins> + +</build> +</project>
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/Application.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/Application.java new file mode 100644 index 0000000..f6a5355 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/Application.java @@ -0,0 +1,48 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports; + + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication +//@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}) +@EnableJpaRepositories("com.onap.sdnc.reports.repository") +@EnableAutoConfiguration +@EntityScan("com.onap.sdnc.reports.*") +public class Application { + private static final Logger logger = LogManager.getLogger(Application.class); + public static void main(String[] args) { + + SpringApplication.run(Application.class, args); + logger.info("SDNC REPORTS API Has Started.."); + } +} + + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/ServletInitializer.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/ServletInitializer.java new file mode 100644 index 0000000..45ab303 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/ServletInitializer.java @@ -0,0 +1,34 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.support.SpringBootServletInitializer; + + + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(Application.class); + } + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/config/JpaApplicationConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/config/JpaApplicationConfig.java new file mode 100644 index 0000000..cdd2916 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/config/JpaApplicationConfig.java @@ -0,0 +1,61 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.dao.support.PersistenceExceptionTranslator; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.OpenJpaDialect; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +//@Configuration +//@EnableJpaRepositories("com.onap.sdnc.reports.repository") +//@EnableTransactionManagement +public class JpaApplicationConfig { + + /*@Bean + public AbstractEntityManagerFactoryBean entityManagerFactory() + { + LocalContainerEntityManagerFactoryBean factory=new LocalContainerEntityManagerFactoryBean(); + factory.setPackagesToScan("com.onap.sdnc.reports.repository"); + //factory.setPersistenceUnitName("name"); + //factory.setPersistenceUnitName("transactions-optional"); + return factory; + } + + @Bean + public PlatformTransactionManager transactionManager() + { + JpaTransactionManager jpaTransactionManager=new JpaTransactionManager(); + jpaTransactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); + return jpaTransactionManager; + } + + @Bean + public PersistenceExceptionTranslator persistenceExceptionTranslator() + { + return new OpenJpaDialect(); + }*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/ReportController.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/ReportController.java new file mode 100644 index 0000000..0106031 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/ReportController.java @@ -0,0 +1,104 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.controller; + +import java.util.Date; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.hibernate.engine.internal.Collections; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onap.sdnc.reports.Application; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; +import com.onap.sdnc.reports.model.Response; +import com.onap.sdnc.reports.repository.DeviceRepository; +import com.onap.sdnc.reports.rest.model.PreTestModel; +import com.onap.sdnc.reports.service.IReportService; + +@RestController +public class ReportController { + + private static final Logger logger = LogManager.getLogger(ReportController.class); + + @Autowired + IReportService reportService; + + /*@RequestMapping(value = "/saveReport", method = RequestMethod.POST,consumes=MediaType.APPLICATION_JSON_VALUE) + public void saveReport(@RequestBody Report Report) { + + //repository.save(new Report(Report.getFirstName(), Report.getLastName())); + } + + @RequestMapping(value="/findAllReports/{startDate}/{endDate}",produces=MediaType.APPLICATION_JSON_VALUE) + public Response findAllReports(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate) { + + return reportService.findAllReports(startDate,endDate); + } + + // produces = "application/json" + @RequestMapping(value="/findReportByTestName/{startDate}/{endDate}/{testName}",produces=MediaType.APPLICATION_JSON_VALUE) + public Response findReportByTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("testName") String testName) { + + return reportService.findReportByTestName(startDate,endDate,testName); + }*/ + + @RequestMapping(value="/findReportByDeviceName/{startDate}/{endDate}/{deviceName}", produces = "application/json",method=RequestMethod.GET) + public List<PreTestModel> findReportByDeviceName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("deviceName") String deviceName) { + + try{ + logger.info("findReportByDeviceName Started Working.."); + logger.info("Received StartDate : "+startDate+" ,EndDate : "+endDate+" ,DeviceName : "+deviceName); + /*ObjectMapper mapper=new ObjectMapper(); + String jsonVal=""; + try { + jsonVal = mapper.writeValueAsString(reportService.findReportByDeviceName(startDate,endDate,deviceName)); + logger.info("JSON "+jsonVal); + } catch (JsonProcessingException e) { + + }*/ + logger.info("findReportByDeviceName Finished Working.."); + return reportService.findReportByDeviceName(startDate,endDate,deviceName.trim()); + } + catch(Exception ex) + { + logger.info("Exception Occured : "+ex.getLocalizedMessage()); + return java.util.Collections.EMPTY_LIST; + } + + } + + /*@RequestMapping(value="/findReportsByDeviceNamdAndTestName/{startDate}/{endDate}",produces=MediaType.APPLICATION_JSON_VALUE) + public Response findReportsByDeviceNamdAndTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("deviceName") String deviceName,@PathVariable("testName") String testName) { + + return reportService.findReportsByDeviceNamdAndTestName(startDate,endDate,deviceName,testName); + }*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/WebController.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/WebController.java new file mode 100644 index 0000000..a2311fe --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/WebController.java @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +public class WebController { + + @RequestMapping("/") + ModelAndView home(ModelAndView modelAndView) { + + modelAndView.setViewName("index"); + + return modelAndView; + } +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/IReportService.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/IReportService.java new file mode 100644 index 0000000..b4afaf6 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/IReportService.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.service; + +import java.util.Date; +import java.util.List; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; +import com.onap.sdnc.reports.model.Response; +import com.onap.sdnc.reports.rest.model.PreTestModel; + +public interface IReportService { + +/* public void saveReport(@RequestBody Report Report); + + public Response findAllReports(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate); + + + public Response findReportByTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("testName") String testName); + + public Response findReportsByDeviceNamdAndTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("deviceName") String deviceName,@PathVariable("testName") String testName); +*/ + public List<PreTestModel> findReportByDeviceName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@RequestParam("deviceName") String deviceName) throws Exception; + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/ReportServiceImpl.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/ReportServiceImpl.java new file mode 100644 index 0000000..73d040e --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/ReportServiceImpl.java @@ -0,0 +1,115 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.onap.sdnc.reports.controller.ReportController; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; +import com.onap.sdnc.reports.model.Response; +import com.onap.sdnc.reports.repository.DeviceRepository; +import com.onap.sdnc.reports.repository.PreTestConfigRepository; +import com.onap.sdnc.reports.rest.model.PreTestModel; + +@Service +public class ReportServiceImpl implements IReportService { + + private static final Logger logger = LogManager.getLogger(ReportServiceImpl.class); + + @Autowired + DeviceRepository deviceRepository; + + @Autowired + PreTestConfigRepository preTestConfigRepository; + + /*@Override + public void saveReport(Report Report) { + // TODO Auto-generated method stub + + } + + @Override + public Response findAllReports(Date startDate, Date endDate) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Response findReportByTestName(Date startDate, Date endDate, String testName) { + // TODO Auto-generated method stub + return null; + }*/ + + @Override + public List<PreTestModel> findReportByDeviceName(Date startDate, Date endDate, String deviceName) throws Exception{ + + try{ + + List<PreTestConfig> resultSet= preTestConfigRepository.findReportByDeviceName(startDate, endDate, deviceName); + logger.info("Received Output From Repository Is: "+resultSet); + + List<PreTestModel> preTestList=new ArrayList<PreTestModel>(); + for(PreTestConfig config : resultSet) + { + try{ + long deviceid=config.getDevice().getId(); + long testid=config.getTestId(); + String testName=config.getTestName(); + String deviName=config.getDevice().getDeviceName(); + String execuationDetails=config.getExecuationDetails(); + String result=config.getResult(); + Date timeStamp=config.getTimestamp(); + + PreTestModel model=new PreTestModel(testid, deviceid, testName, deviName, execuationDetails, result, timeStamp); + preTestList.add(model); + } + catch(Exception ex) + { + logger.info("Exception Occured : "+ex.getLocalizedMessage()); + } + } + logger.info("Final PreTestConfig List Size : "+preTestList.size()); + Response r=new Response("Pass", resultSet); + return preTestList; + } + catch(Exception ex) + { + logger.info("Exception Occured : "+ex.getLocalizedMessage()); + throw new Exception(ex); + } + + } + + /*@Override + public Response findReportsByDeviceNamdAndTestName(Date startDate, Date endDate, String deviceName, + String testName) { + // TODO Auto-generated method stub + return null; + }*/ + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/application.properties new file mode 100644 index 0000000..e9b1c47 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/application.properties @@ -0,0 +1,51 @@ +server.port = 9002 + +spring.jackson.serialization.fail-on-empty-beans=false + +server.tomcat.uri-encoding=utf-8 + +server.error.whitelabel.enabled=false +spring.mvc.view.prefix = /WEB-INF/views/ +spring.mvc.view.suffix = .jsp + + +spring.datasource.url=jdbc:mariadb://localhost:3307/testreports +spring.datasource.username=root +spring.datasource.password=root +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +# Keep the connection alive if idle for a long time (needed in production) +spring.datasource.testWhileIdle=true +#spring.datasource.validationQuery=SELECT 1 + + +#spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect +#spring.datasource.url=jdbc:mysql://localhost:3306/mysql?useSSL=false +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +#spring.datasource.name=mysql +#spring.jpa.database=mysql + + + + +#spring.jpa.generate-ddl=true + +spring.datasource.tomcat.max-wait=20000 +spring.datasource.tomcat.max-active=50 +spring.datasource.tomcat.max-idle=20 +spring.datasource.tomcat.min-idle=15 + +spring.jpa.show-sql=true +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm + + +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/log4j2.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/log4j2.xml new file mode 100644 index 0000000..e443b52 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/log4j2.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration status="WARN" monitorInterval="30"> + <Properties> + <Property name="LOG_PATTERN"> + %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${hostName} --- [%15.15t] %-40.40c{1.} : %m%n%ex + </Property> + </Properties> + <Appenders> + + <!-- <Console name="ConsoleAppender" target="SYSTEM_OUT" follow="true"> + <PatternLayout pattern="${LOG_PATTERN}"/> + </Console> --> + + <!-- Rolling File Appender --> + <RollingFile name="FileAppender" fileName="logs/sdnc_report_api.log" + filePattern="logs/sdnc_report_api-%d{yyyy-MM-dd}-%i.log"> + <PatternLayout> + <Pattern>${LOG_PATTERN}</Pattern> + </PatternLayout> + <Policies> + <SizeBasedTriggeringPolicy size="10MB" /> + </Policies> + <DefaultRolloverStrategy max="10"/> + </RollingFile> + + </Appenders> + + <Loggers> + <Logger name="com.onap.sdnc.reports" level="debug" additivity="false"> + <AppenderRef ref="FileAppender" /> + </Logger> + + <Root level="debug"> + <!-- <AppenderRef ref="ConsoleAppender" /> --> + <AppenderRef ref="FileAppender"/> + </Root> + </Loggers> +</Configuration>
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/ReportControllerTest.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/ReportControllerTest.java new file mode 100644 index 0000000..8b407cc --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/ReportControllerTest.java @@ -0,0 +1,107 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onap.sdnc.reports.Application; +import com.onap.sdnc.reports.controller.ReportController; +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.rest.model.PreTestModel; +import com.onap.sdnc.reports.service.IReportService; + +import static org.mockito.Mockito.when; +import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestDatabase; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; + +//@RunWith(SpringRunner.class) +//@ContextConfiguration(classes=Application.class) +//@WebMvcTest(ReportController.class) +//@Transactional +//@DataJpaTest +//@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.NONE) +public class ReportControllerTest { + +/* @Autowired + private MockMvc mvc; + + @MockBean + private IReportService reportService; + + private Date startDate,endDate; + + @Test + public void whenFindReportByDeviceName_thenReturnThis() + throws Exception { + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + calendar.add(Calendar.HOUR_OF_DAY, 00); + calendar.add(Calendar.MINUTE, 00); + calendar.add(Calendar.SECOND, 00); + calendar.add(Calendar.MILLISECOND, 00); + startDate=calendar.getTime(); + + Calendar endDateCalendar=Calendar.getInstance(); + + endDateCalendar.add(Calendar.HOUR_OF_DAY, 23); + endDateCalendar.add(Calendar.MINUTE, 59); + calendar.add(Calendar.SECOND, 00); + endDateCalendar.add(Calendar.MILLISECOND, 00); + endDate=endDateCalendar.getTime(); + + PreTestModel preTestModel=new PreTestModel(1, 1, "NetWorkTest", "Router", "Ping Got Successful", "Pass",endDate); + + List<PreTestModel> allTests = Arrays.asList(preTestModel); + + //given(reportService.findReportByDeviceName(startDate,endDate,"Router")).willReturn(allTests); + + when(reportService.findReportByDeviceName(startDate,endDate,"Router")).thenReturn(allTests); + + mvc.perform(get("/findReportByDeviceName/{startDate}/{endDate}/{deviceName",startDate,endDate,"Router") + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()); + }*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/repository/PreTestConfigRepositoryTest.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/repository/PreTestConfigRepositoryTest.java new file mode 100644 index 0000000..e70b04b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/repository/PreTestConfigRepositoryTest.java @@ -0,0 +1,145 @@ +package com.onap.sdnc.reports.repository; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.transaction.Transactional; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.onap.sdnc.reports.Application; +//import com.onap.sdnc.reports.model.DeviceConfig; +//import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +//@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.NONE) +@DataJpaTest +@Transactional +public class PreTestConfigRepositoryTest { + + private static final Logger logger = LogManager.getLogger(Application.class); + + @Autowired + private PreTestConfigRepository preTestRepository; + + @Autowired + private TestEntityManager entityManager; + + + @Test + public void whenFindByDeviceName_thenReturnRouter() { + // given + + + DeviceConfig deviceConfig=new DeviceConfig(); + //deviceConfig.setId(3); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + entityManager.persist(deviceConfig); + entityManager.flush(); + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + //obj.setTestId(8); + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + Set<PreTestConfig> set=new HashSet<>(); + set.add(obj); + deviceConfig.setPreTestConfig( set); + entityManager.persistAndFlush(deviceConfig); + + entityManager.persist(obj); + entityManager.flush(); + + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + Date startDate=calendar.getTime(); + Date endDate=new Date(); + // when + List<PreTestConfig> preTestList = preTestRepository.findReportByDeviceName(startDate,endDate,"Router"); + + assertThat(preTestList.get(0).getTestId()) + .isEqualTo(obj.getTestId()); + + System.out.println("Status : "+(preTestList.get(0).getTestId()==obj.getTestId())); + } + + /*@Test + public void whenFindByDeviceName_thenReturnRouter() { + // given + + PreTestConfigRepository preTestRepository= mock(PreTestConfigRepository.class); + DeviceConfig deviceConfig=new DeviceConfig(); + //deviceConfig.setId(3); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + //obj.setTestId(8); + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + Set<PreTestConfig> set=new HashSet<>(); + set.add(obj); + deviceConfig.setPreTestConfig( set); + + List<PreTestConfig> dummyInput=new ArrayList<>(); + dummyInput.add(obj); + + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + Date startDate=calendar.getTime(); + Date endDate=new Date(); + // when + + when(preTestRepository.findReportByDeviceName(startDate,endDate,"Router")).thenReturn(dummyInput); + + List<PreTestConfig> preTestList = preTestRepository.findReportByDeviceName(startDate,endDate,"Router"); + + assertThat(preTestList.get(0).getTestId()) + .isEqualTo(obj.getTestId()); + + logger.info("Status : "+(preTestList.get(0).getTestId()==obj.getTestId())); + }*/ + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/service/ReportServiceImplTest.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/service/ReportServiceImplTest.java new file mode 100644 index 0000000..b688f58 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/service/ReportServiceImplTest.java @@ -0,0 +1,204 @@ +package com.onap.sdnc.reports.service; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Bean; +import org.springframework.test.context.junit4.SpringRunner; + +import com.onap.sdnc.reports.Application; +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.repository.PreTestConfigRepository; +import com.onap.sdnc.reports.rest.model.PreTestModel; + +import org.mockito.InjectMocks; +import org.mockito.Mock; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@DataJpaTest +@Transactional +public class ReportServiceImplTest { + + private static final Logger logger = LogManager.getLogger(Application.class); + + private Date startDate,endDate; + +/* @TestConfiguration + static class ReportServiceImplTestContextConfiguration + { + @Bean + public IReportService reportService() + { + return new ReportServiceImpl(); + } + } + + @Autowired + private IReportService reportService; + + @MockBean + private PreTestConfigRepository preTestConfigRepository; + + @Before + public void setUp() + { + DeviceConfig deviceConfig=new DeviceConfig(); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + calendar.add(Calendar.HOUR_OF_DAY, 00); + calendar.add(Calendar.MINUTE, 00); + calendar.add(Calendar.SECOND, 00); + calendar.add(Calendar.MILLISECOND, 00); + startDate=calendar.getTime(); + + Calendar endDateCalendar=Calendar.getInstance(); + + endDateCalendar.add(Calendar.HOUR_OF_DAY, 23); + endDateCalendar.add(Calendar.MINUTE, 59); + calendar.add(Calendar.SECOND, 00); + endDateCalendar.add(Calendar.MILLISECOND, 00); + endDate=endDateCalendar.getTime(); + + System.out.println("Before Call : startDate "+startDate.toLocaleString() +" endDate : "+endDate.toLocaleString()); + List<PreTestConfig> configList=new ArrayList<>(); + configList.add(obj); + Mockito.when(preTestConfigRepository.findReportByDeviceName(startDate,endDate,"Router")) + .thenReturn(configList); + } + + + @Test + public void whenFindByDeviceName_thenReturPreTest() + { + int expectedTestId=0; + System.out.println("Test Call : startDate "+startDate.toLocaleString() +" endDate : "+endDate.toLocaleString()); + + List<PreTestModel> testList; + try { + testList = reportService.findReportByDeviceName(startDate,endDate,"Router"); + assertThat(testList.get(0).getTestid()) + .isEqualTo(expectedTestId); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + } + */ + /* @InjectMocks + private IReportService reportService; + + @Mock + private PreTestConfigRepository preTestConfigRepository;*/ + + List<PreTestConfig> configList; + + List<PreTestModel> dummyList; + @Before + public void setUp() + { + DeviceConfig deviceConfig=new DeviceConfig(); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + PreTestModel model=new PreTestModel(1, 1, "Protocol Layer", "Router", "{\"output\": {\"testresult\": \"pass\", \"status\": \"unreachable\"}}", "Pass", new Date()); + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + calendar.add(Calendar.HOUR_OF_DAY, 00); + calendar.add(Calendar.MINUTE, 00); + calendar.add(Calendar.SECOND, 00); + calendar.add(Calendar.MILLISECOND, 00); + startDate=calendar.getTime(); + + Calendar endDateCalendar=Calendar.getInstance(); + + endDateCalendar.add(Calendar.HOUR_OF_DAY, 23); + endDateCalendar.add(Calendar.MINUTE, 59); + calendar.add(Calendar.SECOND, 00); + endDateCalendar.add(Calendar.MILLISECOND, 00); + endDate=endDateCalendar.getTime(); + + System.out.println("Before Call : startDate "+startDate.toLocaleString() +" endDate : "+endDate.toLocaleString()); + configList=new ArrayList<>(); + configList.add(obj); + + dummyList=new ArrayList<>(); + dummyList.add(model); + + } + + @Test + public void whenFindByDeviceName_thenReturPreTest() + { + IReportService reportService= mock(IReportService.class); + try { + when(reportService.findReportByDeviceName(startDate,endDate,"Router")).thenReturn(dummyList); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + int expectedTestId=1; + + List<PreTestModel> testList; + try { + testList = reportService.findReportByDeviceName(startDate,endDate,"Router"); + assertThat(testList.get(0).getTestid()) + .isEqualTo(expectedTestId); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/resources/application.properties new file mode 100644 index 0000000..b48a921 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/resources/application.properties @@ -0,0 +1,56 @@ +#server.port = 9001 + + + +# H2 DB Details +spring.jpa.hibernate.ddl-auto = create-drop +spring.jpa.database = HSQL +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect +spring.datasource.driverClassName = org.hsqldb.jdbcDriver +spring.datasource.url: jdbc:hsqldb:mem:scratchdb +spring.datasource.username =sa +spring.datasource.password =sa + + +# maria db details + +#spring.jackson.serialization.fail-on-empty-beans=false +#server.tomcat.uri-encoding=utf-8 +#spring.datasource.continue-on-error=true +#server.error.whitelabel.enabled=false +#spring.mvc.view.prefix = /WEB-INF/views/ +#spring.mvc.view.suffix = .jsp + +#spring.datasource.url=jdbc:mysql://localhost:3306/dummyreports?useSSL=false +#spring.datasource.url=jdbc:mariadb://localhost:3307/dummyReports +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +#spring.datasource.name=mysql +#spring.jpa.database=mysql + +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +#spring.datasource.username=root +#spring.datasource.password=root +#spring.jpa.generate-ddl=true + +spring.datasource.tomcat.max-wait=20000 +spring.datasource.tomcat.max-active=50 +spring.datasource.tomcat.max-idle=20 +spring.datasource.tomcat.min-idle=15 + +spring.jpa.show-sql=true + + + +# mysql db Details + +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.classpath b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.classpath new file mode 100644 index 0000000..01a9d42 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.classpath @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="var" path="M2_REPO/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/4.3.9.RELEASE/spring-context-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/4.3.9.RELEASE/spring-aop-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/4.3.9.RELEASE/spring-beans-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/4.3.9.RELEASE/spring-core-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-expression/4.3.9.RELEASE/spring-expression-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-test/1.5.3.RELEASE/spring-boot-starter-test-1.5.3.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-test/1.5.4.RELEASE/spring-boot-test-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot/1.5.4.RELEASE/spring-boot-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-test-autoconfigure/1.5.4.RELEASE/spring-boot-test-autoconfigure-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/1.5.4.RELEASE/spring-boot-autoconfigure-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/com/jayway/jsonpath/json-path/2.2.0/json-path-2.2.0.jar"/> + <classpathentry kind="var" path="M2_REPO/net/minidev/json-smart/2.2.1/json-smart-2.2.1.jar"/> + <classpathentry kind="var" path="M2_REPO/net/minidev/accessors-smart/1.1/accessors-smart-1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar"/> + <classpathentry kind="var" path="M2_REPO/junit/junit/4.12/junit-4.12.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/> + <classpathentry kind="var" path="M2_REPO/org/assertj/assertj-core/2.6.0/assertj-core-2.6.0.jar"/> + <classpathentry kind="var" path="M2_REPO/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar"/> + <classpathentry kind="var" path="M2_REPO/org/objenesis/objenesis/2.1/objenesis-2.1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar"/> + <classpathentry kind="var" path="M2_REPO/org/skyscreamer/jsonassert/1.4.0/jsonassert-1.4.0.jar"/> + <classpathentry kind="var" path="M2_REPO/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-test/4.3.9.RELEASE/spring-test-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-data-jpa/1.5.4.RELEASE/spring-boot-starter-data-jpa-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter/1.5.4.RELEASE/spring-boot-starter-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-logging/1.5.4.RELEASE/spring-boot-starter-logging-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar"/> + <classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-core/1.1.11/logback-core-1.1.11.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar"/> + <classpathentry kind="var" path="M2_REPO/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-aop/1.5.4.RELEASE/spring-boot-starter-aop-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/aspectj/aspectjweaver/1.8.10/aspectjweaver-1.8.10.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-jdbc/1.5.4.RELEASE/spring-boot-starter-jdbc-1.5.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/tomcat-jdbc/8.5.15/tomcat-jdbc-8.5.15.jar"/> + <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/tomcat-juli/8.5.15/tomcat-juli-8.5.15.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-jdbc/4.3.9.RELEASE/spring-jdbc-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-tx/4.3.9.RELEASE/spring-tx-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/5.0.12.Final/hibernate-core-5.0.12.Final.jar"/> + <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging/3.3.1.Final/jboss-logging-3.3.1.Final.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar"/> + <classpathentry kind="var" path="M2_REPO/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar"/> + <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/> + <classpathentry kind="var" path="M2_REPO/org/jboss/jandex/2.0.0.Final/jandex-2.0.0.Final.jar"/> + <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/common/hibernate-commons-annotations/5.0.1.Final/hibernate-commons-annotations-5.0.1.Final.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/data/spring-data-jpa/1.11.4.RELEASE/spring-data-jpa-1.11.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/data/spring-data-commons/1.13.4.RELEASE/spring-data-commons-1.13.4.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-orm/4.3.9.RELEASE/spring-orm-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-aspects/4.3.9.RELEASE/spring-aspects-4.3.9.RELEASE.jar"/> + <classpathentry kind="var" path="M2_REPO/mysql/mysql-connector-java/5.1.42/mysql-connector-java-5.1.42.jar"/> + <classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar"/> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.project b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.project new file mode 100644 index 0000000..95fb91b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.project @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>sdnc_reports_dao</name> + <comment>Parent pom providing dependency and plugin management for applications + built with Maven. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment> + <projects/> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + </buildCommand> + <buildCommand> + <name>org.springframework.ide.eclipse.core.springbuilder</name> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + </buildCommand> + </buildSpec> + <natures> + <nature>org.springframework.ide.eclipse.core.springnature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + </natures> +</projectDescription>
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.core.resources.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.jdt.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..5ce4518 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.m2e.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.wst.common.project.facet.core.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..d858295 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="cloudfoundry.standalone.app" version="1.0"/> +</faceted-project> diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/pom.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/pom.xml new file mode 100644 index 0000000..0134b37 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/pom.xml @@ -0,0 +1,66 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>sdnc_reports_dao</artifactId> + <packaging>jar</packaging> + + <parent> + <groupId>com.sdnc.reports</groupId> + <artifactId>sdnc_reports</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + <version>1.5.3.RELEASE</version> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + <exclusions> + <exclusion> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-entitymanager</artifactId> + </exclusion> + </exclusions> + + </dependency> + + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <scope>runtime</scope> + </dependency> + + <!-- <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + <scope>provided</scope> + </dependency> --> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </dependency> + + <!-- <dependency> + <groupId>org.hibernate.javax.persistence</groupId> + <artifactId>hibernate-jpa-2.0-api</artifactId> + <version>1.0.1.Final</version> + </dependency> --> + <dependency> + <groupId>org.mariadb.jdbc</groupId> + <artifactId>mariadb-java-client</artifactId> + <version>1.1.7</version> +</dependency> + </dependencies> +</project>
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java new file mode 100644 index 0000000..2979de3 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java @@ -0,0 +1,109 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.model; + +import java.io.Serializable; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +//@Table(name = "deviceconfig",schema="testreports") +@Table(name = "deviceconfig") +public class DeviceConfig implements Serializable +{ + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "deviceid") + private long id; + + @Column(name = "devicename") + private String deviceName; + + @Column(name = "createdon") + private String createdon; + + @OneToMany(mappedBy="device") + private Set<ProtocolConfig> protocolConfig; + + @OneToMany(mappedBy="device") + private Set<PreTestConfig> preTestConfig; + + public DeviceConfig() { + // TODO Auto-generated constructor stub + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getCreationDate() { + return createdon; + } + + public void setCreationDate(String creationDate) { + this.createdon = creationDate; + } + + public Set<ProtocolConfig> getProtocolConfig() { + return protocolConfig; + } + + public void setProtocolConfig(Set<ProtocolConfig> protocolConfig) { + this.protocolConfig = protocolConfig; + } + + public Set<PreTestConfig> getPreTestConfig() { + return preTestConfig; + } + + public void setPreTestConfig(Set<PreTestConfig> preTestConfig) { + this.preTestConfig = preTestConfig; + } + + @Override + public String toString() { + return "DeviceConfig [id=" + id + ", deviceName=" + deviceName + ", createdon=" + createdon + + "]"; + } + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java new file mode 100644 index 0000000..fe9ee2a --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java @@ -0,0 +1,127 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.model; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +//@Table(name = "pretestconfig",schema="testreports") +@Table(name = "pretestconfig") +public class PreTestConfig implements Serializable{ + + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "testid") + private long testId ; + + @Column(name = "testname") + private String testName; + + + @Column(name = "result") + private String result; + + @Column(name = "execuationdetails") + private String execuationDetails; + + @Column(name = "timestamp") + @Temporal(TemporalType.DATE) + private Date timestamp; + + @ManyToOne + @JoinColumn(name="deviceid",nullable=false) + private DeviceConfig device; + + public PreTestConfig() + { + // TODO Auto-generated constructor stub + } + + public long getTestId() { + return testId; + } + + public void setTestId(long testId) { + this.testId = testId; + } + + public String getTestName() { + return testName; + } + + public void setTestName(String testName) { + this.testName = testName; + } + + public DeviceConfig getDevice() { + return device; + } + + public void setDevice(DeviceConfig device) { + this.device = device; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public String getExecuationDetails() { + return execuationDetails; + } + + public void setExecuationDetails(String execuationDetails) { + this.execuationDetails = execuationDetails; + } + + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + @Override + public String toString() { + return "PreTestConfig [testId=" + testId + ", testName=" + testName + ", result=" + result + + ", execuationDetails=" + execuationDetails + ", timestamp=" + timestamp + ", device=" + device + "]"; + } + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/ProtocolConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/ProtocolConfig.java new file mode 100644 index 0000000..3ad2fbf --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/ProtocolConfig.java @@ -0,0 +1,198 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.model; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "protocolconfig",schema="testreports") +public class ProtocolConfig implements Serializable{ + + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "protocolid") + private long protocolId; + + @Column(name = "protocolname") + private String protocolname; + + @Column(name = "process_id") + private String process_id; + + @Column(name = "networks") + private String networks; + + @Column(name = "as_number") + private String as_number; + + @Column(name = "neighbors") + private String neighbors; + + @Column(name = "cos_entry_number") + private String cos_entry_number; + + @Column(name = "destination_address") + private String destination_address; + + @Column(name = "source_address") + private String source_address; + + @Column(name = "customer_name") + private String customer_name; + + @Column(name = "version") + private String version; + + //@Column(name = "creationDate") + //private String creationDate; + + @ManyToOne + @JoinColumn(name="deviceid",nullable=false) + private DeviceConfig device; + + public ProtocolConfig() { + // TODO Auto-generated constructor stub + } + + public long getProtocolId() { + return protocolId; + } + + public void setProtocolId(long protocolId) { + this.protocolId = protocolId; + } + + public String getProtocolName() { + return protocolname; + } + + public void setProtocolName(String protocolName) { + this.protocolname = protocolName; + } + + public String getProcess_id() { + return process_id; + } + + public void setProcess_id(String process_id) { + this.process_id = process_id; + } + + public String getNetworks() { + return networks; + } + + public void setNetworks(String networks) { + this.networks = networks; + } + + public String getAs_number() { + return as_number; + } + + public void setAs_number(String as_number) { + this.as_number = as_number; + } + + public String getNeighbors() { + return neighbors; + } + + public void setNeighbors(String neighbors) { + this.neighbors = neighbors; + } + + public String getCos_entry_number() { + return cos_entry_number; + } + + public void setCos_entry_number(String cos_entry_number) { + this.cos_entry_number = cos_entry_number; + } + + public String getDestination_address() { + return destination_address; + } + + public void setDestination_address(String destination_address) { + this.destination_address = destination_address; + } + + public String getSource_address() { + return source_address; + } + + public void setSource_address(String source_address) { + this.source_address = source_address; + } + + public String getCustomer_name() { + return customer_name; + } + + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /*public String getCreationDate() { + return creationDate; + } + + public void setCreationDate(String creationDate) { + this.creationDate = creationDate; + }*/ + + public DeviceConfig getDevice() { + return device; + } + + public void setDevice(DeviceConfig device) { + this.device = device; + } + + /*@Override + public String toString() { + return "ProtocolConfig [protocolId=" + protocolId + ", protocolname=" + protocolname + ", process_id=" + + process_id + ", networks=" + networks + ", as_number=" + as_number + ", neighbors=" + neighbors + + ", cos_entry_number=" + cos_entry_number + ", destination_address=" + destination_address + + ", source_address=" + source_address + ", customer_name=" + customer_name + ", version=" + version + + ", device=" + device + "]"; + }*/ + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Report.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Report.java new file mode 100644 index 0000000..53373b3 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Report.java @@ -0,0 +1,94 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.model; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + + +//@Entity +//@Table(name = "report") +public class Report implements Serializable { +/* + + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + @Column(name = "router_name") + private String router_name; + + protected Report() { + } + + List<RouterConfigDetails> routerConfigDetailsObj; + + + + public long getRouter_id() { + return id; + } + + + + public void setRouter_id(long router_id) { + this.id = router_id; + } + + + + public String getRouter_name() { + return router_name; + } + + + + public void setRouter_name(String router_name) { + this.router_name = router_name; + } + + + + public List<RouterConfigDetails> getRouterConfigDetailsObj() { + return routerConfigDetailsObj; + } + + + + public void setRouterConfigDetailsObj(List<RouterConfigDetails> routerConfigDetailsObj) { + this.routerConfigDetailsObj = routerConfigDetailsObj; + } + + + @Override + public String toString() { + return "Router [router_id=" + id + ", router_name=" + router_name+"]"; + } + + +*/} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Response.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Response.java new file mode 100644 index 0000000..3203931 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Response.java @@ -0,0 +1,50 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.model; + +public class Response { + private String status; + private Object data; + + public Response() { + + } + + public Response(String status, Object data) { + this.status = status; + this.data = data; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/RouterConfigDetails.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/RouterConfigDetails.java new file mode 100644 index 0000000..96bf38b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/RouterConfigDetails.java @@ -0,0 +1,281 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.springframework.data.annotation.Id; + +import com.onap.sdnc.reports.rest.model.ConfigDetailsRestModel; +import com.onap.sdnc.reports.rest.model.ProtocolModel; + +public class RouterConfigDetails implements Comparable<RouterConfigDetails>{ + + @Override + public int compareTo(RouterConfigDetails o) { + // TODO Auto-generated method stub + return 0; + } + +/* + @Id + String router_config_details_id; + + Date date; + String version_id; + String protocol; + String cos_entry_number; + String destination_address; + String source_address; + String customer_name; + + String process_id; + String subnet_ip; + String area_id; + String as_number; + String router_id; + String peer_ip; + + HashMap<String, String> neighbors; + HashMap<String, String> networks; + + List<Object> networkList; + + public static List<ConfigDetailsRestModel> fromEntityToModel(List<RouterConfigDetails> entityList) { + List<ConfigDetailsRestModel> modelList= new ArrayList<ConfigDetailsRestModel>(); + ConfigDetailsRestModel configmodel= new ConfigDetailsRestModel(); + List<ProtocolModel> protocolmodelList= new ArrayList<ProtocolModel>(); + + for (RouterConfigDetails entity : entityList) { + ProtocolModel model = new ProtocolModel(); + // + model.setDate(entity.getDate().toString()); + if ("ipsla".equals(entity.getProtocol())) { + model.setVersion_id(entity.getVersion_id()); + model.setProtocol_name(entity.getProtocol()); + model.setCos_entry_number(entity.getCos_entry_number()); + model.setCustomer_name(entity.getCustomer_name()); + model.setDestination_address(entity.getDestination_address()); + model.setSource_address(entity.getSource_address()); + // routerConfigDetails.setRouter_config_details_id(String.valueOf(seqDao.getRouterConfigDetailsNextSequenceId(ROUTER_CONFIG_VERSION))); + protocolmodelList.add(model); + } + if ("bgp".equals(entity.getProtocol())) { + model.setVersion_id(entity.getVersion_id()); + model.setProtocol_name(entity.getProtocol()); + HashMap<String, String> neighbor = entity.getNeighbors(); + HashMap<String, String> neighbormap = new HashMap<String, String>(); + model.setAs_number(entity.getAs_number()); + model.setRouter_id(entity.getRouter_id()); + + String as_number = neighbor.get("as_number").toString(); + String peer_ip = neighbor.get("peer_ip").toString(); + + neighbormap.put("as_number", as_number); + neighbormap.put("peer_ip", peer_ip); + + model.setNeighbors(neighbormap); + protocolmodelList.add(model); + } + if ("ospf".equals(entity.getProtocol())) { + model.setVersion_id(entity.getVersion_id()); + model.setProtocol_name(entity.getProtocol()); + HashMap<String, String> networks = entity.getNetworks(); + HashMap<String, String> networksmap = new HashMap<String, String>(); + String network_subnet_ip = networks.get("subnet_ip").toString(); + String network_area_id = networks.get("area_id").toString(); + + + networksmap.put("subnet_ip", network_subnet_ip); + networksmap.put("area_id", network_subnet_ip); + + model.setNetworks(networksmap); + model.setProcess_id(entity.getProcess_id()); + protocolmodelList.add(model); + } + } + configmodel.setProtocol(protocolmodelList); + modelList.add(configmodel); + return modelList; + } + + public String getRouter_config_details_id() { + return router_config_details_id; + } + + public void setRouter_config_details_id(String router_config_details_id) { + this.router_config_details_id = router_config_details_id; + } + + public String getCos_entry_number() { + return cos_entry_number; + } + + public void setCos_entry_number(String cos_entry_number) { + this.cos_entry_number = cos_entry_number; + } + + public String getDestination_address() { + return destination_address; + } + + public void setDestination_address(String destination_address) { + this.destination_address = destination_address; + } + + public String getSource_address() { + return source_address; + } + + public void setSource_address(String source_address) { + this.source_address = source_address; + } + + public String getCustomer_name() { + return customer_name; + } + + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + + * public String getVersion() { return version; } + * + * public void setVersion(String version) { this.version = version; } + + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getProcess_id() { + return process_id; + } + + public void setProcess_id(String process_id) { + this.process_id = process_id; + } + + public String getSubnet_ip() { + return subnet_ip; + } + + public void setSubnet_ip(String subnet_ip) { + this.subnet_ip = subnet_ip; + } + + public String getArea_id() { + return area_id; + } + + public void setArea_id(String area_id) { + this.area_id = area_id; + } + + public String getAs_number() { + return as_number; + } + + public void setAs_number(String as_number) { + this.as_number = as_number; + } + + public String getRouter_id() { + return router_id; + } + + public void setRouter_id(String router_id) { + this.router_id = router_id; + } + + public String getPeer_ip() { + return peer_ip; + } + + public void setPeer_ip(String peer_ip) { + this.peer_ip = peer_ip; + } + + public HashMap<String, String> getNeighbors() { + return neighbors; + } + + public void setNeighbors(HashMap<String, String> neighbormap) { + this.neighbors = neighbormap; + } + + public HashMap<String, String> getNetworks() { + return networks; + } + + public void setNetworks(HashMap<String, String> networks) { + this.networks = networks; + } + + public List<Object> getNetworkList() { + return networkList; + } + + public void setNetworkList(List<Object> networkList) { + this.networkList = networkList; + } + + @Override + public String toString() { + return "RouterConfigDetails [router_config_details_id=" + router_config_details_id + ",date=" + date + + ",protocol=" + protocol + ", cos_entry_number=" + cos_entry_number + ", destination_address=" + + destination_address + ", source_address=" + source_address + ", customer_name=" + customer_name + "]"; + } + + //@Override + public int compareTo(RouterConfigDetails o) { + if (this.date.before(o.getDate())) + return 1; + else if (this.date.equals(o.getDate())) + return 0; + else + return -1; + } + + public String getVersion_id() { + return version_id; + } + + public void setVersion_id(String version_id) { + this.version_id = version_id; + } +*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java new file mode 100644 index 0000000..3864a35 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java @@ -0,0 +1,31 @@ + +package com.onap.sdnc.reports.repository; + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; + +@Repository +public interface DeviceRepository extends JpaRepository<DeviceConfig, Long> { +//public interface DeviceRepository extends CrudRepository<DeviceConfig, Long> { + //List<Report> findByLastName(String lastName); + /*@Query(value= "from DeviceConfig where deviceName = :deviceName" ) + DeviceConfig findDeviceName(@Param("deviceName") String deviceName); + + @Modifying + @Query(value = "insert into DeviceConfig (deviceName,createdOn) VALUES (:deviceName,:createdOn)", nativeQuery = true) + @Transactional + void logDeviceName(@Param("deviceName") String deviceName, @Param("createdOn") String createdOn);*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java new file mode 100644 index 0000000..e399bfd --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java @@ -0,0 +1,34 @@ + +package com.onap.sdnc.reports.repository; + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.onap.sdnc.reports.model.PreTestConfig; + +@Repository +public interface PreTestConfigRepository extends JpaRepository<PreTestConfig, Long> { + + /*@Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate" ) + List<PreTestConfig> findPreTestConfigByTimeStamp(@Param("startDate") Date startDate, @Param("endDate")Date endDate); + + + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and testName = :testName" ) + List<PreTestConfig> findReportByTestName(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("testName")String testName); + */ + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and device.deviceName = :deviceName" ) + List<PreTestConfig> findReportByDeviceName(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("deviceName")String deviceName); + + @Modifying + @Query(value = "insert into PreTestConfig (testName,result,execuationDetails,timestamp,deviceId) VALUES (:testName,:result,:execuationDetails,:timestamp,:deviceId)", nativeQuery = true) + @Transactional + void logPreTestReport(@Param("testName") String testName,@Param("result") String result, @Param("execuationDetails") String execuationDetails,@Param("timestamp") String timestamp,@Param("deviceId") long deviceId); +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java new file mode 100644 index 0000000..5794459 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java @@ -0,0 +1,73 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.rest.model; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ConfigDetailsRestModel { + + @JsonProperty(value = JSONTags.TAG_ROUTER) + String router; + + @JsonProperty(value = JSONTags.TAG_DATE) + String date; + + List<ProtocolModel> protocol; + + + public ConfigDetailsRestModel() { + super(); + } + + + public String getRouter() { + return router; + } + + + public void setRouter(String router) { + this.router = router; + } + + + public String getDate() { + return date; + } + + + public void setDate(String date) { + this.date = date; + } + + + public List<ProtocolModel> getProtocol() { + return protocol; + } + + + public void setProtocol(List<ProtocolModel> protocol) { + this.protocol = protocol; + } + + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java new file mode 100644 index 0000000..90ff570 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java @@ -0,0 +1,56 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.rest.model; + +public class JSONTags { + + public static final String TAG_REQUEST_FNAME = "first_name"; + public static final String TAG_REQUEST_MNAME = "middle_name"; + public static final String TAG_STATUS_SUCCESS = "success"; + public static final String TAG_RESPONSE_STATUS = "status"; + public static final String TAG_REQUEST_FROM = "request_from"; + public static final String TAG_REQUEST_ID = "request_id"; + public static final String TAG_RESPONSE_DETAIL = "response_detail"; + public static final String TAG_RESPONSE_BODY = "response_body"; + public static final String TAG_REQUEST_BODY = "request_body"; + public static final String TAG_RESPONSE_MESSAGE = "request"; + public static final String TAG_ERROR_CODE = "error_code"; + public static final String TAG_ERROR_CODE_SUCCESS = "100"; + + + public static final String TAG_ROUTER = "router"; + public static final String TAG_IPSLA = "ipsla"; + public static final String TAG_OSPF = "ospf"; + public static final String TAG_DATE = "date"; + public static final String TAG_COS_ENTRY_NUMBER = "cos-entry-number"; + public static final String TAG_DESTINATION_ADDRESS = "destination-address"; + public static final String TAG_SOURCE_ADDRESS = "source-address"; + public static final String TAG_CUSTOMER_NAME = "customer-name"; + public static final String TAG_PROTOCOL_NAME = "protocol-name"; + + + public static final String TAG_AS_NUMBER = "as-number"; + public static final String TAG_ROUTER_ID = "router-id"; + public static final String TAG_PEER_IP = "peer-ip"; + + public static final String TAG_PROCESS_ID = "process-id"; + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java new file mode 100644 index 0000000..4f73e02 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java @@ -0,0 +1,116 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.rest.model; + +import java.io.Serializable; +import java.util.Date; + +public class PreTestModel implements Serializable{ + + private static final long serialVersionUID = -3009157732242241606L; + + private long testid; + + private long deviceid; + + private String testName; + + private String deviceName,execuationDetails,result; + + private Date timeStamp; + + public PreTestModel(long testid, long deviceid, String testName, String deviceName, String execuationDetails, + String result, Date timeStamp) { + super(); + this.testid = testid; + this.deviceid = deviceid; + this.testName = testName; + this.deviceName = deviceName; + this.execuationDetails = execuationDetails; + this.result = result; + this.timeStamp = timeStamp; + } + + @Override + public String toString() { + return "PreTestModel [testid=" + testid + ", deviceid=" + deviceid + ", testName=" + testName + ", deviceName=" + + deviceName + ", execuationDetails=" + execuationDetails + ", result=" + result + ", timeStamp=" + + timeStamp + "]"; + } + + public long getTestid() { + return testid; + } + + public void setTestid(long testid) { + this.testid = testid; + } + + public long getDeviceid() { + return deviceid; + } + + public void setDeviceid(long deviceid) { + this.deviceid = deviceid; + } + + public String getTestName() { + return testName; + } + + public void setTestName(String testName) { + this.testName = testName; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getExecuationDetails() { + return execuationDetails; + } + + public void setExecuationDetails(String execuationDetails) { + this.execuationDetails = execuationDetails; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public Date getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(Date timeStamp) { + this.timeStamp = timeStamp; + } + + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ProtocolModel.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ProtocolModel.java new file mode 100644 index 0000000..d90584d --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ProtocolModel.java @@ -0,0 +1,207 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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 com.onap.sdnc.reports.rest.model; + +import java.util.HashMap; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ProtocolModel { + + + + @JsonProperty(value = JSONTags.TAG_COS_ENTRY_NUMBER) + String cos_entry_number; + @JsonProperty(value = JSONTags.TAG_DESTINATION_ADDRESS) + String destination_address; + @JsonProperty(value = JSONTags.TAG_SOURCE_ADDRESS) + String source_address; + @JsonProperty(value = JSONTags.TAG_CUSTOMER_NAME) + String customer_name; + + + String date; + + String version_id; + + String protocol_name; + + // added by bhawna + + String process_id; + String subnet_ip; + String area_id; + @JsonProperty(value = JSONTags.TAG_AS_NUMBER) + String as_number; + @JsonProperty(value = JSONTags.TAG_ROUTER_ID) + String router_id; + @JsonProperty(value = JSONTags.TAG_PEER_IP) + String peer_ip; + + HashMap<String, String> neighbors; + HashMap<String, String> networks; + + List<Object> networkList; + + public ProtocolModel() { + super(); + } + + /* + * @Override public String toString() { return + * "RouterConfigDetailsRestModel [cos_entry_number=" + cos_entry_number + + * ", destination_address=" + destination_address + ", source_address=" + + * source_address + ", customer_name=" + customer_name + "]"; } + */ + public String getProtocol_name() { + return protocol_name; + } + + + public void setProtocol_name(String protocol_name) { + this.protocol_name = protocol_name; + } + + public String getCos_entry_number() { + return cos_entry_number; + } + + public void setCos_entry_number(String cos_entry_number) { + this.cos_entry_number = cos_entry_number; + } + + public String getDestination_address() { + return destination_address; + } + + public void setDestination_address(String destination_address) { + this.destination_address = destination_address; + } + + public String getSource_address() { + return source_address; + } + + public void setSource_address(String source_address) { + this.source_address = source_address; + } + + public String getCustomer_name() { + return customer_name; + } + + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + + + public String getProcess_id() { + return process_id; + } + + public void setProcess_id(String process_id) { + this.process_id = process_id; + } + + public String getSubnet_ip() { + return subnet_ip; + } + + public void setSubnet_ip(String subnet_ip) { + this.subnet_ip = subnet_ip; + } + + public String getArea_id() { + return area_id; + } + + public void setArea_id(String area_id) { + this.area_id = area_id; + } + + public String getAs_number() { + return as_number; + } + + public void setAs_number(String as_number) { + this.as_number = as_number; + } + + public String getRouter_id() { + return router_id; + } + + public void setRouter_id(String router_id) { + this.router_id = router_id; + } + + public String getPeer_ip() { + return peer_ip; + } + + public void setPeer_ip(String peer_ip) { + this.peer_ip = peer_ip; + } + + public HashMap<String, String> getNeighbors() { + return neighbors; + } + + public void setNeighbors(HashMap<String, String> neighbors) { + this.neighbors = neighbors; + } + + public HashMap<String, String> getNetworks() { + return networks; + } + + public void setNetworks(HashMap<String, String> networks) { + this.networks = networks; + } + + public List<Object> getNetworkList() { + return networkList; + } + + public void setNetworkList(List<Object> networkList) { + this.networkList = networkList; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getVersion_id() { + return version_id; + } + + public void setVersion_id(String version_id) { + this.version_id = version_id; + } + + + +} + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/resources/application.properties new file mode 100644 index 0000000..e79c8b2 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/resources/application.properties @@ -0,0 +1,29 @@ +#spring.datasource.url=jdbc:mysql://localhost:3306/mysql?useSSL=false +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.datasource.name=mysql +#spring.jpa.database=mysql +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +spring.jpa.generate-ddl=true +spring.datasource.url=jdbc:mariadb://localhost:3306/testreports +spring.datasource.username=root +spring.datasource.password=root +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +# Keep the connection alive if idle for a long time (needed in production) +spring.datasource.testWhileIdle=true + +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm + +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true +#spring.jpa.hibernate.ddl-auto=create + + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE + +# Naming strategy +#spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/test/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/test/resources/application.properties new file mode 100644 index 0000000..b48a921 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/test/resources/application.properties @@ -0,0 +1,56 @@ +#server.port = 9001 + + + +# H2 DB Details +spring.jpa.hibernate.ddl-auto = create-drop +spring.jpa.database = HSQL +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect +spring.datasource.driverClassName = org.hsqldb.jdbcDriver +spring.datasource.url: jdbc:hsqldb:mem:scratchdb +spring.datasource.username =sa +spring.datasource.password =sa + + +# maria db details + +#spring.jackson.serialization.fail-on-empty-beans=false +#server.tomcat.uri-encoding=utf-8 +#spring.datasource.continue-on-error=true +#server.error.whitelabel.enabled=false +#spring.mvc.view.prefix = /WEB-INF/views/ +#spring.mvc.view.suffix = .jsp + +#spring.datasource.url=jdbc:mysql://localhost:3306/dummyreports?useSSL=false +#spring.datasource.url=jdbc:mariadb://localhost:3307/dummyReports +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +#spring.datasource.name=mysql +#spring.jpa.database=mysql + +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +#spring.datasource.username=root +#spring.datasource.password=root +#spring.jpa.generate-ddl=true + +spring.datasource.tomcat.max-wait=20000 +spring.datasource.tomcat.max-active=50 +spring.datasource.tomcat.max-idle=20 +spring.datasource.tomcat.min-idle=15 + +spring.jpa.show-sql=true + + + +# mysql db Details + +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
\ No newline at end of file |