Add integration test for sliboot docker
[ccsdk/apps.git] / ms / sliboot / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3     <modelVersion>4.0.0</modelVersion>
4
5     <parent>
6         <groupId>org.onap.ccsdk.parent</groupId>
7         <artifactId>spring-boot-starter-parent</artifactId>
8         <version>2.1.0-SNAPSHOT</version>
9         <relativePath/>
10     </parent>
11
12     <groupId>org.onap.ccsdk.apps</groupId>
13     <artifactId>sliboot</artifactId>
14     <version>1.1.0-SNAPSHOT</version>
15     <packaging>jar</packaging>
16
17     <name>ccsdk-apps :: sliboot :: ${project.artifactId}</name>
18
19     <properties>
20         <start-class>org.onap.ccsdk.apps.ms.sliboot.SlibootApp</start-class>
21         <shiro.version>1.5.0</shiro.version>
22         <aaf-shiro-bundle.version>2.1.13</aaf-shiro-bundle.version>
23         <base.image.name>onap/ccsdk-alpine-image</base.image.name>
24         <base.image.version>1.1-STAGING-latest</base.image.version>
25         <image.name>onap/ccsdk-sliboot-alpine-image</image.name>
26         <ccsdk.project.version>${project.version}</ccsdk.project.version>
27         <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp>
28         <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
29         <ccsdk.sliboot.jar>${project.artifactId}-${project.version}-exec.jar</ccsdk.sliboot.jar>
30         <docker.push.phase>deploy</docker.push.phase>
31         <docker.verbose>true</docker.verbose>
32         <docker.autoCreateCustomNetworks>true</docker.autoCreateCustomNetworks>
33     </properties>
34
35     <dependencies>
36         <dependency>
37             <groupId>io.swagger</groupId>
38             <artifactId>swagger-annotations</artifactId>
39         </dependency>
40         <dependency>
41             <groupId>org.apache.shiro</groupId>
42             <artifactId>shiro-spring-boot-web-starter</artifactId>
43             <version>${shiro.version}</version>
44             <exclusions>
45                 <exclusion>
46                     <groupId>org.springframework.boot</groupId>
47                     <artifactId>spring-boot-starter-logging</artifactId>
48                 </exclusion>
49             </exclusions>
50         </dependency>
51         <dependency>
52             <groupId>org.springframework.boot</groupId>
53             <artifactId>spring-boot-starter-log4j2</artifactId>
54         </dependency>
55         <dependency>
56             <groupId>org.springframework.boot</groupId>
57             <artifactId>spring-boot-starter-validation</artifactId>
58         </dependency>
59         <dependency>
60             <groupId>org.onap.aaf.cadi</groupId>
61             <artifactId>aaf-cadi-shiro</artifactId>
62             <version>${aaf-shiro-bundle.version}</version>
63         </dependency>
64
65         <dependency>
66             <groupId>org.springframework.boot</groupId>
67             <artifactId>spring-boot-starter-test</artifactId>
68             <scope>test</scope>
69         </dependency>
70         <dependency>
71             <groupId>org.springframework.boot</groupId>
72             <artifactId>spring-boot-starter-data-jpa</artifactId>
73         </dependency>
74         <dependency>
75             <groupId>io.springfox</groupId>
76             <artifactId>springfox-swagger2</artifactId>
77             <version>2.9.2</version>
78         </dependency>
79         <dependency>
80             <groupId>io.springfox</groupId>
81             <artifactId>springfox-swagger-ui</artifactId>
82             <version>2.9.2</version>
83         </dependency>
84         <dependency>
85             <groupId>${project.groupId}</groupId>
86             <artifactId>services</artifactId>
87             <version>${project.version}</version>
88         </dependency>
89         <dependency>
90             <groupId>org.onap.ccsdk.sli.core</groupId>
91             <artifactId>dblib-provider</artifactId>
92             <version>${ccsdk.sli.core.version}</version>
93         </dependency>
94         <dependency>
95             <groupId>org.onap.ccsdk.sli.core</groupId>
96             <artifactId>sli-common</artifactId>
97             <version>${ccsdk.sli.core.version}</version>
98         </dependency>
99         <dependency>
100             <groupId>org.onap.ccsdk.sli.core</groupId>
101             <artifactId>sli-provider-base</artifactId>
102             <version>${ccsdk.sli.core.version}</version>
103         </dependency>
104         <dependency>
105             <groupId>com.google.code.gson</groupId>
106             <artifactId>gson</artifactId>
107         </dependency>
108         <dependency>
109             <groupId>org.apache.derby</groupId>
110             <artifactId>derby</artifactId>
111             <scope>test</scope>
112         </dependency>
113         <dependency>
114             <groupId>org.mariadb.jdbc</groupId>
115             <artifactId>mariadb-java-client</artifactId>
116         </dependency>
117         <dependency>
118             <groupId>junit</groupId>
119             <artifactId>junit</artifactId>
120             <scope>test</scope>
121         </dependency>
122         <dependency>
123             <groupId>org.onap.logging-analytics</groupId>
124             <artifactId>logging-filter-spring</artifactId>
125             <version>1.6.6</version>
126         </dependency>
127         <dependency>
128             <groupId>javax.ws.rs</groupId>
129             <artifactId>javax.ws.rs-api</artifactId>
130         </dependency>
131         <dependency>
132             <groupId>org.onap.ccsdk.sli.core</groupId>
133             <artifactId>sliPluginUtils-provider</artifactId>
134             <version>${ccsdk.sli.core.version}</version>
135         </dependency>
136         <dependency>
137             <groupId>org.onap.ccsdk.sli.plugins</groupId>
138             <artifactId>restapi-call-node-provider</artifactId>
139             <version>${ccsdk.sli.plugins.version}</version>
140         </dependency>
141         <dependency>
142             <groupId>org.onap.ccsdk.sli.plugins</groupId>
143             <artifactId>properties-node-provider</artifactId>
144             <version>${ccsdk.sli.plugins.version}</version>
145         </dependency>
146         <!-- this jersey jar is needed for rest api call node to function properly -->
147         <dependency>
148             <groupId>org.glassfish.jersey.inject</groupId>
149             <artifactId>jersey-hk2</artifactId>
150         </dependency>
151     </dependencies>
152
153     <build>
154         <plugins>
155             <plugin>
156                 <groupId>org.codehaus.groovy.maven</groupId>
157                 <artifactId>gmaven-plugin</artifactId>
158                 <executions>
159                     <execution>
160                         <phase>validate</phase>
161                         <goals>
162                             <goal>execute</goal>
163                         </goals>
164                         <configuration>
165                             <source>${basedir}/TagVersion.groovy</source>
166                         </configuration>
167                     </execution>
168                 </executions>
169             </plugin>
170
171             <plugin>
172                 <groupId>org.apache.maven.plugins</groupId>
173                 <artifactId>maven-dependency-plugin</artifactId>
174                 <version>2.10</version>
175
176                 <executions>
177                     <execution>
178                         <id>get-sliapi-yaml</id>
179                         <phase>initialize</phase>
180                         <goals>
181                             <goal>copy</goal>
182                         </goals>
183                         <configuration>
184                             <artifactItems>
185                                 <artifactItem>
186                                     <groupId>org.onap.ccsdk.sli.core</groupId>
187                                     <artifactId>sliapi-model-swagger</artifactId>
188                                     <version>${ccsdk.sli.core.version}</version>
189                                     <type>yaml</type>
190                                     <outputDirectory>${project.build.directory}/yaml</outputDirectory>
191                                     <destFileName>sliapi.yaml</destFileName>
192                                 </artifactItem>
193                             </artifactItems>
194                         </configuration>
195                     </execution>
196                     <execution>
197                         <id>copy-dependencies</id>
198                         <goals>
199                             <goal>copy-dependencies</goal>
200                         </goals>
201                         <phase>prepare-package</phase>
202                         <configuration>
203                             <excludeTransitive>true</excludeTransitive>
204                             <outputDirectory>${project.build.directory}/docker-stage/opt/onap/ccsdk/lib</outputDirectory>
205                             <overWriteReleases>false</overWriteReleases>
206                             <overWriteSnapshots>true</overWriteSnapshots>
207                             <overWriteIfNewer>true</overWriteIfNewer>
208                             <useRepositoryLayout>false</useRepositoryLayout>
209                             <addParentPoms>false</addParentPoms>
210                             <copyPom>false</copyPom>
211                         </configuration>
212                     </execution>
213                     <execution>
214                         <id>unpack dgs</id>
215                         <phase>generate-sources</phase>
216                         <goals>
217                             <goal>unpack</goal>
218                         </goals>
219                         <configuration>
220                             <outputDirectory>${basedir}/target/docker-stage/opt/onap/ccsdk</outputDirectory>
221                             <artifactItems>
222                                 <artifactItem>
223                                     <groupId>org.onap.ccsdk.distribution</groupId>
224                                     <artifactId>platform-logic-installer</artifactId>
225                                     <version>${project.version}</version>
226                                     <type>zip</type>
227                                 </artifactItem>
228                             </artifactItems>
229                         </configuration>
230                     </execution>
231                 </executions>
232             </plugin>
233             <plugin>
234                 <groupId>io.swagger</groupId>
235                 <artifactId>swagger-codegen-maven-plugin</artifactId>
236                 <version>2.3.1</version>
237                 <executions>
238                     <execution>
239                         <phase>generate-sources</phase>
240                         <goals>
241                             <goal>generate</goal>
242                         </goals>
243                         <configuration>
244                             <output>target/generated-sources</output>
245                             <inputSpec>${project.build.directory}/yaml/sliapi.yaml</inputSpec>
246                             <language>spring</language>
247                             <apiPackage>org.onap.ccsdk.apps.ms.sliboot.swagger</apiPackage>
248                             <modelPackage>org.onap.ccsdk.apps.ms.sliboot.swagger.model</modelPackage>
249                             <invokerPackage>org.onap.ccsdk.apps.ms.sliboot.swagger</invokerPackage>
250                             <generateApis>true</generateApis>
251                             <generateApiTests>true</generateApiTests>
252                             <ignoreFileOverride>${project.basedir}/.swagger-codegen-ignore</ignoreFileOverride>
253                             <withXml>true</withXml>
254                             <templateDirectory>${project.basedir}/src/main/templates</templateDirectory>
255                             <configOptions>
256                                 <java8>true</java8>
257                                 <springBootVersion>2.2.4-RELEASE</springBootVersion>
258                             </configOptions>
259                         </configuration>
260                     </execution>
261                 </executions>
262             </plugin>
263             <plugin>
264                 <groupId>org.springframework.boot</groupId>
265                 <artifactId>spring-boot-maven-plugin</artifactId>
266                 <configuration>
267                     <classifier>exec</classifier>
268                 </configuration>
269                 <executions>
270                     <execution>
271                         <goals>
272                             <goal>repackage</goal>
273                         </goals>
274                     </execution>
275                 </executions>
276             </plugin>
277             <plugin>
278                 <groupId>org.apache.maven.plugins</groupId>
279                 <artifactId>maven-surefire-plugin</artifactId>
280                 <version>2.19.1</version>
281                 <configuration>
282                     <forkMode>always</forkMode>
283                     <environmentVariables>
284                         <SDNC_CONFIG_DIR>${basedir}/src/test/resources</SDNC_CONFIG_DIR>
285                         <SVCLOGIC_PROPERTIES>${basedir}/src/test/resources/svclogic.properties</SVCLOGIC_PROPERTIES>
286                     </environmentVariables>
287                 </configuration>
288             </plugin>
289             <plugin>
290                 <groupId>org.apache.maven.plugins</groupId>
291                 <artifactId>maven-failsafe-plugin</artifactId>
292                 <executions>
293                   <execution>
294                     <goals>
295                       <goal>integration-test</goal>
296                       <goal>verify</goal>
297                     </goals>
298                   </execution>
299                 </executions>
300                 <configuration>
301                   <skipITs>true</skipITs>
302                 </configuration>
303               </plugin>
304               <plugin>
305                 <artifactId>maven-resources-plugin</artifactId>
306                 <version>2.6</version>
307                 <executions>
308                     <execution>
309                         <id>copy-dockerfile</id>
310                         <goals>
311                             <goal>copy-resources</goal>
312                         </goals><!-- here the phase you need -->
313                         <phase>initialize</phase>
314                         <configuration>
315                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
316                             <resources>
317                                 <resource>
318                                     <directory>src/main/docker</directory>
319                                     <includes>
320                                         <include>Dockerfile</include>
321                                     </includes>
322                                     <filtering>true</filtering>
323                                 </resource>
324                             </resources>
325                         </configuration>
326                     </execution>
327                     <execution>
328                         <id>copy-config</id>
329                         <goals>
330                             <goal>copy-resources</goal>
331                         </goals><!-- here the phase you need -->
332                         <phase>generate-resources</phase>
333                         <configuration>
334                             <outputDirectory>${basedir}/target/docker-stage/opt/onap/ccsdk/config</outputDirectory>
335                             <resources>
336                                 <resource>
337                                     <directory>src/main/resources</directory>
338                                     <includes>
339                                         <include>*.properties</include>
340                                         <include>*.props</include>
341                                         <include>*.sql</include>
342                                     </includes>
343                                     <filtering>true</filtering>
344                                 </resource>
345                                 <resource>
346                                     <directory>src/main/resources</directory>
347                                     <includes>
348                                         <include>*.keyfile</include>
349                                         <include>*.jks</include>
350                                         <include>*.p12</include>
351                                     </includes>
352                                     <filtering>false</filtering>
353                                 </resource>
354                             </resources>
355                         </configuration>
356                     </execution>
357                     <execution>
358                         <id>copy-script</id>
359                         <goals>
360                             <goal>copy-resources</goal>
361                         </goals><!-- here the phase you need -->
362                         <phase>generate-resources</phase>
363                         <configuration>
364                             <outputDirectory>${basedir}/target/docker-stage/opt/onap/ccsdk/bin</outputDirectory>
365                             <resources>
366                                 <resource>
367                                     <directory>src/main/resources</directory>
368                                     <includes>
369                                         <include>*.sh</include>
370                                     </includes>
371                                     <filtering>true</filtering>
372                                 </resource>
373                             </resources>
374                         </configuration>
375                     </execution>
376                     <execution>
377                         <id>copy-jar</id>
378                         <goals>
379                             <goal>copy-resources</goal>
380                         </goals><!-- here the phase you need -->
381                         <phase>package</phase>
382                         <configuration>
383                             <outputDirectory>${basedir}/target/docker-stage/opt/onap/ccsdk/lib</outputDirectory>
384                             <resources>
385                                 <resource>
386                                     <directory>${basedir}/target</directory>
387                                     <includes>
388                                         <include>${ccsdk.sliboot.jar}</include>
389                                     </includes>
390                                     <filtering>false</filtering>
391                                 </resource>
392                             </resources>
393                         </configuration>
394                     </execution>
395                 </executions>
396             </plugin>
397
398         </plugins>
399     </build>
400
401     <profiles>
402         <profile>
403             <id>docker</id>
404             <build>
405                 <plugins>
406                     <plugin>
407                         <groupId>org.apache.maven.plugins</groupId>
408                         <artifactId>maven-failsafe-plugin</artifactId>
409                         <executions>
410                           <execution>
411                             <goals>
412                               <goal>integration-test</goal>
413                               <goal>verify</goal>
414                             </goals>
415                           </execution>
416                         </executions>
417                         <configuration>
418                           <skipITs>false</skipITs>
419                           <environmentVariables>
420                             <SLIBOOT_PORT>${sliboot.port}</SLIBOOT_PORT>
421                           </environmentVariables>
422                         </configuration>
423                       </plugin>
424                     <plugin>
425                         <groupId>io.fabric8</groupId>
426                         <artifactId>docker-maven-plugin</artifactId>
427                         <version>0.28.0</version>
428                         <inherited>false</inherited>
429                         <configuration>
430                             <images>
431                                 <image>
432                                     <name>${image.name}</name>
433                                     <build>
434                                         <cleanup>try</cleanup>
435                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
436                                         <dockerFile>Dockerfile</dockerFile>
437                                         <tags>
438                                             <tag>${project.docker.latestminortag.version}</tag>
439                                             <tag>${project.docker.latestfulltag.version}</tag>
440                                             <tag>${project.docker.latesttagtimestamp.version}</tag>
441                                         </tags>
442                                     </build>
443                                 </image>
444                             </images>
445                         </configuration>
446                         <executions>
447                             <execution>
448                                 <id>generate-images</id>
449                                 <phase>package</phase>
450                                 <goals>
451                                     <goal>build</goal>
452                                 </goals>
453                             </execution>
454         
455                             <execution>
456                                 <id>start-it-instance</id>
457                                 <phase>pre-integration-test</phase>
458                                 <goals>
459                                     <goal>start</goal>
460                                 </goals>
461                                 <configuration>
462                                     <images>
463                                         <image>
464                                             <name>mariadb:10.5</name>
465                                             <alias>slibootdb</alias>
466                                             <run>
467                                                 <env>
468                                                     <MYSQL_ROOT_PASSWORD>itsASecret</MYSQL_ROOT_PASSWORD>
469                                                     <MYSQL_USER>sli</MYSQL_USER>
470                                                     <MYSQL_PASSWORD>abc123</MYSQL_PASSWORD>
471                                                     <MYSQL_DATABASE>sdnctl</MYSQL_DATABASE>
472                                                 </env>
473                                                 <network>
474                                                     <mode>custom</mode>
475                                                     <name>onap</name>
476                                                     <alias>dbhost</alias>
477                                                 </network>
478                                                 <ports>
479                                                     <port>slibootdb.port:3306</port>
480                                                 </ports>
481                                                 <log>
482                                                     <enabled>true</enabled>
483                                                 </log>
484                                             </run>
485                                         </image>
486                                         <image>
487                                             <name>${image.name}:${project.docker.latesttagtimestamp.version}</name>
488                                             <alias>sliboot-container</alias>
489                                             <run>
490                                                 <env>
491                                                     <MYSQL_USER>sli</MYSQL_USER>
492                                                     <MYSQL_PASSWORD>abc123</MYSQL_PASSWORD>
493                                                     <MYSQL_DATABASE>sdnctl</MYSQL_DATABASE>
494                                                     <SDNC_CONFIG_DIR>/opt/onap/ccsdk/config</SDNC_CONFIG_DIR>
495                                                 </env>
496                                                 <dependsOn>
497                                                     <container>slibootdb</container>
498                                                 </dependsOn>
499                                                 <network>
500                                                     <mode>custom</mode>
501                                                     <name>onap</name>
502                                                     <alias>sliboot</alias>
503                                                 </network>
504                                                 <ports>
505                                                     <port>sliboot.port:8080</port>
506                                                 </ports>
507                                                 <wait>
508                                                     <log>Started SlibootApp</log>
509                                                     <time>120000</time>
510                                                 </wait>
511                                                 <log>
512                                                     <enabled>true</enabled>
513                                                 </log>
514                                             </run>
515                                         </image>
516                                     </images>
517                                 </configuration>
518                             </execution>
519                             <execution>
520                                 <id>stop-it-instance</id>
521                                 <phase>post-integration-test</phase>
522                                 <goals>
523                                     <goal>stop</goal>
524                                 </goals>
525                             </execution>
526                             <execution>
527                                 <id>push-images</id>
528                                 <phase>${docker.push.phase}</phase>
529                                 <goals>
530                                     <goal>build</goal>
531                                     <goal>push</goal>
532                                 </goals>
533                             </execution>
534                         </executions>
535                     </plugin>
536
537                 </plugins>
538             </build>
539         </profile>
540     </profiles>
541 </project>