Aufgrund der aktuellen Instabilität des Gitlabs wurden alle Shell-Runner deaktiviert. Bitte auf docker-runner umsteigen. Bei Fragen wendet euch bitte an Thomas Pohl oder Daniel Weisser.

Commit a1fcfee9 authored by Jan Hauer's avatar Jan Hauer 🌄

Init

parents
Pipeline #74403 passed with stage
in 1 minute and 6 seconds
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
include:
- { project: 'demo/ci/pipeline', file: '/maven/app.yml' }
# Demo Projekt
Zeigt die Verwendung von Include bei der GitLabCi
## Status Master
[![pipeline status](https://gitlabci.exxeta.com/demo/ci/groovy/badges/master/pipeline.svg)](https://gitlabci.exxeta.com/demo/gitlabci/commits/master)
[![coverage report](https://gitlabci.exxeta.com/demo/ci/groovy/badges/master/coverage.svg)](https://gitlabci.exxeta.com/demo/gitlabci/commits/master)⏎
\ No newline at end of file
<?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"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.exxeta</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Gitlab CI</description>
<properties>
<java.version>1.8</java.version>
<spock.version>1.3-groovy-2.5</spock.version>
<jacoco-maven-plugin.version>0.8.4</jacoco-maven-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-spring</artifactId>
<version>${spock.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6.3</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>compileTests</goal>
<goal>removeStubs</goal>
<goal>removeTestStubs</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useFile>false</useFile>
<includes>
<include>**/*Test.java</include>
<include>**/*IT.java</include>
<include>**/*Spec.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/DemoApplication.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>agent-for-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>agent-for-it</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package com.exxeta.demo
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
@SpringBootApplication
class DemoApplication {
static void main(String[] args) {
SpringApplication.run(DemoApplication, args)
}
}
package com.exxeta.demo
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController
@RestController
class WebController {
@GetMapping
def hello () {
"Hello World"
}
@GetMapping("/{name}")
def helloName (@PathVariable String name) {
"Hello $name"
}
}
package com.exxeta.demo
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.ApplicationContext
import spock.lang.Specification
@SpringBootTest
class LoadContext extends Specification {
@Autowired (required = false)
ApplicationContext applicationContext
def "load context"() {
expect:
applicationContext
}
}
\ No newline at end of file
package com.exxeta.demo
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
import org.springframework.test.web.servlet.MockMvc
import spock.lang.Specification
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
@WebMvcTest
class WebControllerSpec extends Specification {
@Autowired
MockMvc mvc
def hello() {
expect:
def body = mvc.perform(get("/")).andExpect(status().isOk()).andReturn().response.contentAsString
and:
body == "Hello World"
}
def helloName() {
expect:
def body = mvc.perform(get("/Hans")).andExpect(status().isOk()).andReturn().response.contentAsString
and:
body == "Hello Hans"
}
}
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