diff options
author | Dan Timoney <dtimoney@att.com> | 2020-10-27 16:47:24 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2020-10-27 16:47:24 -0400 |
commit | 370f5fe6f8c90bb35a9529f19d862e63a2cf8b9d (patch) | |
tree | a47de0f116057f88c912bd0e32a0818cfbfb962d /ms/generic-resource-api | |
parent | 9b90144c883eb42937f601f9e8ea32c4895fc072 (diff) |
Import SLI-API controller
Import sliboot controller to implement SLI-API interface.
Change-Id: Iea85a9cb128366fa0f580852d9f2fa71405a4bad
Issue-ID: SDNC-1400
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/generic-resource-api')
11 files changed, 54 insertions, 78 deletions
diff --git a/ms/generic-resource-api/pom.xml b/ms/generic-resource-api/pom.xml index 8fc19cd..e4cecac 100644 --- a/ms/generic-resource-api/pom.xml +++ b/ms/generic-resource-api/pom.xml @@ -18,13 +18,13 @@ <url>http://wiki.onap.org</url> <properties> - <start-class>org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp</start-class> + <start-class>org.onap.sdnc.apps.ms.gra.GenericResourceMsApp</start-class> <shiro.version>1.5.0</shiro.version> <aaf-shiro-bundle.version>2.1.13</aaf-shiro-bundle.version> - <ccsdk.apps.version>1.0.0</ccsdk.apps.version> - <ccsdk.docker.version>1.0-STAGING-latest</ccsdk.docker.version> - <sdnc.northbound.version>2.0.1</sdnc.northbound.version> - <sdnc.oam.version>2.0.1</sdnc.oam.version> + <ccsdk.apps.version>1.1.0-SNAPSHOT</ccsdk.apps.version> + <ccsdk.docker.version>1.1-STAGING-latest</ccsdk.docker.version> + <sdnc.northbound.version>2.1.0-SNAPSHOT</sdnc.northbound.version> + <sdnc.oam.version>2.1.0-SNAPSHOT</sdnc.oam.version> <base.image.name>onap/ccsdk-alpine-j11-image</base.image.name> <image.name>onap/sdnc-gra-image</image.name> @@ -95,6 +95,11 @@ <version>${ccsdk.apps.version}</version> </dependency> <dependency> + <groupId>org.onap.ccsdk.apps</groupId> + <artifactId>sliboot</artifactId> + <version>${ccsdk.apps.version}</version> + </dependency> + <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> <version>${ccsdk.sli.core.version}</version> @@ -120,6 +125,21 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>mdsal-resource-provider</artifactId> + <version>${ccsdk.sli.adaptors.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors.messagerouter</groupId> + <artifactId>publisher.provider</artifactId> + <version>${ccsdk.sli.adaptors.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>netbox-client-provider</artifactId> + <version>${ccsdk.sli.adaptors.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> <artifactId>sql-resource-provider</artifactId> <version>${ccsdk.sli.adaptors.version}</version> </dependency> diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/core/GenericResourceMsApp.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/GenericResourceMsApp.java index e3a2bd7..9501f99 100644 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/core/GenericResourceMsApp.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/GenericResourceMsApp.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.sdnc.apps.ms.gra.core; +package org.onap.sdnc.apps.ms.gra; import org.apache.shiro.realm.Realm; import org.apache.shiro.realm.text.PropertiesRealm; @@ -29,13 +29,22 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.onap.ccsdk.apps.ms.sliboot.controllers.RestconfApiController; + import springfox.documentation.swagger2.annotations.EnableSwagger2; -@SpringBootApplication(scanBasePackages= { "org.onap.sdnc.apps.ms.gra.*", "org.onap.ccsdk.apps.services"}) +@SpringBootApplication(scanBasePackages={ "org.onap.sdnc.apps.ms.gra", "org.onap.ccsdk.apps.services"}) +@EnableJpaRepositories(basePackages={"org.onap.sdnc.apps.ms.gra", "org.onap.ccsdk.apps.ms.sliboot"}) +@EntityScan(basePackages={"org.onap.sdnc.apps.ms.gra", "org.onap.ccsdk.apps.ms.sliboot"}) +@EnableTransactionManagement +@Import(RestconfApiController.class) @EnableSwagger2 + public class GenericResourceMsApp { private static final Logger log = LoggerFactory.getLogger(GenericResourceMsApp.class); diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/core/WebConfig.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/core/WebConfig.java deleted file mode 100644 index 5c1a923..0000000 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/core/WebConfig.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SDNC - * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdnc.apps.ms.gra.core; - -import org.onap.logging.filter.spring.LoggingInterceptor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; - -@Configuration -@EnableJpaRepositories("org.onap.sdnc.apps.ms.gra.*") -@ComponentScan(basePackages={"org.onap.sdnc.apps.ms.gra.*", "org.onap.ccsdk.apps.services"}) -@EntityScan("org.onap.sdnc.apps.ms.gra.*") -@EnableTransactionManagement -public class WebConfig implements WebMvcConfigurer { - - -} diff --git a/ms/generic-resource-api/src/main/resources/schema-derby.sql b/ms/generic-resource-api/src/main/resources/schema-derby.sql index 52afd71..8d691cc 100644 --- a/ms/generic-resource-api/src/main/resources/schema-derby.sql +++ b/ms/generic-resource-api/src/main/resources/schema-derby.sql @@ -1,7 +1,7 @@ -CREATE SCHEMA sdnctl; +CREATE SCHEMA gra; -SET SCHEMA sdnctl; +SET SCHEMA gra; -- -- Table structure for table ACCESS_LOG diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java index 49f3ae7..5b0a8e6 100644 --- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java @@ -3,7 +3,7 @@ package org.onap.sdnc.apps.ms.gra.controllers; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp; +import org.onap.sdnc.apps.ms.gra.GenericResourceMsApp; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository; diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java index 6329500..e9a5c8b 100644 --- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp; +import org.onap.sdnc.apps.ms.gra.GenericResourceMsApp; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigServices; diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java index 260d66b..166278a 100644 --- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java @@ -6,7 +6,7 @@ import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp; +import org.onap.sdnc.apps.ms.gra.GenericResourceMsApp; import java.util.Map; diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java index f0f29d3..b285d9e 100644 --- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java @@ -3,7 +3,7 @@ package org.onap.sdnc.apps.ms.gra.controllers; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp; +import org.onap.sdnc.apps.ms.gra.GenericResourceMsApp; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigServices; import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository; @@ -126,7 +126,7 @@ public class OperationsApiControllerTest { .andReturn(); assertEquals(200, mvcResult.getResponse().getStatus()); assertEquals(1, configServicesRepository.count()); - assertEquals(1, operationalServicesRepository.count()); + assertEquals(0, operationalServicesRepository.count()); } diff --git a/ms/generic-resource-api/src/test/resources/application.properties b/ms/generic-resource-api/src/test/resources/application.properties index 807719e..a3a99b8 100644 --- a/ms/generic-resource-api/src/test/resources/application.properties +++ b/ms/generic-resource-api/src/test/resources/application.properties @@ -5,13 +5,14 @@ spring.jackson.date-format=org.onap.sdnc.apps.ms.gra.swagger.RFC3339DateFormat spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false logging.level.com.att=TRACE logging.level.org.onap=TRACE -spring.datasource.url=jdbc:derby:memory:sdnctl;create=true +spring.datasource.url=jdbc:derby:memory:gra;create=true spring.datasource.platform=derby -spring.datasource.username=sdnctl +spring.datasource.username=sdnc spring.datasource.password=abc123 spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver spring.datasource.testWhileIdle=true spring.datasource.validationQuery=SELECT 1 +spring.datasource.continue-on-error=true spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl diff --git a/ms/generic-resource-api/src/test/resources/dblib.properties b/ms/generic-resource-api/src/test/resources/dblib.properties index 198a00c..27923aa 100644 --- a/ms/generic-resource-api/src/test/resources/dblib.properties +++ b/ms/generic-resource-api/src/test/resources/dblib.properties @@ -23,12 +23,12 @@ org.onap.ccsdk.sli.dbtype=jdbc org.onap.ccsdk.sli.jdbc.hosts=localhost -org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true +org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:gra;create=true org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver -org.onap.ccsdk.sli.jdbc.database = sdnctl -org.onap.ccsdk.sli.jdbc.user = sdnctl +org.onap.ccsdk.sli.jdbc.database = gra +org.onap.ccsdk.sli.jdbc.user = sdnc org.onap.ccsdk.sli.jdbc.password = abc123 -org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 +org.onap.ccsdk.sli.jdbc.connection.name=gradb01 org.onap.ccsdk.sli.jdbc.connection.timeout=50 org.onap.ccsdk.sli.jdbc.request.timeout=100 org.onap.ccsdk.sli.jdbc.limit.init=10 diff --git a/ms/generic-resource-api/src/test/resources/svclogic.properties b/ms/generic-resource-api/src/test/resources/svclogic.properties index 8f5243e..acbf8d0 100644 --- a/ms/generic-resource-api/src/test/resources/svclogic.properties +++ b/ms/generic-resource-api/src/test/resources/svclogic.properties @@ -20,10 +20,10 @@ ### org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true +org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:gra;create=true org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver -org.onap.ccsdk.sli.jdbc.database = sdnctl -org.onap.ccsdk.sli.jdbc.user = sdnctl +org.onap.ccsdk.sli.jdbc.database = gra +org.onap.ccsdk.sli.jdbc.user = sdnc org.onap.ccsdk.sli.jdbc.password = abc123 serviceLogicDirectory=target/docker-stage/opt/onap/sdnc/svclogic/graphs/generic-resource-api |