Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
99f2d9a
add test that uses stub message producer
markfisher Apr 14, 2016
13fdd1d
Test incoming v2 messages
Apr 20, 2016
26a46e4
Add new fields to metric store
Apr 21, 2016
8cf6f98
Add spring.application.name
Apr 21, 2016
5df3ee7
Added Accurest
marcingrzejszczak Apr 27, 2016
87e5bfb
Added Distribution management
marcingrzejszczak Apr 27, 2016
c3f071f
Updating repository root
marcingrzejszczak Apr 28, 2016
5aad244
Updating repository root
marcingrzejszczak Apr 28, 2016
417e7f4
Updated accurest to M2
marcingrzejszczak Apr 28, 2016
018b56a
Updating repository root
marcingrzejszczak Apr 28, 2016
2a14244
Updating repository root
marcingrzejszczak Apr 28, 2016
31a4aa2
Updating repositories
marcingrzejszczak Apr 28, 2016
68d6bf1
Added Accurest Maven Plugin
marcingrzejszczak Apr 29, 2016
ba3d587
Bumped accurest to 1.1.0-M3
marcingrzejszczak Apr 29, 2016
e1cf804
Bumping accurest to M6
marcingrzejszczak May 17, 2016
8c4685b
Updated the props
marcingrzejszczak Jun 15, 2016
6a9f7a1
Fixed wrong import
marcingrzejszczak Jun 20, 2016
8906a50
Upgraded boot to 1.4, BOM to Camden.SNAPSHOT
marcingrzejszczak Sep 1, 2016
4f59fac
Simplified the project / added cloud profile
marcingrzejszczak Sep 2, 2016
fb0fe31
Added missing manifest
marcingrzejszczak Sep 2, 2016
6ba341e
Added rest endpoint to count entries
marcingrzejszczak Sep 2, 2016
e22ddc7
Added contracts for rest endpoints
marcingrzejszczak Sep 2, 2016
c127021
Prearing for cloud deployment
marcingrzejszczak Sep 2, 2016
3a54af0
Added integratoin tests
marcingrzejszczak Sep 2, 2016
b1110d9
Changed Group id
marcingrzejszczak Sep 3, 2016
8eff451
Updated props
marcingrzejszczak Sep 3, 2016
2f35cb1
Updated stubrunner props
marcingrzejszczak Sep 3, 2016
60730f1
Added http to the url
marcingrzejszczak Sep 3, 2016
8822c4f
Fixed tests
marcingrzejszczak Sep 3, 2016
da0b0c5
Fixed tests
marcingrzejszczak Sep 3, 2016
5d3c62f
Added logging
marcingrzejszczak Sep 3, 2016
1404e26
Fixed impl
marcingrzejszczak Sep 4, 2016
ae544b7
Updated mvnw
marcingrzejszczak Sep 9, 2016
1dcc718
Revert "Updated mvnw"
marcingrzejszczak Sep 9, 2016
99d7a6c
Parametrized distribution management
marcingrzejszczak Sep 13, 2016
f81b5b1
Added service discovery feature
marcingrzejszczak Sep 16, 2016
9d2b9d4
Updated tests to pass contract tests
marcingrzejszczak Sep 16, 2016
091136f
Updated tests to pass integration tests
marcingrzejszczak Sep 16, 2016
a5ca3f2
Added dependency to stubrunner at runtime
marcingrzejszczak Sep 19, 2016
e1e7827
Added beans on smoke profile
marcingrzejszczak Sep 20, 2016
1f1a2d9
Added e2e profile
marcingrzejszczak Sep 20, 2016
9ee2125
Pointing by default to local artifactory
marcingrzejszczak Oct 6, 2016
22b8aad
Changing versions with Maven Versions plugin
marcingrzejszczak Oct 6, 2016
ba71566
Fixed deploy url
marcingrzejszczak Oct 6, 2016
956c9f3
Fixed deploy url
marcingrzejszczak Oct 6, 2016
388f420
Updated repository root
marcingrzejszczak Oct 12, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ _site/
dump.rdb
.apt_generated
artifacts
*.versionsBackup
9 changes: 9 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
applications:
- name: github-analytics
services:
- github-rabbitmq
- github-eureka
env:
SPRING_PROFILES_ACTIVE: cloud
DEBUG: "true"
156 changes: 140 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.springframework.github</groupId>
<groupId>com.example.github</groupId>
<artifactId>github-analytics</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
Expand All @@ -14,54 +14,74 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.4.BUILD-SNAPSHOT</version>
<version>1.4.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-cloud-contract.version>1.0.0.BUILD-SNAPSHOT</spring-cloud-contract.version>
<spring-cloud-bom.version>Camden.BUILD-SNAPSHOT</spring-cloud-bom.version>
<stubrunner.ids>com.example.github:github-webhook</stubrunner.ids>
<distribution.management.release.id>artifactory-local</distribution.management.release.id>
<distribution.management.release.url>http://localhost:8081/artifactory/libs-release-local</distribution.management.release.url>
</properties>

