diff options
Diffstat (limited to 'ms')
4 files changed, 386 insertions, 145 deletions
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()); + } +} |