Skip to content

Commit ee455cb

Browse files
author
Vitalii Cherkashyn
committed
examples from different sources
1 parent 9e28c79 commit ee455cb

File tree

62 files changed

+3225
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3225
-0
lines changed

Diff for: catalog-spring-boot/.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
target/
2+
*.iml
3+
*.log
4+
*.class
5+
tmp/
6+
.idea/
7+
.openshiftio
8+
.settings/
9+
.classpath
10+
.project
11+
.DS_Store
12+
bower_components/
13+
node_modules/

Diff for: catalog-spring-boot/pom.xml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
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">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.redhat.cloudnative</groupId>
7+
<artifactId>catalog</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<name>CoolStore Catalog Service</name>
10+
<description>CoolStore Catalog Service with Spring Boot</description>
11+
<properties>
12+
<spring-boot.version>1.4.1.RELEASE</spring-boot.version>
13+
<spring-boot.bom.version>1</spring-boot.bom.version>
14+
<fabric8.version>2.3.4</fabric8.version>
15+
<spring.k8s.bom.version>0.2.0.RELEASE</spring.k8s.bom.version>
16+
<k8s.client.version>2.4.1</k8s.client.version>
17+
<fabric8.maven.plugin.version>3.5.32</fabric8.maven.plugin.version>
18+
<postgresql.version>9.4.1212</postgresql.version>
19+
</properties>
20+
<dependencyManagement>
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.jboss.snowdrop</groupId>
24+
<artifactId>spring-boot-1.4-bom</artifactId>
25+
<version>${spring-boot.bom.version}</version>
26+
<type>pom</type>
27+
<scope>import</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.cloud</groupId>
31+
<artifactId>spring-cloud-kubernetes-dependencies</artifactId>
32+
<version>${spring.k8s.bom.version}</version>
33+
<type>pom</type>
34+
<scope>import</scope>
35+
</dependency>
36+
</dependencies>
37+
</dependencyManagement>
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter-web</artifactId>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.springframework.boot</groupId>
45+
<artifactId>spring-boot-starter-data-jpa</artifactId>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.springframework.boot</groupId>
49+
<artifactId>spring-boot-starter-actuator</artifactId>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.springframework.cloud</groupId>
53+
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
54+
</dependency>
55+
<dependency>
56+
<groupId>io.fabric8</groupId>
57+
<artifactId>kubernetes-client</artifactId>
58+
<version>${k8s.client.version}</version>
59+
</dependency>
60+
<dependency>
61+
<groupId>com.h2database</groupId>
62+
<artifactId>h2</artifactId>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.postgresql</groupId>
66+
<artifactId>postgresql</artifactId>
67+
<version>${postgresql.version}</version>
68+
</dependency>
69+
</dependencies>
70+
<build>
71+
<plugins>
72+
<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-compiler-plugin</artifactId>
75+
<version>3.6.1</version>
76+
<configuration>
77+
<source>1.8</source>
78+
<target>1.8</target>
79+
</configuration>
80+
</plugin>
81+
<plugin>
82+
<groupId>org.springframework.boot</groupId>
83+
<artifactId>spring-boot-maven-plugin</artifactId>
84+
<version>${spring-boot.version}</version>
85+
<executions>
86+
<execution>
87+
<goals>
88+
<goal>repackage</goal>
89+
</goals>
90+
</execution>
91+
</executions>
92+
<configuration>
93+
<jvmArguments>-Djava.net.preferIPv4Stack=true -Dserver.port=9000 -Dspring.cloud.kubernetes.enabled=false</jvmArguments>
94+
</configuration>
95+
</plugin>
96+
<plugin>
97+
<groupId>io.fabric8</groupId>
98+
<artifactId>fabric8-maven-plugin</artifactId>
99+
<version>${fabric8.maven.plugin.version}</version>
100+
<executions>
101+
<execution>
102+
<goals>
103+
<goal>resource</goal>
104+
<goal>build</goal>
105+
</goals>
106+
</execution>
107+
</executions>
108+
<configuration>
109+
<resources>
110+
<labels>
111+
<all>
112+
<property>
113+
<name>app</name>
114+
<value>catalog</value>
115+
</property>
116+
</all>
117+
</labels>
118+
</resources>
119+
<enricher>
120+
<excludes>
121+
<exclude>spring-boot-health-check</exclude>
122+
</excludes>
123+
</enricher>
124+
<generator>
125+
<includes>
126+
<include>spring-boot</include>
127+
</includes>
128+
<config>
129+
<spring-boot>
130+
<from>registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:1.1</from>
131+
</spring-boot>
132+
</config>
133+
</generator>
134+
</configuration>
135+
</plugin>
136+
</plugins>
137+
</build>
138+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.redhat.cloudnative.catalog;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class CatalogApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(CatalogApplication.class, args);
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.redhat.cloudnative.catalog;
2+
3+
import java.util.List;
4+
import java.util.Spliterator;
5+
import java.util.stream.Collectors;
6+
import java.util.stream.StreamSupport;
7+
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.http.MediaType;
10+
import org.springframework.stereotype.Controller;
11+
import org.springframework.web.bind.annotation.GetMapping;
12+
import org.springframework.web.bind.annotation.RequestMapping;
13+
import org.springframework.web.bind.annotation.ResponseBody;
14+
15+
@Controller
16+
@RequestMapping(value = "/api/catalog")
17+
public class CatalogController {
18+
19+
@Autowired
20+
private ProductRepository repository;
21+
22+
@ResponseBody
23+
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
24+
public List<Product> getAll() {
25+
Spliterator<Product> products = repository.findAll().spliterator();
26+
return StreamSupport.stream(products, false).collect(Collectors.toList());
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.redhat.cloudnative.catalog;
2+
3+
import java.io.Serializable;
4+
5+
import javax.persistence.Entity;
6+
import javax.persistence.Id;
7+
import javax.persistence.Table;
8+
import javax.persistence.UniqueConstraint;
9+
10+
@Entity
11+
@Table(name = "PRODUCT", uniqueConstraints = @UniqueConstraint(columnNames = "itemId"))
12+
public class Product implements Serializable {
13+
14+
@Id
15+
private String itemId;
16+
17+
private String name;
18+
19+
private String description;
20+
21+
private double price;
22+
23+
public Product() {
24+
}
25+
26+
public String getItemId() {
27+
return itemId;
28+
}
29+
30+
public void setItemId(String itemId) {
31+
this.itemId = itemId;
32+
}
33+
34+
public String getName() {
35+
return name;
36+
}
37+
38+
public void setName(String name) {
39+
this.name = name;
40+
}
41+
42+
public String getDescription() {
43+
return description;
44+
}
45+
46+
public void setDescription(String description) {
47+
this.description = description;
48+
}
49+
50+
public double getPrice() {
51+
return price;
52+
}
53+
54+
public void setPrice(double price) {
55+
this.price = price;
56+
}
57+
58+
@Override
59+
public String toString() {
60+
return "Product [itemId=" + itemId + ", name=" + name + ", price=" + price + "]";
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.redhat.cloudnative.catalog;
2+
3+
import org.springframework.data.repository.CrudRepository;
4+
5+
public interface ProductRepository extends CrudRepository<Product, String> {
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
spring.application.name=catalog
2+
3+
spring.datasource.url=jdbc:h2:mem:fruits;DB_CLOSE_ON_EXIT=FALSE
4+
spring.datasource.username=sa
5+
spring.datasource.password=
6+
spring.datasource.driver-class-name=org.h2.Driver

Diff for: catalog-spring-boot/src/main/resources/import.sql

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('329299', 'Red Fedora', 'Official Red Hat Fedora', 34.99);
2+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('329199', 'Forge Laptop Sticker', 'JBoss Community Forge Project Sticker', 8.50);
3+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('165613', 'Solid Performance Polo', 'Moisture-wicking, antimicrobial 100% polyester design wicks for life of garment. No-curl, rib-knit collar...', 17.80)
4+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('165614', 'Ogio Caliber Polo', 'Moisture-wicking 100% polyester. Rib-knit collar and cuffs; Ogio jacquard tape insitem_ide neck; bar-tacked three-button placket with...', 28.75)
5+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('165954', '16 oz. Vortex Tumbler', 'Double-wall insulated, BPA-free, acrylic cup. Push-on litem_id with thumb-slitem_ide closure; for hot and cold beverages. Holds 16 oz. Hand wash only. Imprint. Clear.', 6.00)
6+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('444434', 'Pebble Smart Watch', 'Smart glasses and smart watches are perhaps two of the most exciting developments in recent years. ', 24.00)
7+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('444435', 'Oculus Rift', 'The world of gaming has also undergone some very unique and compelling tech advances in recent years. Virtual reality...', 106.00)
8+
INSERT INTO PRODUCT (item_id, name, description, price) VALUES ('444436', 'Lytro Camera', 'Consumers who want to up their photography game are looking at newfangled cameras like the Lytro Field camera, designed to ...', 44.30)

Diff for: gateway-vertx/.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
target/
2+
*.iml
3+
*.log
4+
*.class
5+
tmp/
6+
.idea/
7+
.openshiftio
8+
.settings/
9+
.classpath
10+
.project
11+
.DS_Store
12+
bower_components/
13+
node_modules/

0 commit comments

Comments
 (0)