Commit f05dbd9f authored by Marco Ortiz's avatar Marco Ortiz

Preparación para la integración con el nuevo jenkins

parent cffb5d6b
pipeline {
agent any
tools {
maven 'Maven'
jdk "jdk-11.0.1"
jdk "jdk8"
}
stages {
stage ('Initialize') {
steps {
sh '''
echo "PATH = ${PATH}"
echo "M2_HOME = ${M2_HOME}"
'''
}
}
stage('Build') {
steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn -B -DskipTests clean package'
}
}
}
stage('Test') {
steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn test'
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('Code Quality Check via SonarQube') {
steps {
withEnv(["JAVA_HOME=${tool 'jdk8'}", "PATH=${tool 'jdk8'}/bin:${env.PATH}"]) {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn -DskipTests sonar:sonar \
-Dsonar.projectKey=bytebot-service_$BRANCH_NAME \
-Dsonar.projectName=bytebot-service_$BRANCH_NAME \
-Dsonar.sources=src/main/java/ \
-Dsonar.language=java \
-Dsonar.java.binaries=target/classes \
-Dsonar.junit.reportsPath=target/surefire-reports \
-Dsonar.jacoco.reportPaths=target/jacoco.exec \
-Dsonar.cobertura.reportPath=target/site/cobertura/coverage.xml \
-Dsonar.clover.reportPath=target/clover.xml \
-Dsonar.dynamicAnalysis=reuseReports \
-Dsonar.java.coveragePlugin=plugin \
-Dsonar.jacoco.reportMissing.force.zero=true \
-Dsonar.host.url=http://byteswpe-sonar.tbs.com:9000 \
-Dsonar.login=d09303420d51f36385b4613d29ee98978ca2ebe4'
}}
}
}
stage('Deploy') {
steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn -DskipTests deploy'
}
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.bytesw.xdf</groupId>
<artifactId>byteXDF4Java-arq</artifactId>
<version>3.2.0-SNAPSHOT</version>
</parent>
<groupId>com.bytesw.bytebot</groupId> <groupId>com.bytesw.bytebot</groupId>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>bytebot-service</artifactId> <artifactId>bytebot-service</artifactId>
...@@ -16,19 +10,27 @@ ...@@ -16,19 +10,27 @@
<properties> <properties>
<xdf.version>3.2.0-SNAPSHOT</xdf.version> <xdf.version>3.2.0-SNAPSHOT</xdf.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<camel.version>2.22.0</camel.version> <camel.version>2.22.0</camel.version>
<mainclass>com.bytesw.bytebot.BytebotApplication</mainclass> <mainclass>com.bytesw.bytebot.BytebotApplication</mainclass>
<jacoco.version>0.8.5</jacoco.version>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>java</sonar.language>
<docker.image.prefix>bytesw</docker.image.prefix> <docker.image.prefix>bytesw</docker.image.prefix>
<docker.image.name>bytebot-service</docker.image.name> <docker.image.name>bytebot-service</docker.image.name>
<packaging.type>war</packaging.type> <packaging.type>war</packaging.type>
<json-path.version>2.4.0</json-path.version> <json-path.version>2.4.0</json-path.version>
<org.everit.json.schema.version>1.5.1</org.everit.json.schema.version> <org.everit.json.schema.version>1.5.1</org.everit.json.schema.version>
<jacoco.version>0.8.5</jacoco.version>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>java</sonar.language>
<sonar.exclusions></sonar.exclusions>
</properties> </properties>
<dependencies> <dependencies>
...@@ -289,9 +291,11 @@ ...@@ -289,9 +291,11 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration> <configuration>
<runOrder>random</runOrder> <runOrder>random</runOrder>
</configuration> </configuration>
...@@ -300,16 +304,6 @@ ...@@ -300,16 +304,6 @@
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version> <version>${jacoco.version}</version>
<configuration>
<skip>${maven.test.skip}</skip>
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
<output>file</output>
<append>true</append>
<excludes>
<exclude>*MethodAccess</exclude>
</excludes>
</configuration>
<executions> <executions>
<execution> <execution>
<id>jacoco-initialize</id> <id>jacoco-initialize</id>
...@@ -320,7 +314,7 @@ ...@@ -320,7 +314,7 @@
</execution> </execution>
<execution> <execution>
<id>jacoco-site</id> <id>jacoco-site</id>
<phase>verify</phase> <phase>test</phase>
<goals> <goals>
<goal>report</goal> <goal>report</goal>
</goals> </goals>
...@@ -493,4 +487,30 @@ ...@@ -493,4 +487,30 @@
</profiles> </profiles>
<!-- SOPORTE AL XDF -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.bytesw.xdf</groupId>
<artifactId>byteXDF4Java-arq</artifactId>
<version>${xdf.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>maven-releases</id>
<name>Repository Release</name>
<url>http://byteswpe-nexus.tbs.com:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<name>RepositoryProxy</name>
<url>http://byteswpe-nexus.tbs.com:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project> </project>
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
package com.bytesw.bytebot.controller; package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.http.FileValidationResponse;
import com.bytesw.bytebot.service.AgentService; import com.bytesw.bytebot.service.AgentService;
import com.bytesw.bytebot.service.FileManagementService; import com.bytesw.bytebot.service.FileManagementService;
import com.bytesw.xdf.config.security.annotation.DummyPermissionEvaluator; import com.bytesw.xdf.config.security.annotation.DummyPermissionEvaluator;
...@@ -85,7 +86,9 @@ public class AgentControllerTest { ...@@ -85,7 +86,9 @@ public class AgentControllerTest {
"application/vnd.ms-excel", "application/vnd.ms-excel",
"my-xls-file".getBytes()); "my-xls-file".getBytes());
Mockito.when(fileManagementService.validateAndSaveFile(anyString(), eq(xlsFile) ))
.thenReturn(new FileValidationResponse());
mvc.perform(MockMvcRequestBuilders.multipart(baseService + "/file-upload") mvc.perform(MockMvcRequestBuilders.multipart(baseService + "/file-upload")
.file(xlsFile)) .file(xlsFile))
.andExpect(status().isOk()); .andExpect(status().isOk());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment