File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM openjdk:8-jre-alpine
2+ ADD build/libs/demo-0.0.1-SNAPSHOT.jar app.jar
3+ EXPOSE 8082
4+ ENTRYPOINT ["java" ,"-jar" ,"/app.jar" ]
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -e
3+ docker login -u mogronalol -p $DOCKER_PASSWORD
4+ docker build -t mogronalol/mesos-marathon-demo:$BUILD_NUMBER .
5+ docker push mogronalol/mesos-marathon-demo:$BUILD_NUMBER
Original file line number Diff line number Diff line change 1+ {
2+ "id" : " mesos-marathon-demo" ,
3+ "container" : {
4+ "type" : " DOCKER" ,
5+ "docker" : {
6+ "image" : " " ,
7+ "network" : " BRIDGE" ,
8+ "portMappings" : [
9+ { "containerPort" : 8082 , "hostPort" : 0 }
10+ ]
11+ },
12+ "volumes" : []
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <modelVersion >4.0.0</modelVersion >
6+
7+ <groupId >com.baeldung</groupId >
8+ <artifactId >mesos-marathon</artifactId >
9+ <version >0.0.1-SNAPSHOT</version >
10+
11+ <parent >
12+ <groupId >org.springframework.boot</groupId >
13+ <artifactId >spring-boot-starter-parent</artifactId >
14+ <version >1.5.1.RELEASE</version >
15+ </parent >
16+
17+ <dependencies >
18+ <dependency >
19+ <groupId >org.springframework.boot</groupId >
20+ <artifactId >spring-boot-starter-web</artifactId >
21+ </dependency >
22+ <dependency >
23+ <groupId >org.springframework.boot</groupId >
24+ <artifactId >spring-boot-starter-test</artifactId >
25+ <scope >test</scope >
26+ </dependency >
27+ </dependencies >
28+
29+ <build >
30+ <plugins >
31+ <plugin >
32+ <groupId >org.springframework.boot</groupId >
33+ <artifactId >spring-boot-maven-plugin</artifactId >
34+ <version >1.5.1.RELEASE</version >
35+ <executions >
36+ <execution >
37+ <goals >
38+ <goal >repackage</goal >
39+ </goals >
40+ </execution >
41+ </executions >
42+ </plugin >
43+ </plugins >
44+ </build >
45+
46+ </project >
Original file line number Diff line number Diff line change 1+ package com .mogronalol ;
2+
3+ import org .springframework .boot .SpringApplication ;
4+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5+
6+ import javax .annotation .PostConstruct ;
7+
8+ @ SpringBootApplication
9+ public class DemoApplication {
10+
11+ public static void main (String [] args ) {
12+ SpringApplication .run (DemoApplication .class , args );
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package com .mogronalol ;
2+
3+ import org .springframework .stereotype .Controller ;
4+ import org .springframework .web .bind .annotation .GetMapping ;
5+ import org .springframework .web .bind .annotation .ResponseBody ;
6+ import org .springframework .web .bind .annotation .RestController ;
7+
8+ @ RestController (value = "/" )
9+ public class HelloController {
10+
11+ @ GetMapping
12+ @ ResponseBody
13+ public String getMapping () {
14+ return "Hello world" ;
15+ }
16+
17+ }
Original file line number Diff line number Diff line change 1+ server.port =8082
Original file line number Diff line number Diff line change 1+ package com .mogronalol ;
2+
3+ import org .junit .Before ;
4+ import org .junit .Test ;
5+ import org .junit .runner .RunWith ;
6+ import org .springframework .boot .context .embedded .LocalServerPort ;
7+ import org .springframework .boot .test .context .SpringBootTest ;
8+ import org .springframework .test .context .ContextConfiguration ;
9+ import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
10+ import org .springframework .web .client .RestTemplate ;
11+
12+ import static org .assertj .core .api .Assertions .assertThat ;
13+
14+ @ RunWith (SpringJUnit4ClassRunner .class )
15+ @ SpringBootTest (classes = {DemoApplication .class }, webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
16+ public class DemoApplicationTests {
17+
18+ private RestTemplate restTemplate ;
19+
20+ @ LocalServerPort
21+ private int port ;
22+
23+ @ Before
24+ public void setUp () {
25+ restTemplate = new RestTemplate ();
26+ }
27+
28+ @ Test
29+ public void contextLoads () {
30+ final String result = restTemplate .getForObject ("http://localhost:" + port + "/" , String .class );
31+ assertThat (result ).isEqualTo ("Hello world" );
32+ }
33+
34+ }
Original file line number Diff line number Diff line change 7979
8080 <module >mapstruct</module >
8181 <module >metrics</module >
82+ <module >mesos-marathon</module >
8283 <module >mockito</module >
8384 <module >mocks</module >
8485
You can’t perform that action at this time.
0 commit comments