summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/controllerblueprints/application/etc/logback.xml1
-rw-r--r--ms/controllerblueprints/application/opt/app/onap/config/application.properties4
-rw-r--r--ms/controllerblueprints/application/pom.xml9
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java14
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java3
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationBasicAuthenticationEntryPoint.java43
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java72
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java30
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java15
-rw-r--r--ms/controllerblueprints/application/src/test/resources/application.properties4
-rw-r--r--ms/neng/pom.xml263
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/IdentifierMapTest.java98
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/PolicyDetailsTest.java75
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/ServiceParameterTest.java95
-rw-r--r--ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/UnassignVlanTagResponseTest.java71
15 files changed, 627 insertions, 170 deletions
diff --git a/ms/controllerblueprints/application/etc/logback.xml b/ms/controllerblueprints/application/etc/logback.xml
index 0a75e60f..6639705e 100644
--- a/ms/controllerblueprints/application/etc/logback.xml
+++ b/ms/controllerblueprints/application/etc/logback.xml
@@ -33,6 +33,7 @@
<logger name="org.springframework" level="info"/>
<logger name="org.springframework.web" level="info"/>
+ <logger name="org.springframework.security.web.authentication" level="warn"/>
<logger name="org.hibernate" level="error"/>
<logger name="org.onap.ccsdk.apps" level="info"/>
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application.properties b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
index d2814827..e4457d01 100644
--- a/ms/controllerblueprints/application/opt/app/onap/config/application.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
@@ -18,6 +18,10 @@ appName=ControllerBluePrints
ms_name=org.onap.ccsdk.apps.controllerblueprints
appVersion=1.0.0
+# Basic Authentication
+basic-auth.user-name=ccsdkapps
+basic-auth.hashed-pwd=$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
+
#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
logging.level.org.springframework.web=INFO
diff --git a/ms/controllerblueprints/application/pom.xml b/ms/controllerblueprints/application/pom.xml
index 24f4debe..9834924e 100644
--- a/ms/controllerblueprints/application/pom.xml
+++ b/ms/controllerblueprints/application/pom.xml
@@ -55,6 +55,10 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
@@ -68,6 +72,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<scope>test</scope>
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
index 6e9dcd7f..78706d57 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
@@ -23,13 +23,19 @@ import org.onap.ccsdk.apps.controllerblueprints.service.common.ErrorMessage;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.web.csrf.InvalidCsrfTokenException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
+import javax.naming.AuthenticationException;
+import java.nio.file.AccessDeniedException;
+
@ControllerAdvice
@RestController
@SuppressWarnings("unused")
@@ -43,6 +49,14 @@ public class ApplicationExceptionHandler {
return new ResponseEntity<>(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR);
}
+ @ExceptionHandler({InvalidCsrfTokenException.class, AuthenticationException.class, BadCredentialsException.class, AccessDeniedException.class})
+ @ResponseStatus(value = HttpStatus.UNAUTHORIZED)
+ public final ResponseEntity<ErrorMessage> handleAuthenticationRequest(Exception ex, WebRequest request) {
+ log.error("Authentication Exception", ex);
+ ErrorMessage exceptionResponse = new ErrorMessage(ex.getMessage(), HttpStatus.UNAUTHORIZED.value(), ex.getLocalizedMessage());
+ return new ResponseEntity<>(exceptionResponse, HttpStatus.UNAUTHORIZED);
+ }
+
@ExceptionHandler({HttpMessageNotReadableException.class, MethodArgumentNotValidException.class,
HttpRequestMethodNotSupportedException.class})
public final ResponseEntity<ErrorMessage> handleBadRequest(Exception ex, WebRequest request) {
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java
index fbef55fb..44761177 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java
@@ -25,6 +25,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.servlet.*;
@@ -40,6 +42,7 @@ import java.io.IOException;
*/
@Component
@WebFilter(asyncSupported = true, urlPatterns = {"/*"})
+@Order(Ordered.HIGHEST_PRECEDENCE)
@SuppressWarnings("unused")
public class ApplicationLoggingFilter implements Filter {
private static Logger log = LoggerFactory.getLogger(ApplicationLoggingFilter.class);
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationBasicAuthenticationEntryPoint.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationBasicAuthenticationEntryPoint.java
new file mode 100644
index 00000000..e3df3a62
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationBasicAuthenticationEntryPoint.java
@@ -0,0 +1,43 @@
+/*
+ * 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.security;
+
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
+import org.springframework.stereotype.Component;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@Component
+public class ApplicationBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint {
+
+ @Override
+ public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException)
+ throws IOException {
+ response.addHeader("WWW-Authenticate", "Basic realm=\"" + getRealmName() + "\"");
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
+ }
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ setRealmName("CCSDK-APPS");
+ super.afterPropertiesSet();
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java
new file mode 100644
index 00000000..3a39d782
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java
@@ -0,0 +1,72 @@
+/*
+ * 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.security;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+@SuppressWarnings("unused")
+@Configuration
+@EnableWebSecurity
+public class ApplicationSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
+
+ @Value("${basic-auth.user-name}")
+ private String userName;
+
+ @Value("${basic-auth.hashed-pwd}")
+ private String userHashedPassword;
+
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationSecurityConfigurerAdapter.class);
+
+ @Autowired
+ private ApplicationBasicAuthenticationEntryPoint authenticationEntryPoint;
+
+ @Autowired
+ public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
+ log.info("User Id {} and hashed pwd : {}", userName, userHashedPassword);
+ auth.inMemoryAuthentication()
+ .withUser(userName).password(userHashedPassword)
+ .authorities("ROLE_USER");
+ }
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.authorizeRequests()
+ .antMatchers("/actuator/health").permitAll()
+ .antMatchers("/**").authenticated()
+ .and()
+ .httpBasic()
+ .authenticationEntryPoint(authenticationEntryPoint);
+
+ http.csrf().disable();
+ }
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
+} \ No newline at end of file
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 61b5c50f..7a5f952d 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
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ *
* 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
@@ -16,8 +16,6 @@
package org.onap.ccsdk.apps.controllerblueprints;
-import static org.assertj.core.api.Assertions.assertThat;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -27,56 +25,40 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
+import org.springframework.http.client.support.BasicAuthorizationInterceptor;
import org.springframework.test.context.junit4.SpringRunner;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class ControllerBluprintsApplicationTest {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBluprintsApplicationTest.class);
-
@Autowired
private TestRestTemplate restTemplate;
- private HttpHeaders headers;
- private ResponseEntity<ConfigModel> entity;
@Before
public void setUp(){
- headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
- entity = this.restTemplate
- .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);
-
+ BasicAuthorizationInterceptor bai = new BasicAuthorizationInterceptor("ccsdkapps", "ccsdkapps");
+ this.restTemplate.getRestTemplate().getInterceptors().add(bai);
}
@Test
public void testConfigModel() {
-
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
ResponseEntity<ConfigModel> entity = this.restTemplate
.exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);
-
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
Assert.assertNotNull("failed to get response Config model",entity.getBody());
}
@Test
public void testConfigModelFailure() {
-
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
ResponseEntity<ConfigModel> entity = this.restTemplate
.exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);
-
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
Assert.assertNotNull("failed to get response Config model",entity.getBody());
}
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java
index 9445e1d3..995644fd 100644
--- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java
+++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java
@@ -16,21 +16,34 @@
package org.onap.ccsdk.apps.controllerblueprints;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Test;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+
/**
* VersionSplitTest
*
* @author Brinda Santh
*/
public class VersionSplitTest {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(VersionSplitTest.class);
@Test
public void testVersionSplit() {
String version = "1.03.04";
String[] tokens = StringUtils.split(version, '.');
Assert.assertNotNull("failed to tokenize", tokens);
- Assert.assertEquals("failed to three token ", 3, tokens.length );
+ Assert.assertEquals("failed to three token ", 3, tokens.length);
+ }
+
+ @Test
+ public void encodeTest() {
+ String name = "ccsdkapps";
+ BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
+ String encodedValue = bCryptPasswordEncoder.encode(name);
+ Assert.assertTrue("Failed to match", bCryptPasswordEncoder.matches(name, encodedValue));
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
index 5c6acf93..e812da5c 100644
--- a/ms/controllerblueprints/application/src/test/resources/application.properties
+++ b/ms/controllerblueprints/application/src/test/resources/application.properties
@@ -20,6 +20,10 @@ appName=ControllerBluePrints
ms_name=org.onap.ccsdk.apps.controllerblueprints
appVersion=1.0.0
+# Basic Authentication
+basic-auth.user-name=ccsdkapps
+basic-auth.hashed-pwd=$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
+
#To Remove Null in JSON API Response
spring.jackson.default-property-inclusion=non_null
diff --git a/ms/neng/pom.xml b/ms/neng/pom.xml
index 3f90e0af..8f6c7b15 100644
--- a/ms/neng/pom.xml
+++ b/ms/neng/pom.xml
@@ -55,10 +55,12 @@
<project.version>0.3.0</project.version>
<ccsdk.distribution.version>0.2.4</ccsdk.distribution.version>
<docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
- <docker.push.phase>deploy</docker.push.phase>
- <docker.build.phase>deploy</docker.build.phase>
- <docker.verbose>true</docker.verbose>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
+ <docker.push.phase>deploy</docker.push.phase>
+ <docker.build.phase>deploy</docker.build.phase>
+ <docker.verbose>true</docker.verbose>
+ <ccsdk.project.version>${project.version}</ccsdk.project.version>
+ <image.name>onap/ccsdk-apps-ms-neng</image.name>
+
</properties>
<profiles>
@@ -114,72 +116,111 @@
</build>
</profile>
- <profile>
- <id>dockerTBD</id>
- <build>
- <plugins>
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.4.11</version>
- <executions>
- <execution>
- <id>push-images</id>
- <phase>${docker.build.phase}</phase>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <imageName>${docker.registry}/onap/ccsdk-apps-ms-neng:${project.version}</imageName>
- <dockerDirectory>${basedir}/target/docker</dockerDirectory>
- <serverId>docker-hub</serverId>
- <registryUrl>https://${docker.registry}</registryUrl>
- <imageTags>
- <imageTag>${project.version}</imageTag>
- <imageTag>${project.version}-STAGING-${maven.build.timestamp}</imageTag>
- <imageTag>${project.docker.latesttag.version}</imageTag>
- </imageTags>
- <forceTags>true</forceTags>
- <resources>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>${project.build.finalName}.jar</include>
- </resource>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>opt/etc/config/*</include>
- </resource>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>opt/etc/keystore/*</include>
- </resource>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>opt/etc/truststore/*</include>
- </resource>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>opt/aai/keystore/*</include>
- </resource>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>etc/*</include>
- </resource>
- </resources>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>${docker.build.phase}</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/docker</directory>
+ <includes>
+ <include>startService.sh</include>
+ <include>Dockerfile</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-app-jar</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>${docker.build.phase}</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/target/</directory>
+ <includes>
+ <include>NetworkElementNameGen.jar</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-config</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>${docker.build.phase}</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage/opt/etc/config</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/opt/etc/config</directory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.26.1</version>
+ <inherited>false</inherited>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <id>push-images</id>
+ <phase>${docker.build.phase}</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
@@ -271,11 +312,11 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <version>${mariadb.connector.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <version>${mariadb.connector.version}</version>
+ </dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -331,6 +372,7 @@
<build>
<finalName>NetworkElementNameGen</finalName>
<plugins>
+
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
@@ -474,68 +516,6 @@
<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>org.springframework.boot</groupId>
@@ -550,16 +530,9 @@
</executions>
</plugin>
</plugins>
+
<resources>
<resource>
- <directory>src/main/docker</directory>
- <targetPath>../docker</targetPath>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/IdentifierMapTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/IdentifierMapTest.java
new file mode 100644
index 00000000..dc510429
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/IdentifierMapTest.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.apps.ms.neng.persistence.entity;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IdentifierMapTest {
+ private IdentifierMap identifierMap;
+
+ @Before
+ public void setUp() {
+ identifierMap = new IdentifierMap();
+ }
+
+ @Test
+ public void testGetSetIdentifierMapId() {
+ identifierMap.setIdentifierMapId(1);
+ Integer expected = 1;
+ Assert.assertEquals(expected, identifierMap.getIdentifierMapId());
+ }
+
+ @Test
+ public void testGetSetPolicyFnName() {
+ identifierMap.setPolicyFnName("PolicyFnName");
+ String expected = "PolicyFnName";
+ Assert.assertEquals(expected, identifierMap.getPolicyFnName());
+ }
+
+ @Test
+ public void testGetSetJsFnName() {
+ identifierMap.setJsFnName("JsFnName");
+ String expected = "JsFnName";
+ Assert.assertEquals(expected, identifierMap.getJsFnName());
+ }
+
+ @Test
+ public void testGetSetCreatedTime() throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+ Date date = dateFormat.parse("23/09/2007");
+ long time = date.getTime();
+ Timestamp timeStamp = new Timestamp(time);
+ identifierMap.setCreatedTime(timeStamp);
+ Timestamp expected = timeStamp;
+ Assert.assertEquals(expected, identifierMap.getCreatedTime());
+ }
+
+ @Test
+ public void testGetSetCreatedBy() {
+ identifierMap.setCreatedBy("Name");
+ String expected = "Name";
+ Assert.assertEquals(expected, identifierMap.getCreatedBy());
+ }
+
+ @Test
+ public void testGetSetLastUpdatedTime() throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+ Date date = dateFormat.parse("23/09/2007");
+ long time = date.getTime();
+ Timestamp timeStamp = new Timestamp(time);
+ identifierMap.setLastUpdatedTime(timeStamp);
+ Timestamp expected = timeStamp;
+ Assert.assertEquals(expected, identifierMap.getLastUpdatedTime());
+ }
+
+ @Test
+ public void testGetSetLastUpdatedBy() {
+ identifierMap.setLastUpdatedBy("Name");
+ String expected = "Name";
+ Assert.assertEquals(expected, identifierMap.getLastUpdatedBy());
+ }
+
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/PolicyDetailsTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/PolicyDetailsTest.java
new file mode 100644
index 00000000..70508684
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/PolicyDetailsTest.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.apps.ms.neng.persistence.entity;
+
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PolicyDetailsTest {
+ private PolicyDetails policyDetails;
+
+ @Before
+ public void setUp() {
+ policyDetails = new PolicyDetails();
+ }
+
+ @Test
+ public void testGetSetPolicyId() {
+ policyDetails.setPolicyId(1);
+ Integer expected = 1;
+ Assert.assertEquals(expected, policyDetails.getPolicyId());
+ }
+
+ @Test
+ public void testGetSetPolicyName() {
+ policyDetails.setPolicyName("PolicyName");
+ String expected = "PolicyName";
+ Assert.assertEquals(expected, policyDetails.getPolicyName());
+ }
+
+ @Test
+ public void testGetSetPolicyResponse() {
+ policyDetails.setPolicyResponse("PolicyResponse");
+ String expected = "PolicyResponse";
+ Assert.assertEquals(expected, policyDetails.getPolicyResponse());
+ }
+
+ @Test
+ public void testGetSetCreatedTime() throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+ Date date = dateFormat.parse("23/09/2007");
+ long time = date.getTime();
+ Timestamp timeStamp = new Timestamp(time);
+ policyDetails.setCreatedTime(timeStamp);
+ String expected = "PolicyResponse";
+ Assert.assertEquals(timeStamp, policyDetails.getCreatedTime());
+ }
+
+
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/ServiceParameterTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/ServiceParameterTest.java
new file mode 100644
index 00000000..42118a5d
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/ServiceParameterTest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.apps.ms.neng.persistence.entity;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ServiceParameterTest {
+ private ServiceParameter serviceParameter;
+
+ @Before
+ public void setUp() {
+ serviceParameter = new ServiceParameter();
+ }
+
+ @Test
+ public void testGetSetServiceParameterId() {
+ serviceParameter.setServiceParameterId(1);
+ Integer expected = 1;
+ Assert.assertEquals(expected, serviceParameter.getServiceParameterId());
+ }
+
+ @Test
+ public void testGetSetName() {
+ serviceParameter.setName("Name");
+ String expected = "Name";
+ Assert.assertEquals(expected, serviceParameter.getName());
+ }
+
+ @Test
+ public void testGetSetValue() {
+ serviceParameter.setValue("Value");
+ String expected = "Value";
+ Assert.assertEquals(expected, serviceParameter.getValue());
+ }
+
+ @Test
+ public void testGetSetCreatedTime() throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+ Date date = dateFormat.parse("23/09/2007");
+ long time = date.getTime();
+ Timestamp timeStamp = new Timestamp(time);
+ serviceParameter.setCreatedTime(timeStamp);
+ Assert.assertEquals(timeStamp, serviceParameter.getCreatedTime());
+ }
+
+ @Test
+ public void testGetSetCreatedBy() {
+ serviceParameter.setCreatedBy("CreatedBy");
+ String expected = "CreatedBy";
+ Assert.assertEquals(expected, serviceParameter.getCreatedBy());
+ }
+
+ @Test
+ public void testGetSetLastUpdatedBy() {
+ serviceParameter.setLastUpdatedBy("LastUpdatedBy");
+ String expected = "LastUpdatedBy";
+ Assert.assertEquals(expected, serviceParameter.getLastUpdatedBy());
+ }
+
+ @Test
+ public void testGetSetLastUpdatedTime() throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+ Date date = dateFormat.parse("23/09/2007");
+ long time = date.getTime();
+ Timestamp timeStamp = new Timestamp(time);
+ serviceParameter.setLastUpdatedTime(timeStamp);
+ Assert.assertEquals(timeStamp, serviceParameter.getLastUpdatedTime());
+ }
+}
diff --git a/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/UnassignVlanTagResponseTest.java b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/UnassignVlanTagResponseTest.java
new file mode 100644
index 00000000..4712d14e
--- /dev/null
+++ b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/UnassignVlanTagResponseTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright © 2018 IBM.
+ *
+ * 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.ms.vlangtagapi.core.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.apps.ms.vlantagapi.core.model.UnassignVlanTagResponse;
+import org.onap.ccsdk.apps.ms.vlantagapi.core.model.UnassignVlanTagResponseOutput;
+
+public class UnassignVlanTagResponseTest {
+
+ private UnassignVlanTagResponse unassignVlanTagResponse;
+ private UnassignVlanTagResponse unassignVlanTagResponse1;
+
+ @Before
+ public void setUp()
+ {
+ unassignVlanTagResponse= new UnassignVlanTagResponse();
+ unassignVlanTagResponse1= new UnassignVlanTagResponse();
+ }
+
+ @Test
+ public void testOutput()
+ {
+ List<UnassignVlanTagResponseOutput> output= new ArrayList<>();
+ unassignVlanTagResponse.output(output);
+ assertEquals(output, unassignVlanTagResponse.getOutput());
+ }
+
+ @Test
+ public void testErrorCode()
+ {
+ unassignVlanTagResponse.errorCode(200);
+ Integer errorCode=200;
+ assertEquals(errorCode, unassignVlanTagResponse.getErrorCode());
+ }
+
+ @Test
+ public void testErrorMessage()
+ {
+ unassignVlanTagResponse.errorMessage("testErrorMessage");
+ assertEquals("testErrorMessage", unassignVlanTagResponse.getErrorMessage());
+ }
+
+ @Test
+ public void testEqualsAndHashCode()
+ {
+ assertTrue(unassignVlanTagResponse.equals(unassignVlanTagResponse1));
+ assertTrue((Integer)unassignVlanTagResponse.hashCode() instanceof Integer);
+ }
+}