Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #653 from zalando/aruha-778-db-timeout
Browse files Browse the repository at this point in the history
Aruha 778 db timeout
  • Loading branch information
lmontrieux authored Jun 8, 2017
2 parents ddbfc69 + 48cd516 commit 1d5ab2a
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 51 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The project also provides compatability with the [STUPS project](https://stups.i

* Filtering of events for subscribing consumers.

* Role base access control to data.
* Role based access control to data.

* Support for different streaming technologies and engines. Nakadi currently uses [Apache Kafka](http://kafka.apache.org/) as its broker, but other providers (such as Kinesis) will be possible.

Expand Down
67 changes: 37 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ apply plugin: 'spring-boot'
apply plugin: "jacoco"
apply plugin: 'findbugs'
apply plugin: 'checkstyle'
apply plugin: 'project-report'

group 'org.zalando'
sourceCompatibility = 1.8
Expand Down Expand Up @@ -62,6 +63,11 @@ sourceSets {
}

buildscript {
ext {
springBootVersion = '1.5.3.RELEASE'
springFrameworkVersion = '4.3.8.RELEASE'
}

repositories {
mavenCentral()
maven {
Expand All @@ -71,7 +77,7 @@ buildscript {

dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE"
classpath 'org.yaml:snakeyaml:1.14'
classpath 'org.yaml:snakeyaml:1.17'
}
}

Expand All @@ -98,84 +104,85 @@ dependencies {
dropwizardVersion = '3.1.2'
}

pgsql 'org.postgresql:postgresql:9.4.1207'
// spring
compile('org.springframework.boot:spring-boot-starter-web:1.3.1.RELEASE') {
compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion") {
exclude module: 'logback-classic'
exclude module: 'log4j-over-slf4j'
}
compile 'org.springframework:spring-context:4.2.0.RELEASE'
compile 'org.springframework:spring-web:4.2.0.RELEASE'
compile 'org.springframework:spring-webmvc:4.2.0.RELEASE'
compile "org.springframework:spring-context:$springFrameworkVersion"
compile "org.springframework:spring-web:$springFrameworkVersion"
compile "org.springframework:spring-webmvc:$springFrameworkVersion"
compile "org.springframework.boot:spring-boot-test:$springBootVersion"

// oauth
compile 'org.springframework.security.oauth:spring-security-oauth2:2.0.8.RELEASE'
compile 'org.springframework.security.oauth:spring-security-oauth2:2.1.0.RELEASE'
compile('org.springframework.boot:spring-boot-starter-security') {
exclude module: "logback-classic"
}

// actuator
compile 'org.springframework.boot:spring-boot-starter-actuator:1.3.1.RELEASE'
compile 'org.zalando.zmon:zmon-actuator:0.9.3'
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
compile 'org.zalando.zmon:zmon-actuator:0.9.7'

// storage
compile 'org.springframework.boot:spring-boot-starter-jdbc:1.3.1.RELEASE'
compile 'org.postgresql:postgresql:9.4.1207'
compile "org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion"
compile 'org.postgresql:postgresql:42.1.1'

compile 'org.springframework.cloud:spring-cloud-starter-hystrix:1.1.3.RELEASE'
compile 'org.springframework.cloud:spring-cloud-starter-hystrix:1.3.0.RELEASE'

// misc
compile 'org.apache.httpcomponents:httpclient:4.5.1'
compile ('org.zalando.stups:stups-spring-oauth2-server:1.0.10') {
compile 'org.apache.httpcomponents:httpclient:4.5.3'
compile ('org.zalando.stups:stups-spring-oauth2-server:1.0.18') {
exclude module: "httpclient"
}
compile 'org.zalando:jackson-datatype-problem:0.5.0'
compile 'org.zalando:problem:0.5.0'
compile 'org.zalando:problem-spring-web:0.5.0'
compile 'com.google.guava:guava:19.0'
compile 'javax.ws.rs:javax.ws.rs-api:2.0.1'
compile 'org.slf4j:slf4j-log4j12:1.7.14'
compile 'org.slf4j:slf4j-log4j12:1.7.25'
compile "io.dropwizard.metrics:metrics-core:$dropwizardVersion"
compile "com.ryantenney.metrics:metrics-spring:$dropwizardVersion"
compile "io.dropwizard.metrics:metrics-servlets:$dropwizardVersion"
compile "io.dropwizard.metrics:metrics-jvm:$dropwizardVersion"
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.zalando:problem-spring-web:0.5.0'
compile 'org.zalando:jackson-datatype-problem:0.5.0'
compile 'org.apache.commons:commons-lang3:3.5'
compile 'org.zalando:nakadi-plugin-api:1.0.5'
compile 'org.echocat.jomon:runtime:1.6.2'
compile 'org.echocat.jomon:runtime:1.6.3'

// kafka & zookeeper
compile 'org.apache.kafka:kafka-clients:0.9.0.1'
compile 'org.apache.kafka:kafka_2.11:0.9.0.1'
compile 'org.apache.curator:curator-framework:2.11.1'
compile 'org.apache.curator:curator-recipes:2.11.1'
compile 'org.apache.curator:curator-framework:2.12.0'
compile 'org.apache.curator:curator-recipes:2.12.0'

// json
compile 'org.everit.json:org.everit.json.schema:1.4.0'
compile ('com.fasterxml.jackson.datatype:jackson-datatype-json-org:2.4.0') {
compile 'org.everit.json:org.everit.json.schema:1.5.1'
compile ('com.fasterxml.jackson.datatype:jackson-datatype-json-org:2.8.8') {
exclude module: "json"
}
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.0'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.8.8'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.8'
compile 'org.zalando:twintip-spring-web:1.1.0'
compile 'com.grack:nanojson:1.1'
compile 'com.grack:nanojson:1.2'
compile 'org.json:json:20160810'

// tests
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile('junit:junit:4.12') {
exclude module: "hamcrest-core"
}
testCompile 'org.springframework:spring-test:4.3.2.RELEASE'
testCompile "org.springframework:spring-test:$springFrameworkVersion"
testCompile 'org.springframework.boot:spring-boot-test'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.skyscreamer:jsonassert:1.3.0'
testCompile 'org.skyscreamer:jsonassert:1.5.0'
testCompile 'uk.co.datumedge:hamcrest-json:0.2'
testCompile 'org.mockito:mockito-all:1.10.19'
testCompile('com.jayway.restassured:rest-assured:2.5.0') {
testCompile('com.jayway.restassured:rest-assured:2.9.0') {
exclude module: "hamcrest-core"
exclude module: "hamcrest-library"
}
testCompile 'com.jayway.jsonpath:json-path:2.2.0'
testRuntime 'org.pegdown:pegdown:1.1.0'
testRuntime 'org.pegdown:pegdown:1.6.0'
}
// end::dependencies[]

Expand Down Expand Up @@ -353,4 +360,4 @@ checkstyle {

task checkstyle {
dependsOn checkstyleMain, checkstyleTest, checkstyleAcceptanceTest
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void whenGetEventsWithUknownTopicThenTopicNotFound() {
.then()
.statusCode(HttpStatus.NOT_FOUND.value())
.and()
.contentType(equalTo("application/problem+json;charset=UTF-8"))
.contentType(equalTo("application/problem+json"))
.and()
.body("detail", equalTo("topic not found"));
}
Expand All @@ -267,7 +267,7 @@ public void whenStreamLimitLowerThanBatchLimitThenUnprocessableEntity() {
.then()
.statusCode(HttpStatus.UNPROCESSABLE_ENTITY.value())
.and()
.contentType(equalTo("application/problem+json;charset=UTF-8"))
.contentType(equalTo("application/problem+json"))
.and()
.body("detail", equalTo("stream_limit can't be lower than batch_limit"));
}
Expand All @@ -282,7 +282,7 @@ public void whenStreamTimeoutLowerThanBatchTimeoutThenUnprocessableEntity() {
.then()
.statusCode(HttpStatus.UNPROCESSABLE_ENTITY.value())
.and()
.contentType(equalTo("application/problem+json;charset=UTF-8"))
.contentType(equalTo("application/problem+json"))
.and()
.body("detail", equalTo("stream_timeout can't be lower than batch_flush_timeout"));
}
Expand All @@ -296,7 +296,7 @@ public void whenIncorrectCursorsFormatThenBadRequest() {
.then()
.statusCode(HttpStatus.BAD_REQUEST.value())
.and()
.contentType(equalTo("application/problem+json;charset=UTF-8"))
.contentType(equalTo("application/problem+json"))
.and()
.body("detail", equalTo("incorrect syntax of X-nakadi-cursors header"));
}
Expand All @@ -310,7 +310,7 @@ public void whenInvalidCursorsThenPreconditionFailed() {
.then()
.statusCode(HttpStatus.PRECONDITION_FAILED.value())
.and()
.contentType(equalTo("application/problem+json;charset=UTF-8"))
.contentType(equalTo("application/problem+json"))
.and()
.body("detail", equalTo("non existing partition very_wrong_partition"));
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/zalando/nakadi/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = {"org.zalando.nakadi", "org.zalando.nakadi.config"})
public class Application {

public static void main(final String[] args) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/zalando/nakadi/config/MetricsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.ryantenney.metrics.spring.config.annotation.EnableMetrics;
import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/zalando/nakadi/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
Expand Down
20 changes: 11 additions & 9 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ spring:
username: nakadi
password: nakadi
driverClassName: org.postgresql.Driver
initialSize: 2
maxActive: 2
minIdle: 1
maxIdle: 1
testOnBorrow: true
validationQuery: SELECT 1
testWhileIdle: true
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
tomcat:
initial-size: 2
max-active: 2
min-idle: 1
max-idle: 1
test-on-borrow: true
validation-query: SELECT 1
test-while-idle: true
time-between-eviction-runs-millis: 5000
min-evictable-idle-time-millis: 60000
connection-properties: socketTimeout=2;connectTimeout=2;loginTimeout=2

hystrix.command.default.execution.isolation.strategy: SEMAPHORE
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 15000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
Expand Down Expand Up @@ -70,8 +70,7 @@
import static org.zalando.nakadi.utils.TestUtils.randomUUID;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(Application.class)
@WebIntegrationTest(randomPort = true)
@SpringBootTest(classes=Application.class, webEnvironment= WebEnvironment.RANDOM_PORT)
@DirtiesContext(classMode = AFTER_CLASS)
@ActiveProfiles("test")
public abstract class AuthenticationTest {
Expand Down

0 comments on commit 1d5ab2a

Please sign in to comment.