Skip to content
Permalink
Browse files

demo

  • Loading branch information...
clun committed Oct 20, 2018
1 parent 4b3c2de commit 0894820dde3a9d3e29e3a526d558f265fdc943d3
Showing with 356 additions and 235 deletions.
  1. BIN .DS_Store
  2. BIN ff4j-sample-springboot/src/.DS_Store
  3. +16 −8 ff4j-voxxeddays-ticino-2018/customerOrderService/pom.xml
  4. +20 −12 ...oxxeddays-ticino-2018/customerOrderService/src/main/java/org/ff4j/voxxeddays/conf/FF4jConfig.java
  5. +7 −3 ...ticino-2018/customerOrderService/src/main/java/org/ff4j/voxxeddays/controller/HomeController.java
  6. +3 −0 ff4j-voxxeddays-ticino-2018/customerOrderService/src/main/resources/application.properties
  7. +48 −2 ff4j-voxxeddays-ticino-2018/customerOrderService/src/main/resources/static/css/main.css
  8. BIN ff4j-voxxeddays-ticino-2018/customerOrderService/src/main/resources/static/img/shopping-cart.png
  9. +12 −5 ff4j-voxxeddays-ticino-2018/customerOrderService/src/main/resources/templates/welcome.html
  10. +14 −8 ff4j-voxxeddays-ticino-2018/customerSupportService/pom.xml
  11. +18 −10 ...xeddays-ticino-2018/customerSupportService/src/main/java/org/ff4j/voxxeddays/conf/FF4jConfig.java
  12. +6 −2 ...cino-2018/customerSupportService/src/main/java/org/ff4j/voxxeddays/controller/HomeController.java
  13. +3 −0 ff4j-voxxeddays-ticino-2018/customerSupportService/src/main/resources/application.properties
  14. +46 −1 ff4j-voxxeddays-ticino-2018/customerSupportService/src/main/resources/static/css/main.css
  15. BIN ff4j-voxxeddays-ticino-2018/customerSupportService/src/main/resources/static/img/support.png
  16. +13 −5 ff4j-voxxeddays-ticino-2018/customerSupportService/src/main/resources/templates/welcome.html
  17. +1 −1 ff4j-voxxeddays-ticino-2018/demo-console/.springBeans
  18. +34 −1 ff4j-voxxeddays-ticino-2018/demo-console/pom.xml
  19. +18 −0 ff4j-voxxeddays-ticino-2018/demo-console/src/main/java/org/ff4j/springboot/HomeController.java
  20. +3 −4 ...no-2018/demo-console/src/main/java/org/ff4j/springboot/{DemoConsoleApp.java → SpringBootApp.java}
  21. +73 −65 ...voxxeddays-ticino-2018/demo-console/src/main/java/org/ff4j/springboot/conf/FF4jConfiguration.java
  22. +0 −44 ...voxxeddays-ticino-2018/demo-console/src/main/java/org/ff4j/springboot/conf/FF4jServletConfig.java
  23. +0 −40 ff4j-voxxeddays-ticino-2018/demo-console/src/main/java/org/ff4j/springboot/rsc/HomeResource.java
  24. +12 −20 ff4j-voxxeddays-ticino-2018/demo-console/src/main/resources/application.properties
  25. +9 −4 ff4j-voxxeddays-ticino-2018/pom.xml
BIN +0 Bytes (100%) .DS_Store
Binary file not shown.
Binary file not shown.
@@ -16,32 +16,40 @@

<dependencies>

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

<!-- Dependencies for WEB -->
<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>







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

</dependencies>

</project>
@@ -1,7 +1,8 @@
package org.ff4j.voxxeddays.conf;

import org.ff4j.FF4j;
import org.ff4j.audit.repository.InMemoryEventRepository;
import org.ff4j.cassandra.CassandraConnection;
import org.ff4j.cassandra.store.EventRepositoryCassandra;
import org.ff4j.consul.ConsulConnection;
import org.ff4j.consul.store.FeatureStoreConsul;
import org.ff4j.consul.store.PropertyStoreConsul;
@@ -14,25 +15,32 @@
@Configuration
public class FF4jConfig {

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

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

// Connectivity to Cassandra
@Value("${cassandra.host:localhost}")
private String cassandraHost;
@Value("${cassandra.port:9042}")
private int cassandraPort;

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

@Bean
public FF4j ff4j(Consul c) {
public FF4j ff4j() {
FF4j ff4j = new FF4j().audit(true).autoCreate(true);
ConsulConnection connection = new ConsulConnection(c);

// Features in Consul
ConsulConnection connection = new ConsulConnection(
Consul.builder().withUrl("http://" + consulHost + ":" + consulPort).build());
ff4j.setFeatureStore(new FeatureStoreConsul(connection));
ff4j.setPropertiesStore(new PropertyStoreConsul(connection));
ff4j.setEventRepository(new InMemoryEventRepository());

// Events into Cassandra
ff4j.setEventRepository(
new EventRepositoryCassandra(
new CassandraConnection(cassandraHost, cassandraPort)));
return ff4j;
}

}
@@ -15,9 +15,13 @@

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


model.put("featureCallUs", ff4j.check("CallUS"));

if (ff4j.getPropertiesStore().existProperty("phoneNumber")) {
model.put("phoneNumber", ff4j.getProperty("phoneNumber").asString());
}

return "welcome";
}