<dependencies>

<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>spring-cloud-starter-stream-sink-field-value-counter</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<groupId>org.springframework.analytics</groupId>
<artifactId>spring-analytics</artifactId>
<version>1.0.1.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<!-- Dunno Why -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.BUILD-SNAPSHOT</version>
<version>${spring-cloud-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
Expand All @@ -72,9 +92,97 @@
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>${spring-cloud-contract.version}</version>
<extensions>true</extensions>
<configuration>
<baseClassForTests>org.springframework.github.contract.BaseClass</baseClassForTests>
</configuration>
</plugin>
</plugins>
</build>


<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>org/**/*Tests.java</include>
<include>org/**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>smoke</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>smoke/**/*Tests.java</include>
<include>smoke/**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>e2e</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>e2e/**/*Tests.java</include>
<include>e2e/**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<distributionManagement>
<repository>
<id>${distribution.management.release.id}</id>
<name>Spring Milestone Repository</name>
<url>${distribution.management.release.url}</url>
</repository>
<snapshotRepository>
<id>repo.spring.io</id>
<name>Spring Snapshot Repository</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>

<repositories>
<repository>
<id>spring-snapshots</id>
Expand All @@ -92,6 +200,14 @@
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
Expand All @@ -110,6 +226,14 @@
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

</project>
53 changes: 50 additions & 3 deletions src/main/java/org/springframework/github/AnalyticsApplication.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,62 @@
package org.springframework.github;

import java.util.Arrays;

import org.springframework.analytics.metrics.FieldValueCounterRepository;
import org.springframework.analytics.metrics.memory.InMemoryFieldValueCounterRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.app.fieldvaluecounter.sink.FieldValueCounterSinkStoreConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@Import(FieldValueCounterSinkStoreConfiguration.class)
@EnableBinding(Sink.class)
public class AnalyticsApplication {

public static void main(String[] args) {
SpringApplication.run(AnalyticsApplication.class, args);
}

@Bean InMemoryFieldValueCounterRepository repository() {
return new InMemoryFieldValueCounterRepository();
}

@Bean GithubDataListener githubDataListener(FieldValueCounterRepository fieldValueCounterRepository,
GithubDataListener.WebhookService webhookService) {
return new GithubDataListener(fieldValueCounterRepository, webhookService);
}

@Bean
GithubDataListener.WebhookService webhookService(final @LoadBalanced RestTemplate restTemplate) {
return () -> restTemplate.getForObject("http://github-webhook/", GithubData.class);
}

/**
* Since an app in Cloud Foundry can't run on multiple ports, for HTTP we need to do
* a poor man's version and stub out any communication if we want to just check if the
* application is properly packaged
*/
@Bean
@Profile("smoke")
@Primary
GithubDataListener.WebhookService integrationWebhookService() {
return () -> {
GithubData githubData = new GithubData();
githubData.setData(Arrays.asList(
new GithubDatum("dsyer", "spring-cloud-samples", "hook", "updated"),
new GithubDatum("smithapitla", "spring-cloud/spring-cloud-netflix", "issue", "created")));
return githubData;
};
}

@Bean
@LoadBalanced
RestTemplate restTemplate() {
return new RestTemplate();
}
}
27 changes: 9 additions & 18 deletions src/main/java/org/springframework/github/GithubData.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,17 @@
*/
package org.springframework.github;

public class GithubData {


private String username;
import java.util.List;

private String repository;

public String getUsername() {
return username;
}
public class GithubData {

public void setUsername(String username) {
this.username = username;
}
private List<GithubDatum> data;

public String getRepository() {
return repository;
}
public List<GithubDatum> getData() {
return data;
}

public void setRepository(String repository) {
this.repository = repository;
}
public void setData(List<GithubDatum> data) {
this.data = data;
}
}
Loading