22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/fortune-teller-ui/src/main/java/io/spring/cloud/samples/fortuneteller/ui/Application.java:
--------------------------------------------------------------------------------
1 | package io.spring.cloud.samples.fortuneteller.ui;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.client.loadbalancer.LoadBalanced;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.web.client.RestTemplate;
10 |
11 | @SpringBootApplication
12 | @EnableDiscoveryClient
13 | @EnableCircuitBreaker
14 | public class Application {
15 |
16 | @Bean
17 | @LoadBalanced
18 | public RestTemplate restTemplate() {
19 | return new RestTemplate();
20 | }
21 |
22 | public static void main(String[] args) {
23 | SpringApplication.run(Application.class, args);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/fortune-teller-ui/src/main/java/io/spring/cloud/samples/fortuneteller/ui/services/fortunes/FortuneService.java:
--------------------------------------------------------------------------------
1 | package io.spring.cloud.samples.fortuneteller.ui.services.fortunes;
2 |
3 | import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
6 | import org.springframework.stereotype.Service;
7 | import org.springframework.web.client.RestTemplate;
8 |
9 | @Service
10 | @EnableConfigurationProperties(FortuneProperties.class)
11 | public class FortuneService {
12 |
13 | @Autowired
14 | FortuneProperties fortuneProperties;
15 |
16 | @Autowired
17 | RestTemplate restTemplate;
18 |
19 | @HystrixCommand(fallbackMethod = "fallbackFortune")
20 | public Fortune randomFortune() {
21 | return restTemplate.getForObject("http://fortunes/random", Fortune.class);
22 | }
23 |
24 | private Fortune fallbackFortune() {
25 | return new Fortune(42L, fortuneProperties.getFallbackFortune());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/fortune-teller-fortune-service/src/main/java/io/spring/cloud/samples/fortuneteller/fortuneservice/controllers/FortuneController.java:
--------------------------------------------------------------------------------
1 | package io.spring.cloud.samples.fortuneteller.fortuneservice.controllers;
2 |
3 | import io.spring.cloud.samples.fortuneteller.fortuneservice.domain.Fortune;
4 | import io.spring.cloud.samples.fortuneteller.fortuneservice.respositories.FortuneRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.data.domain.PageRequest;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import java.util.List;
11 |
12 | @RestController
13 | public class FortuneController {
14 |
15 | @Autowired
16 | FortuneRepository repository;
17 |
18 | @RequestMapping("/fortunes")
19 | public Iterable fortunes() {
20 | return repository.findAll();
21 | }
22 |
23 | @RequestMapping("/random")
24 | public Fortune randomFortune() {
25 | List randomFortunes = repository.randomFortunes(new PageRequest(0, 1));
26 | return randomFortunes.get(0);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/fortune-teller-eureka/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.spring.cloud.samples
7 | fortune-teller-eureka
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | fortune-teller-eureka
12 | Eureka Server
13 |
14 |
15 | io.spring.cloud.samples
16 | fortune-teller
17 | 0.0.1-SNAPSHOT
18 | ../pom.xml
19 |
20 |
21 |
22 | io.spring.cloud.samples.fortuneteller.eureka.Application
23 |
24 |
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-starter-eureka-server
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/fortune-teller-hystrix-dashboard/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.spring.cloud.samples
7 | fortune-teller-hystrix-dashboard
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | fortune-teller-hystrix-dashboard
12 | Hystrix Dashboard
13 |
14 |
15 | io.spring.cloud.samples
16 | fortune-teller
17 | 0.0.1-SNAPSHOT
18 | ../pom.xml
19 |
20 |
21 |
22 | io.spring.cloud.samples.fortuneteller.hystrixdashboard.Application
23 |
24 |
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-starter-hystrix-dashboard
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/fortune-teller-config-server/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.spring.cloud.samples
7 | fortune-teller-config-server
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | fortune-teller-config-server
12 | Config Server
13 |
14 |
15 | io.spring.cloud.samples
16 | fortune-teller
17 | 0.0.1-SNAPSHOT
18 | ../pom.xml
19 |
20 |
21 |
22 | io.spring.cloud.samples.fortuneteller.configserver.Application
23 |
24 |
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-config-server
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/fortune-teller-ui/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.spring.cloud.samples
7 | fortune-teller-ui
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | fortune-teller-ui
12 | Fortune Teller UI
13 |
14 |
15 | io.spring.cloud.samples
16 | fortune-teller
17 | 0.0.1-SNAPSHOT
18 | ../pom.xml
19 |
20 |
21 |
22 | io.spring.cloud.samples.fortuneteller.ui.Application
23 |
24 |
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-config-client
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-starter-eureka
33 |
34 |
35 | org.springframework.cloud
36 | spring-cloud-starter-hystrix
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/fortune-teller-fortune-service/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.spring.cloud.samples
7 | fortune-teller-fortune-service
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | fortune-teller-fortune-service
12 | Fortunes Service
13 |
14 |
15 | io.spring.cloud.samples
16 | fortune-teller
17 | 0.0.1-SNAPSHOT
18 |
19 |
20 |
21 | io.spring.cloud.samples.fortuneteller.fortuneservice.Application
22 |
23 |
24 |
25 |
26 | org.springframework.cloud
27 | spring-cloud-config-client
28 |
29 |
30 | org.springframework.cloud
31 | spring-cloud-starter-eureka
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-data-jpa
36 |
37 |
38 | org.hsqldb
39 | hsqldb
40 |
41 |
42 | org.mariadb.jdbc
43 | mariadb-java-client
44 | 1.1.7
45 |
46 |
47 |
48 |
49 |
50 |
51 | au.com.dius
52 | pact-jvm-provider-maven_2.11
53 | 2.1.13
54 |
55 |
56 |
57 | FortuneService
58 |
59 |
60 | FortuneUi
61 | ../fortune-teller-ui/target/pacts/FortuneUi-FortuneService.json
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/fortune-teller-ui/src/test/java/io/spring/cloud/samples/fortuneteller/ui/services/fortunes/FortuneServicePactTest.java:
--------------------------------------------------------------------------------
1 | package io.spring.cloud.samples.fortuneteller.ui.services.fortunes;
2 |
3 |
4 | import au.com.dius.pact.consumer.*;
5 | import au.com.dius.pact.model.PactFragment;
6 | import io.spring.cloud.samples.fortuneteller.ui.Application;
7 | import org.junit.Rule;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.boot.test.SpringApplicationConfiguration;
12 | import org.springframework.test.context.ActiveProfiles;
13 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
14 | import org.springframework.test.context.web.WebAppConfiguration;
15 |
16 | import java.util.HashMap;
17 | import java.util.Map;
18 |
19 | import static org.hamcrest.Matchers.*;
20 | import static org.junit.Assert.assertNotNull;
21 | import static org.junit.Assert.assertThat;
22 |
23 | @RunWith(SpringJUnit4ClassRunner.class)
24 | @SpringApplicationConfiguration(classes = Application.class)
25 | @WebAppConfiguration
26 | @ActiveProfiles({"pact"})
27 | public class FortuneServicePactTest {
28 |
29 | @Autowired
30 | FortuneService fortuneService;
31 |
32 | @Rule
33 | public PactRule rule = new PactRule("localhost", 8080, this);
34 |
35 | @Pact(state = "FortuneState", provider = "FortuneService", consumer = "FortuneUi")
36 | public PactFragment createFragment(ConsumerPactBuilder.PactDslWithProvider.PactDslWithState builder) {
37 | Map headers = new HashMap<>();
38 | headers.put("Content-Type", "application/json;charset=UTF-8");
39 |
40 | PactDslJsonBody responseBody = new PactDslJsonBody()
41 | .numberType("id")
42 | .stringType("text");
43 |
44 | return builder.uponReceiving("a request for a random fortune")
45 | .path("/random")
46 | .method("GET")
47 | .willRespondWith()
48 | .headers(headers)
49 | .status(200)
50 | .body(responseBody).toFragment();
51 | }
52 |
53 | @Test
54 | @PactVerification("FortuneState")
55 | public void runTest() {
56 | Fortune fortune = fortuneService.randomFortune();
57 | assertNotNull(fortune);
58 | assertThat(fortune.getId(), is(greaterThan(0L)));
59 | assertThat(fortune.getId(), is(not(equalTo(42L))));
60 | assertThat(fortune.getText(), not(isEmptyOrNullString()));
61 | assertThat(fortune.getText(), is(not(equalTo("Your future is unclear."))));
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/scripts/fortunes.txt:
--------------------------------------------------------------------------------
1 | People are naturally attracted to you.
2 | You learn from your mistakes... You will learn a lot today.
3 | If you have something good in your life, don't let it go!
4 | What ever you're goal is in life, embrace it visualize it, and for it will be yours.
5 | Your shoes will make you happy today.
6 | You cannot love life until you live the life you love.
7 | Be on the lookout for coming events; They cast their shadows beforehand.
8 | Land is always on the mind of a flying bird.
9 | The man or woman you desire feels the same about you.
10 | Meeting adversity well is the source of your strength.
11 | A dream you have will come true.
12 | Our deeds determine us, as much as we determine our deeds.
13 | Never give up. You're not a failure if you don't give up.
14 | You will become great if you believe in yourself.
15 | There is no greater pleasure than seeing your loved ones prosper.
16 | You will marry your lover.
17 | A very attractive person has a message for you.
18 | You already know the answer to the questions lingering inside your head.
19 | It is now, and in this world, that we must live.
20 | You must try, or hate yourself for not trying.
21 | You can make your own happiness.
22 | The greatest risk is not taking one.
23 | The love of your life is stepping into your planet this summer.
24 | Love can last a lifetime, if you want it to.
25 | Adversity is the parent of virtue.
26 | Serious trouble will bypass you.
27 | A short stranger will soon enter your life with blessings to share.
28 | Now is the time to try something new.
29 | Wealth awaits you very soon.
30 | If you feel you are right, stand firmly by your convictions.
31 | If winter comes, can spring be far behind?
32 | Keep your eye out for someone special.
33 | You are very talented in many ways.
34 | A stranger, is a friend you have not spoken to yet.
35 | A new voyage will fill your life with untold memories.
36 | You will travel to many exotic places in your lifetime.
37 | Your ability for accomplishment will follow with success.
38 | Nothing astonishes men so much as common sense and plain dealing.
39 | Its amazing how much good you can do if you dont care who gets the credit.
40 | Everyone agrees. You are the best.
41 | LIFE CONSIST NOT IN HOLDING GOOD CARDS, BUT IN PLAYING THOSE YOU HOLD WELL.
42 | Jealousy doesn't open doors, it closes them!
43 | It's better to be alone sometimes.
44 | When fear hurts you, conquer it and defeat it!
45 | Let the deeds speak.
46 | You will be called in to fulfill a position of high honor and responsibility.
47 | The man on the top of the mountain did not fall there.
48 | You will conquer obstacles to achieve success.
49 | Joys are often the shadows, cast by sorrows.
50 | Fortune favors the brave.
51 |
--------------------------------------------------------------------------------
/README.adoc:
--------------------------------------------------------------------------------
1 | # This repository is no longer actively maintained by VMware, Inc.
2 |
3 |
4 | = Fortune Teller
5 |
6 | *Fortune Teller* is a very basic application composed of two services:
7 |
8 | . link:fortune-teller-fortune-service[Fortune Service] - serves up random Chinese fortune cookie fortunes
9 | . link:fortune-teller-ui[Fortune UI] - presents a UI that consumes the fortune service
10 |
11 | It leverages libraries and services from Spring Cloud and Netflix OSS to compose the system.
12 |
13 | NOTE: Want to deploy Fortune Teller to Pivotal Cloud Foundry environments that have installed the https://network.pivotal.io/products/p-spring-cloud-services[Spring Cloud Services] package? See the link:https://github.com/spring-cloud-services-samples/fortune-teller[SCS version of Fortune Teller].
14 |
15 | == Build
16 |
17 | . Using Maven, build and package the application:
18 | +
19 | ----
20 | $ mvn clean package
21 | ----
22 | +
23 | Maven will automatically download all of _Fortune Teller_'s dependencies. This may take a few moments.
24 |
25 | == Run
26 |
27 | . Start the Config Server
28 | +
29 | ----
30 | $ cd fortune-teller-config-server
31 | $ mvn spring-boot:run
32 | ----
33 |
34 | . Start the Eureka Service
35 | +
36 | ----
37 | $ cd fortune-teller-eureka
38 | $ mvn spring-boot:run
39 | ----
40 |
41 | . Start the Hystrix Dashboard
42 | +
43 | ----
44 | $ cd fortune-teller-hystrix-dashboard
45 | $ mvn spring-boot:run
46 | ----
47 |
48 | . Start the Fortunes Service
49 | +
50 | ----
51 | $ cd fortune-teller-fortune-service
52 | $ mvn spring-boot:run
53 | ----
54 |
55 | . Start the Fortunes UI
56 | +
57 | ----
58 | $ cd fortune-teller-ui
59 | $ mvn spring-boot:run
60 | ----
61 |
62 |
63 | == Test the Application
64 |
65 | . In a browser, access the fortunes-ui application at http://localhost:8081/
66 | +
67 | image:docs/images/fortunes_1.png[]
68 |
69 | . Now, in another browser tab, access the Hystrix Dashboard at http://localhost:7979/hystrix/. Enter the route for the UI application, `http://localhost:8081/hystrix.stream`, and click the ``Monitor Stream.''
70 | +
71 | image:docs/images/fortunes_2.png[]
72 |
73 | . Access the fortunes-ui and show that the circuit breaker is registering successful requests.
74 | +
75 | image:docs/images/fortunes_3.png[]
76 |
77 | . Stop the fortunes application
78 |
79 | . Access the fortunes-ui and see that the ``fallback fortune'' is being returned.
80 | +
81 | image:docs/images/fortunes_4.png[]
82 |
83 | . Access the fortunes-ui and show that the circuit breaker is registering short-circuited requests.
84 | +
85 | image:docs/images/fortunes_5.png[]
86 |
87 | . Restart the fortunes application
88 |
89 | . Continue to access the fortunes-ui and watch the dashboard.
90 | After the fortunes service has re-registered with Eureka and the fortunes-ui load balancer caches are refreshed, you will see the circuit breaker recover.
91 | You should then start getting random fortunes again!
92 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 |
7 | io.spring.cloud.samples
8 | fortune-teller
9 | pom
10 | 0.0.1-SNAPSHOT
11 | Fortune Teller Cloud-Native Application
12 |
13 |
14 | fortune-teller-config-server
15 | fortune-teller-eureka
16 | fortune-teller-fortune-service
17 | fortune-teller-hystrix-dashboard
18 | fortune-teller-ui
19 |
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter-parent
24 | 1.3.7.RELEASE
25 |
26 |
27 |
28 |
29 | UTF-8
30 | 1.8
31 |
32 |
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-starter-web
37 |
38 |
39 | org.springframework.boot
40 | spring-boot-starter-actuator
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-starter-test
45 | test
46 |
47 |
48 | au.com.dius
49 | pact-jvm-consumer-junit_2.11
50 | 2.1.13
51 | test
52 |
53 |
54 | org.hamcrest
55 | hamcrest-all
56 | 1.3
57 | test
58 |
59 |
60 |
61 |
62 |
63 |
64 | org.springframework.cloud
65 | spring-cloud-dependencies
66 | Brixton.SR5
67 | pom
68 | import
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | org.springframework.boot
77 | spring-boot-maven-plugin
78 |
79 |
80 |
81 |
82 |
83 |
84 | spring-repository
85 | Spring Repository
86 | https://repo.spring.io/libs-release/
87 |
88 |
89 | spring-milestones
90 | Spring Milestones
91 | https://repo.spring.io/libs-milestone/
92 |
93 |
94 | spring-snapshots
95 | Spring Snapshots
96 | https://repo.spring.io/libs-snapshot/
97 |
98 | true
99 |
100 |
101 |
102 |
103 |
104 |
105 | spring-plugins
106 | Spring Plugins Repository
107 | https://repo.spring.io/plugins-release
108 |
109 |
110 | spring-repository
111 | Spring Repository
112 | https://repo.spring.io/libs-release
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/fortune-teller-fortune-service/src/main/resources/import.sql:
--------------------------------------------------------------------------------
1 | insert into fortunes (id, text) values (1000, 'People are naturally attracted to you.');
2 | insert into fortunes (id, text) values (1001, 'You learn from your mistakes... You will learn a lot today.');
3 | insert into fortunes (id, text) values (1002, 'If you have something good in your life, don't let it go!');
4 | insert into fortunes (id, text) values (1003, 'What ever you're goal is in life, embrace it visualize it, and for it will be yours.');
5 | insert into fortunes (id, text) values (1004, 'Your shoes will make you happy today.');
6 | insert into fortunes (id, text) values (1005, 'You cannot love life until you live the life you love.');
7 | insert into fortunes (id, text) values (1006, 'Be on the lookout for coming events; They cast their shadows beforehand.');
8 | insert into fortunes (id, text) values (1007, 'Land is always on the mind of a flying bird.');
9 | insert into fortunes (id, text) values (1008, 'The man or woman you desire feels the same about you.');
10 | insert into fortunes (id, text) values (1009, 'Meeting adversity well is the source of your strength.');
11 | insert into fortunes (id, text) values (1010, 'A dream you have will come true.');
12 | insert into fortunes (id, text) values (1011, 'Our deeds determine us, as much as we determine our deeds.');
13 | insert into fortunes (id, text) values (1012, 'Never give up. You're not a failure if you don't give up.');
14 | insert into fortunes (id, text) values (1013, 'You will become great if you believe in yourself.');
15 | insert into fortunes (id, text) values (1014, 'There is no greater pleasure than seeing your loved ones prosper.');
16 | insert into fortunes (id, text) values (1015, 'You will marry your lover.');
17 | insert into fortunes (id, text) values (1016, 'A very attractive person has a message for you.');
18 | insert into fortunes (id, text) values (1017, 'You already know the answer to the questions lingering inside your head.');
19 | insert into fortunes (id, text) values (1018, 'It is now, and in this world, that we must live.');
20 | insert into fortunes (id, text) values (1019, 'You must try, or hate yourself for not trying.');
21 | insert into fortunes (id, text) values (1020, 'You can make your own happiness.');
22 | insert into fortunes (id, text) values (1021, 'The greatest risk is not taking one.');
23 | insert into fortunes (id, text) values (1022, 'The love of your life is stepping into your planet this summer.');
24 | insert into fortunes (id, text) values (1023, 'Love can last a lifetime, if you want it to.');
25 | insert into fortunes (id, text) values (1024, 'Adversity is the parent of virtue.');
26 | insert into fortunes (id, text) values (1025, 'Serious trouble will bypass you.');
27 | insert into fortunes (id, text) values (1026, 'A short stranger will soon enter your life with blessings to share.');
28 | insert into fortunes (id, text) values (1027, 'Now is the time to try something new.');
29 | insert into fortunes (id, text) values (1028, 'Wealth awaits you very soon.');
30 | insert into fortunes (id, text) values (1029, 'If you feel you are right, stand firmly by your convictions.');
31 | insert into fortunes (id, text) values (1030, 'If winter comes, can spring be far behind?');
32 | insert into fortunes (id, text) values (1031, 'Keep your eye out for someone special.');
33 | insert into fortunes (id, text) values (1032, 'You are very talented in many ways.');
34 | insert into fortunes (id, text) values (1033, 'A stranger, is a friend you have not spoken to yet.');
35 | insert into fortunes (id, text) values (1034, 'A new voyage will fill your life with untold memories.');
36 | insert into fortunes (id, text) values (1035, 'You will travel to many exotic places in your lifetime.');
37 | insert into fortunes (id, text) values (1036, 'Your ability for accomplishment will follow with success.');
38 | insert into fortunes (id, text) values (1037, 'Nothing astonishes men so much as common sense and plain dealing.');
39 | insert into fortunes (id, text) values (1038, 'Its amazing how much good you can do if you dont care who gets the credit.');
40 | insert into fortunes (id, text) values (1039, 'Everyone agrees. You are the best.');
41 | insert into fortunes (id, text) values (1040, 'LIFE CONSIST NOT IN HOLDING GOOD CARDS, BUT IN PLAYING THOSE YOU HOLD WELL.');
42 | insert into fortunes (id, text) values (1041, 'Jealousy doesn''t open doors, it closes them!');
43 | insert into fortunes (id, text) values (1042, 'It''s better to be alone sometimes.');
44 | insert into fortunes (id, text) values (1043, 'When fear hurts you, conquer it and defeat it!');
45 | insert into fortunes (id, text) values (1044, 'Let the deeds speak.');
46 | insert into fortunes (id, text) values (1045, 'You will be called in to fulfill a position of high honor and responsibility.');
47 | insert into fortunes (id, text) values (1046, 'The man on the top of the mountain did not fall there.');
48 | insert into fortunes (id, text) values (1047, 'You will conquer obstacles to achieve success.');
49 | insert into fortunes (id, text) values (1048, 'Joys are often the shadows, cast by sorrows.');
50 | insert into fortunes (id, text) values (1049, 'Fortune favors the brave.');
51 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------