Skip to content

Commit

Permalink
Gh 3464 upgrade scc new (#3667)
Browse files Browse the repository at this point in the history
* Upgrade Spring Cloud Contract version to 2.1.3.RELEASE.

* Gh 3409 turbine stream test (#3665)

* Add stream-test-support.

* Fix condition.

* Remove outdated workaround.

(cherry picked from commit 24f5e0b)
  • Loading branch information
OlgaMaciaszek authored Sep 26, 2019
1 parent bd6005e commit d0c5bed
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<spring-cloud-config.version>2.1.5.BUILD-SNAPSHOT</spring-cloud-config.version>
<spring-cloud-stream.version>Fishtown.SR4</spring-cloud-stream.version>
<!-- Has to be a stable version (not one that depends on this version of netflix): -->
<donotreplacespring-cloud-contract.version>2.0.2.RELEASE</donotreplacespring-cloud-contract.version>
<donotreplacespring-cloud-contract.version>2.1.3.RELEASE</donotreplacespring-cloud-contract.version>

<!-- Sonar -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-netflix-hystrix-contract/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<name>spring-cloud-netflix-hystrix-contract</name>
<description>Spring Cloud Netflix Hystrix Contract</description>
<properties>
<donotreplacespring-cloud-contract.version>2.0.2.RELEASE</donotreplacespring-cloud-contract.version>
<donotreplacespring-cloud-contract.version>2.1.3.RELEASE</donotreplacespring-cloud-contract.version>
</properties>
<dependencies>
<dependency>
Expand Down
5 changes: 5 additions & 0 deletions spring-cloud-netflix-turbine-stream/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,10 @@
<artifactId>spring-cloud-netflix-hystrix-contract</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,15 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.contract.stubrunner.StubTrigger;
import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner;
import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties.StubsMode;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRequest;
Expand All @@ -63,12 +58,13 @@
* @author Daniel Lavoie
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = TurbineStreamTests.Application.class, webEnvironment = RANDOM_PORT, properties = {
// TODO: we don't need this if we harmonize the turbine and hystrix destinations
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = {
// TODO: we don't need this if we harmonize the turbine and hystrix
// destinations
// https://github.com/spring-cloud/spring-cloud-netflix/issues/1948
"spring.cloud.stream.bindings.turbineStreamInput.destination=hystrixStreamOutput",
"spring.jmx.enabled=true", "stubrunner.workOffline=true",
"stubrunner.ids=org.springframework.cloud:spring-cloud-netflix-hystrix-stream:${projectVersion:2.0.0.BUILD-SNAPSHOT}:stubs" })
"stubrunner.ids=org.springframework.cloud:spring-cloud-netflix-hystrix-stream:${projectVersion:2.1.3.BUILD-SNAPSHOT}:stubs" })
@AutoConfigureStubRunner(stubsMode = StubsMode.LOCAL)
public class TurbineStreamTests {

Expand Down Expand Up @@ -106,7 +102,7 @@ public void contextLoads() throws Exception {
}

private boolean containsMetrics(String line) {
return line.startsWith("data:") && !line.contains("Ping");
return line.startsWith("data:") && !line.contains("ping");
}

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -145,28 +141,8 @@ private ResponseEntity<String> extract(ClientHttpResponse response)

@EnableAutoConfiguration
@EnableTurbineStream
public static class Application {

// Workaround for stub runner lowercasing id somewhere
@Bean
BeanDefinitionRegistryPostProcessor myBeanDefinitionRegistryPostProcessor() {
return new BeanDefinitionRegistryPostProcessor() {
@Override
public void postProcessBeanDefinitionRegistry(
BeanDefinitionRegistry registry) throws BeansException {
BeanDefinition beanDefinition = registry
.getBeanDefinition(TurbineStreamClient.INPUT);
registry.registerBeanDefinition(
TurbineStreamClient.INPUT.toLowerCase(), beanDefinition);
}

@Override
public void postProcessBeanFactory(
ConfigurableListableBeanFactory beanFactory)
throws BeansException {
}
};
}
@Configuration
public static class TestConfig {

}

Expand Down

0 comments on commit d0c5bed

Please sign in to comment.