aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ms/controllerblueprints/.gitignore1
-rw-r--r--ms/controllerblueprints/application/etc/logback.xml36
-rw-r--r--ms/controllerblueprints/application/opt/app/onap/config/application.properties35
-rw-r--r--ms/controllerblueprints/application/pom.xml5
-rw-r--r--ms/controllerblueprints/application/src/assembly/distribution.xml8
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java8
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsFilterConfiguration.java37
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/CorsConfig.java22
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java102
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java70
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java37
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebMvcConfiguration.java37
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java3
-rw-r--r--ms/controllerblueprints/application/src/test/resources/application.properties45
-rw-r--r--ms/controllerblueprints/application/src/test/resources/logback.xml (renamed from ms/controllerblueprints/application/opt/app/onap/config/logback.xml)2
-rw-r--r--ms/controllerblueprints/modules/core/pom.xml58
-rw-r--r--ms/controllerblueprints/modules/resource-dict/pom.xml7
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml24
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java42
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java24
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java232
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java116
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java147
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java87
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java152
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java91
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java160
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java94
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java69
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java36
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java3
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java3
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java3
-rw-r--r--ms/controllerblueprints/parent/pom.xml122
-rw-r--r--ms/neng/.classpath18
-rw-r--r--ms/neng/.project4
-rw-r--r--ms/neng/opt/etc/config/application-dbless.properties42
-rw-r--r--ms/neng/opt/etc/config/application-standalone.properties44
-rw-r--r--ms/neng/opt/etc/config/application.properties47
-rw-r--r--ms/neng/opt/etc/config/logback.xml40
-rw-r--r--ms/neng/opt/etc/config/system.properties35
-rw-r--r--ms/neng/pom.xml161
-rw-r--r--ms/neng/src/main/docker/Dockerfile32
-rw-r--r--ms/neng/src/main/docker/startService.sh34
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java4
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/ApplicationConfig.java26
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java21
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestService.java5
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java14
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceDbImpl.java3
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingDataTest.java (renamed from ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingData.java)2
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/SequenceGeneratorTest.java (renamed from ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/TestSequenceGenerator.java)2
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java15
-rw-r--r--ms/neng/src/test/resources/application-test.properties43
-rw-r--r--ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml20
-rw-r--r--ms/neng/src/test/sanity/README.txt6
-rw-r--r--ms/neng/src/test/sanity/add-policy.sh46
-rw-r--r--ms/neng/src/test/sanity/env.sh26
-rw-r--r--ms/neng/src/test/sanity/gen-name.sh52
-rw-r--r--ms/neng/src/test/sanity/get-policy.sh32
-rw-r--r--ms/neng/src/test/sanity/hello.sh38
-rw-r--r--ms/neng/src/test/sanity/policy-1.json32
-rw-r--r--ms/neng/src/test/sanity/release-name.sh49
-rw-r--r--ms/neng/src/test/sanity/suite.sh31
65 files changed, 1365 insertions, 1481 deletions
diff --git a/ms/controllerblueprints/.gitignore b/ms/controllerblueprints/.gitignore
index b808e843..644e3b49 100644
--- a/ms/controllerblueprints/.gitignore
+++ b/ms/controllerblueprints/.gitignore
@@ -7,6 +7,7 @@
**/target-ide/*
**/target/*
**/logs/*
+**/debug-logs/*
**/tokens/*
# Added for Intellij IDEA IDE
diff --git a/ms/controllerblueprints/application/etc/logback.xml b/ms/controllerblueprints/application/etc/logback.xml
new file mode 100644
index 00000000..44e9a8a1
--- /dev/null
+++ b/ms/controllerblueprints/application/etc/logback.xml
@@ -0,0 +1,36 @@
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ 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.
+ -->
+
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="info"/>
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.apps" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application.properties b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
index 202017de..9fa8e04c 100644
--- a/ms/controllerblueprints/application/opt/app/onap/config/application.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
@@ -14,43 +14,8 @@
# limitations under the License.
#
-info.build.artifact=@project.artifactId@
-info.build.name=@project.name@
-info.build.description=@project.description@
-info.build.version=@project.version@
-info.build.groupId=@project.groupId@
-logging.level.root=info
-
-server.contextPath=/
-server.servlet-path=/
-spring.jersey.application-path=/api/controller-blueprints/v1
-server.routingPath=/api
-
-mots.application.acronym=MOTS_ID
-platform.identifier=AJSC7_JERSEY
-#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
-
#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
-#The max number of active threads in this pool
-server.tomcat.max-threads=200
-#The minimum number of threads always kept alive
-server.tomcat.min-Spare-Threads=25
-#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
-server.tomcat.max-idle-time=60000
-
-#for changing the tomcat port...
-#server.port=8081
-
-#Servlet context parameters
-server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
-
-# make this true for AAF authentication and place cadi.properties into etc folder
-aaf.enabled=false
-
-# set to true to enable version proxy
-#ivp.enabled=false
-
logging.level.org.springframework.web=INFO
logging.level.org.hibernate.SQL=warn
logging.level.org.hibernate.type.descriptor.sql=debug
diff --git a/ms/controllerblueprints/application/pom.xml b/ms/controllerblueprints/application/pom.xml
index 18d9a903..19fd9c72 100644
--- a/ms/controllerblueprints/application/pom.xml
+++ b/ms/controllerblueprints/application/pom.xml
@@ -70,11 +70,6 @@
<optional>true</optional>
</dependency>
<dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
diff --git a/ms/controllerblueprints/application/src/assembly/distribution.xml b/ms/controllerblueprints/application/src/assembly/distribution.xml
index adfb52d1..c58c20d7 100644
--- a/ms/controllerblueprints/application/src/assembly/distribution.xml
+++ b/ms/controllerblueprints/application/src/assembly/distribution.xml
@@ -27,14 +27,6 @@
<dependencySet>
<outputDirectory>/opt/app/onap/lib</outputDirectory>
<excludes>
- <exclude>org.slf4j:slf4j-log4j12</exclude>
- <exclude>javax.servlet:servlet-api</exclude>
- <exclude>javax.servlet:javax.servlet-api</exclude>
- <exclude>j2ee:j2ee</exclude>
- <exclude>log4j:log4j</exclude>
- <exclude>com.sun:j2ee</exclude>
- <exclude>log4j:apache-log4j-extras</exclude>
- <exclude>org.slf4j:slf4j-simple</exclude>
</excludes>
</dependencySet>
</dependencySets>
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java
index 96d82e7e..447e1966 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java
@@ -16,22 +16,26 @@
package org.onap.ccsdk.apps.controllerblueprints;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.web.reactive.config.EnableWebFlux;
/**
- *
- *
* @author Brinda Santh
*/
@SpringBootApplication
+@EnableWebFlux
@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints"})
@EnableAutoConfiguration
public class ControllerBluprintsApplication {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBluprintsApplication.class);
public static void main(String[] args) {
+ log.info("****** Starting Controller Bluprints Application **************");
SpringApplication.run(ControllerBluprintsApplication.class, args);
}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsFilterConfiguration.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsFilterConfiguration.java
deleted file mode 100644
index 6f4bfc98..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsFilterConfiguration.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-/**
- *
- *
- * @author Brinda Santh
- */
-@Configuration
-public class ControllerBluprintsFilterConfiguration {
- private static Logger log = LoggerFactory.getLogger(JerseyConfiguration.class);
-
- @Value("${server.routingPath:#{null}}")
- private String routingPath;
-
-
-}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/CorsConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/CorsConfig.java
index 0d9ab162..5d682ed5 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/CorsConfig.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/CorsConfig.java
@@ -1,17 +1,17 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
*
- * 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
+ * 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
+ * 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.
+ * 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.
*/
package org.onap.ccsdk.apps.controllerblueprints;
@@ -29,7 +29,7 @@ import org.springframework.web.filter.CorsFilter;
* @author Brinda Santh
* @version 1.0
*/
-@Configuration
+//@Configuration
public class CorsConfig {
/**
* This is a CORS Implementation for different Orgin GUI to access.
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java
deleted file mode 100644
index a3b0faf0..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import io.swagger.jaxrs.config.BeanConfig;
-import io.swagger.jaxrs.listing.ApiListingResource;
-import io.swagger.jaxrs.listing.SwaggerSerializers;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.servlet.ServletProperties;
-import org.onap.ccsdk.apps.controllerblueprints.service.common.ServiceExceptionMapper;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ConfigModelRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ResourceDictionaryRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ServiceTemplateRestImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-
-import javax.ws.rs.core.MediaType;
-
-/**
- *
- *
- * @author Brinda Santh
- */
-@Component
-public class JerseyConfiguration extends ResourceConfig {
- private static Logger log = LoggerFactory.getLogger(JerseyConfiguration.class);
- /**
- *
- */
- @Autowired
- public JerseyConfiguration() {
- register(ConfigModelRestImpl.class);
- register(ModelTypeRestImpl.class);
- register(ResourceDictionaryRestImpl.class);
- register(ServiceTemplateRestImpl.class);
- register(ServiceExceptionMapper.class);
- property(ServletProperties.FILTER_FORWARD_ON_404, true);
- configureSwagger();
- }
-
- /**
- *
- * @return ObjectMapper
- */
- @Bean
- @Primary
- public ObjectMapper objectMapper() {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
- objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
- objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
- return objectMapper;
- }
-
- /**
- *
- */
- private void configureSwagger() {
- register(ApiListingResource.class);
- register(SwaggerSerializers.class);
- BeanConfig beanConfig = new BeanConfig();
- beanConfig.setVersion("1.0.0");
- beanConfig.setSchemes(new String[]{"http", "https"});
- beanConfig.setBasePath("/api/controller-blueprints/v1");
- beanConfig.setTitle("Controller Blueprints API");
- beanConfig.setDescription("Controller BluePrints API");
- beanConfig.getSwagger().addConsumes(MediaType.APPLICATION_JSON);
- beanConfig.getSwagger().addProduces(MediaType.APPLICATION_JSON);
- beanConfig.setResourcePackage("org.onap.ccsdk.apps.controllerblueprints");
- beanConfig.setPrettyPrint(true);
- beanConfig.setScan(true);
- }
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
new file mode 100644
index 00000000..5970bafd
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * SwaggerConfig
+ *
+ * @author Brinda Santh 8/13/2018
+ */
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+ private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
+ new HashSet<String>(Arrays.asList("application/json",
+ "application/xml"));
+ private static Logger log = LoggerFactory.getLogger(SwaggerConfig.class);
+
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .select()
+ .apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any())
+ .build()
+ .apiInfo(apiInfo());
+ }
+
+ private ApiInfo apiInfo() {
+ return new ApiInfo(
+ "Controller Blueprints API",
+ "Controller blueprints API for VNF Self Service.",
+ "1.0.0",
+ "Terms of service",
+ new Contact("Brinda Santh", "www.onap.com", "brindasanth@onap.com"),
+ "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());
+ }
+
+
+}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java
new file mode 100644
index 00000000..1eba97cd
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.reactive.config.ResourceHandlerRegistry;
+import org.springframework.web.reactive.config.WebFluxConfigurationSupport;
+
+/**
+ * WebConfig
+ *
+ * @author Brinda Santh 8/13/2018
+ */
+@Configuration
+public class WebConfig extends WebFluxConfigurationSupport {
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("swagger-ui.html")
+ .addResourceLocations("classpath:/META-INF/resources/");
+
+ registry.addResourceHandler("/webjars/**")
+ .addResourceLocations("classpath:/META-INF/resources/webjars/");
+ }
+}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebMvcConfiguration.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebMvcConfiguration.java
deleted file mode 100644
index a690c056..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebMvcConfiguration.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-/**
- *
- * WebMvcConfiguration WebMvcConfiguration
- * @author Brinda Santh
- */
-@Configuration
-@EnableWebMvc
-public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/swagger-ui/dist/");
- }
-
-}
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
index 4bdbde00..95639bd3 100644
--- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
+++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
@@ -46,9 +46,8 @@ public class ControllerBluprintsApplicationTest {
@Test
public void testConfigModel() {
-
ResponseEntity<String> entity = this.restTemplate
- .getForEntity("/api/controller-blueprints/v1/service/configmodel/1", String.class);
+ .getForEntity("/api/v1/config-model/1", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
}
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
index c6057e56..55ffeaf1 100644
--- a/ms/controllerblueprints/application/src/test/resources/application.properties
+++ b/ms/controllerblueprints/application/src/test/resources/application.properties
@@ -14,51 +14,6 @@
# limitations under the License.
#
-info.build.artifact=@project.artifactId@
-info.build.name=@project.name@
-info.build.description=@project.description@
-info.build.version=@project.version@
-info.build.groupId=@project.groupId@
-logging.level.root=info
-
-server.contextPath=/
-server.servlet-path=/
-spring.jersey.application-path=/api/controller-blueprints/v1
-server.routingPath=/api
-
-mots.application.acronym=MOTS_ID
-platform.identifier=AJSC7_JERSEY
-#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
-
-#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
-
-#The max number of active threads in this pool
-server.tomcat.max-threads=200
-#The minimum number of threads always kept alive
-server.tomcat.min-Spare-Threads=25
-#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
-server.tomcat.max-idle-time=60000
-
-#for changing the tomcat port...
-#server.port=8081
-
-#Servlet context parameters
-server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
-
-# make this true for AAF authentication and place cadi.properties into etc folder
-aaf.enabled=false
-
-# set to true to enable version proxy
-#ivp.enabled=false
-
-logging.level.org.springframework.web=INFO
-logging.level.org.hibernate.SQL=warn
-logging.level.org.hibernate.type.descriptor.sql=debug
-
-spring.jpa.properties.hibernate.show_sql=true
-spring.jpa.properties.hibernate.use_sql_comments=true
-spring.jpa.properties.hibernate.format_sql=true
-
#Load Blueprints
# blueprints.load.initial-data may be overridden by ENV variables
blueprints.load.initial-data=true
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/logback.xml b/ms/controllerblueprints/application/src/test/resources/logback.xml
index cdd20c8b..b9b97dc8 100644
--- a/ms/controllerblueprints/application/opt/app/onap/config/logback.xml
+++ b/ms/controllerblueprints/application/src/test/resources/logback.xml
@@ -26,7 +26,7 @@
<logger name="org.springframework" level="info"/>
<logger name="org.springframework.web" level="debug"/>
- <logger name="org.hibernate" level="error"/>
+ <logger name="org.hibernate" level="info"/>
<logger name="org.onap.ccsdk.apps.controllerblueprints" level="info"/>
<root level="warn">
diff --git a/ms/controllerblueprints/modules/core/pom.xml b/ms/controllerblueprints/modules/core/pom.xml
index 0e88dd29..fc7581c8 100644
--- a/ms/controllerblueprints/modules/core/pom.xml
+++ b/ms/controllerblueprints/modules/core/pom.xml
@@ -30,30 +30,6 @@
<dependencies>
<dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-reflect</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-kotlin</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
@@ -66,43 +42,9 @@
<artifactId>jackson-module-jsonSchema</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
- <dependency>
- <groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test</artifactId>
- <scope>test</scope>
- </dependency>
-<!-- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>-->
</dependencies>
</project>
diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml
index a0d1be61..337f5512 100644
--- a/ms/controllerblueprints/modules/resource-dict/pom.xml
+++ b/ms/controllerblueprints/modules/resource-dict/pom.xml
@@ -33,13 +33,6 @@
<groupId>org.onap.ccsdk.apps</groupId>
<artifactId>controllerblueprints-core</artifactId>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
-
</dependencies>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index 17738bf4..b4b798e6 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -37,36 +37,16 @@
<artifactId>controllerblueprints-resource-dict</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jersey</artifactId>
+ <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java
deleted file mode 100644
index f223dccb..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.common;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-@Provider
-public class ServiceExceptionMapper implements ExceptionMapper<BluePrintException> {
-
- @Override
- public Response toResponse(BluePrintException ex) {
- ErrorMessage errorMessage = new ErrorMessage();
- errorMessage.setCode(ex.getCode());
- errorMessage.setMessage(ex.getMessage());
- StringWriter errorStackTrace = new StringWriter();
- ex.printStackTrace(new PrintWriter(errorStackTrace));
- errorMessage.setDeveloperMessage(ex.toString());
- return Response.status(500).entity(errorMessage).type(MediaType.APPLICATION_JSON).build();
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java
index e9080763..81f7d701 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java
@@ -1,17 +1,17 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
*
- * 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
+ * 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
+ * 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.
+ * 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.
*/
package org.onap.ccsdk.apps.controllerblueprints.service.common;
@@ -20,7 +20,6 @@ import io.swagger.models.*;
import io.swagger.models.parameters.BodyParameter;
import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.*;
-import io.swagger.util.Json;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
@@ -63,8 +62,7 @@ public class SwaggerGenerator {
swagger.setDefinitions(getDefinition());
- swaggerContent = Json.pretty(swagger);
- return swaggerContent;
+ return swagger.toString();
}
private Info getInfo() {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java
index 86c89bf9..94324a80 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java
@@ -16,164 +16,112 @@
package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
import java.util.List;
/**
- * ConfigModelRest.java Purpose: Rest service controller for ConfigModelRest Management
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
-public interface ConfigModelRest {
+@RestController
+@RequestMapping("/api/v1/config-model")
+public class ConfigModelRest {
- /**
- * This is a getConfigModel rest service
- *
- * @param id
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodel/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- @RequestMapping(value = "/configmodel/{id}", method = RequestMethod.GET)
- @ResponseBody ConfigModel getConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
- throws BluePrintException;
-
+ private ConfigModelService configModelService;
/**
- * This is a saveConfigModel rest service
- *
- * @param configModel
- * @return ConfigModel
- * @throws BluePrintException
+ * This is a ConfigModelRest constructor.
+ *
+ * @param configModelService Config Model Service
*/
- @POST
- @Path("/configmodel")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ServiceTemplate.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel saveConfigModel(@ApiParam(required = true) ConfigModel configModel)
- throws BluePrintException;
+ public ConfigModelRest(ConfigModelService configModelService) {
+ this.configModelService = configModelService;
- /**
- * This is a deleteConfigModel rest service
- *
- * @param id
- * @throws BluePrintException
- */
- @DELETE
- @Path("/configmodel/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to delete ConfigModel.")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- void deleteConfigModel(@ApiParam(required = true) @PathParam("id") Long id) throws BluePrintException;
+ }
- /**
- * This is a getInitialConfigModel rest service
- *
- * @param name
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelinitial/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel getInitialConfigModel(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ @GetMapping(path = "/initial/{name}")
+ public @ResponseBody
+ ConfigModel getInitialConfigModel(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ return this.configModelService.getInitialConfigModel(name);
+ } catch (Exception e) {
+ throw new BluePrintException(2000, e.getMessage(), e);
+ }
+ }
- /**
- * This is a getCloneConfigModel rest service
- *
- * @param id
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelclone/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel getCloneConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
- throws BluePrintException;
+ @PostMapping(path = "/")
+ public @ResponseBody
+ ConfigModel saveConfigModel(@RequestBody ConfigModel configModel) throws BluePrintException {
+ try {
+ return this.configModelService.saveConfigModel(configModel);
+ } catch (Exception e) {
+ throw new BluePrintException(2200, e.getMessage(), e);
+ }
+ }
- /**
- * This is a publishConfigModel rest service
- *
- * @param id
- * @return ServiceTemplate
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelpublish/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel publishConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
- throws BluePrintException;
+ @DeleteMapping(path = "/{id}")
+ public void deleteConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ this.configModelService.deleteConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(4000, e.getMessage(), e);
+ }
+ }
- /**
- * This is a getConfigModelByNameAndVersion rest service
- *
- * @param name
- * @param version
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelbyname/{name}/version/{version}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel getConfigModelByNameAndVersion(@ApiParam(required = true) @PathParam("name") String name,
- @ApiParam(required = true) @PathParam("version") String version) throws BluePrintException;
+ @GetMapping(path = "/publish/{id}")
+ public @ResponseBody
+ ConfigModel publishConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ return this.configModelService.publishConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2500, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchServiceModels rest service
- *
- * @param tags
- * @return List<ConfigModel>
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelsearch/{tags}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ConfigModel> searchConfigModels(@ApiParam(required = true) @PathParam("tags") String tags)
- throws BluePrintException;
+ @GetMapping(path = "/{id}")
+ public @ResponseBody
+ ConfigModel getConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ return this.configModelService.getConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2001, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/by-name/{name}/version/{version}")
+ public @ResponseBody
+ ConfigModel getConfigModelByNameAndVersion(@PathVariable(value = "name") String name,
+ @PathVariable(value = "version") String version) throws BluePrintException {
+ try {
+ return this.configModelService.getConfigModelByNameAndVersion(name, version);
+ } catch (Exception e) {
+ throw new BluePrintException(2002, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/search/{tags}")
+ public @ResponseBody
+ List<ConfigModel> searchConfigModels(@PathVariable(value = "tags") String tags) throws BluePrintException {
+ try {
+ return this.configModelService.searchConfigModels(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(2003, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/clone/{id}")
+ public @ResponseBody
+ ConfigModel getCloneConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ return this.configModelService.getCloneConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2004, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java
deleted file mode 100644
index a9abcd5f..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ConfigModelRestImpl implements ConfigModelRest {
-
- private ConfigModelService configModelService;
-
- /**
- * This is a ConfigModelRestImpl constructor.
- *
- * @param configModelService Config Model Service
- */
- public ConfigModelRestImpl(ConfigModelService configModelService) {
- this.configModelService = configModelService;
-
- }
-
- @Override
- public ConfigModel getInitialConfigModel(String name) throws BluePrintException {
- try {
- return this.configModelService.getInitialConfigModel(name);
- } catch (Exception e) {
- throw new BluePrintException(2000, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel saveConfigModel(ConfigModel configModel) throws BluePrintException {
- try {
- return this.configModelService.saveConfigModel(configModel);
- } catch (Exception e) {
- throw new BluePrintException(2200, e.getMessage(), e);
- }
- }
-
- @Override
- public void deleteConfigModel(Long id) throws BluePrintException {
- try {
- this.configModelService.deleteConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(4000, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel publishConfigModel(Long id) throws BluePrintException {
- try {
- return this.configModelService.publishConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(2500, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel getConfigModel(Long id) throws BluePrintException {
- try {
- return this.configModelService.getConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(2001, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel getConfigModelByNameAndVersion(String name, String version) throws BluePrintException {
- try {
- return this.configModelService.getConfigModelByNameAndVersion(name, version);
- } catch (Exception e) {
- throw new BluePrintException(2002, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ConfigModel> searchConfigModels(String tags) throws BluePrintException {
- try {
- return this.configModelService.searchConfigModels(tags);
- } catch (Exception e) {
- throw new BluePrintException(2003, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel getCloneConfigModel(Long id) throws BluePrintException {
- try {
- return this.configModelService.getCloneConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(2004, e.getMessage(), e);
- }
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
index 59b73030..2fa64316 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
@@ -16,110 +16,77 @@
package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
import java.util.List;
/**
- * ModelTypeRest.java Purpose: Rest service controller for Artifact Handling
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
-public interface ModelTypeRest {
+@RestController
+@RequestMapping("/api/v1/model-type")
+public class ModelTypeRest {
- /**
- * This is a getModelTypeByName rest service
- *
- * @param name
- * @return ModelType
- * @throws BluePrintException
- */
- @GET
- @Path("/modeltype/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by id", response = ModelType.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ModelType getModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ private ModelTypeService modelTypeService;
/**
- * This is a saveModelType rest service
- *
- * @param modelType
- * @return ModelType
- * @throws BluePrintException
+ * This is a ModelTypeResourceImpl, used to save and get the model types stored in database
+ *
+ * @param modelTypeService Model Type Service
*/
+ public ModelTypeRest(ModelTypeService modelTypeService) {
+ this.modelTypeService = modelTypeService;
+ }
- @POST
- @Path("/modeltype")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Save Model Type", response = ModelType.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ModelType saveModelType(@ApiParam(required = true) ModelType modelType) throws BluePrintException;
+ @GetMapping(path = "/{name}")
+ public ModelType getModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ return modelTypeService.getModelTypeByName(name);
+ } catch (Exception e) {
+ throw new BluePrintException(1000, e.getMessage(), e);
+ }
+ }
- /**
- * This is a deleteModelType rest service
- *
- * @param name
- * @throws BluePrintException
- */
- @DELETE
- @Path("/modeltype/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to delete Model Type")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- void deleteModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ @GetMapping(path = "/search/{tags}")
+ public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) throws BluePrintException {
+ try {
+ return modelTypeService.searchModelTypes(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(1001, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchModelType rest service
- *
- * @param tags
- * @return List<ModelType>
- * @throws BluePrintException
- */
- @GET
- @Path("/modeltypesearch/{tags}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,
- responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ModelType> searchModelTypes(@ApiParam(required = true) @PathParam("tags") String tags)
- throws BluePrintException;
+ @GetMapping(path = "/by-definition/{definitionType}")
+ public @ResponseBody
+ List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) throws BluePrintException {
+ try {
+ return modelTypeService.getModelTypeByDefinitionType(definitionType);
+ } catch (Exception e) {
+ throw new BluePrintException(1002, e.getMessage(), e);
+ }
+ }
- /**
- * This is a getModelTypeByDefinitionType rest service
- *
- * @param definitionType
- * @return List<ModelType>
- * @throws BluePrintException
- */
- @GET
- @Path("/modeltypebydefinition/{definitionType}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,
- responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ModelType> getModelTypeByDefinitionType(
- @ApiParam(required = true) @PathParam("definitionType") String definitionType)
- throws BluePrintException;
+ @PostMapping(path = "/")
+ public @ResponseBody
+ ModelType saveModelType(@RequestBody ModelType modelType) throws BluePrintException {
+ try {
+ return modelTypeService.saveModel(modelType);
+ } catch (Exception e) {
+ throw new BluePrintException(1100, e.getMessage(), e);
+ }
+ }
+ @DeleteMapping(path = "/{name}")
+ public void deleteModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ modelTypeService.deleteByModelName(name);
+ } catch (Exception e) {
+ throw new BluePrintException(1400, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java
deleted file mode 100644
index 6fbc6969..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ModelTypeRestImpl implements ModelTypeRest {
-
- private ModelTypeService modelTypeService;
-
- /**
- * This is a ModelTypeResourceImpl, used to save and get the model types stored in database
- *
- * @param modelTypeService Model Type Service
- */
- public ModelTypeRestImpl(ModelTypeService modelTypeService) {
- this.modelTypeService = modelTypeService;
- }
-
- @Override
- public ModelType getModelTypeByName(String modelName) throws BluePrintException {
- try {
- return modelTypeService.getModelTypeByName(modelName);
- } catch (Exception e) {
- throw new BluePrintException(1000, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ModelType> searchModelTypes(String tags) throws BluePrintException {
- try {
- return modelTypeService.searchModelTypes(tags);
- } catch (Exception e) {
- throw new BluePrintException(1001, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ModelType> getModelTypeByDefinitionType(String definitionType) throws BluePrintException {
- try {
- return modelTypeService.getModelTypeByDefinitionType(definitionType);
- } catch (Exception e) {
- throw new BluePrintException(1002, e.getMessage(), e);
- }
- }
-
- @Override
- public ModelType saveModelType(ModelType modelType) throws BluePrintException {
- try {
- return modelTypeService.saveModel(modelType);
- } catch (Exception e) {
- throw new BluePrintException(1100, e.getMessage(), e);
- }
- }
-
- @Override
- public void deleteModelTypeByName(String name) throws BluePrintException {
- try {
- modelTypeService.deleteByModelName(name);
- } catch (Exception e) {
- throw new BluePrintException(1400, e.getMessage(), e);
- }
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
index 5bc98336..dfb06bba 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
@@ -16,111 +16,83 @@
package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
import java.util.List;
/**
- * ResourceDictionaryRest.java Purpose: Rest service controller for Artifact Handling
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
+@RestController
+@RequestMapping(value = "/api/v1/dictionary")
+public class ResourceDictionaryRest {
-public interface ResourceDictionaryRest {
- /**
- * This is a getDataDictionaryByPath rest service
- *
- * @param name
- * @return ResourceDictionary
- * @throws BluePrintException
- */
- @GET
- @Path("/dictionary/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Resource dictionary", response = ResourceDictionary.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ResourceDictionary getResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ private ResourceDictionaryService resourceDictionaryService;
/**
- * This is a saveDataDictionary rest service
- *
- * @param resourceMapping
- * @return ResourceDictionary
- * @throws BluePrintException
+ * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database
+ *
+ * @param dataDictionaryService Data Dictionary Service
*/
+ public ResourceDictionaryRest(ResourceDictionaryService dataDictionaryService) {
+ this.resourceDictionaryService = dataDictionaryService;
+ }
- @POST
- @Path("/dictionary")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Save Resource dictionary Type", response = ResourceDictionary.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ResourceDictionary saveResourceDictionary(@ApiParam(required = true) ResourceDictionary resourceMapping)
- throws BluePrintException;
+ @PostMapping(path = "/")
+ public @ResponseBody
+ ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary)
+ throws BluePrintException {
+ try {
+ return resourceDictionaryService.saveResourceDictionary(dataDictionary);
+ } catch (Exception e) {
+ throw new BluePrintException(4100, e.getMessage(), e);
+ }
+ }
- /**
- * This is a deleteDataDictionaryByName rest service
- *
- * @param name
- * @throws BluePrintException
- */
- @DELETE
- @Path("/dictionary/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to delete ResourceDictionary Type")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- void deleteResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ @DeleteMapping(path = "/{name}")
+ public void deleteResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ resourceDictionaryService.deleteResourceDictionary(name);
+ } catch (Exception e) {
+ throw new BluePrintException(4400, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchResourceDictionaryByTags rest service
- *
- * @param tags
- * @return ResourceDictionary
- * @throws BluePrintException
- */
- @GET
- @Path("/dictionarysearch/{tags}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to search Resource dictionary by tags",
- response = ResourceDictionary.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceDictionary> searchResourceDictionaryByTags(
- @ApiParam(required = true) @PathParam("tags") String tags) throws BluePrintException;
+ @GetMapping(path = "/{name}")
+ public @ResponseBody
+ ResourceDictionary getResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ return resourceDictionaryService.getResourceDictionaryByName(name);
+ } catch (Exception e) {
+ throw new BluePrintException(4001, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchResourceDictionaryByNames rest service
- *
- * @param names
- * @return List<ResourceDictionary>
- * @throws BluePrintException
- */
- @POST
- @Path("/dictionarybynames")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get ResourceDictionary Type by names",
- response = ResourceDictionary.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceDictionary> searchResourceDictionaryByNames(@ApiParam(required = true) List<String> names)
- throws BluePrintException;
+ @PostMapping(path = "/by-names")
+ public @ResponseBody
+ List<ResourceDictionary> searchResourceDictionaryByNames(@RequestBody List<String> names)
+ throws BluePrintException {
+ try {
+ return resourceDictionaryService.searchResourceDictionaryByNames(names);
+ } catch (Exception e) {
+ throw new BluePrintException(4002, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/search/{tags}")
+ public @ResponseBody
+ List<ResourceDictionary> searchResourceDictionaryByTags(@PathVariable(value = "tags") String tags) throws BluePrintException {
+ try {
+ return resourceDictionaryService.searchResourceDictionaryByTags(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(4003, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java
deleted file mode 100644
index e3448424..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ResourceDictionaryRestImpl implements ResourceDictionaryRest {
-
-
- private ResourceDictionaryService resourceDictionaryService;
-
- /**
- * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database
- *
- * @param dataDictionaryService Data Dictionary Service
- */
- public ResourceDictionaryRestImpl(ResourceDictionaryService dataDictionaryService) {
- this.resourceDictionaryService = dataDictionaryService;
- }
-
- @Override
- public ResourceDictionary saveResourceDictionary(ResourceDictionary dataDictionary)
- throws BluePrintException {
- try {
- return resourceDictionaryService.saveResourceDictionary(dataDictionary);
- } catch (Exception e) {
- throw new BluePrintException(4100, e.getMessage(), e);
- }
- }
-
- @Override
- public void deleteResourceDictionaryByName(String name) throws BluePrintException {
- try {
- resourceDictionaryService.deleteResourceDictionary(name);
- } catch (Exception e) {
- throw new BluePrintException(4400, e.getMessage(), e);
- }
- }
-
- @Override
- public ResourceDictionary getResourceDictionaryByName(String resourcePath) throws BluePrintException {
- try {
- return resourceDictionaryService.getResourceDictionaryByName(resourcePath);
- } catch (Exception e) {
- throw new BluePrintException(4001, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceDictionary> searchResourceDictionaryByNames(List<String> names)
- throws BluePrintException {
- try {
- return resourceDictionaryService.searchResourceDictionaryByNames(names);
- } catch (Exception e) {
- throw new BluePrintException(4002, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceDictionary> searchResourceDictionaryByTags(String tags) throws BluePrintException {
- try {
- return resourceDictionaryService.searchResourceDictionaryByTags(tags);
- } catch (Exception e) {
- throw new BluePrintException(4003, e.getMessage(), e);
- }
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
index fcb8f311..d8ea1941 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
@@ -16,119 +16,87 @@
package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
+
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
import java.util.List;
-
/**
- * ServiceTemplateRest.java Purpose: ServiceTemplateRest interface
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
+@RestController
+@RequestMapping(value = "/api/v1/service-template")
+public class ServiceTemplateRest {
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
-public interface ServiceTemplateRest {
+ private ServiceTemplateService serviceTemplateService;
/**
- * This is a enrichServiceTemplate rest service
- *
- * @param serviceTemplate
- * @return ServiceTemplate
- * @throws BluePrintException
+ * This is a ServiceTemplateRest constructor
+ *
+ * @param serviceTemplateService Service Template Service
*/
- @POST
- @Path("/servicetemplate/enrich")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to enrich service template", response = ServiceTemplate.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ServiceTemplate enrichServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)
- throws BluePrintException;
+ public ServiceTemplateRest(ServiceTemplateService serviceTemplateService) {
+ this.serviceTemplateService = serviceTemplateService;
+ }
- /**
- * This is a validateServiceTemplate rest service
- *
- * @param serviceTemplate
- * @return ServiceTemplate
- * @throws BluePrintException
- */
- @POST
- @Path("/servicetemplate/validate")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to validate service template", response = ServiceTemplate.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ServiceTemplate validateServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)
- throws BluePrintException;
+ @PostMapping(path = "/enrich")
+ public @ResponseBody
+ ServiceTemplate enrichServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
+ try {
+ return serviceTemplateService.enrichServiceTemplate(serviceTemplate);
+ } catch (Exception e) {
+ throw new BluePrintException(3500, e.getMessage(), e);
+ }
+ }
- /**
- * This is a generateResourceAssignments rest service
- *
- * @param templateContent
- * @return List<ResourceAssignment>
- * @throws BluePrintException
- */
- @POST
- @Path("/resourceassignment/generate")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to auto map for the Resource Mapping",
- response = ResourceAssignment.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceAssignment> generateResourceAssignments(
- @ApiParam(required = true) ConfigModelContent templateContent) throws BluePrintException;
+ @PostMapping(path = "/validate")
+ public @ResponseBody
+ ServiceTemplate validateServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
+ try {
+ return serviceTemplateService.validateServiceTemplate(serviceTemplate);
+ } catch (Exception e) {
+ throw new BluePrintException(3501, e.getMessage(), e);
+ }
+ }
- /**
- * This is a autoMap rest service
- *
- * @param resourceAssignments
- * @return AutoMapResponse
- * @throws BluePrintException
- */
- @POST
- @Path("/resourceassignment/automap")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to auto map for the Resource assignments",
- response = AutoMapResponse.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- AutoMapResponse autoMap(@ApiParam(required = true) List<ResourceAssignment> resourceAssignments)
- throws BluePrintException;
+ @PostMapping(path = "/resource-assignment/auto-map")
+ public @ResponseBody
+ AutoMapResponse autoMap(@RequestBody List<ResourceAssignment> resourceAssignments) throws BluePrintException {
+ try {
+ return serviceTemplateService.autoMap(resourceAssignments);
+ } catch (Exception e) {
+ throw new BluePrintException(3502, e.getMessage(), e);
+ }
+ }
- /**
- * This is a validateResourceAssignments rest service
- *
- * @param resourceAssignments
- * @return List<ResourceAssignment>
- * @throws BluePrintException
- */
- @POST
- @Path("/resourceassignment/validate")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to validate Resource assignments", response = ResourceAssignment.class,
- responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceAssignment> validateResourceAssignments(
- @ApiParam(required = true) List<ResourceAssignment> resourceAssignments) throws BluePrintException;
+ @PostMapping(path = "/resource-assignment/validate")
+ public @ResponseBody
+ List<ResourceAssignment> validateResourceAssignments(@RequestBody List<ResourceAssignment> resourceAssignments)
+ throws BluePrintException {
+ try {
+ return serviceTemplateService.validateResourceAssignments(resourceAssignments);
+ } catch (Exception e) {
+ throw new BluePrintException(3503, e.getMessage(), e);
+ }
+ }
+
+ @PostMapping(path = "/resource-assignment/generate")
+ public @ResponseBody
+ List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent)
+ throws BluePrintException {
+ try {
+ return serviceTemplateService.generateResourceAssignments(templateContent);
+ } catch (Exception e) {
+ throw new BluePrintException(3504, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java
deleted file mode 100644
index 6c49d5c6..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
-import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ServiceTemplateRestImpl implements ServiceTemplateRest {
-
- private ServiceTemplateService serviceTemplateService;
-
- /**
- * This is a ServiceTemplateRestImpl constructor
- *
- * @param serviceTemplateService Service Template Service
- */
- public ServiceTemplateRestImpl(ServiceTemplateService serviceTemplateService) {
- this.serviceTemplateService = serviceTemplateService;
- }
-
- @Override
- public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
- try {
- return serviceTemplateService.enrichServiceTemplate(serviceTemplate);
- } catch (Exception e) {
- throw new BluePrintException(3500, e.getMessage(), e);
- }
- }
-
- @Override
- public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
- try {
- return serviceTemplateService.validateServiceTemplate(serviceTemplate);
- } catch (Exception e) {
- throw new BluePrintException(3501, e.getMessage(), e);
- }
- }
-
- @Override
- public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {
- try {
- return serviceTemplateService.autoMap(resourceAssignments);
- } catch (Exception e) {
- throw new BluePrintException(3502, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceAssignment> validateResourceAssignments(List<ResourceAssignment> resourceAssignments)
- throws BluePrintException {
- try {
- return serviceTemplateService.validateResourceAssignments(resourceAssignments);
- } catch (Exception e) {
- throw new BluePrintException(3503, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceAssignment> generateResourceAssignments(ConfigModelContent templateContent)
- throws BluePrintException {
- try {
- return serviceTemplateService.generateResourceAssignments(templateContent);
- } catch (Exception e) {
- throw new BluePrintException(3504, e.getMessage(), e);
- }
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java
deleted file mode 100644
index f5535eb1..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import org.glassfish.jersey.logging.LoggingFeature;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.servlet.ServletProperties;
-import org.onap.ccsdk.apps.controllerblueprints.service.common.ServiceExceptionMapper;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ConfigModelRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ResourceDictionaryRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ServiceTemplateRestImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-
-import java.util.logging.Logger;
-
-
-@Component
-public class JerseyConfiguration extends ResourceConfig {
- private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
-
- @Bean
- @Primary
- public ObjectMapper objectMapper() {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
- objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
- objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
- return objectMapper;
- }
-
- @Autowired
- public JerseyConfiguration() {
- register(ConfigModelRestImpl.class);
- register(ModelTypeRestImpl.class);
- register(ResourceDictionaryRestImpl.class);
- register(ServiceTemplateRestImpl.class);
- // Exception Mapping
- register(ServiceExceptionMapper.class);
- property(ServletProperties.FILTER_FORWARD_ON_404, true);
- register(new LoggingFeature(log));
- }
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java
deleted file mode 100644
index ea259c9c..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import org.springframework.context.annotation.Bean;
-
-import java.util.ArrayList;
-
-//@Configuration
-public class TestConfiguration {
-
- @Bean("jaxrsProviders")
- public ArrayList<Object> provider() {
- return new ArrayList<Object>();
- }
-
- @Bean("jaxrsServices")
- public ArrayList<Object> service() {
- return new ArrayList<Object>();
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java
index 5b10a7e8..a4a787b0 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java
@@ -20,7 +20,6 @@ import org.junit.*;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
import org.slf4j.Logger;
@@ -35,7 +34,7 @@ import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@ContextConfiguration(classes = {TestApplication.class})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ConfigModelRestTest {
@@ -68,7 +67,6 @@ public class ConfigModelRestTest {
ConfigModel configModel = configModelRest.getInitialConfigModel(name);
Assert.assertNotNull("Failed to get Initial Config Model , Return object is Null", configModel);
Assert.assertNotNull("Failed to get Service Template Content ", configModel.getConfigModelContents());
-
}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
index d33349c5..d328b3ea 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
@@ -21,7 +21,6 @@ import org.junit.*;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
import org.slf4j.Logger;
@@ -38,7 +37,7 @@ import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@ContextConfiguration(classes = {TestApplication.class})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ModelTypeRestTest {
private static Logger log = LoggerFactory.getLogger(ModelTypeRestTest.class);
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
index 71dff338..afe9b426 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
@@ -24,7 +24,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,7 +40,7 @@ import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@ContextConfiguration(classes = {TestApplication.class})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ResourceDictionaryRestTest {
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
index f81dd416..fdc68e4e 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
@@ -24,7 +24,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
@@ -46,7 +45,7 @@ import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@ContextConfiguration(classes = {TestApplication.class})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ServiceTemplateRestTest {
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 0b19186d..f8977d1f 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -27,17 +27,19 @@
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
- <kotlin.version>1.2.51</kotlin.version>
- <ajsc.version>200.4.2-RELEASE</ajsc.version>
- <common.version>2.4.2-RELEASE</common.version>
- <cadi.aaf.version>1.4.2</cadi.aaf.version>
- <spring.boot.version>1.5.7.RELEASE</spring.boot.version>
- <sdnc.config.version>20.0.1-SNAPSHOT</sdnc.config.version>
+ <java.version>1.8</java.version>
+ <spring.boot.version>2.0.4.RELEASE</spring.boot.version>
+ <kotlin.version>1.2.60</kotlin.version>
+ <eelf.version>1.0.0</eelf.version>
+ <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
+ <h2database.version>1.4.197</h2database.version>
</properties>
<dependencyManagement>
<dependencies>
+ <!-- Spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
@@ -47,6 +49,24 @@
</dependency>
<dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>${eelf.version}</version>
+ </dependency>
+
+ <!--Swagger Dependencies -->
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${springfox.swagger2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${springfox.swagger2.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.2.1</version>
@@ -67,32 +87,11 @@
<version>1.7</version>
</dependency>
<dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>20180130</version>
- </dependency>
- <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.1-jre</version>
</dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>1.5.20</version>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<!-- Kotlin Dependencies -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
@@ -105,9 +104,17 @@
<version>${kotlin.version}</version>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-kotlin</artifactId>
- <version>2.9.6</version>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-jdk8</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+
+
+ <!-- Database -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${h2database.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
@@ -135,9 +142,64 @@
<dependencies>
<dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-jdk8</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-kotlin</artifactId>
+ </dependency>
+ <!-- test -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-test</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/ms/neng/.classpath b/ms/neng/.classpath
index 2fd27b36..1272921b 100644
--- a/ms/neng/.classpath
+++ b/ms/neng/.classpath
@@ -1,43 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <classpathentry kind="src" output="target-ide/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="opt/etc/config">
+ <classpathentry kind="src" output="target-ide/classes" path="opt/etc/config">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="opt/etc/keystore">
+ <classpathentry kind="src" output="target-ide/classes" path="opt/etc/keystore">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="opt/etc/truststore">
+ <classpathentry kind="src" output="target-ide/classes" path="opt/etc/truststore">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <classpathentry kind="src" output="target-ide/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">
+ <classpathentry kind="src" output="target-ide/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <classpathentry kind="src" output="target-ide/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="opt/aai/keystore">
+ <classpathentry kind="src" output="target-ide/classes" path="opt/aai/keystore">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@@ -57,5 +57,5 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="output" path="target-ide/classes"/>
</classpath>
diff --git a/ms/neng/.project b/ms/neng/.project
index e3af4837..2ede1b82 100644
--- a/ms/neng/.project
+++ b/ms/neng/.project
@@ -26,12 +26,12 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
diff --git a/ms/neng/opt/etc/config/application-dbless.properties b/ms/neng/opt/etc/config/application-dbless.properties
new file mode 100644
index 00000000..3ac94d18
--- /dev/null
+++ b/ms/neng/opt/etc/config/application-dbless.properties
@@ -0,0 +1,42 @@
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#=========================================================================
+#
+# Configuration used for running the application from your IDE, without a DB, for testing.
+#
+# It uses an in-memory DB to support database related functions.
+#
+#=========================================================================
+datasource.db.driver-class-name=org.h2.Driver
+datasource.db.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;
+datasource.db.username=TBD
+datasource.db.password=TBD
+jpa.hibernate.ddl-auto=none
+jpa.show-sql=true
+
+policymgr.clientAuth=Basic TBD
+policymgr.basicAuth=Basic TBD
+policymgr.url=https://TBD/pdp/api/getConfig
+policymgr.environment=TEST
+policymgr.ecompRequestId=xx
+
+aai.certPassword=TBD
+aai.cert=opt/aai/keystore/TBD
+aai.uriBase=https://TBD/aai/v13/
+aai.fromAppId=namegen-mS
diff --git a/ms/neng/opt/etc/config/application-standalone.properties b/ms/neng/opt/etc/config/application-standalone.properties
new file mode 100644
index 00000000..07ad0ee2
--- /dev/null
+++ b/ms/neng/opt/etc/config/application-standalone.properties
@@ -0,0 +1,44 @@
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#=========================================================================
+#
+# Configuration used for running the application stand-alone, in a docker
+# container, without a DB.
+#
+# It uses an in-memory DB for supporting database related functions.
+#
+#=========================================================================
+datasource.db.driver-class-name=org.h2.Driver
+datasource.db.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;
+datasource.db.username=${neng_db_user}
+datasource.db.password=${neng_db_pass}
+jpa.hibernate.ddl-auto=none
+jpa.show-sql=true
+
+policymgr.clientAuth=Basic TBD
+policymgr.basicAuth=Basic TBD
+policymgr.url=${policymgr_url}
+policymgr.environment=TEST
+policymgr.ecompRequestId=xx
+
+aai.certPassword=${aai_cert_pass}
+aai.cert=opt/aai/keystore/TBD
+aai.uriBase=${aai_uribase}
+aai.fromAppId=namegen-mS
+
diff --git a/ms/neng/opt/etc/config/application.properties b/ms/neng/opt/etc/config/application.properties
new file mode 100644
index 00000000..71d7a5f5
--- /dev/null
+++ b/ms/neng/opt/etc/config/application.properties
@@ -0,0 +1,47 @@
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#=========================================================================
+#
+# Main configuration for the application, used always.
+#
+# This can be overridden with entries in the 'application-xyz.properties' file
+# when using a specific spring profile 'xyz'.
+#
+#=========================================================================
+
+datasource.db.driver-class-name=com.mysql.jdbc.Driver
+
+endpoints.beans.id=springbeans
+endpoints.beans.sensitive=false
+
+logging.level.liquibase=DEBUG
+
+liquibase.changeLog=classpath:/db/changelog/db.changelog-master.xml
+
+management.security.enabled=false
+
+server.contextPath=/web
+
+#The max number of active threads in this pool
+server.tomcat.max-threads=200
+
+#The minimum number of threads always kept alive
+server.tomcat.min-spare-threads=25
+
+spring.jersey.type=filter
diff --git a/ms/neng/opt/etc/config/logback.xml b/ms/neng/opt/etc/config/logback.xml
new file mode 100644
index 00000000..6e0ea863
--- /dev/null
+++ b/ms/neng/opt/etc/config/logback.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 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=========================================================
+ -->
+
+<configuration scan="true" scanPeriod="3 seconds" debug="false">
+
+ <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
+
+ <property name="namespace" value="${kubernetes.namespace}"></property>
+
+ <property name="defaultPattern"
+ value="%d{yyyy-MM-dd HH:mm:ss.SSS} $ thread:%X{threadId} %-5level NS:o.o.c.a.m.neng %logger{20} [ host:%X{hostname} serv:%X{serviceName} ver:%X{version} tx:%X{transactionId} conv:%X{conversationId} reqTime:%X{requestTimestamp} respTime:%X{responseTimestamp} dur:%X{duration}] %m%n" />
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+ <root level="INFO">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
diff --git a/ms/neng/opt/etc/config/system.properties b/ms/neng/opt/etc/config/system.properties
new file mode 100644
index 00000000..d8fa4d45
--- /dev/null
+++ b/ms/neng/opt/etc/config/system.properties
@@ -0,0 +1,35 @@
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#=========================================================================
+#
+# system configuration for the application.
+#
+#=========================================================================
+
+logging.config=opt/etc/config/logback.xml
+
+# Spring configuration files
+spring.config.location=opt/etc/config/
+spring.config.name=application
+
+appName=networkelementnamegen
+
+#Modify the below system property
+info.build.version=2018.10.01
+javax.net.ssl.trustStore=opt/etc/truststore/truststore.jks
diff --git a/ms/neng/pom.xml b/ms/neng/pom.xml
index a282f2cc..9cf6f33c 100644
--- a/ms/neng/pom.xml
+++ b/ms/neng/pom.xml
@@ -32,8 +32,8 @@
<icd.package>org.onap.ccsdk.apps.ms.neng.service.rs</icd.package>
<java.version>1.8</java.version>
<spring.version>4.3.8.RELEASE</spring.version>
- <springboot.version>1.5.3.RELEASE</springboot.version>
- <docker.registry>TBD:5100</docker.registry>
+ <springboot.version>1.5.6.RELEASE</springboot.version>
+ <docker.registry>nexus3.onap.org:10003</docker.registry>
<build.number>local</build.number>
<kube.namespace>TBD</kube.namespace>
<service.account>TBD</service.account>
@@ -52,6 +52,8 @@
<sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.language>java</sonar.language>
<serviceArtifactName>ms-networkelementnamegen</serviceArtifactName>
+ <project.version>0.3.0</project.version>
+ <ccsdk.distribution.version>0.2.4</ccsdk.distribution.version>
</properties>
<profiles>
@@ -74,6 +76,39 @@
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
+
+ <profile>
+ <id>blackduck</id>
+ <activation>
+ <property>
+ <name>blackduck-scan</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.blackducksoftware.integration</groupId>
+ <artifactId>hub-maven-plugin</artifactId>
+ <version>1.4.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <hubProjectName>${project.name}</hubProjectName>
+ <outputDirectory>${project.basedir}</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-bdio-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>createHubOutput</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
<developers>
@@ -189,12 +224,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
- <version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -338,12 +371,74 @@
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
</plugin>
+ <!--
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <inherited>false</inherited>
+ <configuration>
+ <verbose>false</verbose>
+ <images>
+ <image>
+ <name>onap/ccsdk-apps-ms-neng</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/src/main/docker</dockerFileDir>
+ <dockerFile>Dockerfile</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ </tags>
+
+ <assembly>
+ <targetDir>/</targetDir>
+ <inline>
+ <files>
+ <file>
+ <source>${project.build.directory}/${build.finalName}.${project.packaging}</source>
+ </file>
+ </files>
+ <fileSet>
+ <directory>${basedir}/opt/etc</directory>
+ <outputDirectory>opt/etc</outputDirectory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+ </inline>
+ </assembly>
+
+
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
<configuration>
- <imageName>${docker.registry}/org.onap.ccsdk.apps/${serviceArtifactName}</imageName>
+ <imageName>${docker.registry}/org.onap.ccsdk.apps/${serviceArtifactName}:${project.version}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<serverId>docker-hub</serverId>
<registryUrl>https://${docker.registry}</registryUrl>
@@ -441,6 +536,62 @@
</includes>
</resource>
</resources>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.apache.maven.plugins
+ </groupId>
+ <artifactId>
+ maven-checkstyle-plugin
+ </artifactId>
+ <versionRange>
+ [2.17,)
+ </versionRange>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.codehaus.mojo
+ </groupId>
+ <artifactId>
+ properties-maven-plugin
+ </artifactId>
+ <versionRange>
+ [1.0.0,)
+ </versionRange>
+ <goals>
+ <goal>
+ set-system-properties
+ </goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
</project>
diff --git a/ms/neng/src/main/docker/Dockerfile b/ms/neng/src/main/docker/Dockerfile
index db87c4c0..dd239ebc 100644
--- a/ms/neng/src/main/docker/Dockerfile
+++ b/ms/neng/src/main/docker/Dockerfile
@@ -1,10 +1,32 @@
-FROM TBD:TBD/TBD/TBD/alpine-java:8_jdk
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#================================================================================
+# Docker setup for the micro-service
+#================================================================================
+FROM onap/ccsdk-ubuntu-image:latest
VOLUME /tmp
ADD NetworkElementNameGen.jar app.jar
VOLUME /opt/etc
-VOLUME /opt/aai
-ADD /opt/etc/ /opt/etc/
-ADD /opt/aai/ /opt/aai/
+#VOLUME /opt/aai
+ADD opt/etc/ /opt/etc/
+#ADD /opt/aai/ /opt/aai/
ADD startService.sh /startService.sh
RUN chmod 700 /startService.sh
-ENTRYPOINT ./startService.sh \ No newline at end of file
+ENTRYPOINT sh /startService.sh
+EXPOSE 8080
diff --git a/ms/neng/src/main/docker/startService.sh b/ms/neng/src/main/docker/startService.sh
index e690311c..2e3e454c 100644
--- a/ms/neng/src/main/docker/startService.sh
+++ b/ms/neng/src/main/docker/startService.sh
@@ -1,9 +1,29 @@
#!/bin/sh
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
touch /app.jar
-app_args=-Dspring.profiles.active=${SPRING_PROFILE}
-app_args=${app_args}" -Dpolicymgr_url="${POLICYMGR_URL}" -Dinstar_aaf_enc_pass="${AAF_PASS_ENC}
-app_args=${app_args}" -Daai_cert_pass="${AAI_CERT_PASSWORD}" -Daai_uribase="${AAI_URI_BASE}
-app_args=${app_args}" -Dnwelgen_db_user="${NWEG_DB_USER}" -Dnwelgen_db_pass="${NWEG_DB_PASS}" -Dnwelgen_db_url="${NWEG_DB_URL}
-echo "app_args ="${app_args}
-echo "app_args ="${app_args}
-java -Djava.security.egd=file:/dev/./urandom ${app_args} -Xms1024m -Xmx1024m -jar /app.jar
+APP_ARGS=-Dspring.profiles.active=${SPRING_PROFILE}
+APP_ARGS=${APP_ARGS}" -Dpolicymgr_url="${POLICYMGR_URL}" -Dinstar_aaf_enc_pass="${AAF_PASS_ENC}
+APP_ARGS=${APP_ARGS}" -Daai_cert_pass="${AAI_CERT_PASSWORD}" -Daai_uribase="${AAI_URI_BASE}
+APP_ARGS=${APP_ARGS}" -Dneng_db_user="${NENG_DB_USER}" -Dneng_db_pass="${NENG_DB_PASS}
+APP_ARGS=${APP_ARGS}" -Dneng_db_url="${NENG_DB_URL}
+APP_ARGS=${APP_ARGS}" -cp /opt/etc/config"
+
+echo "APP_ARGS ="${APP_ARGS}
+java -Djava.security.egd=file:/dev/./urandom ${APP_ARGS} -Xms1024m -Xmx1024m -jar /app.jar --spring.config.location=/opt/etc/config/ > /tmp/app.out 2> /tmp/app.err
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java
index e95fb7eb..6efa94de 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java
@@ -23,10 +23,7 @@ package org.onap.ccsdk.apps.ms.neng.core;
import java.util.Arrays;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.ApplicationContext;
@@ -40,7 +37,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication
@ComponentScan(basePackages = "org.onap.ccsdk")
@EnableAsync
-@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
public class Application extends SpringBootServletInitializer {
/**
* Configures the application.
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/ApplicationConfig.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/ApplicationConfig.java
index d69c270c..f68add72 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/ApplicationConfig.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/persistence/ApplicationConfig.java
@@ -20,16 +20,23 @@
package org.onap.ccsdk.apps.ms.neng.core.persistence;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
+import java.util.stream.StreamSupport;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.AbstractEnvironment;
+import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.Environment;
+import org.springframework.core.env.MutablePropertySources;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
@@ -44,17 +51,32 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
*/
@Configuration
@EnableJpaRepositories(basePackages = "org.onap.ccsdk.apps.ms.neng.persistence.repository")
+@EntityScan("org.onap.ccsdk.apps.ms.neng.persistence.entity")
@EnableTransactionManagement
public class ApplicationConfig {
@Autowired
private Environment environment;
+ @SuppressWarnings("rawtypes")
+ void debugProperties() {
+ Properties props = new Properties();
+ MutablePropertySources propSrcs = ((AbstractEnvironment)this.environment).getPropertySources();
+ StreamSupport.stream(propSrcs.spliterator(), false)
+ .filter(ps -> ps instanceof EnumerablePropertySource)
+ .map(ps -> ((EnumerablePropertySource) ps).getPropertyNames())
+ .flatMap(Arrays::<String>stream)
+ .forEach(propName -> props.setProperty(propName, this.environment.getProperty(propName)));
+ System.out.println("Properties: " + props);
+ }
+
/**
* Builds and returns the DataSource used for persisting the data managed by this micro-service.
*/
@Bean
public DataSource dataSource() {
+ debugProperties();
+
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getProperty("datasource.db.driver-class-name"));
dataSource.setUrl(environment.getProperty("datasource.db.url"));
@@ -133,9 +155,9 @@ public class ApplicationConfig {
JpaVendorAdapter jpaVendAdapter,
Map<String, String> hibProps,
DataSource dataSource) {
+ debugProperties();
EntityManagerFactoryBuilder factBuilder = new EntityManagerFactoryBuilder(jpaVendAdapter, hibProps, null);
- String pkgToScan = environment.getProperty("entitymanager.packagesToScan");
+ String pkgToScan = "org.onap.ccsdk.apps.ms.neng.persistence.entity";
return factBuilder.dataSource(dataSource).packages(pkgToScan).build();
}
-
}
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
index 24736b2f..79e46575 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
@@ -168,18 +168,15 @@ public class SpringServiceImpl implements SpringService {
*/
@Override
public void addPolicy(Object request) throws Exception {
- try {
- @SuppressWarnings("unchecked")
- Map<String, Object> policyData = (Map<String, Object>)request;
- PolicyDetails pd = new PolicyDetails();
- pd.setPolicyName((String) policyData.get("policyName"));
- ObjectMapper objectmapper = new ObjectMapper();
- log.info(objectmapper.writeValueAsString(policyData.get("policyValue")));
- pd.setPolicyResponse(objectmapper.writeValueAsString(policyData.get("policyValue")));
- policyDetailsRepository.save(pd);
- } catch (Exception e) {
- log.warning(e.getMessage());
- }
+ @SuppressWarnings("unchecked")
+ Map<String, Object> policyData = (Map<String, Object>)request;
+ PolicyDetails pd = new PolicyDetails();
+ String name = (String) policyData.get("policyName");
+ pd.setPolicyName(name);
+ ObjectMapper objectmapper = new ObjectMapper();
+ log.info(objectmapper.writeValueAsString(policyData.get("policyValue")));
+ pd.setPolicyResponse((String)policyData.get("policyValue"));
+ policyDetailsRepository.save(pd);
}
void buildUnAssignResponse(List<GeneratedName> generatedNames, NameGenResponse response) {
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestService.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestService.java
index f8da1eee..8319a545 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestService.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestService.java
@@ -24,7 +24,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
-import java.util.List;
import java.util.Map;
import javax.validation.Valid;
import javax.ws.rs.DELETE;
@@ -76,9 +75,9 @@ public interface RestService {
* <p/>This is not used by clients -- it is here to help with diagnostics.
*/
@GET
- @Path("/v1/getpolicyresponse/{policyName}")
+ @Path("/v1/getpolicyresponse")
@Produces({MediaType.APPLICATION_JSON})
- public List<Map<String, Object>> getPolicyResponse(@QueryParam("policyName") String policyName) throws Exception;
+ public Response getPolicyResponse(@QueryParam("policyName") String policyName) throws Exception;
/**
* API to add a naming policy to the database cache in this micro-service.
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java
index ed5723b6..bc8cab42 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/rs/RestServiceImpl.java
@@ -20,10 +20,7 @@
package org.onap.ccsdk.apps.ms.neng.core.service.rs;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.validation.Valid;
@@ -90,13 +87,11 @@ public class RestServiceImpl implements RestService {
* API to return naming policy cached in this micro-service.
*/
@Override
- public List<Map<String, Object>> getPolicyResponse(String policyName) throws Exception {
+ public Response getPolicyResponse(String policyName) throws Exception {
+ log.info("get-policy: " + policyName);
+
PolicyDetails policyDetails = service.getPolicyDetails(policyName);
- List<Map<String, Object>> policyResponse = null;
- ObjectMapper mapper = new ObjectMapper();
- policyResponse = mapper.readValue(policyDetails.getPolicyResponse(),
- new TypeReference<List<Map<String, Object>>>() {});
- return policyResponse;
+ return Response.ok().entity(policyDetails.getPolicyResponse()).build();
}
/**
@@ -109,6 +104,7 @@ public class RestServiceImpl implements RestService {
service.addPolicy(request);
respMap.put("status", "Policy added successfully");
} catch (Exception e) {
+ log.warning(e.getMessage());
respMap.put("status", "Failed");
}
return respMap;
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceDbImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceDbImpl.java
index d283b362..9cb434ff 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceDbImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceDbImpl.java
@@ -49,6 +49,9 @@ public class PolicyFinderServiceDbImpl extends PolicyFinderServiceImpl {
ObjectMapper objectmapper = new ObjectMapper();
objectmapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
PolicyDetails policyDetails = policyDetailsRepo.findPolicyResponseByName(policyName);
+ if (policyDetails == null) {
+ throw new Exception("Unable to find the policy " + policyName);
+ }
List<Map<Object, Object>> respObj = objectmapper.readValue(policyDetails.getPolicyResponse(),
new TypeReference<List<Map<Object, Object>>>() {});
transformConfigObject(objectmapper, respObj);
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingData.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingDataTest.java
index 4b1d1eac..d05644b8 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingData.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/NameGeneratorExcMissingDataTest.java
@@ -44,7 +44,7 @@ import org.onap.ccsdk.apps.ms.neng.core.validator.AaiNameValidator;
import org.onap.ccsdk.apps.ms.neng.core.validator.DbNameValidator;
@RunWith(MockitoJUnitRunner.class)
-public class NameGeneratorExcMissingData {
+public class NameGeneratorExcMissingDataTest {
@Mock
private PolicyParameters policyParams = mock(PolicyParameters.class);
@Mock
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/TestSequenceGenerator.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/SequenceGeneratorTest.java
index fcee4da0..23bbc7c0 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/TestSequenceGenerator.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/seq/SequenceGeneratorTest.java
@@ -36,7 +36,7 @@ import org.onap.ccsdk.apps.ms.neng.persistence.repository.ServiceParameterReposi
@RunWith(MockitoJUnitRunner.class)
-public class TestSequenceGenerator {
+public class SequenceGeneratorTest {
@Mock
private GeneratedNameRespository genNameRepo = mock(GeneratedNameRespository.class);
@Mock
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java
index a1873692..c3815f43 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java
@@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -195,18 +196,14 @@ public class SpringServiceIntTest {
}
@Test
- public void testRestGetPolicyResponse() throws Exception {
- List<Map<String, Object>> policyResponse =
- restServiceImpl.getPolicyResponse("JQINSRIOV.Config_MS_SriovBigJson.1.xml");
- assertNotNull(policyResponse);
- }
-
- @Test
public void testRestAddPolicyToDb() throws Exception {
Map<String, Object> policy = new HashMap<>();
- policy.put("policyName", "policyname");
- policy.put("policyValue", "policyname");
+ policy.put("policyName", "JQINSRIOV.Config_MS_SriovBigJson.1.xml");
+ policy.put("policyValue", "some policy");
restServiceImpl.addPolicyToDb(policy);
+
+ Response policyResponse = restServiceImpl.getPolicyResponse("JQINSRIOV.Config_MS_SriovBigJson.1.xml");
+ assertNotNull(policyResponse);
}
@Test
diff --git a/ms/neng/src/test/resources/application-test.properties b/ms/neng/src/test/resources/application-test.properties
index ca8ac129..ae425c38 100644
--- a/ms/neng/src/test/resources/application-test.properties
+++ b/ms/neng/src/test/resources/application-test.properties
@@ -1,38 +1,13 @@
-info.build.artifact=@project.artifactId@
-info.build.name=@project.name@
-info.build.description=@project.description@
-info.build.version=@project.version@
-
-spring.jersey.type=filter
-
-logging.level.root=info
-logging.level.org.glassfish=info
-logging.level.org.glassfish.jersey=info
-
-spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
-
-logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
-
-liquibase.changeLog=classpath:/h2db/changelog/h2db.changelog-master.xml
-logging.level.liquibase: DEBUG
-
-spring.jersey.type=filter
-spring.mvc.urls=swagger,docs,prometheus,auditevents,info,heapdump,autoconfig,beans,loggers,dump,env,trace,health,configprops,mappings
-
-server.contextPath=/web
-
-spring.datasource.driver-class-name=org.h2.Driver
-spring.datasource.username=sa
-spring.datasource.password=sa
-spring.jpa.hibernate.ddl-auto=none
-spring.jpa.show-sql=true
-spring.datasource.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;
+#=========================================================================
+#
+# Configuration for the test profile, which is used to run integration
+# tests of the application, normally in your IDE.
+#
+#=========================================================================
datasource.db.driver-class-name=org.h2.Driver
datasource.db.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;
-datasource.db.username=sa
-datasource.db.password=sa
-jpa.hibernate.ddl-auto=none
-jpa.show-sql=true
+datasource.db.username=none
+datasource.db.password=none
-entitymanager.packagesToScan=org.onap.ccsdk.apps.ms.neng.persistence.entity
+liquibase.changeLog=classpath:/h2db/changelog/h2db.changelog-master.xml
diff --git a/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml b/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml
index 496a2e9d..2826e4d4 100644
--- a/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml
+++ b/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml
@@ -1,5 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+ <!--
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 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=========================================================
+ -->
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
diff --git a/ms/neng/src/test/sanity/README.txt b/ms/neng/src/test/sanity/README.txt
new file mode 100644
index 00000000..b98414f8
--- /dev/null
+++ b/ms/neng/src/test/sanity/README.txt
@@ -0,0 +1,6 @@
+To run the sanity test, do the following:
+
+ With no DB:
+ bring up the app with the 'dbless' profile.
+ Run from shell:
+ ./suite.sh
diff --git a/ms/neng/src/test/sanity/add-policy.sh b/ms/neng/src/test/sanity/add-policy.sh
new file mode 100644
index 00000000..108d0d48
--- /dev/null
+++ b/ms/neng/src/test/sanity/add-policy.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#==================================================================================
+# This script does a sanity test on the add-policy API of the micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/addPolicy
+TEMP_FILE=/tmp/add-policy.$$.$RANDOM
+EXTERNAL_KEY=${1:-123456789}
+
+printf '{ ' > $TEMP_FILE
+printf '"policyName": "sanity-policy-' >> $TEMP_FILE
+printf $EXTERNAL_KEY >> $TEMP_FILE
+printf '", "policyValue" : "' >> $TEMP_FILE
+cat ./policy-1.json | sed 's/\"/\\\"/g' | tr '\n' ' ' | tr '\r' ' ' >> $TEMP_FILE
+echo '"}' >> $TEMP_FILE
+
+echo "==================================================="
+echo "====== Adding Policy: ==========================="
+cat $TEMP_FILE
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo "==================================================="
+
+rm -f $TEMP_FILE
diff --git a/ms/neng/src/test/sanity/env.sh b/ms/neng/src/test/sanity/env.sh
new file mode 100644
index 00000000..8685bcf8
--- /dev/null
+++ b/ms/neng/src/test/sanity/env.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#==================================================================================
+# Sets up environment for testing.
+#==================================================================================
+
+PORT=8080
+HOST=localhost
+PROTOCOL=http
diff --git a/ms/neng/src/test/sanity/gen-name.sh b/ms/neng/src/test/sanity/gen-name.sh
new file mode 100644
index 00000000..fb106eda
--- /dev/null
+++ b/ms/neng/src/test/sanity/gen-name.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#==================================================================================
+# This script does a sanity test on the generate-name API of this micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/genNetworkElementName
+TEMP_FILE=/tmp/gen-name.$$.$RANDOM
+EXTERNAL_KEY=${2:-123456789}
+
+USE_DB=${1:-'Y'}
+USE_DB_BOOL=$([ "$USE_DB" == "Y" ] && echo "true" || echo "false")
+
+printf '{ "UseDb": "' > $TEMP_FILE
+printf $USE_DB_BOOL >> $TEMP_FILE
+printf '", "elements": [ { "external-key": "sanity-' >> $TEMP_FILE
+printf $EXTERNAL_KEY >> $TEMP_FILE
+printf '", "policy-instance-name": "sanity-policy-' >> $TEMP_FILE
+printf $EXTERNAL_KEY >> $TEMP_FILE
+printf '", "NF_NAMING_CODE": "helloname", ' >> $TEMP_FILE
+printf '"resource-name": "sanity-1", "naming-type": "sanity-1" } ] }' >> $TEMP_FILE
+
+echo "==================================================="
+echo "======== Generating name with request: ============"
+cat $TEMP_FILE
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
diff --git a/ms/neng/src/test/sanity/get-policy.sh b/ms/neng/src/test/sanity/get-policy.sh
new file mode 100644
index 00000000..5c7136b6
--- /dev/null
+++ b/ms/neng/src/test/sanity/get-policy.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#==================================================================================
+# This script does a sanity test on the get-policy API of this micro-service.
+#
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/getpolicyresponse
+EXTERNAL_KEY=${1:-123456789}
+
+echo "==================================================="
+echo "====== Finding Policy: ==========================="
+curl -vi $PROTOCOL://$HOST:$PORT/$URL?policyName=sanity-policy-$EXTERNAL_KEY
+echo "==================================================="
diff --git a/ms/neng/src/test/sanity/hello.sh b/ms/neng/src/test/sanity/hello.sh
new file mode 100644
index 00000000..baa5b703
--- /dev/null
+++ b/ms/neng/src/test/sanity/hello.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#==================================================================================
+# This script does a sanity test on the micro-service, by sending the 'hello' message.
+#
+#==================================================================================
+. ./env.sh
+URL=web/service/hello
+
+echo "==================================================="
+echo "==================================================="
+echo 'This should show {"message":"Hello world!"}'
+echo "==================================================="
+curl -vi $PROTOCOL://$HOST:$PORT/$URL
+
+echo "==================================================="
+echo "==================================================="
+echo 'This should show {"message":"Hello you!"}'
+echo "==================================================="
+curl -vi $PROTOCOL://$HOST:$PORT/$URL?name=you
+echo "==================================================="
diff --git a/ms/neng/src/test/sanity/policy-1.json b/ms/neng/src/test/sanity/policy-1.json
new file mode 100644
index 00000000..e85bc790
--- /dev/null
+++ b/ms/neng/src/test/sanity/policy-1.json
@@ -0,0 +1,32 @@
+[
+ {
+ "config": {
+ "content": {
+ "naming-models":[
+ {
+ "naming-properties":[
+ { "property-name" : "COMPLEX", "property-operation" : "substr(5)" },
+ { "property-name" : "SEQUENCE", "increment-sequence":{
+ "max" : "zzz" , "scope" : "ENTIRETY" , "start-value" : "001" , "length" : "3",
+ "increment" : "1" , "sequence-type" : "alpha-numeric"}
+ },
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "VNF",
+ "nfRole" : "vPE",
+ "naming-recipe" : "COMPLEX|SEQUENCE|NF_NAMING_CODE"
+ },
+ {
+ "naming-properties":[
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "sanity-1",
+ "nfRole" : "sanity-1",
+ "naming-recipe" : "NF_NAMING_CODE"
+ }
+ ]
+ }
+ },
+ "policyName": "sanity-policy-1"
+ }
+]
diff --git a/ms/neng/src/test/sanity/release-name.sh b/ms/neng/src/test/sanity/release-name.sh
new file mode 100644
index 00000000..2a6d16df
--- /dev/null
+++ b/ms/neng/src/test/sanity/release-name.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#==================================================================================
+# This script does a sanity test on the release-name API of this micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/genNetworkElementName
+TEMP_FILE=/tmp/gen-name.$$.$RANDOM
+EXTERNAL_KEY=${2:-123456789}
+
+USE_DB=${1:-'Y'}
+USE_DB_BOOL=$([ "$USE_DB" == "Y" ] && echo "true" || echo "false")
+
+printf '{ "UseDb": "' > $TEMP_FILE
+printf $USE_DB_BOOL >> $TEMP_FILE
+printf '", "elements": [ { "external-key": "sanity-' >> $TEMP_FILE
+printf $EXTERNAL_KEY >> $TEMP_FILE
+printf '", "resource-name": "sanity-1" } ] }' >> $TEMP_FILE
+
+echo "==================================================="
+echo "======= Releasing name with request: =============="
+cat $TEMP_FILE
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -X "DELETE" -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
diff --git a/ms/neng/src/test/sanity/suite.sh b/ms/neng/src/test/sanity/suite.sh
new file mode 100644
index 00000000..79d5b414
--- /dev/null
+++ b/ms/neng/src/test/sanity/suite.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 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=========================================================
+
+#==================================================================================
+# This script does a sanity test on the APIs of the micro-service.
+#==================================================================================
+
+EXTERNAL_KEY=$(date +%s)$RANDOM
+
+./hello.sh
+./add-policy.sh $EXTERNAL_KEY
+./get-policy.sh $EXTERNAL_KEY
+./gen-name.sh Y $EXTERNAL_KEY
+./release-name.sh Y $EXTERNAL_KEY
+