@@ -16,3 +16,6 @@ spring.cloud.consul.discovery.tags=name=customerOrder
spring.cloud.consul.discovery.healthCheckPath=/customerOrder/health
spring.cloud.consul.discovery.healthCheckInterval=15s

# Cassandra
cassandra.host=localhost
cassandra.port=9042
@@ -1,7 +1,53 @@
h1{
color:#0000FF;
color:#008800;
}

h2{
color:#FF0000;
}
}

.button {
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 12px 24px;
border: 1px solid #a12727;
border-radius: 8px;
background: #ff4a4a;
background: -webkit-gradient(linear, left top, left bottom, from(#ff4a4a), to(#992727));
background: -moz-linear-gradient(top, #ff4a4a, #992727);
background: linear-gradient(to bottom, #ff4a4a, #992727);
text-shadow: #591717 1px 1px 1px;
font: normal normal bold 20px arial;
color: #ffffff;
text-decoration: none;
}
.button:hover,
.button:focus {
background: #ff5959;
background: -webkit-gradient(linear, left top, left bottom, from(#ff5959), to(#b62f2f));
background: -moz-linear-gradient(top, #ff5959, #b62f2f);
background: linear-gradient(to bottom, #ff5959, #b62f2f);
color: #ffffff;
text-decoration: none;
}
.button:active {
background: #982727;
background: -webkit-gradient(linear, left top, left bottom, from(#982727), to(#982727));
background: -moz-linear-gradient(top, #982727, #982727);
background: linear-gradient(to bottom, #982727, #982727);
}
.button:before{
content: "\0000a0";
display: inline-block;
height: 24px;
width: 24px;
line-height: 24px;
margin: 0 4px -6px -4px;
position: relative;
top: 0px;
left: 0px;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABc0lEQVRIia3Wv0odQRQG8J9elRsFIYi+gKX9xSoxIPZ5AZ9AfAFFuD6BiEVKsZf0IWKRJqS3El8hqcTrn7ukcBbXYWZ3rnhg2e/MnPN9Z3dmzu6UvK1jE7MtMfCIn/idmpzOJA1wjoUW4nG4L4TYQSpoJpO8hVPsNQrZxcfg/8MxqijnT6nALO6jsapRdRXNPci8jZwAfEEv4HGEl7Af/B4+4XJSgZpsEjyRwCUO0Q/+qAX3ZKzrCfq4DngNVwm82kbQJVCLdOE3C4yw3PBz+M0C9f6HE+wk8HGJUGxDHGAet+FayeD5RvzETzDycpr/ZvCojaBLoMK3gJ8ifNSRi3yzq62PG89bdbGB50rISwR43XfiHtRpJWtQH6SHCL+LQExWTFwi0OymXbaBi9REyRrE8amc7NqUdNMm+a9A9jkiHbZVlLJHfEiM5yqdy81NZRIG+I4z3IWxXqOgmmwcCtnGV4lvck6Al9+WrnWq8CNFDv8BKHRTjq8C8ZsAAAAASUVORK5CYII=") no-repeat left center transparent;
background-size: 100% 100%;
}

Binary file not shown.
@@ -2,17 +2,20 @@
<html xmlns:th="http://www.thymeleaf.org">

<head>
<title>Customer Order Service</title>
<title>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">
<nav class="navbar navbar-inverse" style="background-color:#008800">
<div class="container">
<img th:src="@{/img/shopping-cart.png}" style="padding-top:5px" />
<div class="navbar-header">
<a class="navbar-brand" href="#">Customer Order Service</a>
<a class="navbar-brand" href="#" style="color:white">
Customer Order Service
</a>
</div>
</div>
</nav>
@@ -21,8 +24,12 @@

<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 th:if="${featureCallUs}">
<a class="button" href="#">Call US</a>
<div th:if="${phoneNumber}">
<span th:text="'Phone Number ' + ${phoneNumber}"></span>
</div>
</div>

</div>

@@ -16,32 +16,38 @@

<dependencies>

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

<!-- Dependencies for WEB -->
<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>




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


</dependencies>

</project>
@@ -1,7 +1,8 @@
package org.ff4j.voxxeddays.conf;

import org.ff4j.FF4j;
import org.ff4j.audit.repository.InMemoryEventRepository;
import org.ff4j.cassandra.CassandraConnection;
import org.ff4j.cassandra.store.EventRepositoryCassandra;
import org.ff4j.consul.ConsulConnection;
import org.ff4j.consul.store.FeatureStoreConsul;
import org.ff4j.consul.store.PropertyStoreConsul;
@@ -16,22 +17,29 @@

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

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

@Bean
public Consul consul() {
return Consul.builder().withUrl("http://" + consulHost + ":" + consulPort).build();
}
// Connectivity to Cassandra
@Value("${cassandra.host:localhost}")
private String cassandraHost;
@Value("${cassandra.port:9042}")
private int cassandraPort;

@Bean
public FF4j ff4j(Consul c) {
public FF4j ff4j() {
FF4j ff4j = new FF4j().audit(true).autoCreate(true);
ConsulConnection connection = new ConsulConnection(c);

// Features in Consul
ConsulConnection connection = new ConsulConnection(
Consul.builder().withUrl("http://" + consulHost + ":" + consulPort).build());
ff4j.setFeatureStore(new FeatureStoreConsul(connection));
ff4j.setPropertiesStore(new PropertyStoreConsul(connection));
ff4j.setEventRepository(new InMemoryEventRepository());

// Events into Cassandra
ff4j.setEventRepository(
new EventRepositoryCassandra(
new CassandraConnection(cassandraHost, cassandraPort)));
return ff4j;
}

@@ -15,8 +15,12 @@

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

if (ff4j.getPropertiesStore().existProperty("phoneNumber")) {
model.put("phoneNumber", ff4j.getProperty("phoneNumber").asString());
}

return "welcome";
}
@@ -16,3 +16,6 @@ spring.cloud.consul.discovery.tags=name=customerSupport
spring.cloud.consul.discovery.healthCheckPath=/customerSupport/health
spring.cloud.consul.discovery.healthCheckInterval=15s

# Cassandra
cassandra.host=localhost
cassandra.port=9042
@@ -4,4 +4,49 @@ h1{

h2{
color:#FF0000;
}
}

.button {
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 12px 24px;
border: 1px solid #a12727;
border-radius: 8px;
background: #ff4a4a;
background: -webkit-gradient(linear, left top, left bottom, from(#ff4a4a), to(#992727));
background: -moz-linear-gradient(top, #ff4a4a, #992727);
background: linear-gradient(to bottom, #ff4a4a, #992727);
text-shadow: #591717 1px 1px 1px;
font: normal normal bold 20px arial;
color: #ffffff;
text-decoration: none;
}
.button:hover,
.button:focus {
background: #ff5959;
background: -webkit-gradient(linear, left top, left bottom, from(#ff5959), to(#b62f2f));
background: -moz-linear-gradient(top, #ff5959, #b62f2f);
background: linear-gradient(to bottom, #ff5959, #b62f2f);
color: #ffffff;
text-decoration: none;
}
.button:active {
background: #982727;
background: -webkit-gradient(linear, left top, left bottom, from(#982727), to(#982727));
background: -moz-linear-gradient(top, #982727, #982727);
background: linear-gradient(to bottom, #982727, #982727);
}
.button:before{
content: "\0000a0";
display: inline-block;
height: 24px;
width: 24px;
line-height: 24px;
margin: 0 4px -6px -4px;
position: relative;
top: 0px;
left: 0px;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABc0lEQVRIia3Wv0odQRQG8J9elRsFIYi+gKX9xSoxIPZ5AZ9AfAFFuD6BiEVKsZf0IWKRJqS3El8hqcTrn7ukcBbXYWZ3rnhg2e/MnPN9Z3dmzu6UvK1jE7MtMfCIn/idmpzOJA1wjoUW4nG4L4TYQSpoJpO8hVPsNQrZxcfg/8MxqijnT6nALO6jsapRdRXNPci8jZwAfEEv4HGEl7Af/B4+4XJSgZpsEjyRwCUO0Q/+qAX3ZKzrCfq4DngNVwm82kbQJVCLdOE3C4yw3PBz+M0C9f6HE+wk8HGJUGxDHGAet+FayeD5RvzETzDycpr/ZvCojaBLoMK3gJ8ifNSRi3yzq62PG89bdbGB50rISwR43XfiHtRpJWtQH6SHCL+LQExWTFwi0OymXbaBi9REyRrE8amc7NqUdNMm+a9A9jkiHbZVlLJHfEiM5yqdy81NZRIG+I4z3IWxXqOgmmwcCtnGV4lvck6Al9+WrnWq8CNFDv8BKHRTjq8C8ZsAAAAASUVORK5CYII=") no-repeat left center transparent;
background-size: 100% 100%;
}
Binary file not shown.

0 comments on commit 0894820

Please sign in to comment.
You can’t perform that action at this time.