Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
clun committed Oct 18, 2018
1 parent 81316fb commit 4b3c2de
Show file tree
Hide file tree
Showing 44 changed files with 1,031 additions and 0 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added ff4j-sample-sergii/.DS_Store
Binary file not shown.
Binary file added ff4j-sample-sergii/src/.DS_Store
Binary file not shown.
Binary file added ff4j-sample-sergii/src/test/.DS_Store
Binary file not shown.
Binary file added ff4j-sample-sergii/src/test/java/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added ff4j-voxxeddays-ticino-2018/.DS_Store
Binary file not shown.
47 changes: 47 additions & 0 deletions ff4j-voxxeddays-ticino-2018/customerOrderService/pom.xml
@@ -0,0 +1,47 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>customerOrderService</artifactId>
<name> + customerOrderService</name>
<packaging>jar</packaging>

<parent>
<groupId>org.ff4j.samples</groupId>
<artifactId>demo-voxxeddays</artifactId>
<version>1.7.1</version>
</parent>

<dependencies>

<dependency>
<groupId>org.ff4j</groupId>
<artifactId>ff4j-store-consul</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

</dependencies>

</project>
@@ -0,0 +1,18 @@
package org.ff4j.voxxeddays;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
* Customer Services.
*/
@SpringBootApplication
@EnableDiscoveryClient
public class CustomerOrderApp {

public static void main(String[] args) {
SpringApplication.run(CustomerOrderApp.class, args);
}

}
@@ -0,0 +1,38 @@
package org.ff4j.voxxeddays.conf;

import org.ff4j.FF4j;
import org.ff4j.audit.repository.InMemoryEventRepository;
import org.ff4j.consul.ConsulConnection;
import org.ff4j.consul.store.FeatureStoreConsul;
import org.ff4j.consul.store.PropertyStoreConsul;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.orbitz.consul.Consul;

@Configuration
public class FF4jConfig {

@Value("${spring.cloud.consul.host:localhost}")
private String consulHost;

@Value("${spring.cloud.consul.port:5000}")
private int consulPort;

@Bean
public Consul consul() {
return Consul.builder().withUrl("http://" + consulHost + ":" + consulPort).build();
}

@Bean
public FF4j ff4j(Consul c) {
FF4j ff4j = new FF4j().audit(true).autoCreate(true);
ConsulConnection connection = new ConsulConnection(c);
ff4j.setFeatureStore(new FeatureStoreConsul(connection));
ff4j.setPropertiesStore(new PropertyStoreConsul(connection));
ff4j.setEventRepository(new InMemoryEventRepository());
return ff4j;
}

}
@@ -0,0 +1,24 @@
package org.ff4j.voxxeddays.controller;

import java.util.Map;

import org.ff4j.FF4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController {

@Autowired
private FF4j ff4j;

@RequestMapping("/")
public String welcome(Map<String, Object> model) {
model.put("message", "OK");
model.put("ff4j_feature_TEST", ff4j.check("TEST"));

return "welcome";
}

}
@@ -0,0 +1,18 @@
# --------------------------------------------------- #
# --- Customer Order Service --- #
# --------------------------------------------------- #

# Define Server Port
server.port=8081
server.contextPath=/customerOrder

# General Informations
spring.application.name=Customer Order Service

# Consul
spring.cloud.consul.host=localhost
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.tags=name=customerOrder
spring.cloud.consul.discovery.healthCheckPath=/customerOrder/health
spring.cloud.consul.discovery.healthCheckInterval=15s

@@ -0,0 +1,7 @@
h1{
color:#0000FF;
}

h2{
color:#FF0000;
}
@@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">

<head>
<title>Customer Order Service</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" th:href="@{/css/main.css}" href="../../css/main.css" />
</head>
<body>

<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Customer Order Service</a>
</div>
</div>
</nav>

<div class="container">

<div class="starter-template">
<h1> Customer Order Service </h1>
<li><span th:text="'Message: ' + ${message}"></span></li>
<li><span th:text="'Message: ' + ${ff4j_feature_TEST}"></span></li>

