Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2

Revert "BAEL-3275: Using blocking queue for pub-sub"
This commit is contained in:
Eric Martin
2019-10-31 20:43:47 -05:00
committed by GitHub
parent db85c8f275
commit 3225470df5
20543 changed files with 1642750 additions and 0 deletions
@@ -0,0 +1,74 @@
package com.baeldung.flips.controller;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
@RunWith(SpringRunner.class)
@SpringBootTest(properties = {
"feature.foo.by.id=Y",
"feature.new.foo=Y",
"last.active.after=2018-03-14T00:00:00Z",
"first.active.after=2999-03-15T00:00:00Z",
"logging.level.org.flips=info"
}, webEnvironment = SpringBootTest.WebEnvironment.MOCK)
@AutoConfigureMockMvc
@ActiveProfiles("dev")
public class FlipControllerIntegrationTest {
@Autowired private MockMvc mvc;
@Test
public void givenValidDayOfWeek_APIAvailable() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/foo/1"))
.andExpect(MockMvcResultMatchers.status().is(200))
.andExpect(MockMvcResultMatchers.jsonPath("$.name", Matchers.equalTo("Foo1")))
.andExpect(MockMvcResultMatchers.jsonPath("$.id", Matchers.equalTo(1)));
}
@Test
public void givenValidDate_APIAvailable() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/foo/last"))
.andExpect(MockMvcResultMatchers.status().is(200))
.andExpect(MockMvcResultMatchers.jsonPath("$.name", Matchers.equalTo("Foo6")))
.andExpect(MockMvcResultMatchers.jsonPath("$.id", Matchers.equalTo(6)));
}
@Test
public void givenInvalidDate_APINotAvailable() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/foo/first"))
.andExpect(MockMvcResultMatchers.status().is(501));
}
@Test
public void givenCorrectProfile_APIAvailable() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/foos"))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.hasSize(6)));
}
@Test
public void givenPropertySet_APIAvailable() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/foos/1"))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.name", Matchers.equalTo("Foo1")))
.andExpect(MockMvcResultMatchers.jsonPath("$.id", Matchers.equalTo(1)));
}
@Test
public void getValidExpression_FlipBean() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/foo/new"))
.andExpect(MockMvcResultMatchers.status().is(200))
.andExpect(MockMvcResultMatchers.jsonPath("$.name", Matchers.equalTo("Shiny New Foo!")))
.andExpect(MockMvcResultMatchers.jsonPath("$.id", Matchers.equalTo(100)));
}
}
@@ -0,0 +1,12 @@
package com.baeldung.hikari;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ApplicationWithHikariConnectionPool {
public static void main(String[] args) {
SpringApplication.run(ApplicationWithHikariConnectionPool.class, args);
}
}
@@ -0,0 +1,28 @@
package com.baeldung.hikari;
import static org.junit.Assert.*;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(
// instead of setting this property, we can exclude the dependency to org.apache.tomcat:tomcat-jdbc in pom.xml
properties = "spring.datasource.type=com.zaxxer.hikari.HikariDataSource")
public class HikariIntegrationTest {
@Autowired
private DataSource dataSource;
@Test
public void hikariConnectionPoolIsConfigured() {
assertEquals("com.zaxxer.hikari.HikariDataSource", dataSource.getClass()
.getName());
}
}