</div>

</div>
<!-- /.container -->

<script type="text/javascript"
src="webjars/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</body>
</html>
47 changes: 47 additions & 0 deletions ff4j-voxxeddays-ticino-2018/customerSupportService/pom.xml
@@ -0,0 +1,47 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>customerSupportService</artifactId>
<name> + customerSupportService</name>
<packaging>jar</packaging>

<parent>
<groupId>org.ff4j.samples</groupId>
<artifactId>demo-voxxeddays</artifactId>
<version>1.7.1</version>
</parent>

<dependencies>

<dependency>
<groupId>org.ff4j</groupId>
<artifactId>ff4j-store-consul</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

</dependencies>

</project>
@@ -0,0 +1,18 @@
package org.ff4j.voxxeddays;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
* Customer Services.
*/
@SpringBootApplication
@EnableDiscoveryClient
public class CustomerSupportApp {

public static void main(String[] args) {
SpringApplication.run(CustomerSupportApp.class, args);
}

}
@@ -0,0 +1,38 @@
package org.ff4j.voxxeddays.conf;

import org.ff4j.FF4j;
import org.ff4j.audit.repository.InMemoryEventRepository;
import org.ff4j.consul.ConsulConnection;
import org.ff4j.consul.store.FeatureStoreConsul;
import org.ff4j.consul.store.PropertyStoreConsul;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.orbitz.consul.Consul;

@Configuration
public class FF4jConfig {

@Value("${spring.cloud.consul.host:localhost}")
private String consulHost;

@Value("${spring.cloud.consul.port:5000}")
private int consulPort;

@Bean
public Consul consul() {
return Consul.builder().withUrl("http://" + consulHost + ":" + consulPort).build();
}

@Bean
public FF4j ff4j(Consul c) {
FF4j ff4j = new FF4j().audit(true).autoCreate(true);
ConsulConnection connection = new ConsulConnection(c);
ff4j.setFeatureStore(new FeatureStoreConsul(connection));
ff4j.setPropertiesStore(new PropertyStoreConsul(connection));
ff4j.setEventRepository(new InMemoryEventRepository());
return ff4j;
}

}
@@ -0,0 +1,24 @@
package org.ff4j.voxxeddays.controller;

import java.util.Map;

import org.ff4j.FF4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController {

@Autowired
private FF4j ff4j;

@RequestMapping("/")
public String welcome(Map<String, Object> model) {
model.put("message", "OK");
model.put("ff4j_feature_TEST", ff4j.check("TEST"));

return "welcome";
}

}
@@ -0,0 +1,18 @@
# --------------------------------------------------- #
# --- Customer Order Service --- #
# --------------------------------------------------- #

# Define Server Port
server.port=8082
server.contextPath=/customerSupport

# General Informations
spring.application.name=Customer Support Service

# Consul
spring.cloud.consul.host=localhost
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.tags=name=customerSupport
spring.cloud.consul.discovery.healthCheckPath=/customerSupport/health
spring.cloud.consul.discovery.healthCheckInterval=15s

@@ -0,0 +1,7 @@
h1{
color:#0000FF;
}

h2{
color:#FF0000;
}
@@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">

<head>
<title>Customer Order Service</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" th:href="@{/css/main.css}" href="../../css/main.css" />
</head>
<body>

<nav class="navbar navbar-inverse" style="background-color:#000088">
<div class="container">
<div class="navbar-header" >
<a class="navbar-brand" href="#">Support Service</a>
</div>
</div>
</nav>

<div class="container">

<div class="starter-template">
<h1> Customer Order Service </h1>
<li><span th:text="'Message: ' + ${message}"></span></li>
<li><span th:text="'Message: ' + ${ff4j_feature_TEST}"></span></li>

</div>

</div>
<!-- /.container -->

<script type="text/javascript"
src="webjars/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</body>
</html>
Binary file not shown.

0 comments on commit 4b3c2de

Please sign in to comment.